question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JS debug console gives errors on a couple common Array functions

See original GitHub issue

simple Array functions, executed in the JS debug console, appear to result in errors. (sample shown below)

[1,2,3].find(key => key > 2)
Uncaught SyntaxError: Invalid destructuring assignment target
[1,2,3].filter(key => key > 2)
Uncaught SyntaxError: Invalid destructuring assignment target

To Reproduce Steps to reproduce the behavior:

  1. run a JS file with a debugger statement
  2. when it stops on debugger statement, try to enter an Array function in the JS debug console

Log File

VS Code Version: Version: 1.64.1 Commit: d6ee99e4c045a6716e5c653d7da8e9ae6f5a8b03 Date: 2022-02-07T17:26:08.977Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Darwin x64 20.6.0

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
connor4312commented, Mar 31, 2022

The next nightly build will have the fix, please let me know whether you run into this again!

0reactions
connor4312commented, Apr 29, 2022

Verification instructions:

Create a file minified.js

const o=42;const c=43;debugger;console.log(o,c);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9yaWdpbmFsLmpzIl0sIm5hbWVzIjpbInJlbmFtZWRWYXIiLCJhbm90aGVyUmVuYW1lZFZhciIsImNvbnNvbGUiLCJsb2ciXSwibWFwcGluZ3MiOiJBQUFBLE1BQU1BLEVBQWEsR0FDbkIsTUFBTUMsRUFBb0IsR0FDMUIsU0FDQUMsUUFBUUMsSUFBSUgsRUFBWUMifQ==

and also a file original.js

const renamedVar = 42;
const anotherRenamedVar = 43;
debugger;
console.log(renamedVar, anotherRenamedVar); 

Debug minified.js, with a launch config or in the debug terminal.

Once there, play around the REPL. Verify you can evaluate renamedVar and anotherRenamedVar as expected. For this particular issue, use the renamed name as a parameter, for instance [1, 2, 3].find(renamedVar => renamedVar === 2)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common JavaScript Errors and How to Debug Them
Learn how to debug common JavaScript errors, including SyntaxError, TypeError, and ReferenceError. Get practical code snippets and resources ...
Read more >
A Definitive Guide to Handling Errors in JavaScript - Kinsta
Getting tripped up by errors in your JavaScript? We'll show you how to tame those errors so you can get back to developing...
Read more >
The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >
10. Debugging and Error Handling - JavaScript Cookbook ...
The first is a programming error, where we, the JavaScript developers, do something wrong. These types of errors are typically found using our...
Read more >
Oops, I did it again: A guide to debugging common JavaScript ...
In order to debug these errors, you need to check your variables -- what are they? What is girl ? What is girl.named...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found