[Solved] Formula to find week numbers from the Total [closed]
You could take a bitwise AND & with the day value and take this day. const days = { Monday: 1, Tuesday: 2, Wednesday: 4, Thursday: 8, Friday: 16, Saturday: 32, Sunday: 64 }, getDays = value => Object.keys(days).filter(day => value & days[day]); console.log(getDays(127)); // All Days console.log(getDays(80)); // Friday, Sunday console.log(getDays(7)); // Monday, Tuesday, … Read more