-2

I have the following JavaScript object :

[{
  Name: "Ishan",
  Code: 1,
  Is_Intern: "Yes",
  DateOfJoining: "01/02/2022",
  Skills: ["VB, DOT.NET, Angular"],
  Status: "Working"
}]

How can I add an item to the skills array in this object?

I didn't find any particular article regarding this.

mplungjan
  • 155,085
  • 27
  • 166
  • 222
Fire Bolt
  • 5
  • 1
  • you can add in `array` by `.push()`. – Hyunjune Kim Feb 15 '22 at 06:56
  • But How ? This is not a simple Array this is an array inside of a JavaScript object. – Fire Bolt Feb 15 '22 at 06:59
  • Welcome to Stack Overflow! Visit the [help], take the [tour] to see what and [ask]. Please first ***>>>[Search for related topics on SO](https://www.google.com/search?q=javascript+add+to+nested+array+site%3Astackoverflow.com)<<]`](https://meta.stackoverflow.com/questions/358992/ive-been-told-to-create-a-runnable-example-with-stack-snippets-how-do-i-do) snippet editor. – mplungjan Feb 15 '22 at 07:15

1 Answers1

-1

var data = [{
  Name: "Ishan",
  Code: 1,
  Is_Intern: "Yes",
  DateOfJoining: "01/02/2022",
  Skills: ["VB, DOT.NET, Angular"],
  Status: "Working"
}]
data[0].Skills.push("New Skill");
console.log(data);
mplungjan
  • 155,085
  • 27
  • 166
  • 222
Jagadeesh
  • 1,607
  • 5
  • 23
  • 42