isEqualArray

Test if two arguments are both generic arrays and have equal values.

Usage

var isEqualArray = require( '@stdlib/assert/is-equal-array' );

isEqualArray( v1, v2 )

Tests if two arguments are both generic arrays and have equal values.

var x = [ 1.0, 2.0 ];
var y = [ 1.0, 2.0 ];
var bool = isEqualArray( x, y );
// returns true

bool = isEqualArray( x, [ -1.0, 2.0 ] );
// returns false

Notes

  • The function performs strict equality comparison; thus, the function treats -0 and +0 as equal and NaNs as distinct.

Examples

var isEqualArray = require( '@stdlib/assert/is-equal-array' );

var x = [ 1.0, 2.0, 3.0 ];
var y = [ 1.0, 2.0, 3.0 ];
var out = isEqualArray( x, y );
// returns true

x = [ -0.0, 0.0, -0.0 ];
y = [ 0.0, -0.0, 0.0 ];
out = isEqualArray( x, y );
// returns true

x = [ NaN, NaN, NaN ];
y = [ NaN, NaN, NaN ];
out = isEqualArray( x, y );
// returns false
Did you find this page helpful?