function getQueryParams() {
    let query = window.location.search.substring(1);
    let key_values = query.split("&");
    let params = {};
    key_values.map(key_val => {
        console.log(key_val);
        let key_val_arr = key_val.split("=");
        params[key_val_arr[0]] = key_val_arr[1];
    });
    return params;
}

function getQueryParam(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) { return pair[1]; }
    }
    return (false);
}

function getArrRange(start, stop, step = 1) {
    var arr = [];
    for (var i = start; i <= stop; i = i + step) {
        arr.push(i);
    }
    return arr;
}

function sumArr(arr) {
    let sum = 0;
    for (i=0; i<arr.length; i++) {
        sum += parseFloat(arr[i]);
    }
    return sum;
}

function sleep(time) {
    return new Promise((resolve) => setTimeout(resolve, time));
}
