Compare Revisions

Math.sqrt()

Change Revisions

Revision 499589:

Revision 499589 by fscholz on

Revision 500795:

Revision 500795 by fscholz on

Title:
Math.sqrt()
Math.sqrt()
Slug:
Web/JavaScript/Reference/Global_Objects/Math/sqrt
Web/JavaScript/Reference/Global_Objects/Math/sqrt
Tags:
"Math", "Method", "JavaScript"
"Math", "Method", "JavaScript"
Content:

Revision 499589
Revision 500795
n48    <p>n
49      The following function returns the square root of the varia
>ble <code>x</code>: 
50    </p>
n52function getRoot(x) {n49Math.sqrt(9); // 3
53   return Math.sqrt(x)50Math.sqrt(2); // 1.414213562373095
54}51 
52Math.sqrt(1);  // 1
53Math.sqrt(0);  // 0
54Math.sqrt(-1); // NaN
t56    <p>t
57      If you pass <code>getRoot</code> the value 9, it returns 3;
> if you pass it the value 2, it returns 1.414213562373095. 
58    </p>

Back to History