JavaScript'te Mantıksal VEYA

|| operatörü, mantıksal VEYA'yı temsil eder ve koşullardan en az birinin sağlanmasını gerektirir.

Aşağıdaki örnekte, eğer num1 değişkeni 0'dan büyükse VEYA num2 değişkeni 0'dan büyükse, koşul doğru olacaktır (koşullardan sadece birinin sağlanması yeterlidir):

javascriptlet num1 = 10;
let num2 = -5;

if (num1 > 0 || num2 > 0) {
  console.log('+++'); // bu çalışır
} else {
  console.log('---');
}
Задание 1

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num1 = -10;
let num2 = -10;

if (num1 >= 0 || num2 >= 0) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 2

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num1 = 0;
let num2 = 0;

if (num1 >= 0 || num2 >= 0) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 3

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num1 = 0;
let num2 = 5;

if (num1 >= 0 || num2 >= 0) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 4

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num1 = 5;
let num2 = 5;

if (num1 >= 0 || num2 >= 0) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 5

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num1 = -5;
let num2 = 15;

if (num1 >= 0 || num2 >= 0) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 6

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num = 1;

if (num == 0 || num == 1) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 7

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num = 2;

if (num == 0 || num == 1) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 8

Kodu çalıştırmadan, konsola ne yazdırılacağını belirleyin:

javascriptlet num = 2;

if (num == 0 || num == 1 || num == 2) {
  console.log('+++');
} else {
  console.log('---');
}