ජාවාස්ක්‍රිප්ට් හි අසත්‍ය තහවුරු කිරීමේ කෙටි ආකාරය

දැන් අපට විචල්‍යයක අගය අසත්‍ය දැයි පරීක්ෂා කිරීමට අවශ්‍ය යැයි සිතමු. එය පහත පරිදි සිදු කළ හැකිය:

javascriptlet test = true;

if (test === false) {
  console.log('+++');
} else {
  console.log('---');
}

ඍණාත්මක ලකුණ සමඟ සමාන කේතයක් ලිවිය හැකිය:

javascriptlet test = true;

if (test !== true) {
  console.log('+++');
} else {
  console.log('---');
}

ඉහත කේතය කෙටි ආකාරයෙන් පහත පරිදි නැවත ලිවිය හැකිය:

javascriptlet test = true;

if (!test) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 1

පහත කේතය කෙටි ආකාරය භාවිතා කරමින් නැවත ලියන්න:

javascriptlet test = true;

if (test == false) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 2

පහත කේතය කෙටි ආකාරය භාවිතා කරමින් නැවත ලියන්න:

javascriptlet test = true;

if (test != true) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 3

පහත කේතය කෙටි ආකාරය භාවිතා කරමින් නැවත ලියන්න:

javascriptlet test = true;

if (test != false) {
  console.log('+++');
} else {
  console.log('---');
}