Skip to content

Instantly share code, notes, and snippets.

View godrix's full-sized avatar
💻
trying to take over the world

Godri.dev godrix

💻
trying to take over the world
View GitHub Profile
@godrix
godrix / lottery.js
Last active November 21, 2019 13:21
const lottery = (amount = 15, maximumNumber = 25) => {
const numbersDrawn = []
let amoutNumbersDrawn = 0
const raffle = {
getRandomNumber : (max) => {
return (Math.floor(Math.random() * max) + 1)
},
checkRepeatedNumber : (number) => {
const alreadyDrawn = numbersDrawn.find(findNumber => findNumber === number)
var ls = window.localStorage;
var array_ls = [];
for(x in ls){
array_ls.push(x);
console.log(x);
}
for(i=0;i<6;i++){
array_ls.pop();
//Forçando navagador a usar o https
console.log(window.location.href);
var protocol = window.location.href;
if (protocol.match(/http:/)){
var newUrl = protocol.replace("http://","https://");
window.location = newUrl;
}else{
console.log('Protocolo seguro');
}