0
Why does (a) not aqual any thing in this code ? function test( a , b = 3, c = 42) { return a + b + c; } console.log(test(5));
Java script
2 Réponses
+ 3
a b and c are parameters ,here b and c are assigned default values in case user don't provide an argument for them but for the first input a we want a value from user so we aren't assigning ant default value to it ,
also if it was like a=4
passing 5 would override the previous value 4 and 5 would be the value for a
+ 4
Please clarify your question what u asking about thia program output will be 50 .
console.log(test(5) ) when here test function called so control will move to test function here b and c is also intilize so a will he automatically 5 after in return statement there is a+b+c means 5+3+42 total 50