Please Visit: http://ift.tt/1ajReyV
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1iIDPEw
via LifeLong Community
Set a default parameter value for a JavaScript function - Stack Overflow
There are a lot of ways, but this is my preferred method - it lets you pass in anything you want, including false or null. (typeof null == "object")
function foo(a, b)
{
a = typeof a !== 'undefined' ? a : 42;
b = typeof b !== 'undefined' ? b : 'default_b';
...
}http://ift.tt/1nEAZIn
http://ift.tt/1iIDNfH
There are a lot of ways, but this is my preferred method - it lets you pass in anything you want, including false or null. (typeof null == "object")
function foo(a, b)
{
a = typeof a !== 'undefined' ? a : 42;
b = typeof b !== 'undefined' ? b : 'default_b';
...
}http://ift.tt/1nEAZIn
http://ift.tt/1iIDNfH
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1iIDPEw
via LifeLong Community
No comments:
Post a Comment