Can anyone walk me through what JavaScript is doing here.
var myArray = ["Hello", "world"]
console.log(myArray[length])
We get the output as Hello.
Can anyone walk me through what JavaScript is doing here.
var myArray = ["Hello", "world"]
console.log(myArray[length])
We get the output as Hello.
length is defined in window, which is 0 if you don't have frames.
So, myArray[0]
is "Hello", while myArray[1]
is "world"
Are you going to achieve this?
const myArray = ["Hello", "world"]
console.log(myArray[myArray.length - 1])