Math Object Won't Work!

0 Dylan Dawson · April 16, 2015
Hi I'm A newbie in JavaScript and this code:

var n = prompt("Enter A Number", "");
var answer = Maths.sqrt(n);
document.write("The square route of your number is " + answer);

Comes up with this:
The square route of is your number is undefined
Please tell me what i'm doing wrong!
 

Post a Reply

Replies

Oldest  Newest  Rating
+2 Sho Carter · April 16, 2015
Hi Dylan, 

It's instead of "Maths", it's actually "Math"

...so Math.sqrt(n)
0 Dylan Dawson · April 16, 2015
Sorry silly mistake lol!
0 Dylan Dawson · April 16, 2015
Thankyou!
  • 1

Javascript

107,257 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators