Skip to content
Advertisement

Tag: arrays

What does it mean by “second += arr[i][arr.length-i-1]”

I been practicing my algorithm solving skill by solving HackerRank problems. However, one of the problems is giving me a difficult time to understand. It is about calculating absolute difference between sum of diagonals in a square matrix “arr”. If the square matrix is like this: and the solution is like this: So, I came up with this solution: However,

Getting array of school values from all objects using JS

Hello I am new to the JavaScript language. I have a table1.data property that’s an array of objects with data about a school like: Can I perhaps get an array of the telephone values from all the objects using JS? Please help. Answer All you need to do it traverse the items in the data, while grabbing the telephone field

How to extract all arrays in json object

I have a json object which has a collection of countries. Each country can have multiple regions which are represented in an array. I want to get the regions only and put all regions into one list.However when I map the data it doesn’t put all the regions in a list. What am I missing here? Here is the call

How to list multi level Sub-categories under their Categories if all the catgories are in the same array of objects?

I’m working on dropdown menu of categories with sub-categories, and some sub-categories has sub-categories too. i have array of categories with parent_id property which comes from server and i want to create another array with my custom structure in client side. parent_id : null is for main category. Categories array coming from server My expecting result My code this code

Advertisement