Created
May 1, 2017 15:31
-
-
Save anonymous/0923ef7bfe54c815cdc22fe072eb8229 to your computer and use it in GitHub Desktop.
9.1 Default Values created by smillaraaq - https://repl.it/HMxp/4
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 dogBreeder(name,age){ | |
var tmpName=""; | |
if(name===undefined){ | |
tmpName="Steve"; | |
}else{ | |
if(typeof name ==="string"){name=name;} | |
else{tmpName="Steve";} | |
} | |
if(age===undefined){ | |
if(typeof name ==="number"){age=name;} | |
else if(typeof age ==="number"){age=age;} | |
else{age=0;} | |
}else{ | |
if(typeof name ==="number"){age=name;} | |
if(typeof age ==="number"){age=age;} | |
} | |
return {name:tmpName, age:age}; | |
} | |
// dogBreeder("Sam", 12) // => {name: 'Sam', age: 12} | |
dogBreeder(15) // => {name:'Steve', age: 15} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment