Skip to content

Tag: arrays

The Odin Project – Fundamentals 4 Exercises – sumAll

I am stuck in the sumAll exercise from the Fundamentals 4 portion of the Odin Project. I managed to pass the test in which I need the result to be ‘ERROR’. However, I cannot figure out the correct code to pass the other tests. Where did I go wrong? This is the exercise: My code: Answer I made in this

Why is slice returning an empty array?

I have a set of booleans. Goal: I am trying to change a value based on the index by slicing the old lock array. Issue: If the value is 1, the last part of the array (locks.slice(value + 1)) is returning as empty. Shouldn’t slice returns the selected elements in an array, as a new array object, so it&#82…

How to breakdown an array of objects?

I have an array of objects and i need to classify each object by name and then get the addition of some properties. To be more specific, I have a cart with some orders and i need to breakdown by product name so i can calculate how many items of that product were bought. That is the dummy data, I

Character with longest consecutive repetition

i think i have wirtten the correct code for the problem only one thing and it that i return the first longest sequence how can i alter that to return the last maximum sequence? an example from codewars editor : for input ‘0000000000000011111111111111111222222222222222333333333333334444444444444555555555…