JSFiddle - React, Tailwind, and code Playground
by MuLtDirectX
JavaScript
let a = [3, 19, 2, 5, 17, 45, 4, 9, 1, 100, 23]
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)