I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
Just an update to my initial comment as I typed it out pretty quickly yesterday. const [, last] = someArray will work if the array was only two items. For example, if it's 4 items, this won't work. You'll end up with this.
consta=[1,2,3,4];const[,last]=a;console.log(last);// a === 2
If I wanted to get the last element in the above array, I'd have to do this.
consta=[1,2,3,4];const[,,,last]=a;console.log(last);// a === 2
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Just an update to my initial comment as I typed it out pretty quickly yesterday.
const [, last] = someArray
will work if the array was only two items. For example, if it's 4 items, this won't work. You'll end up with this.If I wanted to get the last element in the above array, I'd have to do this.