Skip to content

Tag: object

Export some properties from the nested object

Let’s say there is an object that looks like this: Now I would like to export some of the nested values so that it can be used in various files across the app (exporting the entire object is not an option). What we could do is manually create all the required variables and export them like this: The pro…

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 th…

JavaScript: get values data from Destructuring of objects

I have this data set: I take the translations out of it like this: But I would like to convert this received result in translations into such a result: So far I have achieved this effect through such a petticoat, but I am convinced that it can be done better. Answer This solution uses Array.reduce() to implem…