const app = function () { const vals = [100, 2, 3, 4, 5, 6, 7, 8, 10, 15, 20, 40, 50, 75, 1, 200]; const page = {}; const game = {}; vals.sort(function (a, b) { return a - b; }) game.offers = [100, 14, 4, 12, 2, 1].filter(function (x) { return x < vals.length; }) game.offers.sort(function (a, b) { return b - a; }) function init() { page.modal1 = document.querySelector('.modal1'); page.modal2 = document.querySelector('.modal2'); page.modalBody = document.querySelector('.modal-body'); page.modalBody2 = document.querySelector('.modal-body2'); page.start = document.querySelector('.start'); page.start.addEventListener('click', startGame); page.con = document.querySelector('.gameArea'); page.main = document.querySelector('.main'); page.leftSide = document.querySelector('.leftSide'); page.rightSide = document.querySelector('.rightSide'); game.inPlay = false; document.querySelector('.close').addEventListener('click', closePopUp); window.onclick = function (e) { if (e.target == page.modal1) { closePopUp(); } } } function closePopUp() { page.modal1.style.display = 'none'; ///add offer logic } function startGame() { console.log('game started'); page.start.style.display = 'none'; buildGameBoard(); game.lastOffer = false; game.inPlay = true; game.offerMade = 0; popUp('