top | item 10242746 (no title) tjbrennan | 10 years ago Even better, +"5" will coerce the string to an integer. I'm ashamed to admit that I've abused it. discuss order hn newest grrowl|10 years ago To quickly cooerse to a boolean: !!0 === false; !!"zipzap" === true; !!NaN === false To cooerse to a integer (not float): ~~0.5 === 0; ~~"12zipzap" === 0; ~~(Math.PI) === 3; I tend to avoid it for readability (for other developers)
grrowl|10 years ago To quickly cooerse to a boolean: !!0 === false; !!"zipzap" === true; !!NaN === false To cooerse to a integer (not float): ~~0.5 === 0; ~~"12zipzap" === 0; ~~(Math.PI) === 3; I tend to avoid it for readability (for other developers)
grrowl|10 years ago