С версией JavaScript 1.6 это так же просто:
Array.prototype.equals = function( array ) {
return this.length == array.length &&
this.every( function(this_i,i) { return this_i == array[i] } )
}
Например, [].equals([])
дает true
, а [1,2,3].equals( [1,3,2] )
дает false
.
Модуль sched может сделать это:
import sched, time
schedTimer = sched.scheduler(time.time, time.sleep)
def increaseX(x):
x += 1
print('X increased to ' + str(x))
schedTimer.enter(2, 1, increaseX, (x,))
schedTimer.enter(2, 1, increaseX, (3,))
schedTimer.run()