Forem

Cover image for Operadores Lógicos (Parte 1)
ananopaisdojavascript
ananopaisdojavascript

Posted on • Originally published at ananopaisdojavascript.hashnode.dev

1 1

Operadores Lógicos (Parte 1)

Definição

Operadores lógicos são utilizados com várias condições em uma mesma expressão. Usamos os operadores lógicos para comparar resultados lógicos (verdadeiro ou falso).

&& (AND - E)

Esse operador devolve um resultado verdadeiro apenas se TODAS as afirmações fornecidas forem verdadeiras.

true && true   // true
true && false  // false
false && true  // false
false && false // false
Enter fullscreen mode Exit fullscreen mode

|| (OR - OU)

Esse operador devolve um resultado verdadeiro se UMA das afirmações fornecidas for verdadeira.

true || true   // true
true || false  // true
false || true  // true
false || false // false
Enter fullscreen mode Exit fullscreen mode

! (NO - NÃO)

Devolve um valor invertido, ou seja, verdadeiro se converte em falso e vice-versa.

!true  // false
!false // true
Enter fullscreen mode Exit fullscreen mode

E aí? Gostaram? Até a próxima anotação! 😊

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay