+ 1
what is the difference?
case1: it works function addNumbers(a,b){ var c = a+b; return c; } document.write(addNumbers(5,6)); case2:but this doesn't work: function addNumbers(a,b){ return a+b; } var c = addNumbers(5,6) case3: again, this looks similar to the 2nd case bt it works: function myFunction(a,b){ return a*b; } var c = myFunction(5,6); i would like to know, why case2 doesn't give answer, as in case1...and what makes t be different from case3(not the sign of operation)
5 Respostas
+ 4
add a ; at end of var c
+ 2
var c = addNumbers(5,6); as @Eldar said...the semicolon ; at the end of this expression was missing.... you didn't forget it for the other examples that's why they worked but not that one...
+ 1
you have space between brackets and 5 in the 2nd example
+ 1
Was it helpful? If so, please mark your question ad answered by selecting my answer as the best one.
0
i have removed the space but still does not give 11...