Converts the string to an integer value - Node.js String

Node.js examples for String:Parse

Description

Converts the string to an integer value

Demo Code

/**//from   www .  j  a  v a2 s.c o m
 * converts the string to an integer value
 * @param Integer base
 * @return Integer or NaN
 */
toInt: function(base) {
  return parseInt(this, base === undefined ? 10 : base);
},

Related Tutorials