JS Object Based Programming



Object Based Programming Language ?

[one_half last=”no”]Object Based Programming Language - JavaScript[/one_half]JavaScript is Considered as Object Based Programming Language , Let’s See what is actually meant by Object Based Programming Language and Why JavaScript is Considered as Object Based Programming Language.

  1. Java Programming is considered as Object Based Programming language.
  2. Language in Which we are allowed to create Objects,manipulate with object is called as Object Based Programming Language.
  3. JavaScript Allows us to create object so we call JavaScript as Object Based Programming Language.

What we can do with Object Based Programming Language ?

  1. We can Create Object in JavaScript.
  2. We can Make Our Own Object Variables.
  3. We can have Properties Assigned to Objects.
  4. We can have Methods specific for Objects.

Let us Consider Different Aspects of Object Based Programming –

  1. Property
  2. Method

A. Properties of Objects

  1. Values associated with “Objects” is called as “Property“.
  2. Properties are accessed by Object Variables Using DOT.
  3. Let’s take following example to know better –

Live Example : Property

<script type="text/javascript">
var str="Pritesh Taral";
document.write(str.length);
</script>
  • str is String Object.
  • length is property of String Object. (It will give Length of the String)

B. Methods of Objects

  1. Methods are nothing but actions performed on Objects.
  2. Example –

Live Example : Property

<script type="text/javascript">
var str="Pritesh Taral";
document.write(str.toUpperCase());
</script>
  • str is Object.
  • toUpperCase is Method which is used to perform action on Object ‘str’.
  • It perform action to change LowerCase letter to Uppercase. (Action of Case Conversion).