lundi 27 septembre 2021

Question mark statement with semicolon, do multiple things if true

I want a question mark statement and multiple things to do if it's true. Like this:

something.includes('read') ? (
    console.log(1);
    console.log(2)
       : console.log(3))

Like this I get ')' expected error at the ;. Is this somehow possible? Or do I need to use a if statement here? I want to console.log 1 and 2 if true.

Aucun commentaire:

Enregistrer un commentaire