I am trying to create an object of array. I have defined it as following:
work = {
'jobs': [{
'employer': 'ABC',
'jobPosition': 'FrontEndEngineer',
'experience': '1 year',
'city': 'Mumbai'
}]
};
Since it is an array I am trying to append it to the next position as
work.jobs[1].employer="QWE";
work.jobs[1].jobPosition = "Web Dev Intern";
work.jobs[1].experience = "6 months";
work.jobs[1].city = "Bengaluru";
And consoling the work object, It shows error:
Uncaught TypeError: Cannot set property 'employer' of undefined
What am I doing wrong?