Questions tagged [javascript]

JavaScript is primarily a language focused on web development. Being a monopoly on the front end and having Node on the back end. 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.

Filter by
Sorted by
Tagged with
1 vote
0 answers
20 views

Custom React Hook For Using Web Socket

I am aware that there are packages containing custom React hooks for web sockets, but since I am learning React I tried to create my own. My intention was to create a custom hook that connects to my ...
muell's user avatar
  • 111
1 vote
1 answer
31 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
  • 11
1 vote
0 answers
74 views

Modernized Javascript randomULID() Generator - Smaller and Optimized

I've finally finished these 2 scripts and would like to get some feedback. Seeking feedback on a modernized ULID (Universally Unique Lexicographically Sortable Identifier) generator in Javascript. ...
suchislife's user avatar
1 vote
2 answers
61 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 ...
Alex Q's user avatar
  • 13
1 vote
1 answer
18 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
1 answer
54 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
2 answers
105 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
0 votes
0 answers
30 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
2 votes
1 answer
73 views

An extended JavaScript plugin for rendering radial pie charts

(This post is the continuation of A JavaScript plugin for rendering radial pie charts.) Now, you can mark up the radial pie charts via XML: index.html: ...
coderodde's user avatar
  • 27k
1 vote
1 answer
47 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
2 votes
0 answers
66 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: ...
coderodde's user avatar
  • 27k
1 vote
0 answers
43 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
  • 11
0 votes
1 answer
36 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
1 answer
63 views

Solving round number in JS by using String

Whatever language you choose, you may encounter a rounding problem. In fact, this is due to the limit of the required number of bits needed to get the right number after a calculation. Simple example: ...
Sébastien Josserand's user avatar
2 votes
0 answers
41 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
1 answer
43 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 votes
1 answer
124 views

Random number generator

Util functions to generate random numbers with upper bound or with both upper and lower bounds: ...
user avatar
1 vote
0 answers
63 views

Partial Function Application in JavaScript

I'm trying to make a partial function from any function. Here is a working example: ...
Miroslav Popov's user avatar
2 votes
1 answer
47 views

Session-based authentication using Express.js

I'm currently learning Express.js and I wrote this authentication code. I'm unsure if what i have is correct, how to improve it and if it's secure. For user and session data storage I'm using ...
Krneki123's user avatar
1 vote
0 answers
41 views

Calculate total running time for movie series

