Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you set the internal [[Class]] property of an ECMAScript object?

Tags:

javascript

Can you set the internal [[Class]] property of an ECMAScript object?

like image 600
Josh Smith Avatar asked Dec 29 '11 19:12

Josh Smith


1 Answers

You can't trick decent javascript engines.

You can trick user land code with

x.toString = function () {
  return '[object Array]';
}
like image 127
Raynos Avatar answered Nov 02 '22 14:11

Raynos