Square root in javascript

in javascript •  5 years ago 

#js-beginners-series #lesson-003

Square root in javascript

Writing a square root of a number in this form √ in arithmetic operations won't work
In this example, I employed the square root of 4 in a simple addition operation

console.log(√4);
// output : SyntaxError: Invalid or unexpected token

As a result, in that format, a square root could not be executed and it could not be used as a number. However, its correct format is Math.sqrt()
Here's an example :

console.log(Math.sqrt(4));
// output : 2

Thank you for reading !!!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!