Knowledge Walls
Laya
Hyderabad, Andhra Pradesh, India
Number.prototype.toPrecision() Method in Number Class of Javascript Syntax with Examples
2238 Views
Usage 
The toPrecision() method is used to returns a string value depend on Number object to the specified precision.
Syntax 
numberObj.toPrecision([precision])
Example
var numObj = 78.123456;

document.write(numObj.toPrecision(3));
document.write(numObj.toPrecision(2));
document.write(numObj.toPrecision(4));
Output 
78.1
78

78.12
Best Lessons of "Javascript Syntax with Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details