Skip to content

Tag: object

Getting array of school values from all objects using JS

Hello I am new to the JavaScript language. I have a 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

Get a specific object from an array of objects [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month. Improve this question Here is the sample input How to get an output that would be like Thank you in advance Answer You could use .reduce() like so:

Looping through and reducing nested array

I can’t seem to get my head around the array.reduce() function. I’ve got the following array: and I’m trying to get a result like below. I’m not sure how to go about multiplying the ingredient amounts with the item quantities: I’ve tried following the structure that was given here but the arrow function is throwing me off. Any sort of

Merge 2 arrays of object based on specific object key

I have 2 arrays which is contains same id with different value (inside selected) My goal is to merge both become 1 array. When I use spread operator like this: It comes the data being override First array Second array How can I make both of arrays become 1 ? the expected result: What am I doing wrong in the

how javascript handles variables in objects?

I have a question about declaring a variable in an object. Assuming that global or window is also an object, why is it not possible to declare a variable using let in an object that is a child of the window object? I do not understand that. Thanks for the answer and sorry for the English but I hope you