JSFiddle - React, Tailwind, and code Playground
JavaScript
const arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
value = +prompt('Введите число');
if (value && !arr.some(v => v === value)) arr.push(value);
console.log(arr);
const arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
value = +prompt('Введите число');
if (value && !arr.some(v => v === value)) arr.push(value);
console.log(arr);