List All Properties in Object in Javascript

You can use for loop to list all properties and methods in object

Output will be
name : Burger
category : food
price : 10
getDiscount :function () {
return this.price * 5 / 100;
}

Leave a Reply

Your email address will not be published. Required fields are marked *