+ 1

How I can make a cube root of a number?

function squareRoot(){ setValues(); result = Math.sqrt(c); alert ("The square root of "+c+" is "+result); } function cubeRoot(){ setValues(); result = Math.cbrt(c); alert ("The cube root of "+c+" is "+result); }

7th Jul 2017, 1:39 PM
Walid Kh. Sharaiyra
5 Respuestas
+ 2
If you know the answer yourself, post it in the lessons to help others. Don't use the Q&A for that.
7th Jul 2017, 1:54 PM
Maart
Maart - avatar
+ 2
Oh my bad! It looks fine. What error are you getting (or did you just think it wasn't legit)?
7th Jul 2017, 8:30 PM
Maart
Maart - avatar
+ 1
@Maart sorry I thought that my code is not valid
7th Jul 2017, 2:27 PM
Walid Kh. Sharaiyra
+ 1
I thought Math.cnrt(c) is wrong
7th Jul 2017, 8:58 PM
Walid Kh. Sharaiyra
0
Well, you should define c first, but if you got a value assigned to it, then it's fine!
7th Jul 2017, 9:08 PM
Maart
Maart - avatar