+ 2

Can somebody explain output of js code

Can somebody explain why this Math.pow(Math.floor(Math.PI),3) alerts 27? So Math.Pi will be 3.14

5th May 2017, 4:48 PM
Profs Stars
Profs Stars - avatar
2 Réponses
+ 18
Math.floor(Math.PI) == 3 Math.pow(3,3) == 3*3*3
5th May 2017, 4:55 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
floor rounded down 3.14 to 3. than powe 3 to 3 , 3^3 = 3*3*3 = 27.
5th May 2017, 4:55 PM
Szabó Gábor
Szabó Gábor - avatar