20,741
edits
Line 33: | Line 33: | ||
}; | }; | ||
</syntaxhighlight> | |||
Now, instead of adding key/value pairs directly to the hash, we can also add a nested hash: | |||
<syntaxhighlight lang="nasal"> | |||
var myDriverHash = { | |||
"hash1": {}, | |||
"hash2": {}, | |||
}; | |||
</syntaxhighlight> | |||
Now, myDriverHash contains two keys, each pointing to another hash - which is empty for now, these can be accessed using the key to look up the field in the namespace: | |||
<syntaxhighlight lang="nasal"> | |||
var myDriverHash = { | |||
"hash1": { value:1}, | |||
"hash2": { value:2}, | |||
}; | |||
print( myDriverHash["hash1"] ); | |||
print( myDriverHash["hash2"] ); | |||
</syntaxhighlight> | </syntaxhighlight> | ||