Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created February 6, 2015 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/9e21e3497449cd902468 to your computer and use it in GitHub Desktop.
Save shigemk2/9e21e3497449cd902468 to your computer and use it in GitHub Desktop.
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");
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