Skip to content

Instantly share code, notes, and snippets.

@shigemk2 shigemk2/string.js
Created Feb 6, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.