VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Hash Tables - Beau teaches JavaScript

Hash Tables - Beau teaches JavaScript

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Hash tables are a quick way to implement associative arrays, or mappings of key-value pairs. Find our more and learn how to create one in JavaScript. - Code: http://codepen.io/beaucarnes/pen/VbYGMb?editors=0012 - Info: http://www.willvillanueva.com/javascript-hash-tables/ - Beau Carnes on
Date: 2022-03-14

Comments and reviews: 6


Can you explain what do you mean by -When (inserted=== false), then push the key,vales into storage array. But how do we get multiple entries for the same bucket? It means collision right? But how can it happen when you don't find the same key which actually happens in previous case i.e. when the key exists already. Help me.
reply

Really weird mixture of var let and const here. Your storage can be a const since the array location in the memory doesn't change, only the array items do. all the functions should also be consts as well. there's really no point in using var anymore. great video otherwise!
reply

I think I might be missing something here, wasn't the point of a hastable to have O(1) reads, inserts, and deletes? This is running O(n) blocks for each of those operations. Is there a way to get those down to O(1) in Javascript?
reply

Nice explanation. Good work, Beau Carnes !
Line 42,
There is a use case in Remove method, that is the key doesn't exist in array.
The code logic works. If we may test it separately, it'll be more clear.

reply

Hey, great content! But I think using splice instead of delete will be a better solution. This throws an error if you remove a chained key and then try to reassign it.
reply

at line 43 you have deleted array item, but length of array wasn't changed. So line 42 never will be true if we have inserted item once
reply
Add a review, comment






Other channel videos