Home  >  Article  >  Web Front-end  >  How to write square in javascript

How to write square in javascript

藏色散人
藏色散人Original
2021-10-27 14:21:154725browse

The ways to write JavaScript squares are: 1. "console.log(2*10**3)" method; 2. "console.log(2*Math.pow(10,3))" method; 3. "console.log(2e3)" method and so on.

How to write square in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

How to write square in javascript?

Three ways to calculate square numbers in JavaScript

console.log(2*10**3)
console.log(2*Math.pow(10,3))
console.log(2e3)
console.log(2*1e3)
console.log(2*10e2)
console.log(2*1000e0)
console.log(2*100000e-2)

The calculation results are all equal to 2000.

[Recommended learning: javascript basic tutorial]

The above is the detailed content of How to write square in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn