I can’t figure out how to index in to arrays using a variable in PogoScript.
Constants seem to work:
xs = ['beef','wellington','ensemble']
console.log (xs.1) // prints wellington
But variables don’t:
xs = ['beef','wellington','ensemble']
i = 1
console.log (xs.i) // prints undefined
Any ideas?
Had this problem last week couldn’t figure it out myself either.
I created a ticket on the PogoScript GitHub page and got an answer there.
You need to place brackets around the variable to index into the array:
Also the Cheat Sheet has now been updated with this info!