Sitemap
Rogerio Santos

Rogerio Santos

Es2016

Jul 27, 2023

before es2016 to find out if a value is present in a array

const  arr = [1, 2, 3, 4, 5, 6, 7, 9]

if(arr.indexOf(2) > 1){
console.log('Number found')
} else {
console.log('Number not found')
}

after es2016

 const arr = [1, 2, 3, 4, 5, 6, 7, 8]

if(arr.include(2)) {
console.log('Number found')
} else {
console.log('Number not found')
}

to calculate a exponentiation

Get Rogerio Santos’s stories in your inbox

Join Medium for free to get updates from this writer.

before

  Math.pow(7, 2)

after

 7 ** 2

--

--