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

108
Views
Cómo verificar si algunos valores de objetos contienen alguna cadena en una matriz de cadenas en JavaScript

Estoy trabajando en una opción de traducción simple, pero estoy atascado en caso de que tenga títulos duplicados. Cuando los títulos son diferentes, funciona bien, pero cuando tengo duplicados, no los traduce.

Aquí está la función:

 function Translate(language, availableLanguages) { let titles = [...document.getElementsByClassName('translate')] let titlesValues = [] titles.forEach((title) => { titlesValues.push(title.textContent) }) for (let i = 0; i < availableLanguages.length; i++) { const languageObject = availableLanguages[i]; titlesValues.forEach((title) => { if(Object.values(languageObject).includes(title)) { titles[titlesValues.indexOf(title)].textContent = languageObject[language] } }) } }

Aquí están los idiomas entrantes json:

 { "Languages": [ "English", "German" ] }

Aquí está el json de idiomas disponibles:

 [ { "Key": "Hello", "English": "Hello", "German": "Hallo" } ]
about 4 years ago · Santiago Gelvez
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!