# Tag Info

5

I'd suggest the following changes: Use a loop instead of recursion Use for/of instead of .forEach() push a single value instead of using an array with one element in it cache the lowest value so far so you don't have to constantly refetch it on every comparison Use a temporary array for the sort so the function is non-destructive to the source array (...

5

Review findMinimum means to me that you find the minimum value in an array of items. Since your function returns the index instead, call it indexOfMinimum. Prefer the use of const over let if you only assign a variable once: let minIndex = findMinimum(toSort); -> const minIndex = findMinimum(toSort);. Use arrow notation to write more compact functions: ...

3

Bearing in mind that this code was posted ~2.5 years ago, I have some feedback. Perhaps you have learned a lot since then and the information below might not be new but it might help others as well. General Feedabck Overall the code looks okay. Readability is pretty good, though the path through the helper functions is a little tricky to comprehend at ...

2

The general rule is that you should never incorporate user-controlled input into a string that will be interpreted by a computer system without escaping it first. Specifically, at a quick glance, it's obvious that… Your exec() call is vulnerable to command-line injection: exec('ping -c 2 ' + req.body.address, …) Your SQL query is vulnerable to SQL ...

1

I admit I haven't used cheerio before, but it looks like a good tool! The code looks decent. I see a couple places that can be simplified. For example: $('a').each(function(i, e) { if ($(e).attr('href').indexOf('reddit.com') === -1 && $(e).attr('href').indexOf('imgur.com') === -1 ) { responseUrl =$(e).attr('href'); } }); ...

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