JavaScript for Beginners!   Part-8⭐

JavaScript for Beginners! Part-8⭐

Hello Legends!!⭐

So, This is my Part-8 of JavaScript for Beginners!😉

Today's topic:

1. Boolean Values💧

Basically Boolean values are having two conditions: true and false.

// Boolean values

function numberAreEqual() {
  //Created a function
  return true; //Now its true
}
console.log(numberAreEqual()); // Output: true

Output:

true

2. If statements🌴

// If statements:

function ourTrueOrFalse(isItTrue) {
  //Create function
  if (isItTrue) {
    //check
    return "Yes, it is true"; //return
  }
  return "that's false";
}

console.log(ourTrueOrFalse(true)); //Output: Yes, it is true

Output:

Yes, it is true

Ta da!!🥳 You did it!!♥

3.Equality operators🌪

// Comparision with the equality operator.

function myEqual(num) {
  // Created function
  if (num == 99) {
    // Checking
    return "Yaa it's equal!"; //return statements
  }
  return "No, that's not equal!";
}

console.log(myEqual(100)); // Output: No, that's not equal!

Output:

No, that's not equal!

Amazing! You cracked it!!🥳

4. Strict Equality🌀

// Strict Equality sign (===)

console.log(3 == "3");
console.log(3 === "3");

Output:

true
false

I want you to run this code, and understand it!!

5. Equality vs Strict equality!🌾

Equality sign in function!!!

// Equality sign in function (==)

function checkNum(x, y) {
  // Created function
  if (x == y) {
    // Checking
    return "Equal!"; //return
  }
  return "Not Equal!";
}

console.log(checkNum(500, "500")); // Output: Equal!

Output:

Equal!

Strict equality sign (===)

Let's check with the same example:

// Strict equality sign in function (===)

 function checkNum(x, y) {        // Created function
   if (x === y) {                  // Checking   
     return "Equal!" //return
  }
 return "Not Equal!"
 }

 console.log(checkNum(500, "500"))   // Output: Not Equal!

Output:

Not Equal!

I want you guys to read and write the code and understand by your own♥

6. Inequality Operators⚡(in functions)

//Comparision with Inequaity Operators

function completed(number) {
  //Created a function
  if (number != 77) {
    return "Not Equal!!"; // checking
  }
  return "Equal!!";
}

console.log(completed(100)); //Output: Not Equal!!

7. Strict Inequality Operators☀

// Comparision with Strict equality operators (!==)

function helloCoders(number) {
  //created a function
  if (number !== 99) {
    return "Not Equal..."; //returning
  }
  return "Equal...";
}

console.log(helloCoders(59)); // Output: Not Equal...

Output:

Not Equal...

So, that is it for today guys!! And also I was my Part-8 for JavaScript for Beginners!!

Motivation for Today: "If you can dream it you can do it!!😉"

I will see you all in the next Part-9 soon so stay tuned!!🌪 Till then take care and Goodbye!!♥