+ 1

Why is this incorrect

function myFunction(a, b) { var x= return a * b; } myFunction(5, 6); document.write(x);

12th Jun 2018, 6:51 AM
Yash Mohta
Yash Mohta - avatar
3 odpowiedzi
+ 8
this is js..you do not say int a,int b.. thats wrong harsh agrawal. The error is with... var x=return a*b you cannot assign a return statement directly to a variable right syntax is: function myFunction(a, b) { return a * b; } var x=myFunction(5, 6); document.write(x);
12th Jun 2018, 7:04 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
🇳🇬Brains ya i think u r right i dont know much about js Sorry for wrong information😢😢
12th Jun 2018, 7:08 AM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
take d data types in formal parameter as like dis (int a,int b) n u cant return with any variable so plzzzz dont take any variable just write return a*b;
12th Jun 2018, 6:55 AM
Harsh Agrawal
Harsh Agrawal - avatar