Skip to content

Instantly share code, notes, and snippets.

@vamshisuram
Created December 27, 2014 14:09
Show Gist options
  • Select an option

  • Save vamshisuram/da56fcb0b644e978f763 to your computer and use it in GitHub Desktop.

Select an option

Save vamshisuram/da56fcb0b644e978f763 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
// 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);
</script>
<script id="jsbin-source-html" type="text/html"><!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></script>
<script id="jsbin-source-javascript" type="text/javascript">// 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);</script></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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment