Skip to content

compute neq

kgryte edited this page May 12, 2015 · 1 revision

Computes an element-wise comparison (not equal) of an array, where x may either be an array of equal length or a single value (of any type).

The function returns an array with length equal to that of the input array. Each output array element is either 0 or 1. A value of 1 means that an element is not equal to a compared value and 0 means that an element is equal to a compared value.

var data = [ 2, 4, 2, 7, 3 ],
	out;

out = compute.neq( data, 3 );
// returns [ 1, 1, 1, 1, 0 ]

out = compute.neq( data, [ 3, 4, 1, 7, 4 ] );
// returns [ 1, 0, 1, 0, 1 ]

For function options, see compute-neq.

Clone this wiki locally