The code directly translates to JS with the removal of the (int) typecast and the replacement of int with let/var/const.
let tx = (texWidth * (floorX - cellX)) & (texWidth - 1);
color = (color >> 1) & 8355711; // make a bit darker
& is the bitwise and, >> is the bitshift right, explained well here.
solved “&” and “>>” number operator in C++?