Created
June 24, 2017 22:23
-
-
Save cristofer-dev/c66951f79a05e3b4c66131f73596fb28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addTogether(x) { | |
console.log("\n"); | |
console.log("In function" + arguments.length); | |
if(arguments.length==2 && typeof arguments[0] === "number" && typeof arguments[1] === "number"){ | |
var sum = arguments[0] + arguments[1]; | |
return sum; | |
}else{ | |
if(arguments.length==1){ | |
var n1 = arguments[0]; | |
console.log(n1); | |
return function(n){ | |
console.log(n1); | |
console.log(typeof n1); | |
console.log(typeof arguments[0]); | |
if(typeof n1 === "number" && typeof arguments[0] === "number"){ | |
var sum = n1 + arguments[0] ; | |
return sum; | |
}else{ | |
return undefined; | |
} | |
};//function | |
}else{ | |
return undefined; | |
} | |
} // if else | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment