JS: Function Terminology

Javascript Function
// This is called function declarationfunction village() {
console.log("Hidden Leaf Village");
}
// This is called function expressionconst village = function () { 
console.log("Hidden Leaf Village");
}
function(){} // <---- anonymous function
function village(){} //<----- named function
function village(name) {
return {
name
}
}
const narutoVillage = village();
function Village(name) {
this.name = name
}
const narutoVillage = new Village("Hidden Leaf Village");
const ninja = {   name : "Naruto",
village : "Hidden Leaf Village",
info : function () { // <---- This is called method
console.log(`${this.name}, from ${this.village}`)
}
}
ninja.info(); // <--- This is a method

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store