freeCodeCamp Challenge Guide: Comparison with the Greater Than Operator

freeCodeCamp Challenge Guide: Comparison with the Greater Than Operator
0.0 0

#1

The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. Otherwise, it returns false.

Like the equality operator, greater than operator will convert data types of values while comparing.

Examples

 5 > 3   // true
 7 > '3' // true
 2 > 3   // false
'1' > 9  // false

READ AND UNDERSTAND YOUR FRIEND: HE IS IN THE INFO SECTION.

function testGreaterThan(val) {
if (val>100) { // Change this line
return “Over 100”;
}

if (val>10) { // Change this line
return “Over 10”;
}

return “10 or Under”;
}

// Change this value to test
testGreaterThan(10);


#2

The problem I ran into was not changing the first (val > 10) to (val > 100)

function testGreaterThan(val) {
if (val > 100) { // Change this line
return “Over 100”;
}

if (val > 10) { // Change this line
return “Over 10”;
}

return “10 or Under”;
}

// Change this value to test
testGreaterThan(11);