More cool stuff:
```javascript
const arr = [1, 2, 3];
// Easy push
arr[] = 4; // => arr[arr.length];
// Easy s(p)lice
arr[begin, end];,
arr[begin,]; // => arr[begin, arr.length];
arr[begin, end] = [1, 2, 3];
```
A terrible example (terrible because this should be done with WebGL
shaders):
```javascript
const image = [ /* Umbagajillion of RGBA pixels */ ];
function manipulate(rgba) {
rgba[0] += 10;
rgba[1] += 10;
rgba[2] += 10;
}
for (let i = 0; i < image.length / 4; i++) {
const begin = i * 4;
const end = begin + 4;
/*
In case easy s(p)lice doesn't actually Array.p.slice
and just creates a limited view of the array
without breaking reference
(image[begin, end] === image[begin, end])
*/
manipulate(image[begin, end]);
/*
In case easy s(p)lice does Array.p.slice
and creates a new array
(image[begin, end] !== image[begin, end])
*/
const pixel = image[begin, end];
manipulate(pixel);
image[begin, end] = pixel;
}
```
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss