+ 1
What if I send null as one parameter and try to perform operation on it in the function like adding, then what would the function return?
3 Respuestas
+ 4
I think null will be considered 0 for the addition operator.
For example:
function sum(x, y) {
return x+y;
}
document.write(sum(10, null));
This will print 10.
0
null is nothing. 0.
0
javascript amazes me sometimes. so null (not nothing btw) will be interpreted as 0?