Problem Statement
given a number, write a JavaScript program with a function that takes the number as argument, finds the square root of this number, and returns the result
Solution
to find the square root of a number in JavaScript, we can use Math.sqrt() method.
Program
function findSquareRoot(num) {
return Math.sqrt(num);
}
var a = 5;
const result = findSquareRoot(a);
console.log(result);
Math.sqrt() function is used in the above program. JavaScript Math library contains trivial functions related to mathematics