Skip to content

Strings #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
03-string>2-check-spam
  • Loading branch information
CheerfulCherry committed May 30, 2022
commit b161b308596cb27bc6296d7403924a905bd6ab01
6 changes: 3 additions & 3 deletions 1-js/05-data-types/03-string/2-check-spam/_js.view/test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
describe("checkSpam", function() {
it('finds spam in "buy ViAgRA now"', function() {
it('uważa "buy ViAgRA now" za spam', function() {
assert.isTrue(checkSpam('buy ViAgRA now'));
});

it('finds spam in "free xxxxx"', function() {
it('uważa "free xxxxx" za spam', function() {
assert.isTrue(checkSpam('free xxxxx'));
});

it('no spam in "innocent rabbit"', function() {
it('nie uważa "innocent rabbit" za spam', function() {
assert.isFalse(checkSpam('innocent rabbit'));
});
});
2 changes: 1 addition & 1 deletion 1-js/05-data-types/03-string/2-check-spam/solution.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
To make the search case-insensitive, let's bring the string to lower case and then search:
Aby wyszukiwanie działało bez względu na wielkość liter, przekonwertujemy cały łańcuch na małe litery, a następnie sprawdzimy, czy zawiera szukany ciąg znaków:

```js run demo
function checkSpam(str) {
Expand Down
6 changes: 3 additions & 3 deletions 1-js/05-data-types/03-string/2-check-spam/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ importance: 5

---

# Check for spam
# Sprawdzanie pod kątem spamu

Write a function `checkSpam(str)` that returns `true` if `str` contains 'viagra' or 'XXX', otherwise `false`.
Napisz funkcję `checkSpam(str)`, która zwraca `true` jeśli `str` zawiera 'viagra' lub 'XXX', w przeciwnym wypadku `false`.

The function must be case-insensitive:
Funkcja musi być niewrażliwa na wielkość liter:

```js
checkSpam('buy ViAgRA now') == true
Expand Down