How to make a document.getElementById value into an integer variable, not a string?

The unary plus (+) coerces its operand into a number:

var results = +document.getElementById("addTweets").value;
    ...

typeof( results ); // number

Leave a Comment