{"size": 378, "ext": "js", "max_stars_repo_path": "Javascript Advanced/JS Advanced/Exercise-2-Arrays-And-Nested-Arrays/04.RotateArray.js", "max_stars_repo_name": "HNochev/SoftUni-CSharp-Software-Engineering", "max_stars_repo_stars_event_min_datetime": "2022-03-20T13:30:55.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:30:55.000Z", "max_issues_repo_path": "Javascript Advanced/JS Advanced/Exercise-2-Arrays-And-Nested-Arrays/04.RotateArray.js", "max_issues_repo_name": "HNochev/SoftUni-CSharp-Software-Engineering", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Javascript Advanced/JS Advanced/Exercise-2-Arrays-And-Nested-Arrays/04.RotateArray.js", "max_forks_repo_name": "HNochev/SoftUni-CSharp-Software-Engineering", "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": 15.75, "max_line_length": 57, "alphanum_fraction": 0.5211640212}
function solve(array, rotations) {
    let realRotations = Number(rotations) % array.length;

    for (let i = 0; i < realRotations; i++) {
        let lastElement = array.pop();
        array.unshift(lastElement);
    }

    console.log(array.join(' '));
}

solve(['1',
    '2',
    '3',
    '4'],
    2
);

solve(['Banana',
    'Orange',
    'Coconut',
    'Apple'],
    15
);