[]
are VERY underpowered in JS compared to Python. Here are some major differences/uses:
- You can use square brackets
[ ]
to access elements, but only in one direction from start to end. - Basically used to get individual characters.
- For mutable structures, you can change elements like
arr[2] = "two"
- You cannot slice using
[ ]
methods. - You cannot get last element using
[-1]