-3

Suppose we have the following object :

var possibility ={
object 1
object 2
object 3
};

how can i add 4th object within "possibility" object,structure of that 4th object is like :

var status = {
name : "lalala",
text : "blabla"
};
1

2 Answers 2

1

If you will assign to the property of an object, which is not defined,it will create a new property and assign to it the value

possibility['status'] = {
   name : "lalala",
   text : "blabla"
};

or

possibility.status = {
       name : "lalala",
       text : "blabla"
    };
Sign up to request clarification or add additional context in comments.

Comments

0

You can also create a property by addressing it as a property.

possibility.status = status;

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.