[JS]refine beer code