Hey Sean, thanks for the response! I think for the way that I'm approaching the problem, that I actually need to initialize the array with 100 indices - otherwise, I couldn't map the keys to their array index positions. Also, I think fill does modify array values, as well as return the outcome of the fill. I tested that out on JSFiddle.
(Your avatar is dope btw. :))
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great job on solving the problem!
Just some pointers for future reference:
new Array(100)
is pretty wasteful, but I'll get back to this in a secmap.fill(0)
in your code isn't doing anything because you don't assign the return value back to map. Array.prototype.fill is not a modifier functionJavaScript can be pretty confusing at time but I hope you stick around and again nice work :D
Hey Sean, thanks for the response! I think for the way that I'm approaching the problem, that I actually need to initialize the array with 100 indices - otherwise, I couldn't map the keys to their array index positions. Also, I think
fill
does modify array values, as well as return the outcome of the fill. I tested that out on JSFiddle.(Your avatar is dope btw. :))