Jalan Technologies Assignment

mail@pastecode.io avatar
unknown
javascript
2 years ago
187 B
2
Indexable
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;
}