Prototype Property in Javascript Object

Last Updated: September 19, 2017

Prototype property of object points to another object in javascript.
We will see how we can use the prototype property

function Product(name){

    return this.price*5/100

var p= new Product('Fanta')

Now you can call the getDiscount() to get the discount
>console.log("Discount is "+p.getDiscount())
>Discount is 0.05