What is "instance" of an object? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is "instance" of an object?

5th Jul 2016, 10:21 AM
Abu
Abu - avatar
2 Answers
+ 6
First, you define an object (using an object constructor): function Person(firstName, lastName, age) { this.firstName = firstName; this.lastName = lastName; this.age = age; } Now, you may create as many as you need of "real" persons using that object constructor and each person would be a new "instance" of the object 'Person': var john = new Person("John", "Doe", 45);
5th Jul 2016, 1:30 PM
ZinC
ZinC - avatar
- 4
bom dia 🐄🐵
18th Jul 2016, 3:01 PM
Lourdes Tavare Lourdes Tavares
Lourdes Tavare Lourdes Tavares - avatar