Java Script Built-In Functions to change Data types

In this post i will be telling about some JavaScript in built function which can be used to convert our data type from one to another.

Many of us might not be awaited about build in JavaScript functions but there are a lot Built-In Functions in JavaScript which can be used to change our data type in javascript.

isNaN(): Cheeks weather the particular value is numeric or not.

Number(): Converts an object’s value to a number or numeric value.
eg Number(“32”); //output 32 in number format

String(): Converts an object’s value to a string.
eg alert(String(32)); //output 32 in string format

parseFloat(): Converts a string and returns a floating point number.
eg alert(parseInt(“10.33”)); //output 10.33 in float format

parseInt(): Converts a string and returns an integer.
eg alert(parseInt(“10.33”)); //output 10 in integer format

Stay tuned for the PHP Magento, WordPress, JavaScript and Magento2 latest tutorial and updates, Hope you enjoyed reading, if you need the professional Magento Development / PHP we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.