konijn
  • Member for 9 years, 6 months
  • Last seen this week
  • Lyon, France
Destructuring with map and assigning to a constant
2 votes

Super short review; Logging to console seems very primitive, consider a logging solution that handles different logging levels. { commit } is very bothering, why should a query function need to ...

View answer
Retry a callback function n times until success
3 votes

Super short review; Pure nitpicking, but to me, you try the first time, and retry afterward. This means that a retry of 3 would guarantee up to 4 calls. I would not create wait but just call the ...

View answer
Transforming a data of key value pairs to label and key
2 votes

A short review; You process the list twice, ideally you process the list only once You can run 1 function once per object with map and then flat You could even run flatMap which is faster than ...

View answer
Add missing business days in CSV file
1 votes

A medium-sized review; Not a huge fan of arr and el and newArr, I suggest to either go for fully spelled out names for readability or spartan variable naming. I go for list and v(alue) Its ...

View answer
Four HTML tabs elements, with fade animations, activated by buttons
4 votes

Short review to make this more DRY Review the documentation on https://api.jquery.com/toggle/, this often helps with code like this Know that you can select multiple id's by separting selectors with ...

View answer
Grade Calculator Tool Code Improvement
1 votes

A quick review; This code does not follow MVC. The worst case is where Calc, gets data from the form, calculates, and then sets data on the form. The function name is basically misleading. 13 is a ...

View answer
Utilizing <template> or DocumentFragment in an appropriate manner
1 votes

I don't think you are using <template> right. It was created so that you can have templates in your HTML code without you having to hide those templates. In your case you could have used <div&...

View answer
Arithmetic progression using Recursion
0 votes

I am assuming this is a school assignment and an exercise in recursion. A short review; Its okay to have the recursive function be another function, but I imagine you get extra points for 1 single ...

View answer
Extracting a part of a URL path
5 votes

Super short review; The code should handle the presence or the absence ? in a transparent way The code should probably check for /supplier/ instead of ? That leaves me with function ...

View answer
Using JS Template Literals as for a simple Templating Engine
2 votes

A short review; Do you think this is reasonable in daily JavaScript? Probably not, for a few reasons You need a function per record type since this wires metadata and styling so tightly There is a ...

View answer
Recursive Filter/Search function
3 votes

From a short review; The function name is a bit misleading, it does not filter anything really. Could be named hasValue, or even hasString You could also just return the occurrence(s) of where the ...

View answer
Random matchmaking for a p2p chat application
2 votes

A longer review; Keep full uppercase names only for constant values like numbers In the ready function you access req.socket.id enough that you could store it locally To me, it is a code smell that ...

View answer
JS Menu Post Get method
2 votes

A short review; You inlined the success function, I would use a properly named function outside of that block This $('#favoritepagesListBlock').empty(); $('#meetingsanddisclosuresBlock').empty(...

View answer
Convert number 1-5 from its spelt-out form
0 votes

Super short review, as others have said, a function should try to be consistent in the type of data it returns your case statement can be replaced with a clever data structure I prefer <verb>&...

View answer
Creating cards for a game of SET
1 votes

The code seems fine except for omitting curly braces and unfortunate naming. I would name the features and their variations. const numbers = [1, 2, 3]; const colors = ["Red", "Green&...

View answer
Sort one array base on another array
Accepted answer
1 votes

From a short review asort is not a great name, sortedA could have been better? As mentioned by another user, it is bad practice to change lists you receive as a parameter You only us bi once. I would ...

View answer
Find the 'n' most frequent words in a text, aka word frequency
1 votes

Tiny review; functions ideally follow <verb><Subject> so wordSplit -> splitText I think it is important to realize that when you do ff(v => f(v)) you can also do ff(f), or in this ...

View answer
income calculator
2 votes

From a short review; You should declare your variables with const or let There is a ton of copy-pasted code in there 'commission-field' is not a great name for your element, I would just call it ...

View answer
Regex detect URL without http(s):// and www
1 votes

For elegance, I would put at least one line of comment pointing to this; https://datatracker.ietf.org/doc/html/rfc1034#section-3.5 You will notice that there is no limit on the top level domain (...

View answer
A (deep) cloning method for ES-Objects
2 votes

I spent a ton of time on this; The choice to replicate Date but not the other 50+ built-ins is interesting I would write isObject as const isObject = x => (typeof x === 'object' && x !== ...

View answer
Combine data from array of objects
Accepted answer
1 votes

From a short review; Your own answer does read better map is the right approach I would go for filter instead of reduce (you only want 'true' values that are not keyword) I probably would have named ...

View answer
OOP refactoring technique
1 votes

From a short review; In OOP, your objects are supposed to be re-usable I would take the x,y from a parameter I would take the vx, vy from a parameter I would even take the alpha from a parameter ...

View answer
Simple way to loop through a JavaScript object array?
Accepted answer
2 votes

A short review; I prefer to use the function keyword You are using libs like a global, I would pass it in the function If you don't need both key and value, then you can just use Object.values ...

View answer
Fizzbuzz questions - job interview rejected
1 votes

Super short review; Your code should be mostly in nicely named methods, not main You call System.out.println(i); twice, which means you do not follow the fizzbuzz rules counter is not used, and I am ...

View answer
A Countdown Timer with reset functionality in pure Javascript
3 votes

From a short review; You use 9 twice, this should be assigned to a nicely named global constant You hard code both 9 and 00:10, this is not flexible. I would expect to be able to change 9 to 99 and ...

View answer
Recursively find data in array of objects
1 votes

From a medium review; This code belongs in a well named function I always forget about destructuring in a filter, very nice Mapping to an object automatically removes dupes, something I (ab)use in my ...

View answer
Speed up javascript code to convert csv to geojson
2 votes

From a short review; Old school for loops still beat map Prevent repeated object[string] access, like accesssing several times item[latName], because it is relatively slow Is it absolutely ...

View answer
Web Component prevent multiple API fetches
1 votes

From a super short review; I would attach the style tag to the head element, especially if you can have this element several times on the page (and ensure that you only add it once) When all a fat ...

View answer
Learning Javascript OOP with a Collapsing Item Class
0 votes

This seems over-engineered. If really all you need is this.content.classList.toggle("bb-collapsed"); then I would simply go for class Collapsible { constructor(link, content) { this....

View answer
Add / Overwrite an object in an array
Accepted answer
1 votes

From a short review; The first snippet does not work, try it with inputTitle = 'BBB' You are in essence doing 2 things Find a possible match Update the match or insert the data Ideally, this is ...

View answer
1
2 3 4 5
27