GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Flussdiagramm

Object data type overview

Kostas Diakogiannis Web Developing Junior Certificate Englisch

Inhalt des Flussdiagramms

  1. JavaScript Objects Type

  2. Objects Data Type

    Objects help us to store multiple pieces of information in one place by defining key value pairs inside them. The keys work as placeholders, while the values can be any data type.

    let newUser = {firstName: 'Kostas', lastName: 'Diakogiannis', age: 30, nickName: 'Jake', profession: 'Data Scientist'};

    Or you can create an object template by using the new constructor as shown here.

    In order to access a property of an object we use the keys: There are 2 ways as shown below, both do the same thing. Select the firstName property from the newUser object.

    console.log(newUser.firstName)

    OR

    console.log(newUser['firstName'])

    Properties can be also functions, These functions when called belong to the object and only to the object and they can changes object's properties. These are called Methods.

    Properties and methods can also be sharable through many objects. The object that all these objects inherit from is called a parent Object. example:

    let Human = {kind: 'Human' , legs: 2, ears: 2, hands: 2, eyes: 2};

    With the setPrototypeOf property we can make the human properties shared to the newUser and to whatever object calls this setPrototypeOf function.

    Object.setPrototypeOf(newUser, Human);

    console.log(newUser.legs) // Prints 2

    Objects are iterable, that means you can loop through each object properties with a for - in loop, by setting a standard variable that each time holds the key for every iteration.

    The for in loop explained here!!

    Additionally you can reference to an object property from inside the object by using the 'this' keyword.

Informationen

Beschreibung
Junior Certificate Web Developing Flussdiagramm am Object data type overview, erstellt von Kostas Diakogiannis am 12/10/2018.
Aufrufe
4
Verlauf
  • Erstellt von Kostas Diakogiannis · 12 Okt 2018
  • Kopiert von Kostas Diakogiannis · 12 Okt 2018
  • Kopiert von Kostas Diakogiannis · 12 Okt 2018
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck