Effect of x = +x in JavaScript

javascript

Solution

Perhaps I am reading this wrong but from the specs http://asmjs.org/spec/latest/#parameter-type-annotations

is that casting it as a double?

Problem

Going though the asm.js documentation I've observed this strange (to me at least, quite new to JS) snippet all over the sample code: ``` function test(x) { x = +x; // THIS ... return +(x*y); } ``` What is the purpose of the `+` on the first line?

Original source

Related problems