exports.handler = function(context, event, callback) { let x = Math.floor(Math.random() * (9 - 1) + 1); let y = Math.floor(Math.random() * (9 - 1) + 1); const operators = ['+', '*', '-', '/']; function randomOperator(operators) { return operators[Math.floor(Math.random() * operators.length)]; } let o = randomOperator(operators); let z = eval(x + o + y); // console.log(x + " " + o + " " + y); // console.log("z = " + z); // console.log("o = " + o); let response = {o:o, x:x, y:y, z:z} callback(null, response); };