While working with numbers in javascript, it is necessary to know what you can do with them, but the most important thing is how to do it.
In this Javascript tutorial, we will demonstrate, the javaScript parseInt () function, you will learn what is parseInt in javascript and what it does. You will not only see many examples, but you will learn from them. After finishing this example, you will be familiar with JavaScript Parsing () syntax and where you should use it.
The javascript parseInt () function returns an integer number by parse the string. If the first character can not be changed in number, the function returns NaN. JavaScript parseInt simple convert a string to an integer number
JavaScript: Remove Element from an Array
The syntax of javascript parseInt () is very simple. The JavaScript parseInt () should look like this :
parseInt(string, radix)
To understand what parseInt is in JavaScript, it is necessary to see an example. Take a look at this parseInt function example – where we parse different numbers and strings :
<script>
// returns a Integer no
a = parseInt("30");
document.write('parseInt("30") = ' + a + "<br>");
// Not a Number character
b = parseInt("40.00");
document.write('parseInt("40.00") = ' + b + "<br>");
// returns NaN on Non numeral character
c = parseInt("2.689");
document.write('parseInt("2.689") = ' + c + "<br>");
// returns Integer value of a Floating point Number
d = parseInt("3.16");
document.write('parseInt("3.16") = ' + d + "<br>");
// only first Number it encounters
e = parseInt("23 12 2019");
document.write('parseInt("23 12 2019") = ' + e + "<br>");
</script>
parseInt("30") = 30
parseInt("40.00") = 40
parseInt("2.689") = 2
parseInt("3.16") = 3
parseInt("23 12 2019") = 23
How to remove Duplicate objects from Array in JavaScript?
#javascript #programming