Tag Info

4

Code style is not the problem. The expectation is that a new coder uses the in house style guides when writing. I think the problem is that you missed an important assumption. The test case passes one argument, however that does not mean that the function you are given will have only one argument. Thus maybe (I am just guessing) if you wrote... const ...

3

A short review of things that could trigger me if I were the lead Why are you returning undefined? That is what a function does by default. All your functions are anonymous, a nightmare in stacktraces There is a time and place for arrow functions, this code implies that you never use function Though to be fair, the challenge over-uses arrow functions as ...

2

This is a partial answer, that only addresses style, but I prefer something like this for the changeColor function. I'm not thrilled with activateColorButton, but it works. This is much more readable and maintainable to me: const changeColor = e => { const lightOrange = "rgb(221, 238, 255)" const lightBlue = "rgb(255, 238, 221)" const {...

2

From a short review; patient is a global variable, global variables are bad var patient = [] is more idiomatic than var patient = new Array(); Comments should be all German or all English (I would go for all English, its the common language of the developers) You can group switch labels, this is valid JavaScript: switch(key){ case "id": ...

2

First off, some code review items; Don't skip on semicolons You are not changing a number of variables, consider const over let in those cases The names of your styles match the names of your variables, you could use this Given that, I would consider something like this function processMetadata(metadata) { let out = {regular: {}, solid: {}, brands: {}}...

2

Whenever you have code that sets up an array, then has a loop to push items into that array, Array.map() could be used to condense that code. For example, these lines: const jsonData = []; data.forEach( (row) => { const json = {}; row.forEach( (item, index) => { json[columns[index]] = item; }); jsonData.push(json); }); return jsonData; ...

1

Inside the inner loop, $1/k$ is a constant term. So you could extract that multiplication from the inner loop, and apply it on the computed subtotal. This won't change the order of complexity though. I was wondering if there is a closed form for computing the sum of reciprocal powers (to replace the summing and thereby speed things up), but I couldn't ...

1

The code looks quite succinct and sufficient. The only suggestions I would offer are minor tweaks: for the imperative solution, a for...of loop could be used to eliminate the need to do bookkeeping on the counter variable and use it to index into the string to get each character: for(const c of s) { if (par[c]) { rep.push(par[c]); } else { if (...

1

Overall Feedback The UI looks good. I think the code is okay, but the number of DOM lookups is higher than it needs to be. Those could be reduced by storing the checkboxes in an array. While browsers have come a long way in terms of efficiency, DOM lookups are still not cheap. Since ecmascript-6 features like template literals are used, a class or else a ...

1

I combined some of the previous answers, and shortened it up a little function findShortestWordAmongMixedElements(arr) { return arr.filter(item => item.constructor === String) .sort((a, b) => a.length - b.length)[0] || ''; }

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