js에서 Square을 쓰는 3가지 방법

wanni kim·2021년 4월 9일
0
post-thumbnail

1. Math.pow()
2. Using Exponentation
3. x * x

  1. Using Math. library, with pow() method, it looks like down this
   Math.pow(x,2) => means x to the 2 (square)
  1. Using Exponentation, looks more simple
    x **2 => means square of x
  1. At second way to square number(x) used x ** 2, but in this equation we can rewrite as x * x. so is it
    x*x => means square of x

구글링하면서 알게된것인데 100% 신뢰는 되지 않지만 성능은 3번이 가장 좋다고 합니다.

profile
Move for myself not for the others

0개의 댓글