DEV Community

loading...

Discussion on: The Two Sum Problem in JavaScript

Collapse
shaileshcodes profile image
Shailesh Vasandani

Awesome post! Using an Object is a great way to ensure it runs in O(n) time.

Also, a tip I learned for making code blocks a lot easier to read is to take advantage of syntax highlighting; i.e. instead of using just the three backticks, put the language after it. It's hard to show in markdown, but something like this: ` ` `javascript.

That should give something like this:

const twoSum = (array, goal) => {
  // ...
}
Enter fullscreen mode Exit fullscreen mode

Thanks so much for sharing! Your code is super readable and your explanations are very understandable.

Collapse
eidorianavi profile image
EidorianAvi Author

Oh that's amazing I will definitely be using that thank you!

Forem Open with the Forem app