Files
Randell Dawson 331cbb88f8 fix(guide): Remove repl.it links from challenge related guide articles (English) (#36204)
* fix: remove repl.it links english

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add extra line

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
2019-07-01 08:49:24 -05:00

1.2 KiB

title
title
Comparison with the Inequality Operator

Comparison with the Inequality Operator

Problem explanation:

· Add the inequality operator != in the if statement so that the function will return "Not equal" when val is not equivalent to 99.

Hint 1

The inequality operator (!=) will return true if the first value is not equal to the second one without taking value type into consideration.

try to solve the problem now

Spoiler alert!

Solution ahead!

Basic code solution:

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

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

Code explanation

The function first evaluates if the condition (val != 99) evaluates to true. If it does, it returns the statement between the curly braces ("Not equal"). If it doesn't, it returns the next return statement outside them ("Equal").

Resources