JSFiddle - React, Tailwind, and code Playground
by Dan Pasca
JavaScript
var x = [7, 3, '3', 5, '2', 6, 2];
var n = x.length;
//console.log(x.sort());
for (var i = 0; i < n-1; i++) {
for (var j = i + 1; j < n; j++) {
if (typeof x[i] !== "number") {
x[i] = parseInt(x[i]);
}
if (typeof x[j] !== "number") {
x[j] = parseInt(x[j]);
}
if (x[i] > x[j]) {
var aux = x[i];
x[i] = x[j];
x[j] = aux;
}
}
}
console.log(x);