list sort in javascript code example Example: sorting javascript list list.sort((a, b) => (a.color > b.color) ? 1 : -1)