Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
187 B
1
Indexable
Never
function shuffle(arr){
	arr.sort((a,b) => a - b);
	for(let i = 1; i < arr.length - 1; i += 2){
		const temp = arr[i];
		arr[i] = arr[i + 1];
		arr[i + 1] = temp;
	}
	return arr;
}