let message = ('Choose a roulette pocket number from 0 to 8');
let atempts = '\nAttempts left: ';
let amountAtempts = 3;
let prize = ('\nTotal prize:');
let totalPrize = 0;
let possiblePrize = ('\non current attempt: ');
let prizes = [25, 50, 100];
if (confirm('Do you want to play a game?')) {
while (--amountAtempts >= 0) {
let random = Math.floor(Math.random() * 8) + 1;
if (random == prompt(message + atempts + (amountAtempts + 1) + prize + totalPrize + possiblePrize + prizes[amountAtempts])) {
alert("You victory! Your prize " + prizes[amountAtempts]);
break;
} else if (amountAtempts == 0) {
alert("You lose!");
break;
}
}
} else {
alert('You did not become a billionaire, but can.');
}
var result;
$(document).mousemove(function(e) {
var height = e.target.clientHeight,
Y = e.pageY;
result = (height / 2 > Y) ? 1 : 0;
otherPlace();//хотя при таком использовании лучше просто передать как аргумент функции
});
function otherPlace(){
console.log(result)
}
1 2 3 4
22:59:50 10 5 22:59:55
22:59:51 9 4.5(5) 22:59:55
22:59:52 8 4 22:59:56
22:59:53 7 3.5(4) 22:59:57
22:59:54 6 3 22:59:57
22:59:55 5 2.5(3) 22:59:58
22:59:56 4 2 22:59:58
22:59:57 3 1.5(2) 22:59:59
22:59:58 2 1 22:59:59
$secondsInMonth = 60 * 60 * 24 * 30; // количество секунд в периоде оплаты (30 дней)
$paidBefore = strtotime('2021-05-30 23:00:00'); // дата окончания подписки
$now = strtotime('2021-05-30 22:00:00'); // текущее время
$currentTariffPrice = 1500; // цена текущего тарифа (за 30 дней)
$newTariffPrice = 3000;
$paidBefore = strtotime('2021-05-30 23:50:00'); // дата окончания подписки
$now = strtotime('now'); // текущее время
$currentTariffPrice = 1590; // цена текущего тарифа (за 30 дней)
$newTariffPrice = 7990; // цена нового тарифа (за 30 дней)
$newdate= $now + ($currentTariffPrice/$newTariffPrice) * ($paidBefore - $now);//Вся формула
echo date('Y-m-d H:i:s', $newdate);