One Pager Cheat Sheet
- We will learn about the data structure
objects
and work withkey-value
pairs in JavaScript to store data easily and efficiently. Objects
allow for the storage ofkey-value
pairs to access data using keys (orproperties
) forindices
, and can also store multiple values for a single key in an array.Objects
cannot haveduplicate keys
, andJavaScript
only allowsstrings
to bekeys
in anobject
.- No two
keys
in the same object can have the samename
, even if the assignedvalues
are the same, as JavaScript does not allow an object to have two same keys. - Attempting to access the first element in a JavaScript
object
using an index (like anarray
orstring
) will returnundefined
since objects consist of only key-value pairs. - Dictionaries have several built-in functions and properties for insertion, deletion, and other operations, as well as
Object
methods for obtaining length, keys, and values. - The
Object.entries()
method returns an array of key-value pairs from an object, which can be accessed using an index starting at zero, e.g.pairs[1]
. - We
learned
about different data storage elements, such as variables, lists, and objects , which are used to store and manipulate data depending on the situation.