Methods of Hash Class
Learn different methods of the hash class.
We'll cover the following...
Hash in JavaScript
In general, the hash data structure is pretty straightforward. Ruby has some methods of the Hash
class that we will probably see in other languages as well. Here is, for example, what hash access looks like in JavaScript:
$ node
> hh = {};
{}
> hh['something'] = 'blabla';
'blabla'
> hh
{ something: 'blabla' }
The difference is that JavaScript doesn’t have a symbol type, and most of the time strings are used as hash keys. We can see a comparison between Ruby and JavaScript ...