VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Comparison Operators & If Else - Beau teaches JavaScript

Comparison Operators & If Else - Beau teaches JavaScript

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Learn about comparison operators. Also, if else statements! Code - http://codepen.io/beaucarnes/pen/vgQKNv?editors=0012 Other resources on topic: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators Beau Carnes on
Date: 2022-03-14

Comments and reviews: 3


You mentioned whenever we have an expression with an assignment to a number, inside the if condition, it is always going to evaluate to TRUE. but that is only if the assignment is for a non-zero number
for ex:
if (age = 1) will be, true
if (age = 0) will be, false
if (age = 0.0) will be, false

reply

how to solve a multiple if statement with in a single function
example program is
function testLessThan(val) -
if (val < ) -
return -Under 25-;
-
else if (val < ) -
return -Under 55-;
-
return -55 or Over-;
-
// Change this value to test
testLessThan(10);

reply

With the if...else statements failing on baby, another way other than swapping could be:
if else (age > 2 && age < 18)
console.log(-You are a child-);

reply
Add a review, comment






Other channel videos