Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
</body>
</html>
 
var my_array = ["A", "B", "C", "10", "D", "E", "F", "8", "G", "H", "I",  "J", "K", "L", "M", "N", "O", "P", "R", "S", "T", "V", "W", "Д", "Ё", "К", "М", "О", "П", "С", "Т", "Ч", "1", "U"];
my_array.sort(function my_sort(a,b) {
  var first_int = parseInt(a, 10);
  var second_int = parseInt(b, 10);
  
  if (isNaN(first_int) && isNaN(second_int)) {
    var strOne = a.toLocaleLowerCase();
    var strTwo = b.toLocaleLowerCase();
    return strOne.localeCompare(strTwo);
  } else if (isNaN(first_int)) {
    return 1;
  } else if (isNaN(second_int)) {
    return -1;
  } else {
    return a - b;
  }
});
console.log(my_array);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers