• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

206
Views
este código devolverá verdadero si el elemento existe en la matriz, pero debería ser verdadero cuando el elemento se duplicó

 const arr = [12, 12, 10, 11]; function repeatedItem(i) { if (arr.indexOf(i) !== -1) return true; else return false } console.log(repeatedItem(10));
este código devolverá verdadero si el elemento existe en la matriz, pero debería ser verdadero cuando el elemento se duplicó

qué debe hacer para devolver verdadero si el artículo fue duplicado

almost 3 years ago · Santiago Trujillo
1 answers
Answer question

0

 const arr = [12, 12, 10, 11]; function repeatedItem(item) { let count = 0; for(let i=0;i<arr.length;i++){ if(arr[i] === item){ count++; if(count > 1){ return true; } } } return false; } console.log(repeatedItem(10));

almost 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error