Bonfire: Arguments Optional

function add() {//1 if (arguments.length === 2 && typeof(arguments[0] + arguments[1]) == 'number') {return arguments[0] + arguments[1];} else if(arguments.length === 1 && typeof arguments[0] === 'number' ) {//2 var oneNumber = arguments[0]; { return function(n){//4 if(typeof n !== 'number') {return 'undefined';}//4- else {return oneNumber + n;}}; }//3- }//2- else {return 'undefined'} } add("http://bit.ly/IqT6zt");

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.