Comparison with the Strict Equality Operator for me

// Setup
function testStrict(val) {
  if (val === val) { // Change this line
    return "Equal";
  }
  return "Not Equal";
}

// Change this value to test
testStrict(7);

i need help with this

1 Like

I’ve edited your post for readability. When you enter a code block into the forum, remember to 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.

markdown_Forums

1 Like

What does the failing test say? Right now your function will always return 'Equal' because you are testing whether val is equal to itself. Is this the challenge requirement?

1 Like


thanks, i got it

// Setup
function testStrict(val) {
if (val === ‘10’) { // Change this line
return “Equal”;
}
return “Not Equal”;
}

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

// Setup
function testStrict(val) {
if (val === 7) { // Change this line
return “Equal”;
}
return “Not Equal”;
}

// Change this value to test
testStrict(7);

// Setup
function testStrict(val) {
if (val === 7) { // Change this line
return “Equal”;
}
return “Not Equal”;
}

// Change this value to test
testStrict(“7”);

1 Like

My exercise, I used this solution.

// Setup
function testStrict(val) {
if (val === ‘10’) {
// Change this line
return “Equal”;
}
return “Not Equal”;
}

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

function testStrict(val) {
if (val === 7) {
// Change this line
return “Equal”;
}
return “Not Equal”;
}

// Change this value to test
testStrict(7);