kelvinsekx
CONTENT
RETURN TO ARTICLES

Exponentiation operator is now standardized in JavaScript

^(* ! *)^ 1 minute read
Last modified on Mon, August 24,2020
loading...

Yello! ECMA2016 standardized the exponentiation operator (**).

Before now, to make an exponent as simple as 2 raise to 2 would require the use of Math.pow() builtin function in javascript.

{
  Math.pow(7, 3) // 343
  Math.pow(4, 0.5) // 2
}

For me, this is unnecessary long compare to that of python (**).

But goodnews, the exponentiation operator similar to python is standardized in JavaScript with support for all browsers except IE(Internet Explorer).

** The Exponentiation **

The exponentiation returns the multiplication of the number on the left by the number of times of the number on the right.

{
 2 ** 3 //becomes 2 * 2 * 2 = 8
}

Same operation above becomes achievable with

{
  7 ** 3 // 343
  4 ** 0.5 // 2
}

For further reading check the MDN docs


**Joke Time : dedicated to my friend Boluwatife**

If life were to be human, it would have been a black woman

How do I know??: ): Urrgh, it simple

  • A blackwoman is not fair
  • A blackwoman is tough
  • A blackwoman is beautiful

**What if I interview you : little quick questions I try and answer myself**

Using the fastest means possible. Given an ordered list, return a boolean, true, if the output is achievable with the sum of a pair in the list. So that

{
    [1,2,3,4] Given output = 8 //returns false
    [1,5,3,4] Given output = 9 //return true: since 5 and 4 are pairs that can be sumed up to the output 9
}

Closing Note:

Hope you smiled, thanks for reading. Remember to be you, a great individual.

And a special thanks to you visiting outside Africa.

Edit this page


    Kelvinsekx.codes is built, maintained and written by Ukuejubola Kelvin Oritsetimeyin.

    Icons from www.flaticon.com