0

What is the use of javascript Object and how we can define them?

29th Dec 2016, 6:42 AM
Vipul Aggarwal
Vipul Aggarwal - avatar
1 Réponse
0
Variables are used to hold data. Objects are kind of similar but they can hold more data. Think of a variable as the little spice container and an object as a spice rack (at least that is how I picture it). If you wanted to create a character, for example, you would define a variable to hold name, age, profession, etc. An object can hold all that information in form of a list in one container. It makes your code more succinct and easy to read. An example of an object: var account = { name: "checking", currentBalance: 185, minBalance: 25, owner: "Vipul" };
20th Mar 2017, 7:56 PM
Amos Nyarongi