Category: Javascript

Javascript forEach Example

I have a Javascript array with products and its name is product_table. Product is Javascript object type and it will have following look

So product_table will have different types of products. So i can add new product to product_table using push method product_table.push( ) How do you prevent adding duplicate products to product_table instead […]

Read more

Javascript Lib

Date Range Picker

Read more

How to use Gulp task to minify Javascript files

Read more

Getting started with gulp.js

What is Gulp? You can do bunch of diffrent things with Gulp. If you develop your project with Saas or Less and you need to convert it to CSS you can use Gulp to do it. If you want to minify your CSS and js file to make your website faster you can use Gulp […]

Read more

Inheritance in Javascript Using Extend Function

You can create function called extend to make subclassing process

This function will do what other languages do using extend keyword Now you can create the parent class Vehicle and create the subclass Car from it

In line 16, I am using extend() method for subclassing process

Read more

Inheritance in Javascript Using Prototype

I am going to define super class Vehicle with make and model properties and drive() method

Then I will define Car constructor function which will inherit from the Vehicle constructor function

In line 5 , you have Car.prototype=new Vehicle() statement which is used to inherit method and properties from the Vehicle super class […]

Read more

ES5 Way of Defining Getter and Setter for Javascript Object

You can use following ES5 code to define getter and setter for Javascript object.

In line 7, you have the Product.prototype to define the getter and setter

Read more

Using defineProperty() to Create Getter and Setter in Javascript Object

To create getter and setter for Javascript object I am going to use Object.defineProperty() function Now I will do getter and setter for the name property of the Product object

In line 7, You can see the defineProperty() method with three argument First argument is the prototype of the object and second argument is […]

Read more

Getter and Setter Creating with Constructor Function in Javascript

You can create getter and setter for the objects created with constructor function in javascript. To create the setter you can use the function and to create getter you can use the function. You have to pass three parameters to the call() function. First parameter is the prototype of the object, second parameter […]

Read more

Getter and Setter Creating with Object Literals in Javascript

As you know Javascript objects can be created as object literals. Now I am going to add getter and setter functionality to the object. I have created product with name and price property and I have added getter and setter for the name property

In Line 5 : You can see the getter for […]

Read more