Bootstrap

js随机生成0-10的数,且相邻两个数不一样

let oldIndex,newIndex;
//随机出现选中
function randomNum() {
     newIndex = Math.floor(Math.random() * 11);
         if (newIndex === oldIndex) {
               return randomNum()
          } else {
               oldIndex = newIndex;
               return newIndex;
          }
   }


;