/ Published in: JavaScript
This sets b to 3 if b isn\'t passed. So all params all optional.
Expand |
Embed | Plain Text
function testDef(a, b) { b = b || 3; return b; }
Comments
Subscribe to comments
You need to login to post a comment.

u can also do it like this: !b && (b = 3);