SHARE
TWEET

Untitled

a guest Dec 13th, 2019 82 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
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top