Implement the function getBit(n, pos)
.
It should return the value of the bit found on position pos
of the number n
.
The position of the rightmost bit is 0
.
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
functions.js
export const getBit = (n, pos) => {
return 0;
}
solution.js
import { getBit } from './functions.js';
console.log(getBit(15, 1)); // 1
console.log(getBit(10, 2)); // 0
console.log(getBit(25, 3)); // 1