What is the constant of PI in JavaScript

4 Answers

0 votes
document.write(Math.PI);
 
/*
run:

3.141592653589793 
 
*/

 



answered Jun 13, 2015 by avibootz
0 votes
var n = Math.PI;
 
document.write(n.toFixed(2));
 
/*
run:

3.14 
 
*/

 



answered Jun 13, 2015 by avibootz
0 votes
var n = Math.PI;

n = n.toFixed(2);
 
document.write(n);
 
/*
run:

3.14 
 
*/

 



answered Jun 13, 2015 by avibootz
0 votes
var n = Math.PI.toFixed(2);
 
document.write(n);
 
/*
run:

3.14 
 
*/

 



answered Jun 13, 2015 by avibootz

Related questions

1 answer 151 views
1 answer 192 views
1 answer 103 views
3 answers 149 views
1 answer 151 views
151 views asked Jul 21, 2021 by avibootz
1 answer 136 views
136 views asked Jul 21, 2021 by avibootz
...