Skip to content

Tag: object

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

Looping over an object to change values inside

I am trying to send an object to an api and my object contains arrays that I want to turn into strings. However I am having trouble returning the new object with the arrays turned to strings. My goal is to have a copy of the original object with all the arrays turned into strings. Answer You are not assigning

js: fill object with array elements using reduce()

trying to learn reduce() but can’t understand it well yet. Maybe someone from you could help me with my problem. I have an object with defined keys and an array. I would like to fill up the objects keys with the arrays values using reduce(). My sandbox LINK Till now I tried something like this: expected…