# Find the square root of n

Given a real number n, find the square root of n. For example, given n = 9, return 3.

My solution:

const findRoot = n => n >=  0 ? n ** .5 : void 0;

console.log(findRoot(9));


Is this some kind of trick question? What's there to solve? Did I miss something?

• -1 is a real number. You might also be meant to solve it without using sqrt or floating-point exponentiation. – Oh My Goodness Mar 30 at 0:27
• It’s a binary search question. – E.Coms Apr 2 at 1:11