Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Created June 16, 2013 16:35
Show Gist options
  • Select an option

  • Save hughfdjackson/5792578 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/5792578 to your computer and use it in GitHub Desktop.
var isInOrder = function(){
var args = Array.prototype.slice.call(arguments)
for ( var i = 0, len = args.length; i < len - 1; i += 1) if ( args[i] > args[i + 1] ) return false
return true
}
var identity = function(a){ return a }
var f = identity
isInOrder(1, f(2), 2) //= true
isInOrder(1, f(2), 3) //= true
isInOrder(1, f(-2), 3) //= false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment