JSFiddle - React, Tailwind, and code Playground
by Avizura
JavaScript
function generateObject() {
const titles = ["Большая уютная квартира", "Маленькая неуютная квартира", "Огромный прекрасный дворец", "Маленький ужасный дворец", "Красивый гостевой домик", "Некрасивый негостеприимный домик", "Уютное бунгало далеко от моря", "Неуютное бунгало по колено в воде"];
const types = ['flat', 'house', 'bungalo'];
const checkins = ['12:00', '13:00', '14:00'];
const author = {};
author.avatar = 'img/avatars/user/0' + Math.round(Math.random() * 8);
const location = {};
location.x = Math.round(Math.random() * (900 - 300) + 300);
location.y = Math.round(Math.random() * (500 - 100) + 100);
const offer = {};
offer.title = titles[Math.round(Math.random() * 8)];
offer.address = location.x + ' ' + location.y;
offer.price = Math.round(Math.random() * (1000000 - 1000) + 1000);
offer.type = types[Math.round(Math.random() * 3)];
offer.rooms = Math.round(Math.random() * (5 - 1) + 1);
offer.guests = Math.round(Math.random() * (10 - 1) + 1);
offer.checkin = checkins[Math.round(Math.random() * 3)];
offer.features = ''; //переделать
offer.description = '';
offer.photos = [];
return {author, offer, location};
}