JSFiddle - React, Tailwind, and code Playground
by juErik
HTML
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<div></div>
JavaScript
var arr = new Array('eins', 'zwei', 'drei', 'vier');
/* arr.shuffle() würfelt das Array durcheinander */
function arrayShuffle() {
var tmp, rand;
for (var i = 0; i < this.length; i++) {
rand = Math.floor(Math.random() * this.length);
tmp = this[i];
this[i] = this[rand];
this[rand] = tmp;
}
}
Array.prototype.shuffle = arrayShuffle;
// --------------------------------------------------
for (i = 0;i < arr.length;i++){
$('div').append(arr[i]+'<br />');
}
$('div').append('<hr />');
arr.shuffle();
for (i = 0;i < arr.length;i++){
$('div').append(arr[i]+'<br />');
}