diff --git a/1-js/05-data-types/03-string/2-check-spam/_js.view/solution.js b/1-js/05-data-types/03-string/2-check-spam/_js.view/solution.js deleted file mode 100644 index 105d70eaef..0000000000 --- a/1-js/05-data-types/03-string/2-check-spam/_js.view/solution.js +++ /dev/null @@ -1,5 +0,0 @@ -function checkSpam(str) { - let lowerStr = str.toLowerCase(); - - return lowerStr.includes('viagra') || lowerStr.includes('xxx'); -} \ No newline at end of file diff --git a/1-js/05-data-types/03-string/2-check-spam/_js.view/test.js b/1-js/05-data-types/03-string/2-check-spam/_js.view/test.js deleted file mode 100644 index 85eb24fcb9..0000000000 --- a/1-js/05-data-types/03-string/2-check-spam/_js.view/test.js +++ /dev/null @@ -1,13 +0,0 @@ -describe("checkSpam", function() { - it('finds spam in "buy ViAgRA now"', function() { - assert.isTrue(checkSpam('buy ViAgRA now')); - }); - - it('finds spam in "free xxxxx"', function() { - assert.isTrue(checkSpam('free xxxxx')); - }); - - it('no spam in "innocent rabbit"', function() { - assert.isFalse(checkSpam('innocent rabbit')); - }); -}); \ No newline at end of file diff --git a/1-js/05-data-types/03-string/2-check-spam/task.md b/1-js/05-data-types/03-string/2-check-spam/task.md deleted file mode 100644 index 98b5dd8a04..0000000000 --- a/1-js/05-data-types/03-string/2-check-spam/task.md +++ /dev/null @@ -1,16 +0,0 @@ -importance: 5 - ---- - -# Check for spam - -Write a function `checkSpam(str)` that returns `true` if `str` contains 'viagra' or 'XXX', otherwise `false`. - -The function must be case-insensitive: - -```js -checkSpam('buy ViAgRA now') == true -checkSpam('free xxxxx') == true -checkSpam("innocent rabbit") == false -``` - diff --git a/1-js/05-data-types/03-string/2-check-verb/_js.view/solution.js b/1-js/05-data-types/03-string/2-check-verb/_js.view/solution.js new file mode 100644 index 0000000000..fc137f3c8b --- /dev/null +++ b/1-js/05-data-types/03-string/2-check-verb/_js.view/solution.js @@ -0,0 +1,5 @@ +function checkVerb(str) { + let lowerStr = str.toLowerCase(); + + return lowerStr.includes('move') || lowerStr.includes('swim'); +} \ No newline at end of file diff --git a/1-js/05-data-types/03-string/2-check-verb/_js.view/test.js b/1-js/05-data-types/03-string/2-check-verb/_js.view/test.js new file mode 100644 index 0000000000..6279430b0e --- /dev/null +++ b/1-js/05-data-types/03-string/2-check-verb/_js.view/test.js @@ -0,0 +1,13 @@ +describe("checkVerb", function() { + it('finds verb in "You Should Move"', function() { + assert.isTrue(checkVerb('You Should Move')); + }); + + it('finds verb in "I am going for a swim"', function() { + assert.isTrue(checkVerb('I am going for a swim')); + }); + + it('no verb in "innocent rabbit"', function() { + assert.isFalse(checkVerb('innocent rabbit')); + }); +}); \ No newline at end of file diff --git a/1-js/05-data-types/03-string/2-check-spam/solution.md b/1-js/05-data-types/03-string/2-check-verb/solution.md similarity index 52% rename from 1-js/05-data-types/03-string/2-check-spam/solution.md rename to 1-js/05-data-types/03-string/2-check-verb/solution.md index de8dde57d3..405d38257a 100644 --- a/1-js/05-data-types/03-string/2-check-spam/solution.md +++ b/1-js/05-data-types/03-string/2-check-verb/solution.md @@ -1,14 +1,14 @@ To make the search case-insensitive, let's bring the string to lower case and then search: ```js run demo -function checkSpam(str) { +function checkVerb(str) { let lowerStr = str.toLowerCase(); - return lowerStr.includes('viagra') || lowerStr.includes('xxx'); + return lowerStr.includes('move') || lowerStr.includes('swim'); } -alert( checkSpam('buy ViAgRA now') ); -alert( checkSpam('free xxxxx') ); +alert( checkSpam('You Should Move') ); +alert( checkSpam('I am going for a swim') ); alert( checkSpam("innocent rabbit") ); ``` diff --git a/1-js/05-data-types/03-string/2-check-verb/task.md b/1-js/05-data-types/03-string/2-check-verb/task.md new file mode 100644 index 0000000000..aad3c9901d --- /dev/null +++ b/1-js/05-data-types/03-string/2-check-verb/task.md @@ -0,0 +1,15 @@ +importance: 5 + +--- + +# Check for verb + +Write a function `checkVerb(str)` that returns `true` if `str` contains 'move' or 'SWIM', otherwise `false`. + +The function must be case-insensitive: + +```js +checkSpam('You Should Move') == true +checkSpam('I am going for a swim') == true +checkSpam("innocent rabbit") == false +```