Skip to content

Instantly share code, notes, and snippets.

@pulges
Last active August 29, 2015 14:02
Show Gist options
  • Save pulges/21c099b919d235f124aa to your computer and use it in GitHub Desktop.
Save pulges/21c099b919d235f124aa to your computer and use it in GitHub Desktop.
Typecasting in js
var a = "1";
var b = "0";
var c = "2.33"
console.log(+a);
// 1
console.log(+b);
// 0
console.log(+c);
// 2.33
console.log(!!+a);
// true
console.log(!!+b);
// false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment