Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- let list = ["a", "bb", "a", "bb", "ccc"];
- function wordCount(arr){
- let obj = {};
- arr.forEach((item)=>{
- obj[item] = item.length;
- });
- return obj;
- }
- console.log(wordCount(list));
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement