배열 뒤섞기, 랜덤 소팅

var x = ['1','2','3','4','5','6','7'];

document.write(x.toString());
document.write('<hr />');
x.sort(function() {return 0.5 - Math.random();});
document.write(x.toString());

 

 

결과

1,2,3,4,5,6,7


2,1,4,3,6,7,5

댓글
  • No Nickname
    No Comment
  • 권한이 없습니다.
    {{m_row.m_nick}}
    -
목록형 📅 달력형