0

Can anyone explain me.

function x(a=1,b=5,c=6){ return a+b-c; } document.write(x(7,4)); //5

2nd Jan 2017, 5:15 AM
Joshiɱ Uddin
Joshiɱ Uddin - avatar
2 ответов
+ 9
When you declared function you set agruments by default parameters (a=1, b=5, c=6), so when you used function you gave new parameters to "a=7" and "b=4", thus comp gets your code like this: document.write(x(7,4)); //return 7+4-6
2nd Jan 2017, 6:15 AM
Umid Berdiev
Umid Berdiev - avatar
0
Thank u so much Umid
2nd Jan 2017, 10:36 AM
Joshiɱ Uddin
Joshiɱ Uddin - avatar