Answer the question
In order to leave comments, you need to log in
Validating js object values, how to write better?
Good afternoon! Please tell me how to write better.
From the code, you can understand what it should do.
You need to check the value of the objects in the array and if they match, write the value to the variable.
At the moment it works, but somehow not correctly.
list.map((item, i, arr) => {
let park;
if(typeof arr[i + 1] !== 'undefined') {
if(arr[i].ln === arr[i + 1].ln) {
park= true;
} else{
park= false;
}
}
})
Answer the question
In order to leave comments, you need to log in
I'm not sure that I helped you, because I didn't really understand the essence of the task, but:
https://codepen.io/anon/pen/jgMeKg
Either this
Either use flexbox as shown by Kirill Udaltsov
Or use css-grid
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question