How to replace key strings in a Javascript key: hash map value?
This is what I have so far:
var hashmap = {"aaa":"foo", "bbb":"bar"}; console.log("before:"); console.log(hashmap); Object.keys(hashmap).forEach(function(key){ key = key + "xxx"; console.log("changing:"); console.log(key); }); console.log("after:"); console.log(hashmap);
See how this jsbin works .
The characters "before" and "after" are the same, so forEach appears in a different volume. How can i fix this? Perhaps there are better ways to do this?
source share