tobym76

Imperative-JS-code

Nov 24th, 2018
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Imperative code
  2. const cities = ['Torino', 'London', 'Dubai', 'London', 'Edinburgh'];
  3. const uppercaseCities = [];
  4.  
  5. for (let city of cities) {
  6.   uppercaseCities.push(city.toUpperCase());
  7. }
  8.  
  9. console.log(uppercaseCities);
  10. // [ 'TORINO', 'LONDON', 'DUBAI', 'LONDON', 'EDINBURGH' ]
  11.  
  12. //taken from Matteo Hertel's slides at https://github.com/matteo-hertel/FPTalk
Advertisement
Add Comment
Please, Sign In to add comment