¡GoConqr estrena diseño! Cuéntanos qué te parece.

Diagrama de flujo

Object data type overview

Kostas Diakogiannis Web Developing Junior Certificate Inglés

Contenido del diagrama

  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.

Información

Descripción
Junior Certificate Web Developing Diagrama sobre Object data type overview, creado por Kostas Diakogiannis el 12/10/2018.
Visitas
3
Historial
  • Creado por Kostas Diakogiannis · 12 oct 2018
  • Copiado por Kostas Diakogiannis · 12 oct 2018
  • Copiado por Kostas Diakogiannis · 12 oct 2018
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?