Skip to content
Advertisement

Distribute array row data to make multiple new rows

I have below the data

JavaScript

I want to create a new array from above as below

JavaScript

I have tried the below code

JavaScript

But it only has one set of data, how can I append all data? Or any improved code to solve this?

Advertisement

Answer

your code was actually replacing a key => value pair data, not pushing a data into $cars, you can fix it like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement