Adding properties; Contact List; 4/8


"Problem with syntax". Help pls. Thanks in advance

var friends = {
    firstName: "Bill",
    lastName: "Gates",
    number: "(206) 555-5555",
    firstName: "Steve",
    lastName: "Jobs",
    number: "(206) 555-5555",
    firstName: "Paddy",
    lastName: "Alviar",
    number: "(661) 369-4157",


You don't need semicolons on the last to curly brackets. I would also suggest that you don't add an extra person until after you have completed the exercise.


Noted. Thank you. I thought adding semicolons were mandatory after each line of code?


Usually yes, but there are some cases where semicolons are not necessary and can mess up your code. I normally code in languages that don't have semicolons, but unfortunately when coding in Java Script then you don't have that luxury :slight_smile:.


The only time we write a semi-colon after a curly brace is when it is a statement.

var myObj = {


var func = function () {


In both of the above there is an assignment. The right hand side of the equal sign is an expression.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.