There is one line missing in the code below:

let car = {
  make'Dodge',
  model:'Dakota'
}
 // Insert line of code here.
console.log(`${car.make} ${car.model}, color: ${car.color}`);

Select the correct missing line in order for the console to show the following after running the whole code: Dodge Viper, color: red

  • car.model = 'Viper'; car.color = 'red';
  • car.set('model', 'Viper'); car.add('color', 'red');
  • An empty line – it is not possible to add a new color property to a previously created object.
  • car = {model: 'Viper', color: 'red'};
Explanation & Hint:

To achieve the desired console output of “Dodge Viper, color: red” after running the whole code, you should use the following line:

car.model = ‘Viper’; car.color = ‘red’;

This line reassigns the car variable with a new object that has both the model and color properties set to the desired values.

For more Questions and Answers:

JavaScript Essentials 2 – JSE2: Module 1: Classless Objects Module 1 Test Exam Answers Full 100%

This Post Has 2 Comments

  1. mohamed shaban

    Thanks too much my brother
    I wait JSE2: module 2

Leave a Reply