wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.17k stars 31 forks source link

"this" inside prototype method #957

Closed lasjorg closed 4 months ago

lasjorg commented 4 months ago

Issue description or question

this contains the prototype function.

Sample code

Array.prototype.logOnly = function (callback) {
  console.log(this); // [ true, false,  logOnly: λ ]
};

[true, false].logOnly(Boolean);

But not if this is empty.

Array.prototype.logOnly = function (callback) {
  console.log(this); // []
};

[].logOnly(Boolean);

Quokka.js Console Output

[ true, false,  logOnly: λ ]

Tested with ​Quokka v1.0.643 using Node 18 and 20.

I would assume this isn't intended or expected behavior?


Code editor version

Version: 1.89.1 (user setup) Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:13:33.891Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.19045

OS name and version

Windows 10

smcenlly commented 4 months ago

Thanks for reporting the error.

Inline values for logged Arrays no longer display any properties that may exist on the array itself, you will now only see the Array values. You can still see and explore other properties that may exist on the array using Value Explorer.

Please update to Quokka for VS Code v1.0.644, it will fix the problem.