maybe someone could explain me how to sort an array of Week Days from Monday...
export const WeekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
WeekDays.sort(
(a, b) =>
WeekDays.indexOf(a) - WeekDays.indexOf(b)
);
But the Result is: Wednesday, Monday, Tuesday, Friday, Wednesday... Hope some one can help.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment