Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

How do you check if an object has a specific property?

View

What does the following code return?

View

What does Object.keys() return?

View

What is the result of the following code?

View

Which method returns an array of the object's property values?

View

How do you create a new object that inherits properties from another object?

View

What does the following code return?

View

Which method freezes an object, preventing any changes to it?

View

Which method only prevents new properties from being added to an object but allows modification of existing properties?

View

What is the output of the following code?

View

How do you check if an object has a specific property?

object.hasOwnProperty()
"property" in object
object.hasProperty()
Both a and b

What does the following code return?

const obj = { name: "Alice", age: 25 }; console.log("name" in obj);

true
false
undefined
null

What does Object.keys() return?

An array of property values
An array of property names
The first key of the object
A boolean indicating if the object has properties

What is the result of the following code?

const person = { name: "John", age: 30 }; const keys = Object.keys(person); console.log(keys);

["name", "age"]
["John", 30]
["person"]
undefined

Which method returns an array of the object's property values?

Object.keys()
Object.values()
Object.entries()
Object.properties()

How do you create a new object that inherits properties from another object?

Object.create(protoObj)
Object.clone(protoObj)
Object.extend(protoObj)
Object.copy(protoObj)

What does the following code return?

const person = { name: "Jane", age: 25 }; const entries = Object.entries(person); console.log(entries);

[["name", "Jane"], ["age", 25]]
["Jane", 25]
{name: "Jane", age: 25}
null

Which method freezes an object, preventing any changes to it?

Object.freeze()
Object.seal()
Object.lock()
Object.preventChanges()

Which method only prevents new properties from being added to an object but allows modification of existing properties?

Object.freeze()
Object.seal()
Object.preventExtensions()
Object.lock()

What is the output of the following code?

const person = { name: "John" }; Object.freeze(person); person.name = "Jane"; console.log(person.name);

John
Jane
undefined
Error