-4

This minified JavaScript code works just fine:

document.onkeyup=function(a){a=a||window.event;a.altKey&&121===a.which&&(my_variable=!0===my_variable?!1:!0)};

However, JSLint complains two things about it:

Unexpected ES6 feature '='

Expected '=>' and instead saw '}'

I can't determine how to edit the code to satisfy JSLint, and I'm especially curious how '=' could be an unexpected feature of ES6. Can anyone help?

Tom
  • 1,836
  • 4
  • 16
  • 30
  • 5
    Looks like a bug in JSLint: http://stackoverflow.com/questions/32655797/jslint-unexpected-es6-feature?rq=1 But why do you need to lint generated/minified code? – Thilo Jun 08 '16 at 00:04

1 Answers1

-1

(x=1) causes the same issue.

(my_variable=!0===my_variable?!1:!0) makes JSLint assume that you are declaring an arrow function (myvariable=...) => ... and JSLint doesn't yet accept default arguments for these (Unexpected ES6 feature '=') and complains about the missing arrow => (Expected '=>' and instead saw '}').

It is obviously a bug within JSLint.

Solution: Don't use JSLint...

le_m
  • 19,302
  • 9
  • 64
  • 74