loading
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const fruits = [ 'pineapple', 'apple', 'banana', 'pear' ];

console.log('map() example');
const upperCaseFruits = fruits.map((value) => {
    return value.toUpperCase();
});

console.log('upperCaseFruits =', upperCaseFruits, '\n');


console.log('for loop example');
let upperCaseFruitsAgain = [];
for (let i = 0; i < fruits.length; i++) {
    upperCaseFruitsAgain.push(fruits[i].toUpperCase());
}

console.log('upperCaseFruitsAgain =', upperCaseFruitsAgain);