Which of these 2 functions is better and more readable and why? (Both functions do the same thing). My goal is to get the total time of a series, using the TMDB API (which has a limit of 20 different ...
jofyavoydo's user avatar
1 vote
1 answer
47 views

Click temporization on user interface elements

Implementation to accommodate different behaviours based on the frequency a user interface element is clicked. It supports number of clicks and number of clicks in a time frame. ...
user275176's user avatar
3 votes
1 answer
46 views

JavaScript front-end 'Library App' implementation from the Odin project

I am currently working through the Javascript portion of the Odin Project curriculum and have completed the library app project. As far as I can see everything is working as expected and I have ...
Daria's user avatar
  • 33
1 vote
2 answers
74 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
1 vote
1 answer
141 views

Minesweeper game with HTML & CSS & JavaScript

I made a Minesweeper game using HTML, CSS and JavaScript and would like to ask for advice and feedback specifically on the code. Here are some questions to review: Is the use of HTML semantics ...
Lucio Mazzini's user avatar
0 votes
0 answers
27 views

Modala creates website from nested JSONs

My question pertains to the style in which I've written this function. Is there anything else I can do, to create a better resolution for user when they create a template from their JSON modal? This ...
thexiv's user avatar
  • 11
1 vote
0 answers
45 views

Memory game code quality

I am making an incremental-memory-game similar to this https://www.crazygames.com/game/incremental-memory I am not very satisfied of how spaghetti this code is. I am trying to learn to improve my code ...
jerma lover1's user avatar
0 votes
0 answers
52 views

small app with bad practices on node.js and vue.js

Can someone help me to understand and give me code review of my small todos APP, why my code in backend is bad? Also give me a answers for some of my questions, please: Where my code is bad? Where do ...
Олег Лазорик's user avatar
0 votes
2 answers
88 views

jQuery + PHP Form Submit and Refresh

Code below successfully processes and submits data to database. Is there anything else that needs to be included / considered? PHP (note-process.php): ...
Mark's user avatar
  • 9
1 vote
1 answer
156 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
  • 113
3 votes
1 answer
141 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
41 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
  • 341
0 votes
0 answers
24 views

An Array of x Elements, Max Entry = y, Total of Elements = z

In working on something else, I have come across this little brain-burner. I want to return an array of all the arrays that satisfy this. There are elArr elements ...
Rewind's user avatar
  • 115
2 votes
0 answers
55 views

Detecting when a user stops typing

I wanted to detect when a user stops typing. I encountered this answer from SO (Not the selected answer, but the second one which seem to be better): https://stackoverflow.com/a/5926782/17746636 But I ...
pileup's user avatar
  • 341
0 votes
0 answers
39 views

validating user input strings to execute in Javascript as safe/sanitized

I would like to give users the ability to enter formulas which will later perform calculations with a small number of variables in scope. While use of ECMAScript's ...
Brent's user avatar
  • 171
0 votes
0 answers
47 views

Simple Javascript Element width and height Resizing

For learning purposes and maybe later on implementing it in React, I made an event system that responds to mouse event to allow element resizing, both in width and height. For now is just Vanilla JS ...
Minsky's user avatar
  • 239
0 votes
3 answers
53 views

Find an object based on substring value

...
user274262's user avatar
1 vote
0 answers
26 views

Storage manager which creates super simple API to talk with chrome storage

Here's some background information: I was working on a Chrome extension called Netflix Hotkeys (you can find it here), and I realized that I needed a persistent storage solution for storing user ...
Kunal Kamble's user avatar
0 votes
1 answer
77 views

Create and store the level data for a remake of Super Mario Bros game

I am trying to remake Super Mario Bros. in JavaScript and I am trying to figure out if there is a more efficient/shorter way to create and store the level data. I have created 1-1 and here's what the ...
Jake Miahn's user avatar
0 votes
1 answer
97 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
  • 9
0 votes
0 answers
16 views

Tampermonkey Note Taker for Google Docs Version 3: Part 2

Previous Versions of this Question: V1 V2 V3 P1 OK. Now I need some help with the testing. I have done my best. But there must be a better way. I am writting regular expressions to extract ...
Martin York's user avatar
  • 93.8k
0 votes
0 answers
21 views

Tampermonkey Note Taker for Google Docs Version 3: Part 1

Previous Versions of this Question: V1 V2 OK. Not much response on the previous questions (but it was a lot of code so that may have effected it). I have quite a lot of changes since then so worth ...
Martin York's user avatar
  • 93.8k
3 votes
1 answer
141 views

Accurate countdown timer

I modified a code from for an accurate timer from Stack Overflow to create a countdown timer: ...
pileup's user avatar
  • 341
1 vote
0 answers
32 views

Tampermonkey Note Taker for Google Docs: Version 2

First version of code here: Tampermonkey Note Taker for Google Docs. I think I have made it better by splitting on the "StorageInterface". Code ...
Martin York's user avatar
  • 93.8k
2 votes
0 answers
63 views

Tampermonkey Note Taker for Google Docs

Intro: Need some feeback on my Javascript (I mostly do C++). Purpose: I find google docs hard to organize in google drive (it takes more effort than it should). So I started created "note" ...
Martin York's user avatar
  • 93.8k
2 votes
2 answers
169 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
35 views

String iteration algorithms performance in jQuery Terminal

I have a JavaScript library jQuery Terminal and I have internal formatting that is used to change colors and style of the text that look like this: ...
jcubic's user avatar
  • 238
0 votes
0 answers
34 views

JS script to allow front-end users to change the number values in the given table using the prompt

I am running a web application with a price table that would allow front-end users to bulk add the distribution markup to the items prices and then select a different currency by clicking the ...
Vicardo's user avatar
0 votes
2 answers
70 views

Palindrome test in JavaScript function

I hope you will tell me tips to ask good questions regarding checking my code. Here it's the code and thanks in advance! ...
Mohammad Abbas's user avatar
4 votes
1 answer
166 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
2 votes
1 answer
86 views

Recursive Factorial Calculation in JavaScript

...
TAHER El Mehdi's user avatar

1
2 3 4 5
193