All Questions
9,398 questions
7
votes
4
answers
867
views
ES6 inner join equivalent
Using the sample data from here, I'm attempting to write JS code (to the ES6 standard) that is equivalent to an SQL inner join. The solution below works fine, but it seems rather long. Is there a ...
0
votes
1
answer
80
views
Raw HTTP header parser
The code must produce the desired output
Input
...
0
votes
0
answers
47
views
Testing whether parenthesis are correct in a string in functional JS
This is a homework exercise and therefore has no further purpose. The writing to me feels clunky, and the typescript types on addParenthesisFactory are unreadable, ...
0
votes
0
answers
62
views
The Wacky World of ANSI Escape Sequences?
I just finished creating my first npm package (for learning, not competition) and published it. Now I want to ask some questions, for example:
Is my method of writing code good (for later maintenance ...
2
votes
0
answers
1k
views
AngularJS wrapper for p5.js - p5 directive and service
I wrote an AngularJS wrapper for p5.js called angular-p5:
...
1
vote
1
answer
121
views
Hidden html elements after search click
I want to:
Hide areas of my template after search click.
Return its original state with the cleaning of the input related to each button.
I don't know if my code exploits all the resources of ...
1
vote
1
answer
42
views
Reduce Redundant event listeners and selectors to make navigation scrolling and clicks more concise
Inside of this navigation function, I have a click event that scrolls to sections which are offset by the fixed header height. I also have a scroll event which changes the links' color when the scroll ...
4
votes
1
answer
125
views
Hangman game in JavaScript
I have attempted to create a hangman game in JavaScript. Some parts of my code is a bit DRY. Basically, the Hangman class is a wrapper for all of the available actions in a typical hangman game: setup ...
3
votes
1
answer
120
views
Sorting the divisors of a given number
I am trying to sort all the divisors of a given number in the most efficient way.
Below is my code for sorting the divisors:
...
3
votes
1
answer
1k
views
Insert json object into existing Json array
I have created a tool to insert JSON objects with several rules:
Read the product status, and then insert based on the status
If there is no data in this status, then insert the object
If there is ...
2
votes
2
answers
209
views
Text input with currency icon in the center
I want to have a input element for currency where there is a currency icon always at the center (but it adjusts according to the number of digits)
Something like:
This is what I've come up with:
<...
4
votes
2
answers
992
views
another Tic-Tac-Toe Game
I have a bit of experience in programming but not that much. I was trying to create a TicTacToe Game in Javascript. I was doing my best to have a good structure. I was thinking about using classes, ...
18
votes
7
answers
11k
views
Dealing with KB, MB, GB and TB and bytes
This function is simple, it gets a number of bytes and returns its representation in either Bytes, KB, MB, GB and TB.
As simple as it is, I am sure there are other (and perhaps better ways) to write ...
3
votes
2
answers
110
views
group computed properties in vue component
I have the following vue component which all works fine
...
1
vote
2
answers
161
views
Strings to array
I've written a simple text tokenizer in JavaScript which works in my specific case, but I do not think it is maintainable (for example, if the requirement ever changed to allow newlines when ...
2
votes
1
answer
128
views
Tile and grid abstraction
This question is a small subset of the problem I am trying to solve.
I am trying to learn to break problems into better abstractions.
The original problem I am trying to solve is:
Write a JS ...
2
votes
1
answer
98
views
Abstract navigationOptions react navigation
I have many stacks with the same navigation options. How do I abstract the navigationOptions part to have it repeat in all my stacks?
...
5
votes
2
answers
667
views
Simplify complexity [closed]
I came across this question which asks to create a function which will return true/false based on the passed array containing all the letters to make up the passed word. Each letter from array can ...
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?
...
-1
votes
1
answer
86
views
Sine function guessing cognitive app
Please help with improving this application. It is a guessing game, for learning the values of the sine function, and boosting brain power in the process.
...
2
votes
1
answer
133
views
Learning Javascript OOP with a Collapsing Item Class
I'm trying to get into object oriented javascript programming. I have written a class for collapsible elements as a test. These elements all have a certain class and no matter how many elements there ...
4
votes
0
answers
74
views
Google App Script to take form responses submitted by teachers on their students and produce formatted PDF student reports
I'm not a programmer but, with help, I managed to make a Google Apps Script which takes reports, submitted by teachers on their students, to the Form Responses Sheet, and then selects all responses ...
1
vote
1
answer
143
views
Need help condensing my code so it takes up less lines and it easier to interpret
Description is at the bottom
Here is a link to all the code: Link
...
2
votes
1
answer
134
views
Combinations of elements in array
I wrote this code to get all possible arrangements for an array containing 3 elements:
...
0
votes
0
answers
35
views
User Management System: a web app for management of user records (Part II: Frontend)
Note: It's Part II of the User Management System project, focused on the frontend. See Part I here.
Here's the frontend part. I want to note that I realized even back then that copy-pasting a huge ...
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 ...
3
votes
1
answer
94
views
A JavaScript plugin for rendering radial pie charts
(See also An extended JavaScript plugin for rendering radial pie charts.)
I have this JavaScript plugin:
rodde-radial-pie-chart.js:
...
4
votes
1
answer
478
views
Fuzzy Humanize date using Moment.js for datatable searching
In my JS project, I am using datatable plugin to show data where I have a date column which users can filter/search.
In order to help users to search using a logical string such as ...
3
votes
1
answer
129
views
Simple React component to view cached data and test result from API
This is only the front end side of things which I have at the moment, as the back end is still being worked on. But as this is my first attempt at a react component, I'd like to know if there is ...
13
votes
2
answers
2k
views
Stack Overflow clone
I have to write a simple web application using the Java Spring framework as my course project. So I decided to write a simple Stack Overflow clone. My application has the following features:
...
1
vote
1
answer
117
views
Detect a straight automatically in Texas Hold em Poker [closed]
I made a Poker-Hands tracker. The 52 cards of the game are in this program represented by their value and their type.
For example Ace-heart is stored as "Ah" and 7-spades as "7h".
...
12
votes
2
answers
3k
views
Generate a nested structure based on a list of file paths
I'm currently working on a small application, as a learning exercise for a Javascript novice. I need to generate an object based on a folder structure. Here is an example of the folder structure:
...
4
votes
1
answer
192
views
Sending only modified data from a table to the backend as form data
The frontend has a table with hundreds of rows. Each row consists of different inputs (text, file, ...
2
votes
0
answers
74
views
React draggable sliding panel
I'm building a sliding bottom panel as a React component, adapting Phuoc Nguyen's excellent draggable element tutorial.
It currently looks like this:
The expected behavior is:
User taps on button to ...
2
votes
1
answer
277
views
auto image slider in js and css
I was just wanting a code review on this image slider I made. I don't have anyone else to give me their opinion on the code I write outside of work, so I'm asking here.
okay so i had made an image ...
0
votes
1
answer
77
views
A Chrome extension for analytics debugging: code to render the popup
I made an extension and got it to the point where it does what I want how I want. At this point, I have a little capacity to work on code refactoring, readability and such. And I would love some ...
4
votes
2
answers
267
views
Is it possible to make this Minecraft Bedrock addon script less resource intensive, so that it no longer triggers performance warnings?
Following the notice that block events will be removed in a future update, I have been implementing custom block mechanics (such as crop growth and groundcover spreading) using server-side scripts ...
5
votes
2
answers
442
views
Optimizing for() loops on Roman Numeral Converter JS
I'm looking for some feedback on this converter I made. It works just fine for the instructions I had, but I'm wondering what else could be done to improve it or if there's a better aproach to doing ...
2
votes
1
answer
261
views
Efficient browser `StorageEvent` handling
I have this class EfficientStorageEventProvider, which is responsible for efficient handling of StorageEvent
...
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 ...
0
votes
1
answer
67
views
Manage repetitive/similar structures (logging & try/catch blocks)
I'm writing a web bot using puppeteer and I'm logging (using winston) every action the bots does and running it inside try/catch blocks.
For automating these processes and avoid code repetition I ...
4
votes
0
answers
167
views
HSL Guessing Game in Svelte
The objective of the game is to guess the hue, saturation, and lightness values of a given color swatch across ten rounds.
https://github.com/shreyasminocha/guess-the-hsl
https://guess-the-hsl.now.sh
...
0
votes
0
answers
52
views
Svelte - Modal window with dark background and appear/disappear animations
I created this code in Svelte which will show a modal and remove it when the background is clicked, based on a native JavaScript implementation I wrote earlier.
In the *.svelte files, I put the focus ...
0
votes
0
answers
58
views
Ascend animation followed by hover effect
This CSS code creates an animation that describes a random movement using the CSS transition property for box-shadow which ...
5
votes
1
answer
213
views
Tic-tac-toe with JS
I am a beginner and was hoping for some honest feedback on my js code. I struggled quite a bit on this, I did ask gpt to explain some concepts which I find it’s good for but wrote it all myself.
<...
2
votes
2
answers
126
views
Dijktra's Algorithm Visualizer
A couple months ago I made an interactive dijktra visualizer that allowed the user to setup the map nodes and run the algorithm. I thought it was a good way to solidify my algorithm and html/css ...
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 ...
0
votes
1
answer
371
views
Find number of times a property has a truthy value in a nested object
I have a nested object and I would like to calculate the number of times the property 'error'. I am able to go n levels deep and find the count. Is there a better solution than mine?
...
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 ...
2
votes
0
answers
40
views
Colorproof dust effect
A combination of various css transitions (background-color, box-shadow, opacity, ...