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,398 questions
-3votes
0answers
32views
Telegram Technical Support bot [closed]
After turning on the bot for the first time and entering the /start command, it starts spamming the welcome message and does not respond to other commands. ...
3votes
1answer
147views
Bulk Text Replacer
I have created a simple text editor with a "replace all" feature. It's meant to be part of a larger project, so it needs to be robust and work reliably across various scenarios. Please ...
0votes
0answers
38views
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 ...
5votes
1answer
242views
Parsing Markdown with bare hyperlinks: Hoping to find a way to workaround the "noscript" workaround
The following example shows how to use markdown-it to parse and render Markdown. It works, but there is a dirty trick there, which I absolutely don't like: to ...
1vote
1answer
64views
React 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 ...
4votes
1answer
114views
Checking that GEE code correctly computing distance to nearest bright pixel using tiff data
I'm using Google Earth Engine (GEE) to calculate the Euclidean distance from sample points to the nearest brightest pixel above the threshold value "avg_rad > 10" in nighttime light data. ...
4votes
2answers
71views
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-...
1vote
1answer
69views
Pomodoro timer with notification popup [closed]
I have this code that I feel like could be done more efficiently; is there any way i could fix it? I'm trying to make a pomodoro timer with html,css and javascript and i want to add popup ...
6votes
1answer
136views
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 ...
5votes
2answers
153views
Tags selector in plain JavaScript, without using any plugin
I have made a "tags selector" in plain JavaScript, without using any plugin. ...
6votes
3answers
786views
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 ...
8votes
1answer
179views
Automatically trim spaces and remove special characters in HTML forms
We have a web-based customer management application. When copy-and-pasting data into our application, users sometimes enter leading or trailing spaces or special characters (tabs, or even control ...
5votes
1answer
147views
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 ...
4votes
0answers
60views
Vue 2 to 3 upgrade: checkbox form field component
I have a checkbox form question component I made in Vue 2, and I'm migrating to Vue 3 so want to simplify it as much as possible and make sure I've taken advantage of all the new feature of Vue 3. ...
-3votes
3answers
167views
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 ...