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

248
Views
¿Cómo colocar datos actualmente en un objeto const dentro del script en un archivo separado?

Tengo un programa que toma parámetros de un formulario y los usa para generar un comentario narrativo (dirigido a maestros que necesitan escribir comentarios narrativos en los informes de calificaciones):

 const sentences = { "participation": "engages productively in class discussions", "assignments": "completes all assignments on time", "mastery": "shows excellent understanding of the content on all assessments" } function writeComment(event) { event.preventDefault(); let name = document.getElementById('name').value; let schoolClass = document.getElementById('schoolClass').value; let term = document.getElementById('term').value; let strength1 = sentences[document.getElementById('strength1').value]; let strength2 = sentences[document.getElementById('strength2').value]; let result = `It has been wonderful having ${name} in ${schoolClass} during the ${term} term! ${name} ${strength1}. ${name} ${strength2}` document.getElementById('result').innerText = result; }

Me gustaría almacenar oraciones constantes en un archivo separado, con otros objetos similares, que el script actual leería y usaría para completar el resultado. ¿Hay una manera de hacer eso? Intenté almacenarlo en un archivo json y usar fetch en un servidor local, pero no pude hacer que los datos fueran accesibles para el script.

about 4 years ago · Juan Pablo Isaza
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!