country - > country.toUpperCase()

pull/174/head
Aravind Prabhu 3 years ago
parent d0c066fcb9
commit ccadccd149

@ -3432,9 +3432,9 @@ For example if we like to change each country to uppercase and store it back to
```js ```js
const countries = ['Finland', 'Estonia', 'Sweden', 'Norway'] const countries = ['Finland', 'Estonia', 'Sweden', 'Norway']
const newCountries = [] const newCountries = []
countries.forEach((country) => newCountries.push(country)) countries.forEach((country) => newCountries.push(country.toUpperCase()))
console.log(newCountries) // ["Finland", "Estonia", "Sweden", "Norway"] console.log(newCountries) // ["FINLAND", "ESTONIA", "SWEDEN", "NORWAY"]
``` ```
Let us see more examples. For instance if we want to sum an array of numbers we can use forEach or reduce. Let us see how we use forEach to sum all numbers in an array. Let us see more examples. For instance if we want to sum an array of numbers we can use forEach or reduce. Let us see how we use forEach to sum all numbers in an array.

Loading…
Cancel
Save