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 create a deep copy of a JavaScript object?

View

What is the output of the following code?

View

Which of the following is true about Object.freeze() in JavaScript?

View

How do you make a property non-enumerable in a JavaScript object?

View

Which method is used to merge two objects in JavaScript?

View

What is the output of the following code?

View

What does the Object.seal() method do?

View

How can you check if a property is configurable in a JavaScript object?

View

What is the result of the following code?

View

Which method returns an array of all enumerable property names of an object?

View

How do you create a deep copy of a JavaScript object?

var newObj = Object.assign({}, obj)
var newObj = { ...obj }
var newObj = JSON.parse(JSON.stringify(obj))
var newObj = obj

What is the output of the following code?

var obj = { name: "Tom" }; Object.defineProperty(obj, 'age', { value: 25 }); console.log(obj.age);

25
undefined
Error
null

Which of the following is true about Object.freeze() in JavaScript?

It prevents adding new properties to the object
It prevents modifying existing properties
It prevents deleting existing properties
All of the above

How do you make a property non-enumerable in a JavaScript object?

Object.seal(obj, property)
Object.assign(obj, {enumerable: false})
Object.defineProperty(obj, 'property', { enumerable: false })
Object.freeze(obj)

Which method is used to merge two objects in JavaScript?

Object.concat()
Object.assign()
Object.copy()
Object.combine()

What is the output of the following code?

var obj = { x: 10, y: 20 }; var newObj = Object.assign({}, obj); newObj.x = 30; console.log(obj.x);

10
20
30
undefined

What does the Object.seal() method do?

Prevents adding or removing properties but allows modifying existing ones.
Freezes the object completely
Makes all properties non-enumerable
Prevents any kind of modification to the object

How can you check if a property is configurable in a JavaScript object?

Object.isConfigurable(obj, property)
Object.isSealed(obj)
Object.getOwnPropertyDescriptor(obj, 'property').configurable
obj.hasOwnPropertyConfigurable()

What is the result of the following code?

var obj = { a: 1, b: 2 }; var desc = Object.getOwnPropertyDescriptor(obj, 'a'); console.log(desc.writable);

true
false
undefined
null

Which method returns an array of all enumerable property names of an object?

Object.getOwnPropertyNames()
Object.keys()
Object.entries()
Object.getProperties()