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

121
Views
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 answers
Answer question

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 Report
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!