Skip to main content
6 votes

ES6 inner join equivalent

Based on your follow up comments, you're only running this once when the app loads, but you may have 10k+ items, so performance is a concern. Your current algorithm is quadratic and uses unnecessary ...
ggorlen's user avatar
  • 3,670
4 votes

Detecting when a user stops typing

Structurally, there is nothing wrong with the approach. You could consider const for doneTypingInterval, I would put a comment ...
konijn's user avatar
  • 33.2k
4 votes
Accepted

ES6 inner join equivalent

Use a Map Existing answers are using Object.groupBy to create a map of departments grouped by id. This is inappropriate as there ...
Blindman67's user avatar
  • 22.2k
3 votes

ES6 inner join equivalent

You told us there are 1e4 employees in 1e4 departments, in some unspecified distribution, presumably pretty sparse with lots of un-staffed departments. The solution below works fine, Really?!? but ...
J_H's user avatar
  • 29.3k
3 votes

ES6 inner join equivalent

An alternative approach (inspired by this thread), for which some feedback would be appreciated, is as follows. One bonus I see to this object merging approach is it's possible to create a left outer ...
knot22's user avatar
  • 469
2 votes

Combining multiple regexps using the `|` operator and grouping the regexps by their flags

This code does not yet have a strong design, nor would it easily be maintained by a team. specification Thank you for the Review Context, it is somewhat helpful. Certainly it is much, much better than ...
J_H's user avatar
  • 29.3k
2 votes

Detecting when a user stops typing

...
3limin4t0r's user avatar
2 votes

Find the starting indices of all occurrences of the pattern in the string - KMP algorithm follow-up

A quick review; This tends to find more than 1 index, findStartingIndex -> findStartingIndexes In KMP, ...
konijn's user avatar
  • 33.2k
1 vote

A Chrome extension for analytics debugging: code to render the popup

I reviewed what you asked me to review: an init function plus {getValuesFromClient, deployClickListeners}. The init looks fine; presumably it does the right thing. comments where appropriate ...
J_H's user avatar
  • 29.3k
1 vote

Merge three (or more) arrays based on specific index and create new array

shape Expected output [ [ 1, 'A', 'D', 'G' ], [ 2, 'B', 'E', 'H' ], [ 3, 'C', 'F', 'I' ] ] I find it slightly surprising that we want lists of [key, ...
J_H's user avatar
  • 29.3k

Only top scored, non community-wiki answers of a minimum length are eligible