var x = 256; var y = Math.log(x)/Math.log(2); var z = Math.floor(y); if ((y-z)===0){ console.log("YES") }else{ console.log("NO") }