DEV Community

Discussion on: JavaScript 101: Breaking Down Functions

Collapse
 
codingnninja profile image
Ayobami Ogundiran • Edited

Great post!

"If there is no function body then your function will return as undefined."

This statement takes us further to passing a function as a value to a variable.

console.log(isNigerian (Ayobami));

function isNigerian(person){
return // Boolean
}

Will work but the below will not.

console.log(isNigerian(Ayobami));

const isNigerian = function(person){
return // boolean
}// isNigerian is not a function

Will not work because a function passed to a variable in JavaScript will be hoisted but you cannot access it until JS execution gets to its definition

Collapse
 
karaluton profile image
Kara Luton

Thank you! And thanks for the addition!