Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

define math.sqrt() method in javascript

// Math.sqrt()

// The Math.sqrt() function returns the square root of a number.

// EXAMPLE : 1
let square_root_of = Math.sqrt(4);
console.log(square_root_of);
// OUTPUT: 2

// EXAMPLE : 2
let square_root_of_1 = Math.sqrt(-9);
console.log(square_root_of_1);
// OUTPUT: NaN (NOT A NUMBER)

// EXAMPLE : 3
let square_root_of_3 = Math.sqrt(8);
console.log(square_root_of_3);
// OUTPUT: 2.8284271247461903
Source by learn.coderslang.com #
 
PREVIOUS NEXT
Tagged: #define #method #javascript
ADD COMMENT
Topic
Name
6+3 =