javascript are arrays equal

var a1 = [1,false,2,3,"dude"];
var a2 = [1,false,2,3,"dude"];

//check if arrays are equal
if(JSON.stringify(a1) === JSON.stringify(a2)){
    //arrays are equal
}