how to avoid pushuing repeated values in an array j code example Example: prevent duplicate entries in javascript array if (array.indexOf(value) === -1) array.push(value);