javascript for beam