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 readOnly = userPermissions & ~flags.WRITE;
const toggled = userPermissions ^ flags.EXECUTE;
const shifted = (flags.DELETE << 2) | (flags.READ >> 0);
console.log(canDelete, readOnly, toggled, shifted); Post #3362
2.56K
CHALLENGE
- ❤ 3
- 👍 2
- 🔥 1