SOURCE

console 命令行工具 X clear

                    
>
console
function shuffleSkin(arr) {
    for (var i = arr.length - 1; i >= 0; i--) {
        var index = Math.floor(Math.random() * (i + 1));
        arr[i] = arr.splice(index, 1, arr[i])[0];
    }
    return arr;
}

function getSkinArr () {
  var userId = 'xxxx';
  var arr = [{skin: 0}, {skin: 1}, {skin: 2}, {skin: 3}, {skin: 4}, {skin: 5}, {skin: 6}, {skin: 7}, {skin: 8}, {skin: 9}];
  var skin = [];

  if (localStorage.getItem('userId') === userId) {
      skin = JSON.parse(localStorage.getItem('skin'));
    	console.log(skin)
  } else {
      localStorage.setItem('userId', userId);
      skin = shuffleSkin(arr);
      localStorage.setItem('skin', JSON.stringify(shuffleSkin(arr)));
  }
}

getSkinArr();