+ 1
Js functions
function test(a,b){ return (a,b); } function values(){ var d = test(5,6); return d; } function calc(){ var c = test(arguments [0]) * test(arguments [1]); return c; } console.log(calc()); /*Output NaN */ Output is supposed to be 30, can anyone help pls?
4 Respuestas
+ 4
Oluwasegun Are
I understand values() purpose, my question to you is where in your code do values() get invoked to pass any value in a and b.
In the calc() function instead of invoking test(), the values() function can be invoked thus invoking the test function and passing 5 and 6 to it(test())
Now for the test() function where you are trying to return the values that were passed to it. This can be done but instead of trying to return two separate numbers you need to return the arguments object
https://code.sololearn.com/W2M1Bha8y7Py/#js
+ 4
When does the function values() get invoke?
+ 1
Thanks
0
It's is to accept values to be stored in a and b