akram.dag avatar

Square root in javascript

akram.dag

Published: 29 Dec 2019 › Updated: 29 Dec 2019Square root in javascript

Square root in javascript

#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 !!!

Leave Square root in javascript to:

Written by

Read more #javascript posts


Best Posts From akram.dag

We have not curated any of akram.dag's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From akram.dag