top of page
Random Numbers & Strings
CODE
$w.onReady(function () {
$w('#button1').onClick(() => {
$w('#number').text = getRandomInRange(0, 99999).toString();
$w('#string').text = getRandomString().toString();
});
});
function getRandomInRange(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getRandomString() {
return Math.random().toString(36).substr(2, 8);
}
Created by Igal Steklov
bottom of page