Skip to content

Instantly share code, notes, and snippets.

@AaronAsAChimp
Last active October 19, 2015 17:05
Show Gist options
  • Save AaronAsAChimp/354374a7e1cdc68c4d9f to your computer and use it in GitHub Desktop.
Save AaronAsAChimp/354374a7e1cdc68c4d9f to your computer and use it in GitHub Desktop.
'use strict';
class ExtendedArray extends Float64Array {
double () {}
}
while (true) {
let thing = new ExtendedArray(1);
console.log('The method "double" is', typeof thing.double);
console.log('Is it still an ExtendedArray?', thing instanceof ExtendedArray);
console.log('Is it still an Float64Array?', thing instanceof Float64Array);
if (thing.double === undefined) {
throw new Error('Method "double" should not be undefined');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment