Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
What are the different ways of defining functions in javascript?
please tell me as many as possible in brief, thankyou.
2 Respostas
+ 3
Basically, There are two types of functions. First declared by using 'function' keyword like this -
function myFunc(){
// your code
}
// how to call these functions
myFunc();
And second that are called anonymous functions (without a name). Like this-
var myFunc = function(){
// your code
};
// how to call the function
myFunc();
Can you see the difference. First type of functions are real functions. Second type of functions are used to create methods of JavaScript objects.
+ 2
you can define a function by 'function' keyword.
function myFunc(){
// all the code.
}