2
I am starting in java script, however, not being able to understand the main difference between the use of these two functions, I know it can be a basic question but I do not understand, in which scenario I can apply one or the other.
function modificarNome(){
}
var modificraNome = function(){
}
sure sorry.. But I wanted a more formal response.
– HashMap
There is no difference between the two in operation, but the second model you can use it to insert a function within an object, for example
var objeto = { modificarNome: function(){...} }
to use:objeto.modificarNome()
. It can be on any level of the object:var objeto = { funcoes: { modificarNome: function(){...} } }
to use:objeto.funcoes.modificarNome()
.– GilCarvalhoDev