Theme Layout

Boxed or Wide or Framed

Wide

Theme Translation

Display Featured Slider

Featured Slider Styles

Display Grid Slider

yes

Grid Slider Styles

Display Trending Posts

Display Author Bio

Display Instagram Footer

off

Dark or Light Style

Light

Blog Archive

Powered by Blogger.

Friday, February 10, 2017

[JavaScript] Objects


# JavaScript Objects


● Real Life Objects, Properties, and Methods.

  In Real life, a car is an object.
  A car has properties like weight and color, and methods like start and stop.

<http://www.w3schools.com/js/js_objects.asp>
  All cars have a same properties, but the property values differ from car to car.
  All cars have the same methods, but the methods are performed at different times.

● JavaScript Objects


 Objects are variables too. But objects can contain many values.
 This code assign many values ( Flat, 500, white ) to a variable named car.

● Object Properties.


  The name:values pairs are called properties.
  Use the above example, properties are type, model and color. and property values are     fiat, 500 and white.

● Object Methods

  Methods are actions that can be performed on objects.
  Methods are stored in properties as function definitions.

● Accessing Object Properties.

  Accessing object properties in two ways.
  • objectName.propertyName
  • objectName["propertyName"]

● Do not declare Strings, Numbers, and Booleans as Objects.

  When a JavaScript variable is declared with the keyword new, the variable is created as   an object.
QuickEdit
Unknown
0 Comments
Share This Post :

You Might Also Like

No comments:

Post a Comment

Follow @SunriseSunsetBlog