Task: Sort Array of Objects by Boolean Property in JavaScript
Task: Sort Array of Objects by Boolean Property in JavaScript: a task in Terminal-Lego-15k (Harbor dataset). You need to implement a JavaScript solution that correctly sorts an array of objects by a boolean property. The standard comparison approach using !a && b does not work correctly for…
The task
You need to implement a JavaScript solution that correctly sorts an array of objects by a boolean property. The standard comparison approach using `!a && b` does not work correctly for sorting booleans because the sort comparator function expects a numeric return value (-1, 0, or 1), not a boolean.
Part of PrimeIntellect/Terminal-Lego-15k.