fix error with shuffleArray function

This commit is contained in:
Connor Hudson 2016-06-09 17:33:49 -04:00
parent 04166ab423
commit 3d6a95e84b

View file

@ -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];