Skip to content

Instantly share code, notes, and snippets.

@Achie72
Created October 12, 2020 06:02
Show Gist options
  • Save Achie72/f3561bec44fea880065b771164864b74 to your computer and use it in GitHub Desktop.
Save Achie72/f3561bec44fea880065b771164864b74 to your computer and use it in GitHub Desktop.
Damn
var a = new Float32Array([1,3,6,7,8,12]);
var b = a.filter(function(x){
return x > 0;
});
print( typeof Object.getPrototypeOf(b));
var sample = new Float32Array(4);
var calls = 0;
sample.constructor = { get [Symbol.species]() { calls++ } };
var result = sample.filter(function() { return true;});
print( calls)
print( typeof Object.getPrototypeOf(result));
print(result.length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment