Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

123
Visualizações
Create a filter function in Javascript in a video library

I have a home video library with thumbnails and links to each video. I'd like to have a field to enter keywords and the library would only show the thumbnails of those matching the keywords based on the filename. If there are no keywords entered, then all videos show up. For example, if I type "trip to DC" and click "OK", then only those videos with "trip to DC" be displayed in the library. e.g. "trip to DC- national mall.mpg", "trip to DC- congress.mp4" would be displayed while others disappeared.

Thanks for any pointers.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can create an array containing objects describing your videos, using filter() and includes() (You can also use match or search)

const videos = [
      {
        filename: "Trip to Dc bla bla",
        thumbnail: "example.jpg",
        link: "example.com"
      },
      {
        filename: "Example 1",
        thumbnail: "example.jpg",
        link: "example.com"
      },
      {
        filename: "Example 2",
        thumbnail: "example.jpg",
        link: "example.com"
      }
 ];

const trip = videos.filter(video => {
    return video.filename.includes("Trip");
})

console.log(trip);

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda