1. Fix code solution (it used the assignment operator to compare _a_ and _b_ instead of the comparison one; which wouldn't pass the test at the exercise page). 2. Add problem explanation, hint, code explanation, run example and resources
		
			
				
	
	
	
		
			1.0 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.0 KiB
		
	
	
	
	
	
	
	
title
| title | 
|---|
| Use the Conditional (Ternary) Operator | 
Use the Conditional (Ternary) Operator
Problem explanation:
Use the conditional operator in the checkEqual function to check if two numbers are equal or not. The function should return either true or false.
Hint 1
Remember that the "traditional" if...else syntax can be re-written using the conditional operator (condition ? statement if true : statement if false;)
try to solve the problem now
Spoiler alert!
Solution ahead!
Code solution:
function checkEqual(a, b) {
  return a === b ? true : false;
}
· Run code at repl.it.
Code explanation
- The function checks if the conditionbefore the interrogation sign (?) is true, and if so, executes thetruestatement. Otherwise, it returnsfalse.