Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

86
Vistas
Javascript filter over HTMLCollection

I want to get particular query params from all the js files which have been loaded by the browser. My query params reside in the js file named script.js(ex: https://abcd.com/script.js?code=123). In the browser console, I tried like this:

const scripts = document.getElementsByTagName("SCRIPT")
scripts.filter((script) => { return script.src.includes("script.js?code=")})

But this returns the error Uncaught TypeError: document.getElementsByTagName(...).filter is not a function. Please suggest the code changes or is there any better way to get the same?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Methods like getElementsByTagName do not return an array rather a list of node. Just wrap your queryselector with brackets and the spread operator to create an array from the nodelist.

const scripts = [...document.getElementsByTagName("SCRIPT")]
scripts.filter((script) => { return script.src.includes("script.js?code=")})

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda