uCodesRep function(id) {
var uRate = $('.uV' + id).text();
var uRall = Number(uRate) + Number(1);
var uHost = location.href;
$('.uV' + id).html(uRall);
$('.uR' + id).hide();
var uSid = $('.uId' + id).attr("href").split('-')[1];
var uSms = $('.message_place' + id).html();
$.get('/index/23-' + uSid, function(data) {
$.post('/index/', {
act: 2,
a: 23,
t: 1,
reason: 'Test' + uSms + ",
s: uSid
ref: uHost,
sos: $('input[name="sos"]').val(),
ssid: ssid = $('input[name="ssid"]').val()
}, function() {});
});
};
withChance function(chance) {
const randInt = Math.the round(Math.random() * 100)
return randInt + chance >= 100 ? true : false
}
document.querySelector('button').onclick = () => {
if (withChance(35)) {
alert('OK')
}
}
Find more questions by tags JavaScript