Wierd bitwise example
by alex_o
JavaScript
let str = "keep it short, simple!";
if (~str.indexOf("simple")) {
alert( 'found!' );
}
let res = 3 << 3; // instead of 3 * Math.pow(2,3) = 24
if((res & 0x1) == 0){
alert("even!");
}
by alex_o
let str = "keep it short, simple!";
if (~str.indexOf("simple")) {
alert( 'found!' );
}
let res = 3 << 3; // instead of 3 * Math.pow(2,3) = 24
if((res & 0x1) == 0){
alert("even!");
}