8 votes

Simplify complexity

appropriate names const checkArray = (word, arr) => { This is just a terrible signature, almost as meaningless as ...
J_H's user avatar
  • 25k
8 votes

another Tic-Tac-Toe Game

Game-Loops You ask "Maybe also Ideas for the "game loop" (or explanation if you are using it or not)" Game-Loops are used for animated games (Space Invaders, Pacman, Doom, etc...). ...
Blindman67's user avatar
  • 21.8k
7 votes

another Tic-Tac-Toe Game

You don't really need a game loop in this situation because tic-tac-toe is not an animated game. If you ever wanted to use it, you should use requestAnimationFrame()...
Ridham Sharma's user avatar
6 votes
Accepted

Partial Function Application in JavaScript

An interesting question, I have never seen a partial functional application like that, I am used to see something more like ...
konijn's user avatar
  • 33.2k
6 votes
Accepted

Optimizing for() loops on Roman Numeral Converter JS

A function should have parameters. They should not use global variables as input instead of using parameters. numbersList.length < 4 why is this line here, and ...
Maarten Bodewes's user avatar
5 votes
Accepted

Count matching pairs (modular equality)

With a bit of algebra you can show that (1) abs(a_i − a_j) mod m == 0, m > 1 can be written as ...
slepic's user avatar
  • 5,467
5 votes

First app with JS in OOP

Few review points. Messy formating, inconsistent use of spacing, newlines, and some poor indentation. ...
Blindman67's user avatar
  • 21.8k
5 votes
Accepted

Username Validation RegExp

Your regex looks pretty close to optimal to me, unless I'm missing something. The only adjustments I'd make are: Write some tests if you haven't already (I did ad-hoc tests that can run in the ...
ggorlen's user avatar
  • 3,412
5 votes
Accepted

Convert durations to a single unit

To address your specific concern, it's normal to highlight that fall-through to the next case is intentional, e.g. with a comment: ...
Toby Speight's user avatar
5 votes
Accepted

The core of the assembler (the part of the assembler that actually converts mnemonics to opcodes) is hard to follow due to many if-branchings

descriptive name function formatAsByte(n) { Consider calling it formatAsHexByte. Alternatively, offer one line of JSDoc. As it ...
J_H's user avatar
  • 25k
5 votes

Find the closest named color

Incorrect calculation of color distance sRGB is a logarithmic scale RGB (AKA sRGB) as used by the browser is a logarithmic scale (apart from the very darker values which are linear) Your calculation ...
Blindman67's user avatar
  • 21.8k
5 votes

Math calculation JavaScript. Am I using Objects correctly? Can I use methods / functions to shorten my code further? Also error logging?

I added what I hope are more explicitly stated object advantages for future changes Give objects the functions using their properties. This is a critical key for code to have attributes like ...
radarbob's user avatar
  • 7,554
4 votes
Accepted

Movies App with Vue 3 and TypeScript

This is feedback from me. You can create a directive named composite for outside click. In the movieCard component => you can replace template logic with computed properties. like for the date <...
Awais al-waissy's user avatar
4 votes
Accepted

Im trying to show the traffic lights in a loop

Is your question on topic? Your code does not work as expected. However the rules for asking at code review states that code "...works correctly (to the best of your knowledge)" and timing ...
Blindman67's user avatar
  • 21.8k
4 votes

Text input with currency icon in the center

I think that your solution is pretty good, but, since it's a money input, you should change the input's type to number. ...
SamuelLouf's user avatar
4 votes

Detecting when a user stops typing

Structurally, there is nothing wrong with the approach. You could consider const for doneTypingInterval, I would put a comment ...
konijn's user avatar
  • 33.2k
4 votes
Accepted

v-for loop generating list items that will get rearranged based on an associated value (ranking system)

You don't need these: let count = 0; let increment = 0; let last_value = 0; let values_occurrence = {}; let sorted_values = []; Instead you should assign those ...
Simon Forsberg's user avatar
3 votes
Accepted

JavaScript seedable Math.random

Do not ship this code as-is. The identifier xoshiro256ss is apparently intended to denote xoshiro256**, but there is no comment or documentation explaining that. ...
J_H's user avatar
  • 25k
3 votes

HTML Editor: online HTML editor with real-time preview

Your code is very cool! Definitely better than my editor... Anyway, here are some points to fix your code to be kind of better: Instead of a textarea, maybe use a stylized code editor like CodeFlask ...
RixTheTyrunt's user avatar
3 votes

HTML Editor: online HTML editor with real-time preview

I'll be reviewing the code in your GitLab repository as it has this code in one file: index.html ...
T145's user avatar
  • 3,099
3 votes
Accepted

JavaScript search algorithm to find a town in a particular state

It seems a bit odd that you've defined named capturing groups in your regular expression but then you don't use them because you only use it with the test method, ...
Mark Hanna's user avatar
3 votes
Accepted

Solving round number in JS by using String

document the return value round(number, decimalsLength) { The name suggests something similar to this documented function: Math.round() The Math.round() static ...
J_H's user avatar
  • 25k
3 votes

js template engine

Style Some style points. JS does not use snake_case naming, try to use the JS style camelCase naming. We only use underscore ...
Blindman67's user avatar
  • 21.8k
3 votes
Accepted

An extended JavaScript plugin for rendering radial pie charts

First off, that isn't "XML". Those are custom HTML elements. Most of the code in typesetSinglePieChart belongs in the constructor. You don't need the ...
RoToRa's user avatar
  • 11k
3 votes
Accepted

Simple JS Password System

lint With no indent, your code starts to become illegible. Find a pretty-printer and use it. The machine doesn't care. But people do. security ...
J_H's user avatar
  • 25k
3 votes
Accepted

Listener for property value changes in a Javascript object

Serious BUG! Normally this would make the question "off topic", but unless you are experienced with JS this type of bug is very often overlooked or even considered in normal testing regimes. ...
Blindman67's user avatar
  • 21.8k
3 votes
Accepted

JS animated string builder

Most of the variable names are badly chosen. buildString doesn't really express what it does. name doesn't match its use (...
RoToRa's user avatar
  • 11k
3 votes

Advent of Code 2023 day 1: Trebuchet in JS, part 2

Automatic Semicolon Insertion ASI Generally your use of semicolons is consistent as preferred (use them rather than not) however there is one potential issue. JavaScript requires semicolon. If you do ...
Blindman67's user avatar
  • 21.8k
3 votes
Accepted

programmatically update a <td> element per table row

Is this solution clean? I feel it's a bit dirty to rely on a counter. Couldn't the counter be achieved with a closure? If so, would anyone show me how? You don't need a counter at all. If you want to ...
tacoshy's user avatar
  • 394
3 votes

Paragraph structure template generator refactoring

Vercel has a free tier which you can use to deploy online using their website. As far as the code goes. It's too small to review. There are two nitpicks though. As per PEP-8 global constants must be ...
Ajinkya Kamat's user avatar

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