Object JS

This is one of those times when JavaScript can trow a curb-ball with the addition of “Homonyms” to the language, because the word “Object” can mean other things in the JavaScript language, now lets see how we can initialize and utilize them.


Object Initialization:

MDN-1   —   MDN-2

Other methods to Create Objects:

 

Manipulation: Access, change, Add, Delete.

Object Properties

 

Loopint to Pringint Information of Array

Keys or Values to Array

.hasOwnProperty()

 

Object to –> “Two-Dim Array” .entries()

 

Bank Account Object Example

Using a function inside or an Object is so common practice that even have a name: “METHOD”

Is Key on the Object?

In this case we have an object “CustomeData” and we want to know if the Key :  var = firstName => (the Name of the Customer), is one of the keys in the Object:

GitHub Problems with related information

Given a string, “countWords” returns an object where each key is a word in the given string, with its value being how many times that word appeared in th given string: LINK to CODE

 

.



Copyright 2017. All rights reserved.

Posted January 23, 2017 by Edmundo in category "JS