hasSameValues
Test if two arrays have the same values.
Usage
var hasSameValues = require( '@stdlib/array/base/assert/has-same-values' );
hasSameValues( x, y )
Tests if two arrays have the same values.
var x = [ 0, 0, 1, 0 ];
var y = [ 0, 0, 1, 0 ];
var bool = hasSameValues( x, y );
// returns true
Notes
- If provided arrays of unequal length, the function returns
false
. - The function does not skip
undefined
elements and is thus not optimized for sparse arrays.
Examples
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var Complex128Array = require( '@stdlib/array/complex128' );
var hasSameValues = require( '@stdlib/array/base/assert/has-same-values' );
var buf = discreteUniform( 10, 0, 10 );
// returns <Float64Array>
var x = new Complex128Array( buf );
// returns <Complex128Array>
var y = new Complex128Array( buf );
// returns <Complex128Array>
var out = hasSameValues( x, y );
// returns true