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 an empty object in JavaScript?

View

How do you add a new property to a JavaScript object?

View

Which of the following is NOT a valid way to access an object’s property?

View

What is the output of the following code?

View

What does the following code return?

View

How do you check if a property exists in a JavaScript object?

View

What is the output of the following code?

View

Which method is used to get an array of the keys of an object?

View

What is the correct syntax for creating a new object using a constructor function?

View

Which statement about JavaScript objects is correct?

View

How do you create an empty object in JavaScript?

var obj = []
var obj = {}
var obj = ()
var obj = new Object[]

How do you add a new property to a JavaScript object?

object.property = value
object.addProperty(value)
add.property(object, value)
object.property == value

Which of the following is NOT a valid way to access an object’s property?

obj["property"]
obj.property
obj->property
obj['property']

What is the output of the following code?

var obj = { name: "John" }; console.log(obj.name);

John
undefined
null
Error

What does the following code return?

var obj = { name: "John", age: 30 }; delete obj.age; console.log(obj.age);

30
undefined
null
Error

How do you check if a property exists in a JavaScript object?

if (obj.has(property))
if (obj[property])
if ("property" in obj)
if (obj.contains("property"))

What is the output of the following code?

var obj = { name: "Alice" }; console.log("name" in obj);

true
false
undefined
Error

Which method is used to get an array of the keys of an object?

Object.keys()
Object.getKeys()
Object.keysArray()
Object.properties()

What is the correct syntax for creating a new object using a constructor function?

var obj = Object()
var obj = new Object()
var obj = Object.create()
var obj = Object.new()

Which statement about JavaScript objects is correct?

JavaScript objects are arrays with named keys.
JavaScript objects store data in key-value pairs.
JavaScript objects can only hold primitive types.
JavaScript objects are immutable.