The real speed in bitboards is created by precomputing the bitboards for every instance.  This means that you already have the attacked squares for a rook on d4 and every other piece on every square.  Even faster is to use magic bitboards, but that is too complicated for a forum.  Although both are written in c, I suggest Crafty to understand bitboards better, and Stockfish for magic bitboards.

An alternative which is easier to understand with just a modest speed hit, I suggest a system described here.
https://chess.stackexchange.com/questions/28229/chess-move-generation-with-bit-boards-in-javascript/28242#28242  (In c, I timed the move generation in a 32,000 loop and it took only 32 ms.  In Javascript it will be much slower, but it should be efficient enough.)