Skip to content

Instantly share code, notes, and snippets.

@jasdeep06
Created April 16, 2021 11:01
Show Gist options
  • Save jasdeep06/6e021f22d1ef59d97da135957c2d116c to your computer and use it in GitHub Desktop.
Save jasdeep06/6e021f22d1ef59d97da135957c2d116c to your computer and use it in GitHub Desktop.
//simple function(named)
function hello(name){
console.log("Hello",name)
}
//expression function
const hello = function(name){
console.log("Hello",name)
}
//arrow function
const hello = (name) => {
console.log("Hello",name)
}
//arrow function with syntactic sugar of not including braces in arguments if it has only one argument
const hello = name => {
console.log("Hello",name)
}
//arrow function with syntactic sugar of excluding braces if function has only a single expression
const hello = name => console.log("Hello",name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment