---
id: 65e9727a484dd50f720e6fed
title: Learn Data Types and Conditionals Lesson H
challengeType: 15
dashedName: learn-data-types-and-conditionals-lesson-h
---
# --description--

In any programming language, you need to compare values to make decisions. For example, if the weather is sunny, you will go out, otherwise you will stay at home. Another example would be to see if a user has enough points to level up in a game.

The `if-else` conditional statement is used to make decisions in JavaScript. It is often used with comparison operators to compare values and make decisions based on the results.

An example of an if statement is:

```javascript
let x = 5;

if (x > 3) {
  console.log("x is greater than 3");
} else {
  console.log("x is less than or equal to 3");
}
```

In this example, the `x` variable is compared to the number `3` using the `>` operator. If `x` is greater than `3`, the first block of code will be executed. Otherwise, the second block of code will be executed.

# --questions--

## --text--

What will be the output of the following code?

```javascript

let x = 9;
let y = "5";

if (x == y) {
  console.log("x is equal to y");
} else {
  console.log("x is not equal to y");
}

```

## --answers--

`x is equal to y`

---

`x is not equal to y`


## --video-solution--

2
