One Line If Statement In JavaScript

Publicado em: 05 Março 2023
no canal de: Coding with Josh
883
15

#shorts #javascript #coding #ifstatement

Ever wondered how to do a one line if statement? It's easy but looks a little strange at first.

Copy this into your editor and see what happens. Here you go:
console.log(1 == 2 ? true : false)

The criteria we are checking is if 1 == 2. The question mark states what to do if it is true, and the colon tells the program what to do if it is false. In this case I am just returning true or false.


Nesta página do site você pode assistir ao vídeo on-line One Line If Statement In JavaScript duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Coding with Josh 05 Março 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 883 vezes e gostou 15 espectadores. Boa visualização!