JavaScript: Populate Hash Table with String Character Counts
Execute the Script
In a Unix-like terminal:
$ sudo node charCounts.js
Result
{ a: 2, b: 1 }
{}
Hash Table
In the hash table above, { a: 2, b: 1 }
, the keys a
and b
were mapped to the values 2
and 1
.