Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
// sorting trial 1
var a = [];
var item, i, j, k;
for (i=0; i<20; i++) {
  item = Math.floor(Math.random() * 100 + 1);  
  a.push(item);
}
console.log(a);
var f_item;
for (j=0; j<19; j++) {
  for (k=j+1; k < 20; k++) {
    if(a[j] < a[k]) {
      //
    } else if (a[j] >= a[k]) {
      f_item = a[k];
      a[k] = a[j];
      a[j] = f_item;
    }
    
  }
}
console.log(a);
Output

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

Dismiss x
public
Bin info
vamshisurampro
0viewers