const arr = ["monday","tuesday","thursday","wednesday",
"friday","saturday","sunday"];
let newArr = [];
var num = prompt('Enter number :');
for (var i = 0; i < num; i++) {
var day = prompt('Enter day :');
if(newArr.includes(day) !== day) newArr.push(day);
}
var num = prompt('Enter number :');
for (var i = 0; i < num; i++) {
var day = prompt('Enter day :');
if(newArr.includes(day) != day) newArr.push(day);
}
console.log(7 - (newArr.length));
i only want to know if() part if we entered a repetitive day like friday twice push it once into the newArr for example 1 | friday & 1 | friday ---- > 6
If you wish to check the entered day is present in the array, and if no, push the element to newArr, change your if condition to:
if(!newArr.includes(day))
{
...
}