Загрузка данных


function createZombie(request) {
  const randomInt = (min, max) =>
    Math.floor(Math.random() * (max - min + 1)) + min;

  if (request === 1) {
    return {
      speed: randomInt(10, 15),
      defence: randomInt(5, 10),
      attack: randomInt(10, 15),
      hp: randomInt(100, 200),
      type: 'light'
    };
  } else {
    return {
      speed: randomInt(5, 10),
      defence: randomInt(10, 20),
      attack: randomInt(20, 30),
      hp: randomInt(200, 300),
      type: 'heavy'
    };
  }
}

const zombie1 = createZombie(1);
const zombie2 = createZombie(2);

console.log(zombie1);
console.log(zombie2);