Conteúdo do Curso
Introduction to JavaScript
Introduction to JavaScript
Challenge: Comparing Variables
Task
We have three variables in this task: a = 33
, b = 26
, and c = "26"
. We will perform various comparing operations on these variables.
- Check if
a
is equal tob
. - Check if
b
is strictly equal toc
. - Determine if
a
is greater than or equal toc
. - Find out if
b
is less thanc
. - Check if
a
is greater thanb
AND ifb
is equal toc
. - Check if
a
is equal tob
OR ifc
is less thana
.
let a = 33; let b = 26; let c = "26"; console.log(a ___ b); // Task 1 console.log(b ___ c); // Task 2 console.log(a ___ c); // Task 3 console.log(b ___ c); // Task 4 console.log(a ___ b && b ___ c); // Task 5 console.log(a ___ b || c ___ a); // Task 6
The output should be:
- Use the comparison operators:
==
,===
,>=
,<
,>
. - Use the logical operators: AND (
&&
) and OR (||
).
let a = 33; let b = 26; let c = "26"; console.log(a == b); // Task 1 console.log(b === c); // Task 2 console.log(a >= c); // Task 3 console.log(b < c); // Task 4 console.log(a > b && b == c); // Task 5 console.log(a == b || c < a); // Task 6
Obrigado pelo seu feedback!