blob: 9ca8023c106cb3e9fe6b54ea115c937b83000aca [file] [log] [blame]
// author: Simon Zünd
const array = [];
Object.defineProperty(array, '0', {
get() { debug('get [0]'); return this.foo; },
set(v) { debug(`set [0] with ${v}`); this.foo = v; }
});
debug(".sort(comparator) 0-length array:");
array.sort((a, b) => a - b);
log(array);
debug(".sort() 1-length array:");
array.push('bar');
array.sort();
log(array);