Search This Blog

2026/08/10

Javascript:Guess output of given code

 


Guess Output of following code

Code:
function sumNumber(a,b){
    "use strict"
    a=30;
    b=50;
    return arguments[0] + arguments[1];
}

let sum = sumNumber(10,20);
console.log(`sum=${sum}`)

Output:
sum=30

Explanation:
   if we add use strict them we can't override value of
   function parameter inside function.

No comments:

Post a Comment