Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
2 votes
2 answers
72 views

French Republican Calendar Converter (Romme Rule)

This is a French Republican Calendar / Gregorian Calendar converter I've written; it returns an accurate date for all the dates I've tested (mostly dates in the present age, although it also lines up ...
lagomorph's user avatar
2 votes
2 answers
224 views

Permissions system in MERN app

I am working on a MERN stack app that is a CRM with a couple of modules. Now when the user sends x request to the server to do a supposed action (such as delete something), the server first checks if ...
Syed M. Sannan's user avatar
6 votes
1 answer
1k views

Username Validation RegExp

Working through the freeCodeCamp JavaScript curriculum and I found this RegExp task surprisingly tricky (maybe I just don't use RegExp very much). The parameters are: Usernames can only use alpha-...
Christopher Fimbel's user avatar
3 votes
2 answers
333 views

Intersection of 2D vector equation straight lines

I know the vectors that describe two perpendicular lines, $$\mathbf{a} + \lambda\mathbf{d}$$ and $$\mathbf{b} + \mu\mathbf{d'}$$ I've written a JavaScript function to get the coordinates of the point ...
user avatar
1 vote
1 answer
3k views

Process a binary file by chunk using a read stream in nodejs

I want to process a file chunk by chunk to prevent memory exhaustion. I need to consume the file using a read stream. When trying it, this implementation seems to work fine. I am asking your expert ...
Louis Coulet's user avatar
5 votes
1 answer
104 views

Secure password generator form

With the demise of passwordsgenerator.net I wrote my own generator; Please review with an eye on correctness and maintainability; ...
konijn's user avatar
  • 33.8k
5 votes
3 answers
2k views

Heartbeats per minute in vanilla HTML JS

Attached is a fun little snippet demonstrating a button to be clicked along with your heartbeat and see how many beats per minute you're at. This is a mwe of the concept, any feedback is appreciated. ...
async await's user avatar
1 vote
0 answers
36 views

Refactor Node.js Logging Library for Improved Readability

I have a Node.js logging library that applies ANSI styling for text formatting. Currently, the code contains some redundancy and could be refactored for better readability. I'm particularly interested ...
Dinesh Basnet's user avatar
89 votes
6 answers
7k views

You hate h̶a̶t̶s̶ reputation? Click here to get rid of it

Soo... I recently read a meta-post about the inherent problems of reputation. It listed some things like: Confirmation bias. Demotivating for low-rep users. Hubris and elitism of high-rep users over ...
Vogel612's user avatar
  • 25.3k
1 vote
1 answer
72 views

String represents a road. One character travels on the road obeying the stops - Code challenge (advent.js day 5)

This is my code to solve the 5th Adventjs challenge. In that link you can read the instructions. How can I improve it? It's a bit messy... and I'm repeating some part of the code. All must be in just ...
Sofia Chardin's user avatar
2 votes
2 answers
195 views

First app with JS in OOP

I've already started to creating apps in JS with OOP. I made simple TicTacToe Game in OOP and I want to ask you to review my code and point out everything that I can change about OOP. What is bad ...
Szymon Mińko's user avatar
1 vote
1 answer
352 views

Movies App with Vue 3 and TypeScript

I have made a Movies App with Vue 3, TypeScript and The Movie Database (TMDB) API. For aesthetics, I rely on Bootstrap 5. In src\App.vue I have: ...
Razvan Zamfir's user avatar
4 votes
2 answers
133 views

Filter an object array based on certain conditions

How can I rewrite this in a cleaner way? I have this function that takes a list of contacts of different types (are being called ...
user3378165's user avatar
0 votes
0 answers
34 views

Bidirectional typing effect

Implementation supporting both typing directions from left to right and from right to left. It also supports alternating typing directions and configurable letter spacing. With monospace font the ...
user avatar
1 vote
1 answer
116 views

Personal Computer Web-surfing Digital Well being user script

I have written the following JavaScript small script to do three things in a web browser: Block all or most News websites (send your browser to google.com instead) Block automatic playing of any ...
somo's user avatar
  • 19
7 votes
4 answers
6k views

Generate an HTML table using JavaScript from an array of objects

I've an array of objects and I want to convert it into a visual table in HTML; so I did it last night, but I was tired. I don't think it is the right way of doing it, even though it's working and ...
XMehdi01's user avatar
  • 553
2 votes
1 answer
133 views

Form Validation Code Optimization in HTML and JavaScript"

I've been working on a simple form validation code in JavaScript coupled with an HTML form. The form asks for user's basic information, including name, email, country, gender, and skills. There's a ...
XMehdi01's user avatar
  • 553
0 votes
0 answers
38 views

Colorproof dust effect (second thought)

The colorproof dust effect could be enhanced with positionproof feature getting the position of the dusted element (dust container) from its getBoundingClientRect ...
user avatar
2 votes
1 answer
74 views

Reorganice (and style) form's output in HTML using JQuery: how to do it better?

To clarify: The code in "What I achieved" is working. I'm looking for suggestions so I can improve. I'm quite new with JQuery (and javascript) and I've been learning while styling a forum. ...
Lucas's user avatar
  • 21
2 votes
1 answer
109 views

JavaScript implementation of PHP's array_intersect_key()

I've written a JavaScript function to imitate PHP's array_intersect_key() function for objects. PHP uses arrays as both arrays and objects but JavaScript treats arrays and objects differently. I'm ...
CJ Dennis's user avatar
  • 249
2 votes
2 answers
73 views

Calculating the sum of all k-sized sub-arrays in an array using sliding window algorithm

I need to calculate the sum of all k-sized sub-arrays in an array using sliding window algorithm. Is that a valid sliding window algorithm? If not, why? ...
Alekam's user avatar
  • 21
4 votes
1 answer
116 views

Legend of Zelda: Breath of the Wild armor upgrade materials tracker

There are plenty of these online already but none of them quite fit what I wanted. I've been meaning to learn some more front-end stuff so I decided to make one myself. I know some JavaScript but ...
Captain Man's user avatar
1 vote
2 answers
145 views

Receiving a daily reward

I'm doing a daily reward system on my site. Users can pick up the reward only once a day. The next reward can be picked up the next day, also, only once. When a user visits the site to pick up a daily ...
Andrew Ourst's user avatar
21 votes
5 answers
7k views

Count all vowels in string

For a homework assignment, I was asked to complete this CodeStepByStep problem. It's coded correctly and gave me a right answer. I'm just wondering if there's an easier way to solve this problem ...
Linny's user avatar
  • 10.4k
1 vote
0 answers
78 views

Variable button increment picked from an input:range in React 18

I'm a newbye in React. I created some simple Components to practice. For now, I'm using class Component (I want learn either class COmponent or function COmponent). I would know if I projected ...
Nick's user avatar
  • 111
1 vote
2 answers
581 views

Split the Bill and calculate the Tip

I have created a Bill Splitter page that asks for the total bill amount, tip percentage, and the number of people. Then it displays the tip and the total amount (including the tip) each person has to ...
Ultimate's user avatar
  • 141
3 votes
2 answers
329 views

Count matching pairs (modular equality)

Problem Given an array of natural numbers a. Find the number of such pairs of elements (a_i, a_j), where ...
EzioMercer's user avatar
4 votes
1 answer
167 views

Array Implementation In JavaScript

Review I have written my own implementation of Array in JavaScript with the basic functionalities. Can anyone please review this code and point out the mistakes/how to make the implementation better? ...
enigma6174's user avatar
0 votes
1 answer
79 views

Handling pure in browser HTTP request in Service Worker fetch event

I was suggested by @Bergi on StackOverflow that Async Promise constructors are any pattern. The argument behind this is that async Promise swallows the errors. In my case, I have try..catch so I'm not ...
jcubic's user avatar
  • 238
11 votes
4 answers
4k views

Logs 'Fizz' for multiples of three, 'Buzz', for multiples of 5, and 'Fizz Buzz' for multiples of 3 & 5

I'm new to coding and have been directed here from Stack Overflow. As I'm new to coding, I'm not entirely sure if my program works completely, but I think it does. I'm looking for suggestions on how ...
Marc Sharp's user avatar
98 votes
9 answers
182k views

Generating all combinations of an array

I'm generating all combinations of an array, so for instance, ["a", "b", "c", "d"] will generate: ...
Incognito's user avatar
  • 1,307
1 vote
2 answers
216 views

Function that formats number of seconds to total time (days, hours, minutes and seconds)

I need to format total number of seconds to total time in the following format: Days:Hours:Minutes:Seconds. This is what I did: ...
pileup's user avatar
  • 451
1 vote
1 answer
66 views

Observer design pattern: value observer and variable observer implementation

Observer implementation that leverages both behaviours observing a variable and observing for a value. Supports subscribing and withdrawing observers. ...
user avatar
1 vote
1 answer
77 views

Javascript CLI to boot iOS simulators, install project, extract data, and merge into JSON

I'm a DIY "dev" - so I really create things that I need or think they'll end up helping others. I wrote this Swift Package so the iOS community could get device bezel radius' to help with UI ...
markb's user avatar
  • 171
2 votes
0 answers
120 views

Create a Penrose tiling

I programmed this type of Penrose Tilings in javascript and the algorithm is 'simple': The cyan pentagon always have to draw the yellow losenge and the grey pentagon almost always have to draw two red ...
visionary's user avatar
4 votes
3 answers
2k views

Increment counter on button click

I've written a simple JavaScript function to increment a counter after clicking on a button. Here's my code: ...
Laila Campos's user avatar
1 vote
2 answers
78 views

Changing every link on page, in fastest way possible

I have created a script (mediawiki gadget), which iterates over every redlink in a rendered wiki-page (that is, over every href with class new, signifying an ...
philo math's user avatar
4 votes
1 answer
192 views

Hangman Game in HTML + CSS + JS

I recently developed a hangman game with HTML, CSS and JavaScript and I would like to get your feedback and tips to improve it. The goal of the game is to guess a secret word before 6 incorrect ...
Lucio Mazzini's user avatar
0 votes
1 answer
44 views

js template engine

I am building a template engine for js and I need some help refactoring the code for fast and more efficient performance. If you can help modify or suggest some updates I'll be grateful. ...
ahmed qoreichi's user avatar
2 votes
2 answers
919 views

Clone Div and change input control

I am using keypress to get all the events of a input control. Once the user hits the enter button after I am then clone a div and update the ids. One project I am having is that I only want to do this ...
Jefferson's user avatar
  • 353
4 votes
1 answer
52 views

JavaScript search algorithm to find a town in a particular state

I built a function in JavaScript which executes a search algorithm to find a town in a particular state. The dataset, referenced by the variable townsAndStates is ...
code writer 3000's user avatar
1 vote
1 answer
254 views

Calorie Calculator

I have developed a calorie-tracker webpage and would appreciate some feedback on it. I'm particularly interested in optimizing performance, improving code readability, and ensuring best practices are ...
Ultimate's user avatar
  • 141
3 votes
1 answer
271 views

Snake game using Canvas API

Edit 2: For anyone interested, you can play the game at buggysnake.com Edit 1: I have typed up the code for making the body of the snake move. It's not perfect and there are small problems I need to ...
Seeker's user avatar
  • 133
1 vote
1 answer
415 views

Loading Filtering and Displaying Top 10 Countries Data

I've created a small project that fetches data from a 'countries' API and works around with it to display the 'top 10 most populated countries' & 'top 10 most spoken languages'. I kindly wish if ...
noharm's user avatar
  • 51
3 votes
1 answer
981 views

Adding classes from a given array or an object

I want to add classes to elements based on a source array or object. For example, it can be: ...
pileup's user avatar
  • 451
3 votes
1 answer
155 views

JavaScript seedable Math.random

I made an implementation of xoshiro256** in JavaScript, using BigInts. It's designed to mimic Math.random. Any feedback on the code quality? ...
rfl890's user avatar
  • 101
3 votes
1 answer
289 views

JSON comparison function

I've written a comparison function between two json values. I'd like to know if it can be improved at all in any way. Thanks again for the help. ...
David542's user avatar
  • 429
4 votes
2 answers
190 views

Abundant number implementation

I have implementted a simple JavaScript function to find the list of abundant numbers and print them on the screen. an abundant number is a number for which the sum of its proper divisors is greater ...
Napoleon Bonaparte's user avatar
4 votes
1 answer
3k views

Merge two dictionaries

This function merges two dictionaries, using the value from the later dictionary to resolve conflicts. I have 5 tests that the program passes successfully: ...
alorl's user avatar
  • 41
2 votes
0 answers
82 views

Javascript basic search engine recipes

I have made a search engine for recipes. Requirements for this JS Project are as follow: Create a function called searchRecipes that takes all recipes and an ...
Yass's user avatar
  • 21