Skip to main content

Command Palette

Search for a command to run...

Function Definition Vs Function Declaration

Published
•1 min read•View as Markdown
N

Hi, am a passionate programmer and front-end web developer I am interested in problem solving

Function Declaration

Function Declaration is a practice in which a function is created with a function keyword and can be called before the actual function is being written.

//function declaration
myFunction();
function myFunction(){
console.log("Function declaration")
}

Function Definition

Function definition is a practice in which a function is created and is assigned to a variable. The function created so can only be called once after it is being assigned to a variable. It is also called as function expressions.

const assignedVariable = function myFunction(){
console.log("Function Definition")
}
assingnedVariable()

More from this blog

JavaScript Notes

12 posts

Function Definition Vs Function Declaration