sabadvali sabadvali - 3 months ago 13
Javascript Question

create and use one object in another in angularJS

I have a variable/object called Student.
it's attributes are: name,surname,address.I want it to have one more attribute-"classroom", All I want is to create a new object classroom,which attributes will be "class_number" and "class_type"...
So I want:

var student : [{
name: "Jacob"
surname:"Black"
adress:"Baltimore Street N2",
classroom: // I dont know how to write this
}];

Answer
var student : [{
    name: "Jacob"
    surname:"Black"
    adress:"Baltimore Street N2",
    classroom: {
        "class_number":"101",
        "class_type":"programming"
    }
}];