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

155
Views
Multiple string match without using every function in javascript

Currently i am doing multiple string match in javascript, i know most of us are familiar with javascript every method, as a result it provides true or false. Is there any other way in performance wise better than this.

'javascript code'.split(' ').every(val => 'you should code in javascript'.includes(val));

Actual string length of mine is very big, it becomes performance bottleneck when i using this js every method.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could just check if the set of words is a subset of the larger set of words..

const needles = 'javascript code'.split(' ');
const haystack = 'you should code in javascript'.split(' ');

const is_subSet = (a, b) => {
  const setA = new Set(a), setB = new Set(b);
  return [...setA].every(v => setB.has(v));
};

is_subSet(needles, haystack);
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!