JSFiddle - React, Tailwind, and code Playground

by MuLtDirectX

JavaScript

let a = [3, 10, 19, 2, 5, 1, 45, 4, 9]
let temp = 0

for (let i = 0; i < a.length; i++) {
	for (let j = 0; j < a.length; j++){
  	if (a[i]%2) {
    	if(a[j]%2 && a[j]>a[i]) {
      	temp = a[j]
        a[j] = a[i]
        a[i] = temp
      }
    }
  }
}

console.log(a)