Skip to content

Tag: arrays

Initialise an object with array properties

How can I initialise an object in JavaScript, the properties of which would be arrays? I want to have an object of this format: My usecase is the following: – When a property does not exist, create this property which should be an array and add a number. – When a property exists already, push the …

How to find biggest number in array around undefined elements?

My question is pretty simple actually but I couldnt find satisfied answer lets say that I have array like above.And I wanna get the max value in array which is 20. this is what I did but returned undefined so I tried something like that below and worked but filtering all undefined elements(iterating all) and …