SHARE
TWEET

count

collinsanele May 25th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. let list = ["a", "bb", "a", "bb", "ccc"];
  3.  
  4. function wordCount(arr){
  5.   let obj = {};
  6.   arr.forEach((item)=>{
  7.     obj[item] = item.length;
  8.   });
  9.   return obj;
  10. }
  11.  
  12.  
  13.  
  14. console.log(wordCount(list));
  15. </script>
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