New battle programming template in JavaScript