+ 1

what is the output of this JavaScript Code? alert (125 ** (1/3) );

why it is not 5??

20th Jun 2020, 7:46 PM
Shishupal Kumar
Shishupal Kumar - avatar
3 odpowiedzi
+ 3
You are right about it being cube root alert(Math.pow(125,1/3)) 1/3 results in 0.33333 ,maybe that's why having it doesn't rounds of to 5 and instead prints 4.9999 like 1.9999 for 8
20th Jun 2020, 8:06 PM
Abhay
Abhay - avatar
+ 2
I thought ** 1/3 means cube root ...& cube root of 125 is 5....that's why I asked....I am learning JavaScript ...so don't know how it works yet...
20th Jun 2020, 7:54 PM
Shishupal Kumar
Shishupal Kumar - avatar
+ 2
then why 8 ** (1/3) is equal to 2 ? ......it also should be 1.99999 ?
20th Jun 2020, 8:00 PM
Shishupal Kumar
Shishupal Kumar - avatar