audipower

Build a Wall - Arrays Advanced - Javascript

Jun 15th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function exercise(input) {
  2.     input = input.map(Number).filter(x => x < 30);
  3.     let concreteEachDay = [];
  4.     let amount = 0;
  5.  
  6.     while (input.length > 0) {
  7.         let cubucsPerDay = 0;
  8.         input.forEach(x => cubucsPerDay += 195);
  9.         input = input.map(x => x += 1).filter(x => x < 30);
  10.         concreteEachDay.push(cubucsPerDay);
  11.         amount += cubucsPerDay * 1900;
  12.     }
  13.     console.log(concreteEachDay.join(", "));
  14.     console.log(`${amount} pesos`);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment