+ 7
const person = { name: 'John Doe', age: 30 };
22nd Aug 2024, 9:40 AM
KOTLin
KOTLin - avatar
+ 3
function Person(name, age) { this.name = name; this.age = age; } Person.prototype.introduce = function() { console.log(`Hello, my name is ${this.name} and I am ${this.age} years old.`); }; // Creating an instance const person1 = new Person("John Doe", 30); person1.introduce(); // Output: Hello, my name is John Doe and I am 30 years old.
2nd Sep 2024, 12:13 PM
đŸ’„ertdf uiopđŸ’„
đŸ’„ertdf uiopđŸ’„ - avatar
+ 1
let information = { name: 'Name You Want', age:12 }; Note: Name must be on ' ' or " " ,becuase its string and name can be int or string no problem.
24th Aug 2024, 9:21 AM
Khalid Afghanmal
Khalid Afghanmal - avatar