You're right. I have found it is exactly easy to understand the ternaries because the priority level is default satisfying what I want it to be. But One loop two arrays I don't agree. I code the following code and it is more elegant:
One loop two arrays
const validTrolley = result.filter(item => item.inventoryCount && item.putShelvesFlg) const invalidTrolley = result.filter(item => !(item.inventoryCount && item.putShelvesFlg)).map((item, index) => { item.isInvalid = !index; return item; })
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You're right. I have found it is exactly easy to understand the ternaries because the priority level is default satisfying what I want it to be. But
One loop two arrays
I don't agree. I code the following code and it is more elegant: