Can we compare two arrays?

like the tiles said I wanted to know if this possible to comparre two arrays in JS ? 

like I have those two function : 

Game_Clock.prototype.get_time = function() { this.current_time.push(this.hour,this.min,this.sec); return this.current_time;};Game_Clock.prototype.time_condition = function(argum_hour,argum_min,argum_sec) { this._condition.push(argum_hour,argum_min,argum_sec); return this._condition;};both of them are array

so I wanted to do this

if(get_time() <= time_condition(10,10,10)){//do stuff}but Hudell told me he wasn't not sure if this was possible to do that but in a ways...it's would be logic to being able to do that since it's compare the values in order no?
The simplest way to compare two arrays can be done as such:

var a1 = [1,2,3]var a2 = [1,2,3]var a1String = a1.toString() // "1,2,3"var a2String = a2.toString() // "1,2,3"a1String == a2String // trueYou could also write:

function arraysAreIdentical(arr1, arr2){ if (arr1.length !== arr2.length) return false; for (var i = 0, len = arr1.length; i < len; i++){ if (arr1 !== arr2){ return false; } } return true; }Personally I would use underscores http://underscorejs.org/#difference difference method and do something like if _.difference(...).length > 0 ... else ...
Since it seems you want to compare dates, you should probably use the Date class for this: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date
Sure 🙂

I can provide you with the basics - I don't know the syntax fully yet and this won't work as is, but the for statement will work here.

for the following:

Game_Clock.prototype.get_time = function() {
    this.current_time.push(this.hour,this.min,this.sec);
    return this.current_time;
};

Game_Clock.prototype.time_condition = function(argum_hour,argum_min,argum_sec) {
    this._condition.push(argum_hour,argum_min,argum_sec);
    return this._condition;
};

if the hour is the same, then if the minute is the same, then if the seconds are the same, then run the return statement.

You will have to foreach loop for each one though.
Humm I see but in a ways the ways you show this will be tricky but I will think about this could be a good ways for input this

@lavra : 

I love this method! though it's more for a Fictionnal clock than a true since I want people to permit to edit it likes they wants :c...

but when I think could doing this is possible? 

foo.prototype.method_name = function(){return this.variable1,this.variable2,this.variable3;}if this actually possible to do that it's would get the values and compare them 
I meant that you couldn't compare two arrays to see if one was smaller than the other like that.

What I did on my time system was to simply convert my "hours, minutes and seconds" variable in a "total number of seconds",
so instead of " 3 hours, 20 minutes and 35 seconds", I stored it as "12,035" seconds. That variable can easily be compared to other similar variables. Then you just need to two methods to convert the values between one format and the other.
Since it seems you want to compare dates, you should probably use the Date class for this: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date
The OP stated it returns and array don't compare what the functions signature states it doesn't return 😛
Have a look at this: http://stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript

The same prototype function is used in RMMV, try it in the demo game.

[1,2,3].equals([1,2,3]);// trueThe .toString() function might also work, but thinking of 12/24 h. it could be wrong.
I see! it's a good methods I never saw this  but huddell showed me a really good ways and even more pro efficient!
Have a look at this: http://stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript

The same prototype function is used in RMMV, try it in the demo game.

[1,2,3].equals([1,2,3]);// trueThe .toString() function might also work, but thinking of 12/24 h. it could be wrong.

I don't like there equals solution it looks like a mess. I would probably just use something like underscore or even convert them to strings and then compare the strings with tripple equals.

then again I might also be crazy.

Original thread: https://forums.rpgmakerweb.com/threads/can-we-compare-two-arrays.46020/