commit
726f08a179
3 changed files with 3 additions and 3 deletions
|
@ -4,7 +4,7 @@ importance: 5
|
||||||
|
|
||||||
# Check for spam
|
# Check for spam
|
||||||
|
|
||||||
Write a function `checkSpam(str)` that returns `true` if `str` contains 'viagra' or 'XXX', otherwise false.
|
Write a function `checkSpam(str)` that returns `true` if `str` contains 'viagra' or 'XXX', otherwise `false`.
|
||||||
|
|
||||||
The function must be case-insensitive:
|
The function must be case-insensitive:
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ The array in the process:
|
||||||
|
|
||||||
```js no-beautify
|
```js no-beautify
|
||||||
Jazz, Blues
|
Jazz, Blues
|
||||||
Jazz, Bues, Rock-n-Roll
|
Jazz, Blues, Rock-n-Roll
|
||||||
Jazz, Classics, Rock-n-Roll
|
Jazz, Classics, Rock-n-Roll
|
||||||
Classics, Rock-n-Roll
|
Classics, Rock-n-Roll
|
||||||
Rap, Reggae, Classics, Rock-n-Roll
|
Rap, Reggae, Classics, Rock-n-Roll
|
||||||
|
|
|
@ -453,7 +453,7 @@ We can use an array as a deque with the following operations:
|
||||||
- `push(...items)` adds `items` to the end.
|
- `push(...items)` adds `items` to the end.
|
||||||
- `pop()` removes the element from the end and returns it.
|
- `pop()` removes the element from the end and returns it.
|
||||||
- `shift()` removes the element from the beginning and returns it.
|
- `shift()` removes the element from the beginning and returns it.
|
||||||
- `unshift(...items)` adds items to the beginning.
|
- `unshift(...items)` adds `items` to the beginning.
|
||||||
|
|
||||||
To loop over the elements of the array:
|
To loop over the elements of the array:
|
||||||
- `for (let i=0; i<arr.length; i++)` -- works fastest, old-browser-compatible.
|
- `for (let i=0; i<arr.length; i++)` -- works fastest, old-browser-compatible.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue