Question and answer is powered by AnsPress.io
Enter value all time getting string value, while I want to get integer value in JavaScript.
My Code is here:
var count = $("#count").val(); var val = count+1; console.log(val);
If my count value will 1, I have got the output 11. But I want to get the value 2.
Use parseInt to convert string value to integer value.
For example:
var count = $("#count").val(); var val = parseInt(count) + 1; console.log(val);
Output: 1+1 = 2;