* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.6 KiB
1.6 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244d2 | Comparison with the Inequality Operator | 1 | https://scrimba.com/c/cdBm9Sr | 16787 | comparison-with-the-inequality-operator |
--description--
The inequality operator (!=
) is the opposite of the equality operator. It means "Not Equal" and returns false
where equality would return true
and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing.
Examples
1 != 2 // true
1 != "1" // false
1 != '1' // false
1 != true // false
0 != false // false
--instructions--
Add the inequality operator !=
in the if
statement so that the function will return "Not Equal" when val
is not equivalent to 99
--hints--
testNotEqual(99)
should return "Equal"
assert(testNotEqual(99) === 'Equal');
testNotEqual("99")
should return "Equal"
assert(testNotEqual('99') === 'Equal');
testNotEqual(12)
should return "Not Equal"
assert(testNotEqual(12) === 'Not Equal');
testNotEqual("12")
should return "Not Equal"
assert(testNotEqual('12') === 'Not Equal');
testNotEqual("bob")
should return "Not Equal"
assert(testNotEqual('bob') === 'Not Equal');
You should use the !=
operator
assert(code.match(/(?!!==)!=/));
--seed--
--seed-contents--
// Setup
function testNotEqual(val) {
if (val) { // Change this line
return "Not Equal";
}
return "Equal";
}
testNotEqual(10);
--solutions--
function testNotEqual(val) {
if (val != 99) {
return "Not Equal";
}
return "Equal";
}