1.5 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.5 KiB
		
	
	
	
	
	
	
	
title
| title | 
|---|
| Comparison with the Equality Operator | 
Comparison with the equality operator
Problem explanation:
Add the equality operator to the indicated line so that the function will return "Equal" when val is equivalent to 12.
Hint 1
Remember that equality is different from assignment (=), which assigns the value at the right of the operator to a variable in the left.1
try to solve the problem now
Spoiler alert!
Solution ahead!
Basic code solution:
function testEqual(val) {
  if (val == 12) { // Change this line
    return "Equal";
  }
  return "Not equal";
}
// Change this value to test
testEqual(10);
Code explanation
The function first evaluates if the condition (val == 12) evaluates to true. If it does, it returns the statement between the curly braces ("Equal"). If it doesn't, it returns the next return statement outside them ("Not equal").