JavaScript überprüfen, ob die Nummer eine Leistung von 2 ist
function powerOfTwo(x) {
return Math.log2(x) % 1 === 0;
}
KostasX
function powerOfTwo(x) {
return Math.log2(x) % 1 === 0;
}