JavaScript implementation of Battleship