Data type conversion of JavaScript variables

The type conversion of variables is usually automatically converted by JS, but sometimes manual conversion is required.


##Convert other types to Boolean


First introduce a system built-in function Boolean(), which is used to force data into Boolean type. As for what a function is, we will introduce it later

    php.cn  

Note: We only forced one conversion, you can also use the forced conversion function to convert the rest and view the output results

Convert other types into character types


This time we use the String() function to force other types into character types

    php.cn  

Note: Please test the others carefully. If you encounter unclear conversion in the future, please remember to use the forced conversion function




Convert other types to numeric types

We use the Number() function to force conversion of other types into characters Type

    php.cn  



Continuing Learning
||
php.cn
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!