Skip to content

Instantly share code, notes, and snippets.

View himeshvats19's full-sized avatar

Himesh Vats himeshvats19

View GitHub Profile
function name(parameters){
statements
}
let name = function(parameters){
statements
}
let name = function(parameters){
statements
}
let name = (parameters) => {
statements
}
let myFunction = new Function("a", "b", "return a * b");
(function () {
var x = "Hello!!"; // I will invoke myself
})();
function hello(name) {
return 'Hello ' + name + '!';
}
// Function invocation
var message = hello('World');
console.log(message); // => 'Hello World!'
var message = (function(name) {
return 'Hello ' + name + '!';
})('World');
console.log(message) // => 'Hello World!'
function hello(name) {
return 'Hello ' + name + '!';
}
// Function invocation
var message = hello('World');
console.log(message); // => 'Hello World!'
var myObject = {
// helloFunction is a method
helloFunction: function() {
return 'Hello World!';
}
};
var message = myObject.helloFunction();