TGViewer
Html and Css & Jsآموزش Html and Css & Jsآموزش @htmlcss_channels · 23.1K subscribers
Post #2406 1.67K
✅ JavaScript Objects – Interview Questions & Answers


🔹 1. What is an object in JavaScript?
An object is a collection of key-value pairs used to store related data and functionality.
Example:
const user = { name: "Alice", age: 25 };


🔹 2. How do you access object properties?
Using dot or bracket notation:
user.name  // "Alice"  
user["age"] // 25


🔹 3. How can you loop through an object?
Use for...in or Object.keys()/Object.entries():
for (let key in user) { console.log(key, user[key]); }


🔹 4. Difference between Object.freeze() and Object.seal()?
⦁ freeze() prevents any change (no adding, deleting, or modifying properties).
⦁ seal() allows value changes, but not adding/removing keys.

🔹 5. How do you clone an object?
const clone = {...user };  
// or
const copy = Object.assign({}, user);


🔹 6. What is this inside an object?
this refers to the object itself in method context.
const person = {
name: "Bob",
greet() { return `Hi, I’m ${this.name}`; }
};


🔹 7. How do prototypes relate to objects?
Every JS object has a hidden [[Prototype]]. It lets objects inherit properties from others.

🔹 8. What is a constructor function?
A function used to create multiple similar objects:
function User(name) {
this.name = name;
}
const u = new User("Tom");


🔹 9. What's the difference between Object.create() and new keyword?
⦁ Object.create(proto) creates an object with the given prototype.
⦁ new invokes a constructor function to initialize objects.

🔹 10. How do you check if a property exists in an object?
"name" in user // true
user.hasOwnProperty("age") // true

💬 Tap ❤️ for more!


💎 @Htmlcss_channels | #css #JavaScript #HTML #interview
  • ❤ 7
  • 👍 2
More from @htmlcss_channels
  1. Sep 28, 2026؛CSS Clamp — اندازه‌گذاری هوشمند فرمول ساده ؛clamp(کمترین, مقدار_ایده‌آل, بیشترین) مثل یه…
  2. Sep 28, 2026🔅 CSS Clamp clamp(minimum, preferred, maximum); In this example, the preferred value is 5…
  3. Sep 27, 2026🚀 نقشه راه ورود به بازار فریلنسینگ بین‌المللی طراح، برنامه‌نویس، دیزاینر یا تولیدکننده مح…
  4. Sep 26, 2026برای معرفی پروژه هاتون به کارفرما بهتره از این روش استفاده کنید این وبسایت پروژه هاتون رو…
  5. Sep 24, 2026۵ منبع رایگان کاربردی برای طراحان و توسعه‌دهندگان وبسایت! اگه دنبال کامپوننت‌های آماده، آی…
  6. Sep 23, 2026HTML: Responsive images 🔅 تصاویر واکنش‌گرا در HTML با اين تکنیک، مرورگر خودش بهترین نسخه…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →