|
|
|
@ -1,9 +1,5 @@
|
|
|
|
# W02D02 Morning Warmup
|
|
|
|
# W02D02 Morning Warmup
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# JAVASCRIPT ITERATORS
|
|
|
|
# JAVASCRIPT ITERATORS
|
|
|
|
|
|
|
|
|
|
|
|
#####`.forEach`, `.map`, and `.reduce`
|
|
|
|
#####`.forEach`, `.map`, and `.reduce`
|
|
|
|
@ -26,7 +22,16 @@ arr.forEach(function(n) {
|
|
|
|
=> Prints a bunch of 9s to the console
|
|
|
|
=> Prints a bunch of 9s to the console
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
SOLUTION to .forEach
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
|
|
|
words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
words.forEach(function (e){
|
|
|
|
|
|
|
|
console.log(e.toUpperCase());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### EXERCISE:
|
|
|
|
##### EXERCISE:
|
|
|
|
- Log each word in `words` in upper case using `.forEach.`
|
|
|
|
- Log each word in `words` in upper case using `.forEach.`
|
|
|
|
|