Use the Conditional (Ternary) Operator

Use the Conditional (Ternary) Operator
0.0 0


Tell us what’s happening:
The output of checkEqual(1, -1) should be false.
But when i test this in browser console, it’s true.
I dont get this point, i need help

Your code so far

function checkEqual(a, b) {
  return a>=b ? true : false;

checkEqual(1, -1);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:


1 is greater than -1, so a>=b is true and your function returns true.


Hi @ArielLeslie .
But the expected output of this challenge is false and i dont know why


is “greater than or equal to”, which is different from “equal to”, which is what the challenge is asking for.


The expected value is false because 1 is not equal to -1.


Then, why is this wrong?

function checkEqual(a, b) {
  return a == b ? "true" : "false";

checkEqual(2, 2);


I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

"true" is not the same as true. "false" is not the same as false. One is a string and just treated as text, the other is a boolean value.


Dont use “” around true or false.