Comparison with the Less Than Equal To Operator
This commit is contained in:
committed by
SaintPeter
parent
068c50f517
commit
e8a3a2d172
@ -2633,28 +2633,29 @@
|
|||||||
"title": "Comparison with the Less Than Equal To Operator",
|
"title": "Comparison with the Less Than Equal To Operator",
|
||||||
"description": [
|
"description": [
|
||||||
"The <code>less than equal to</code> operator (<code><=</code>) compares the values of two numbers. If the number to the left is less than or equl the number to the right, it returns <code>true</code>. If the number on the left is greater than the number on the right, it returns <code>false</code>. Like the equality operator, <code>less than equal to</code> converts data types.",
|
"The <code>less than equal to</code> operator (<code><=</code>) compares the values of two numbers. If the number to the left is less than or equl the number to the right, it returns <code>true</code>. If the number on the left is greater than the number on the right, it returns <code>false</code>. Like the equality operator, <code>less than equal to</code> converts data types.",
|
||||||
"<strong>Examples</strong><blockquote> 4 <= 5 // true<br />'7' <= 7 // true<br /> 5 <= 5 // true<br /> 3 <= 2 // false<br />'8' <= 4 // false</blockquote>",
|
"<strong>Examples</strong><blockquote> 4 <= 5 // true<br>'7' <= 7 // true<br> 5 <= 5 // true<br> 3 <= 2 // false<br>'8' <= 4 // false</blockquote>",
|
||||||
"<h4>Instructions</h4>",
|
"<h4>Instructions</h4>",
|
||||||
"Add the <code>less than equal to</code> operator to the indicated lines so that the return statements make sense."
|
"Add the <code>less than equal to</code> operator to the indicated lines so that the return statements make sense."
|
||||||
],
|
],
|
||||||
"releasedOn": "11/27/2015",
|
"releasedOn": "11/27/2015",
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert(myTest(0) === \"Smaller Than 12\", 'message: <code>myTest(0)</code> should return \"Smaller Than 12\"');",
|
"assert(myTest(0) === \"Smaller Than or Equal to 12\", 'message: <code>myTest(0)</code> should return \"Smaller Than or Equal to 12\"');",
|
||||||
"assert(myTest(11) === \"Smaller Than 12\", 'message: <code>myTest(11)</code> should return \"Smaller Than 12\"');",
|
"assert(myTest(11) === \"Smaller Than or Equal to 12\", 'message: <code>myTest(11)</code> should return \"Smaller Than or Equal to 12\"');",
|
||||||
"assert(myTest(12) === \"Smaller Than 24\", 'message: <code>myTest(12)</code> should return \"Smaller Than 24\"');",
|
"assert(myTest(12) === \"Smaller Than or Equal to 12\", 'message: <code>myTest(12)</code> should return \"Smaller Than or Equal to 12\"');",
|
||||||
"assert(myTest(23) === \"Smaller Than 24\", 'message: <code>myTest(23)</code> should return \"Smaller Than 24\"');",
|
"assert(myTest(23) === \"Smaller Than or Equal to 24\", 'message: <code>myTest(23)</code> should return \"Smaller Than or Equal to 24\"');",
|
||||||
"assert(myTest(24) === \"25 or More\", 'message: <code>myTest(24)</code> should return \"24 or More\"');",
|
"assert(myTest(24) === \"Smaller Than or Equal to 24\", 'message: <code>myTest(24)</code> should return \"Smaller Than or Equal to 24\"');",
|
||||||
"assert(myTest(55) === \"25 or More\", 'message: <code>myTest(55)</code> should return \"24 or More\"');",
|
"assert(myTest(25) === \"25 or More\", 'message: <code>myTest(25)</code> should return \"25 or More\"');",
|
||||||
|
"assert(myTest(55) === \"25 or More\", 'message: <code>myTest(55)</code> should return \"25 or More\"');",
|
||||||
"assert(editor.getValue().match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <code><=</code> operator at least twice');"
|
"assert(editor.getValue().match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <code><=</code> operator at least twice');"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"function myTest(val) {",
|
"function myTest(val) {",
|
||||||
" if (val) { // Change this line",
|
" if (val) { // Change this line",
|
||||||
" return \"Smaller Than 12\";",
|
" return \"Smaller Than or Equal to 12\";",
|
||||||
" }",
|
" }",
|
||||||
" ",
|
" ",
|
||||||
" if (val) { // Change this line",
|
" if (val) { // Change this line",
|
||||||
" return \"Smaller Than 24\";",
|
" return \"Smaller Than or Equal to 24\";",
|
||||||
" }",
|
" }",
|
||||||
"",
|
"",
|
||||||
" return \"25 or More\";",
|
" return \"25 or More\";",
|
||||||
@ -2665,7 +2666,17 @@
|
|||||||
""
|
""
|
||||||
],
|
],
|
||||||
"solutions": [
|
"solutions": [
|
||||||
""
|
"function myTest(val) {",
|
||||||
|
" if (val <= 12) { // Change this line",
|
||||||
|
" return \"Smaller Than or Equal to 12\";",
|
||||||
|
" }",
|
||||||
|
" ",
|
||||||
|
" if (val <= 24) { // Change this line",
|
||||||
|
" return \"Smaller Than or Equal to 24\";",
|
||||||
|
" }",
|
||||||
|
"",
|
||||||
|
" return \"25 or More\";",
|
||||||
|
"}"
|
||||||
],
|
],
|
||||||
"type": "waypoint",
|
"type": "waypoint",
|
||||||
"challengeType": "1",
|
"challengeType": "1",
|
||||||
|
Reference in New Issue
Block a user