2

I have a function like this

function makeIJKFromId(id) {
    return id.split("_").splice(1);
}

and this statement in timetable.js gives error(Only in Chromium Browser)

[i, j, k] = makeIJKFromId(e.target.id);

Error : Uncaught ReferenceError: Invalid left-hand side in assignment

Screenshot attached :error screenshot

then when i have made change like this

[i, j, k](makeIJKFromId(e.target.id));

it worked.

But I don't know why it worked? Isn't function destructuring allowed in Chromium?

Tomasz Mularczyk
  • 34,501
  • 19
  • 112
  • 166
  • Perhaps, you need a semicolon at the end of the line before `[i, j, k] = makeIJKFromId(e.target.id);`. See [ES6 Array destructuring weirdness](https://stackoverflow.com/a/38050480/704244) – bartolo-otrit Oct 16 '21 at 15:29

0 Answers0