Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
i want to see if there is no repetitive day insert it into newArr that is the case (only if() part)

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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))
{
  ...
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!