shallowCompareArrays

How to get shallowCompareArrays

import { shallowCompareArrays } from 'fds/system';

Type: Function

Shallowly compares the values of two arrays with each other.

Note that this utility should only be used for simple comparison usages. When comparing entries with prototypes like objects, dates or arrays, it's important to know that JavaScript compares these by reference. Even though two objects have the exact same properties and values, if they're both created at a different point in the code they won't point to the same location in memory. In these cases you might need to do a manual deep comparison.

Arguments

# Name Type Description
1. array1

Array to compare to "array2".

2. array2

Array to compare to "array1".

Returns

Type: Boolean

Whether or not the arrays shallowly differ from each other. Returns true if the arrays are different, returns false if they're the same.

Was this page helpful?