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

Published: 12 March 2015
on channel: 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/


On this page of the site you can watch the video online Javascript - How To Create a Basic Javascript Object and Access Its Properties with a duration of hours minute second in good quality, which was uploaded by the user A Tech Apart 12 March 2015, share the link with friends and acquaintances, this video has already been watched 1,527 times on youtube and it was liked by 10 viewers. Enjoy your viewing!