daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const shoppingList = function(paniers) {
  2.   const panierObject = {};
  3.   for (let i = 0; i < paniers.length; i++) {
  4.     for (let j = 0; j < paniers[j].length; j++) {
  5.       let fruit = paniers[i][j];
  6.         if (panierObject[fruit] === undefined) {
  7.           panierObject[fruit] = 1;
  8.         } else {
  9.           panierObject[fruit] += 1;
  10.         }
  11.     }
  12.   } return panierObject;
  13. }
  14.  
  15.  
  16. shoppingList([
  17.     ["orange", "orange", "kiwi", "ananas"],
  18.     ["kiwi", "ananas", "banane", "prune"],
  19.     ["orange", "orange", "orange", "orange"],
  20.     ["orange", "orange", "kiwi", "kiwi"],
  21.     ["prune", "banane", "pamplemousse", "ananas"]
  22. ]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top