const fs = require('fs');
const genders = ['male', 'female'];
const maleNames = ['Adrian', 'Rafał', 'Michał', 'Sebastian'];
const femaleNames = ['Aleksandra', 'Magdalena', 'Klaudia', 'Oliwia'];
const lastNames = ['Nowak', 'Kowalski', 'Szymański', 'Lewandowski'];
function randChoice(arr){
return Math.random(arr);
}
const people = [];
for (let i=0; i<20; i++) {
function Person(gender, firstName, lastName, age) {
this.gender = gender;
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
let person = new Person(gender, firstName, lastName, age);
const gender = randChoice(genders);
const firstName = function(name){
if (gender = 'male'){
return randChoice(maleNames);
}
else {
return randChoice(femaleNames);
}
}
const lastName = Math.random(lastNames);
const age = function getRandomInt(min, max) {
min = Math.ceil(0);
max = Math.floor(100);
return Math.floor(Math.random() * (max - min)) + min;
}
return people.push(person);
}
console.log('People', people);
I try create 20 random person and add to people, but when i open console and type ‘node app.js’ I see nothing. Where do i go wrong. Why i can’t generate 20 person in people?