Generate Beautiful code snapshots in no Time


function shuffleObjValues() {

    let randomObj = {};

    let valuesArray = Object.values(obj[0].answers);

    function populateObject(key) {
        let randomIndex = Math.floor(Math.random() * valuesArray.length);
        let randomValue = valuesArray[randomIndex];
        randomObj[key] = randomValue;
        valuesArray.splice(randomIndex, 1);
    }

    Object.keys(obj[0].answers).forEach((key) => {
        populateObject(key);
    });
}

Settings

64