我的Javascript语法有什么问题?

时间:2016-03-20 23:56:53

标签: javascript javascript-objects

我试图将一些对象变成对象,但是我的语法存在问题。

代码:

var friends = {
    bill : {
    firstName:"Bill",
    lastName:"Gates",
    number:00158965478
    },
    steve :{

    firstName:"Steve",
    LastName:"Jobs"
    number:00125688977
    },
    Joe: {

    firstName:"Joe",
    LastName:"Erabti",
    number:0021625804429
    }

};

1 个答案:

答案 0 :(得分:0)

你忘记了乔布斯的姓氏之后的逗号。所以它假设是这样的:

  var friends = {
        bill : {
        firstName:"Bill",
        lastName:"Gates",
        number:00158965478
        },
        steve :{
        firstName:"Steve",
        LastName:"Jobs", //<-- You previously forgot it here
        number:00125688977
        },
        Joe: {
        firstName:"Joe",
        LastName:"Erabti",
        number:0021625804429
        }

    };