Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If you have a string and want to convert it to a number then use the parseInt() method. For example this script returns integer values containing 1234 and 43 respectively into X:

     X = parseInt("1234",10);
X = parseInt("34abc",10);

...

If you need to have decimals then use parseFloat(). For example this script returns floating point values 1234.345 and 34.7 respectively into X:    

     X = parseFloat("1234.345");
X = parseFloat("34.7abc");

...