A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript 🚀 Don't miss our Quizzes!
Let's chat: @nairihar
Post #3245
2.69K
CHALLENGE
const flags = {
READ: 0b0001,
WRITE: 0b0010,
EXECUTE: 0b0100,
DELETE: 0b1000,
};
const userPermissions = flags.READ | flags.WRITE | flags.EXECUTE;
const adminPermissions = userPermissions | flags.DELETE;
const canDelete = (adminPermissions & flags.DELETE) !== 0;
const canExecute = (userPermissions & flags.EXECUTE) !== 0;
const readOnly = userPermissions ^ flags.WRITE;
console.log(canDelete, canExecute, readOnly, adminPermissions >> 1);
- ❤ 2
- 👍 2
- 🔥 1






