{"size": 634, "ext": "js", "max_stars_repo_path": "09/js/main.js", "max_stars_repo_name": "theand-exercises/mail-programming-quiz", "max_stars_repo_stars_event_min_datetime": "2018-03-19T11:44:08.000Z", "max_stars_repo_stars_event_max_datetime": "2018-03-19T11:44:08.000Z", "max_issues_repo_path": "09/js/main.js", "max_issues_repo_name": "theand-exercises/mail-programming-quiz", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "09/js/main.js", "max_forks_repo_name": "theand-exercises/mail-programming-quiz", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.4814814815, "max_line_length": 84, "alphanum_fraction": 0.5567823344}
//0. common

const moveZerosToRight = (list) => {
    let count = list.reduce((count, current) => count + (current === 0 ? 1 : 0), 0);
    list = list.filter(Boolean);
    return list.concat(Array(count).fill(0));
};


Array.prototype.swap = function (x, y) {
    const b = this[x];
    this[x] = this[y];
    this[y] = b;
    return this;
};

const moveZerosToRightUsingSwap = (list) => {
    let lastPositionOfZero = 0;
    for (let i = 0; i < list.length; i++) {
        if (list[i] !== 0) {
            list.swap(lastPositionOfZero, i);
            lastPositionOfZero = lastPositionOfZero + 1;
        }
    }
    return list;
};
