mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-04-02 00:03:04 -04:00
fix error with shuffleArray function
This commit is contained in:
parent
04166ab423
commit
3d6a95e84b
1 changed files with 7 additions and 3 deletions
|
@ -110,12 +110,16 @@ var Splash = injectIntl(React.createClass({
|
|||
if (!err) this.setState({featuredCustom: body});
|
||||
}.bind(this));
|
||||
},
|
||||
shuffleArray: function (array) {
|
||||
shuffleArray: function (arr) {
|
||||
var i, j = 0;
|
||||
var temp = null;
|
||||
var tempArray = array.slice(0);
|
||||
if (arr) {
|
||||
var tempArray = arr.slice(0);
|
||||
} else {
|
||||
return arr;
|
||||
}
|
||||
|
||||
for (i = array.length - 1; i > 0; i -= 1) {
|
||||
for (i = arr.length - 1; i > 0; i -= 1) {
|
||||
j = Math.floor(Math.random() * (i + 1));
|
||||
temp = tempArray[i];
|
||||
tempArray[i] = tempArray[j];
|
||||
|
|
Loading…
Add table
Reference in a new issue