-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
  • 169,008
  • 28
  • 173
  • 236
Fire Bolt
  • 7
  • 2
  • 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)<<<*** and if you get stuck, post a [mcve] of your attempt, noting input and expected output using the [`[<>]`](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
  • 169,008
  • 28
  • 173
  • 236
Jagadeesh
  • 1,967
  • 8
  • 24
  • 47