Multiple choice technology programming languages

What is the output of the below JavaScript?


var personObj = {firstname:"Jerome",lastname:"Davin"};          
alert(personObj.lastname);      

  1. Davin

  2. Jerome

  3. error

  4. lastname

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The code creates an object using literal notation with firstname='Jerome' and lastname='Davin', then alerts personObj.lastname which outputs 'Davin'. Object literal syntax is a cleaner way to create objects compared to the Object constructor.