DEV Community

sah-shah7
sah-shah7

Posted on

1

Array of Objects-Part 1

Very much like a normal array, but it’s like inception [ {object inside object(array) } ]

You may wonder , what is an array?

Alt Text

An array is a data structure which can store multiple items and that item can be accessed by using the index number!

Let’s start with creating an array!

Now that we know the syntax of creating a new array , let’s try creating a javascript object ,which is also called JSON.

Javascript Object notation is used to represent the data in a structured format based on Javascript object syntax.
Alt Text

Now that we know how to create JSON and access its data, Next step would be to implement this idea where we combine arrays and json together!

Let’s modify the array and re-write it with json objects inside it.

Alt Text
Here there are 5 objects inside the array. If we want to access the object containing Java, we use the index number 1 as we use in an array. Next we have stored the whole object inside a variable object. Moving on, to access the value from the key “ Java” , the syntax is given on line 9. To access the key of an object, we can use the inbuilt method as shown in line 13.

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

Top comments (0)

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay