extension to make Swift arrays feel more JavaScript-like