Guest User

Untitled

a guest
Dec 13th, 2019
92
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Zadanie 9
  2. function letters(word) {
  3.     numberOfLetters = {};
  4.     for (let i = 0; i<word.length; i++) {
  5.         if (numberOfLetters[word[i]] == undefined) {
  6.             numberOfLetters[word[i]] = 1;
  7.         } else {
  8.             numberOfLetters[word[i]] ++;
  9.         }
  10.     }
  11.     return numberOfLetters;
  12. }
  13.  
  14. let mojeSlowo = "Subaru";
  15. console.log(letters(mojeSlowo));
RAW Paste Data