Javascript - How To Create a Basic Javascript Object and Access Its Properties

Publicado em: 12 Março 2015
no canal de: A Tech Apart
1,527
10

an object creates a model by grouping together a set of related variables, values and functions

an object's properties can use different value types e.g. string, number, boolean, array and even functions (if a property's value is a function, it is called a method), it can even contain other objects

you can access an object's properties using dot notation, most commonly used because it's easier to use and easier on the eyes

you can also access an object's properties using bracket notation, although less commonly used, it has a couple of advantages over dot notation
-bracket notation is the only way to access property or method names that don't follow variable naming rules (e.g. a property name like "another key" has a space inbetween)
-with bracket notation you can also access an object's property using string concatenation, although not entirely recommended

if you try to access a property that doesn't exist, undefined will be returned

   • Javascript - How to Access Javascript Obje...   - Javascript - How to Access Javascript Object Property Names Using Object.keys()

   • Javascript - How to Access Javascript Obje...   - Javascript - How to Access Javascript Object Property Names Using A for in LOOP

----------------
resources:

http://stackoverflow.com/questions/49...

-----------------------------------------------------------
http://atechapart.com |   / alvinsanchez  

see my codepens @ http://codepen.io/_asanchez/


Nesta página do site você pode assistir ao vídeo on-line Javascript - How To Create a Basic Javascript Object and Access Its Properties duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário A Tech Apart 12 Março 2015, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 1,527 vezes e gostou 10 espectadores. Boa visualização!