Number numerical object in JavaScript

Number numerical object

A numerical variable is a numerical object (Number object).



##toFixed()

  • Function: Change a value Convert to a string and round, retaining the specified number of decimal places.

  • Syntax: numObj.toFixed(n)

  • Parameters: n is the number of decimal places to be retained.

  • Example:

var a = 123.9878;

a = a.toFixed(2); // a = “123.99”

    php.cn  

Example: Find the area of a circle

    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!