0

Question

function sum(x = 0, y = 0) { document.write( x + " + " + y + " = " + (x+y)); } Guys, this code returns 1+0=1 How possible? What is +y+? Thanks

27th Nov 2018, 9:01 PM
Ivan Milosavljevic
Ivan Milosavljevic - avatar
3 Answers
0
Thanks a lot. I got it :) I just dont get it how it yields 1 when 0+0=0
27th Nov 2018, 9:49 PM
Ivan Milosavljevic
Ivan Milosavljevic - avatar
0
It doesnt. Sry, i forgot to include the last line of code: sum(1) Tnx a lot for the clarification :)))))))
27th Nov 2018, 10:14 PM
Ivan Milosavljevic
Ivan Milosavljevic - avatar
0
post you
5th Dec 2018, 12:39 PM
Ayyubkhan