Created
February 6, 2015 11:26
-
-
Save shigemk2/9e21e3497449cd902468 to your computer and use it in GitHub Desktop.
This file contains 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 sample(x) { | |
if (typeof x !== "number") { | |
console.log("die"); | |
return; | |
} | |
console.log(x); | |
} | |
console.log(typeof "123"); | |
console.log(typeof "123.0"); | |
console.log(typeof 123.0); | |
console.log(typeof 123); | |
sample(123); | |
sample("123"); |
This file contains 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 sample(x: Number) { | |
if(typeof x !== "number") { | |
console.log("die"); | |
return; | |
} | |
console.log(x); | |
} | |
console.log(typeof "123"); | |
console.log(typeof "123.0"); | |
console.log(typeof 123.0); | |
console.log(typeof 123); | |
sample(123); | |
sample("123"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment