Questions tagged [javascript]
JavaScript is a versatile, high-level programming language. It is the programming language in all browsers, and can be used for back-end programming with Node.js. Use this tag for questions regarding vanilla JavaScript; optionally tagged with an ECMAScript version. If you are using a preprocessor such as TypeScript please tag with that too.
9,425 questions
0
votes
0
answers
35
views
WebSocketStream implementation, JavaScript runtime agnostic
References
WebSocketStream Explained
WebSocketStream API design
Source code
https://github.com/guest271314/websocket-stream-impl
Implementation
...
2
votes
0
answers
75
views
Native Messaging performance test
I put together this Native Messaging performance test to determine based on evidence which programming language, JavaScript engine or runtime, and WebAssembly compiled code is fastest to round trip 1 ...
6
votes
5
answers
1k
views
JavaScript program that calculates the sum and difference of a pair of numbers
The goal of the following openprocessing.org JavaScript program is to calculate the sum and difference of a pair of numbers and print the 2 results if they are both positive. I want to do the ...
7
votes
1
answer
86
views
Fruity Balance GUI Remake
I am new to front end development and thought to recreate the GUI of Fruity Balance just for practice. I would love to hear any advice on best practices. I am also wondering if any improvements could ...
-1
votes
2
answers
140
views
How would a more seasoned developer un-quag this quagmire?
I'm looking for suggestions on how this code structure can be improved. It feels like there's a smarter way.
The purpose of the script is to create live stream players if the following conditions are ...
6
votes
1
answer
537
views
Creating a fast connect 4 ai solver in JavaScript
I’ve implemented a Connect 4 AI in JavaScript using a Negamax search. My goal is to solve the game completely from the starting position (depth 42). I’m trying to make it as fast as possible and would ...
3
votes
1
answer
91
views
UDP and TCP sockets in the browser
I'm using a Web extension to communicate with an Isolated Web App over externally_connectable for the capability to use Direct Sockets UDP and TCP sockets from ...
3
votes
1
answer
105
views
OpenProcessing.org JavaScript program - Building a list of matrices
My openprocessing.org JavaScript code listed below produces the output I want but doesn’t seem very elegant to me especially the “.M” in “matrices[mat].M[row][col]”. Any comments to improve the ...
8
votes
1
answer
544
views
An electronic implementation of the Change Change game
I am fairly new to programming using the site openprocessing.org.
My program, available to play online here, is a simple puzzle game in which you slide the circles so that you end up with 4 circles in ...
3
votes
1
answer
126
views
Informal Text HTML & JavaScript Scorer
This is something I've been writing for a paper I'm working on. There is a debate about what is formal text and what is not, but what I know about myself and my writing is that I use certain words (...
4
votes
1
answer
145
views
Implement a simple image captcha test yourself in Java and JS
First of all: I was looking for a simple image captcha solution for a website, but all I found were "Over-the-top" solutions for me. So I decided to write something to self.
I mainly use two ...
6
votes
3
answers
148
views
Function to reduce dead band when reading a pressure transducer that has calibration device under test information
When reading a pressure transducer, I'm currently using the following code to apply the "device under test data" from the calibration report.
How can I determine which range segment of ...
4
votes
1
answer
167
views
openprocessing.org program - After screen tap, erase red circle, pause and lastly draw new white circle
I am new to programming using the site openprocessing.org.
The code given does the following on my iPad:
Draw a red circle
Wait until I finger tap near the red circle’s center
Erase the red circle
...
4
votes
4
answers
279
views
JavaScript live validation for a registration form
I am working on a blogging application in Laravel 8.
I have added "live validation" to the registration form with JavaScript. For password strength, I use Zxcvbn.
The registration form ...
2
votes
1
answer
110
views
Locate \r\n\r\n in a HTTP POST request (Uint8Array)
The requirement is to split the headers from the request body, most efficiently.
Possible approaches I have employed and/or considered
Decode to text, match ...
2
votes
2
answers
150
views
State management patterns in vanilla JavaScript
I am trying to manage state in vanilla JavaScript—without using frameworks like React or Vue. I am also not using state management libraries.
My requirements are:
Reactivity
Time Travel (Undo/Redo)
...
5
votes
1
answer
70
views
Generate Javascript call graph in Graphviz DOT language
I use the following code to create a call graph from javascript file(s). I generate the output in Graphviz DOT language in order to create visualizations of that graph using the Graphviz command line.
...
3
votes
1
answer
320
views
HTML Editor: Online HTML Editor with Real-Time Preview (version 6)
Overview
HTML Editor is a web-based HTML editor designed for web developers, designers, and learners. It offers a lightweight, minimalist environment for writing and previewing HTML, CSS, and ...
0
votes
0
answers
62
views
Sandboxed, block scope for evaluating user code
I'm working on a modeling app and want to provide block scope for evaluation of user entered code. I'm assuming that the user is not malicious, but error prone, like all of us. At the same time, I ...
1
vote
1
answer
124
views
React TODO list component
The code makes unnecessary API calls because there are two useEffect hooks that both fetch data. The first useEffect runs on mount and fetches data for page 1, while the second useEffect runs whenever ...
4
votes
2
answers
101
views
better-SQLite3 and JS/Next.js - updating data using "transaction"- shorter / better code?
I am pretty new to SQL databases and in particular to the better-SQLite3 database. I have managed to insert, update, and delete data in a way I desire. All of it running in the background of a self-...
6
votes
1
answer
161
views
Dynamic image gallery with filters pulling from a JSON file
I have an image gallery of old internet banner ads that pulls URLs and metadata from a JSON file and then displays them based on a set of user-selectable filters. The filters can show/exclude images ...
6
votes
3
answers
861
views
Collision detection of two rects with rounded borders
I wrote an algorithm how to detect the collision detection of two rects with rounded borders (the code was written using TypeScript but I tried to name things as clear as possible to code be readable ...
5
votes
1
answer
166
views
Simple autoplay JS slider advice
I made a simple vanilla JS slider for a recruitment task. It works well, but I would be a lot calmer if someone could review it or push me in the better direction. Task is to create a banner with ...
-3
votes
3
answers
191
views
Concise way to validate all 5 conditions [closed]
In this code, I am validating whether one is filling the username, password, first name, last name, and gender. However, the way I am doing it is that I have separate ...