Last active
August 29, 2015 14:01
-
-
Save jennschiffer/b544f8670f0d4b4863b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jortSort = function( array ) { | |
// sort the array | |
var originalArray = array.slice(0); | |
array.sort( function(a,b){return a - b} ); | |
// compare to see if it was originally sorted | |
for (var i = 0; i < originalArray.length; ++i) { | |
if (originalArray[i] !== array[i]) return false; | |
} | |
return true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't get the
<
. :-(