Update tableBam.js

eliminate global variables