return array of numbers without duplicates javascript code example Example: prevent duplicate entries in javascript array if (array.indexOf(value) === -1) array.push(value);