Randell Dawson 05f73ca409 fix(curriculum): Convert blockquote elements to triple backtick syntax for JavaScript Algorithms and Data Structures (#35992)
* fix: convert js algorithms and data structures

* fix: revert some blocks back to blockquote

* fix: reverted comparison code block to blockquotes

* fix: change js to json

Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* fix: convert various section to triple backticks

* fix: Make the formatting consistent for comparisons
2019-05-17 08:20:30 -05:00

2.3 KiB

id, title, challengeType, videoUrl
id title challengeType videoUrl
56533eb9ac21ba0edf2244d3 Comparison with the Strict Inequality Operator 1 https://scrimba.com/c/cKekkUy

Description

The strict inequality operator (!==) is the logical opposite of the strict equality operator. It means "Strictly Not Equal" and returns false where strict equality would return true and vice versa. Strict inequality will not convert data types. Examples
3 !==  3   // false
3 !== '3'  // true
4 !==  3   // true

Instructions

Add the strict inequality operator to the if statement so the function will return "Not Equal" when val is not strictly equal to 17

Tests

tests:
  - text: <code>testStrictNotEqual(17)</code> should return "Equal"
    testString: assert(testStrictNotEqual(17) === "Equal", '<code>testStrictNotEqual(17)</code> should return "Equal"');
  - text: <code>testStrictNotEqual("17")</code> should return "Not Equal"
    testString: assert(testStrictNotEqual("17") === "Not Equal", '<code>testStrictNotEqual("17")</code> should return "Not Equal"');
  - text: <code>testStrictNotEqual(12)</code> should return "Not Equal"
    testString: assert(testStrictNotEqual(12) === "Not Equal", '<code>testStrictNotEqual(12)</code> should return "Not Equal"');
  - text: <code>testStrictNotEqual("bob")</code> should return "Not Equal"
    testString: assert(testStrictNotEqual("bob") === "Not Equal", '<code>testStrictNotEqual("bob")</code> should return "Not Equal"');
  - text: You should use the <code>!==</code> operator
    testString: assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0, 'You should use the <code>!==</code> operator');

Challenge Seed

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

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

Solution

function testStrictNotEqual(val) {
  if (val !== 17) {
    return "Not Equal";
  }
  return "Equal";
}