mardi 21 juillet 2020

How to rewrite a ternary statement in pure JavaScript IF/ELSE

How would I write in pure JavaScript an if/else statement for:

arr = (typeof arr !== "object") ? [arr] : arr;

JSLint com keeps saying: “Wrap a ternary expression in parens, with a line break after the left paren.” I have tried every possible solution but nothing works. I just want to revert to the pure JavaScript if/else because although I understand the lint warning, it stops any more warnings and it is annoying interrupts my work.

Aucun commentaire:

Enregistrer un commentaire