function isTwoS(input){ var result = input&(input-1); console.log(result===0); } isTwoS(8); 使用按位与进行判断。