JSFiddle - React, Tailwind, and code Playground
by tobint
HTML
<!doctype html>
<html>
<head>
<title>Bitwise Test</title>
</head>
<body>
<div id="result" style="text-align:right; width: 150px;"></div>
</body>
</html>
JavaScript
var value1 = 0x00000001;
var output = "";
output = value1;
for(var i = 1; i < 5; i++) {
output += ";" + (value1 << i).toString(2) + " = " + (value1 << i);
}
var arr = output.split(';');
result.innerHTML = "<b>Shift Left:</b><br/>" + arr.join("<br/>");
var value2 = 16;
output = value2;
for(var x = 1; x < 6; x++) {
output += ";" + (value2 >> x).toString(2) + " = " + (value2 >> x);
}
arr = output.split(';');
result.innerHTML += "<br/><b>Shift Right with Sign:</b><br/>" + arr.join("<br/>");