New answers tagged

0 votes
Accepted

Refactored Todolist created using TS

This implements the basics of a class to wrap the code, and shows how event listeners can be targetted at the class instance. Because the class constructs the necessary HTML framework into a container ...
user avatar
0 votes
Accepted

Created a todo list in TS

storeObject cannot be both a type and a function. Remove the type storeObject... statement ...
user avatar
0 votes

Populate object values if an array contains a key

Without knowing what the real word input array looks like, its hard to judge what could be the most efficient algorithm, but as its stands, you have 7*N potential iterations (where N in the length of ...
user avatar
0 votes

Populate object values if an array contains a key

When I know that I'll be searching in an array multiple times, I usually just put it in a Set. The Set has method checks if a value is in a Set object, using an approach that is, on average, quicker ...
user avatar
5 votes

Populate object values if an array contains a key

Your code is very verbose and repetitive. As it is not a function it is not portable or easily reusable. Example Removes as much as the repetition as possible Encapsulated in IIEF, the days of the ...
user avatar
  • 20.2k
3 votes
Accepted

API client that builds a response over multiple lines

By using any you are losing type safety, which defeats the point of Typescript, at least in this spot. But sometimes it’s just easier. Just because the example is ...
user avatar
1 vote

Angular - Contact manager component with API

Overall your code already has a decent structure to it. Here are some of the more obvious things that I think could be improved, after taking a look at your project. Some are rather small things that ...
user avatar
  • 229
4 votes
Accepted

Updating large and heavily nested JSON properties based on existing properties using nested forEach loops

I don't think there is a more 'performant' way of doing it, as you need to transform all elements. There might be slight tradeoffs over whether forEach is better/...
user avatar

Top 50 recent answers are included