Simple Objects Operations
Refresh your knowledge about Javascript objects.
We'll cover the following...
Objects
Almost everything in JavaScript is an object. This includes anything that’s not a primitive type in JavaScript. The primitive data types in JavaScript are null
, undefined
, strings, numbers, boolean, and symbols.
We create objects in JavaScript using an object literal or the new
keyword.
Object literal
This is probably the most common method to create an object in JavaScript. An object literal in JavaScript is a key-value pair enclosed in curly brackets ({}
).
The person
variable is an object literal with three property names. These are name
, sex
, and age
. The value of the property or key of an object can be of any of the data types in JavaScript, including arrays, functions, integer, stings, undefined
, and so on. ...