All Questions
9,398 questions
9
votes
2
answers
1k
views
Rock paper scissor game in Javascript
I am new to Javascript, and I made a simple Rock Paper scissor game with some basic UI. We can play the game for how much longer we want and can check the score of both computer and our. It's a ...
3
votes
1
answer
47
views
Seeking help for spreadsheet script for making it compact (date recovery from serialnumbers script)
I wrote some working code in spreadsheet scripts, but it's a little bulky and slow. Is there any way to refactor this to be more compact and faster?
I'm a beginner, so I'm happy it works at the moment....
4
votes
4
answers
2k
views
Simple login script with sha256 hashing
I have been using this code for a while. I got it from a tutorial 5 years back. Now I'm wondering if it still is secure, or if it's time to find a new one? Maybe it has never been secure enough.
...
1
vote
2
answers
143
views
JavaScript Fifteen
Made fifteen in JavaScript. I would like JavaScript programmers to point out my mistakes.
My code works fine. I made fifteen using a two-dimensional array and a one-dimensional array. The function for ...
4
votes
1
answer
99
views
Page scroll marker user script
I recently recalled having a "scroll mark" feature, that is, a line that would show up when hitting the space bar in the Opera browser? There used to be a Greasemonkey script for Firefox, ...
5
votes
2
answers
356
views
Full Promise implementation
I have attempted to implement the native Promise object provided by the browser in JavaScript. The code is pretty easy to understand. It supports most of the promise functionalities, such as chaining, ...
3
votes
3
answers
150
views
Efficiently generate a random position inside an outer rectangle but outside an inner rectangle
It should be a uniform distribution (ie: every point is equally as likely). I also don't want to use the simple solution of: "in a loop check to see if the current generated point is within the ...
4
votes
1
answer
453
views
Credit card number formatter
How to make my script shorter and better? This code allows only digits, auto-format card number like this XXXX XXXX XXXX XXXX. If the user hits delete or backspace to delete space in between digits, ...
1
vote
2
answers
109
views
A simple performant factorial function
I am new to algorithm and data structure. After a little introduction to the topic, I have decided to implement a function called calculateFactorial, which takes an integer and calculates its ...
2
votes
1
answer
134
views
Ecommerce site shipping data
I have a REST API using the Laravel framework and the front-end uses the Vue.js framework. It is a dashboard for an e-commerce store where you can connect to a post shipment service API to upload ...
1
vote
1
answer
162
views
A web page for running AI vs. AI Connect Four matches with selection of algorithms and search depths
This time, I have prepared this page where a user may select what AI bots will be run in the game of Connect Four. The entire repository is here.
Code
index.html:
<...
1
vote
1
answer
66
views
Buffered source of HTMLElement(s)
Temporary storing the element(s) returned by document.querySelector and document.querySelectorAll methods could improve ...
3
votes
1
answer
395
views
Event sourcing javascript implementation
An event source built around an observer design pattern implementation…
...
7
votes
1
answer
372
views
Working with images in multiple formats
I've been doing some research around how to best make use of the WebP images (with fallback) in React. Most solutions point to something similar to what I've written below. That means if I have a lot ...
1
vote
2
answers
58
views
Calculating the total value of an invoice with precision
I have written some functions to calculate the total cost of an invoice, gives its line items. Could someone please tell me if there seems to be a problem with the code? Since it is something as ...
1
vote
1
answer
54
views
Negamax AI for playing Connect Four against Alpha-beta pruning AI in Javascript
The working page is in GitHub.
Introduction
This time, I have two AI bots playing Connect Four against each other. The first AI bot uses Alpha-beta pruning, and the other one uses a Negamax with Alpha-...
2
votes
0
answers
47
views
Connect Four AI vs. AI match in Javascript
This time, I have a Javascript program that runs a Connect Four match between two Alpha-beta pruning based AI bots. (See this page.)
ai-battle.html:
...
1
vote
1
answer
73
views
Extract each occurrence from an array of objects
I have a huge list of 4k+ software products.
My goal is simple. I have a list of products. Each of those products has a software value. I would like to extract each software occurrence and covert it ...
4
votes
1
answer
595
views
HTML Editor : online HTML editor with real-time preview
Note
Please review the new question and ignore the following.
Overview
HTML Editor is an online HTML editor with a minimalist approach. Edit your HTML, CSS, and JavaScript code and monitor the ...
3
votes
1
answer
56
views
Creating an API secured only by the request signature
I'm trying to create an API that will receive requests from users without having to do a login request. They will just have a user id and a key. My intention is that they will use the key to create a ...
6
votes
2
answers
741
views
Lotto Number Generator - Javascript
Newbie to Javascript here and just practicing by making a random Lottery number generator. I am practicing by building simple, achievable projects.
The aim of this project is to make 10 lines of 6 ...
1
vote
0
answers
87
views
comment-monk - Comment hosting script for static blogs and websites
So few days ago, I had created another review request for sqlite database schema for a comment hosting system.
Now that the app development is complete, I have pushed the initial version on github. As ...
1
vote
1
answer
55
views
Listening to bootstrap 5 events in a vuejs application
Starting out with VueJS, making a small fun project. The project is a simple static portfolio website, with a navigation bar at the top and a bootstrap scrollspy, jumping to the different sections (I ...
2
votes
1
answer
58
views
Combining multiple regexps using the `|` operator and grouping the regexps by their flags
I've implemented a function that creates a multiple regular expressions predicate. The idea behind the predicate is combining regular expressions using the disjunction operator ...
8
votes
2
answers
350
views
Usability of API to declare modules in JavaScript
As a JavaScript developer, I want to write modules in a format that is well supported today and that will still work in five years.
I designed an open-source library to this end, scope or not, with ...
15
votes
5
answers
2k
views
Javascript Syntax-Highlighter for Java
Project
I wanted to create a syntax highlighter for Java using JavaScript, HTML and CSS. It uses regular expressions to find the parts that should be highlighted (at the moment: keywords, strings, ...
9
votes
2
answers
340
views
Follow-up: Javascript Syntax-Highlighter for Java
Background
The basics of this project have already been discussed here.
I've improved the following things:
Sᴀᴍ Onᴇᴌᴀ mentioned that I shouldn't use multiple elements with the same id. I corrected ...
12
votes
1
answer
485
views
Resizable containers with VueJS
A month ago I reviewed the code in Resizable split DIVs Vue.js, suggesting that the OP use computed properties and bound styles to simplify the code (at least reducing the need to use ...
21
votes
6
answers
4k
views
Find the longest word's length
The challenge is simple:
Return the length of the longest word in the provided sentence.
The solution is just as simple:
...
1
vote
1
answer
81
views
Sprinkler effect
Developed around visibility CSS property and HTMLElement#offsetHeight and ...
1
vote
1
answer
79
views
Calculate Prime Number using web workers and Web storage in HTML5
Take a number input (less than 100) from the user and save it to the web storage. Create a web worker to increment the number till it becomes prime. Provide two buttons of 'Start' and 'End' to start ...
3
votes
1
answer
45
views
3
votes
2
answers
103
views
A rock-paper-scissors game using HTML & Javascript
I have created a pretty simple rock-paper-scissors game that uses event listeners and manipulates the DOM. I would appreciate any constructive feedback. Whether it is readability, variable names, ...
3
votes
2
answers
94
views
Optimizing a Function to Check Pronic Numbers in JavaScript
I've written a function in JavaScript to check whether a given number is a Pronic number. A Pronic number, also known as an oblong number, rectangular number, or ...
3
votes
4
answers
18k
views
Getting the index of a character within the alphabet
I've made this function to map alphabetic coordinates to their corresponding ordinal number.
...
2
votes
1
answer
71
views
Automatically extract useful cars from car site
I am using puppeteer to extract data and see when a car that meets my requirements shows up, this is what I did so far. I would like some basic syntax advice, or more advanced tips as well.
I tried to ...
4
votes
2
answers
63
views
Optimizing a Function to Generate a Row of Consecutive Odd Numbers in a Triangle
I've written a JavaScript function that generates a row of consecutive odd numbers in a triangle. The triangle looks like this:
...
7
votes
4
answers
781
views
HTML Editor - online HTML editor with real-time preview
Note
Please review the new question and ignore the following.
Overview
HTML Editor is an online HTML editor with a minimalist approach. Edit your HTML, CSS, and JavaScript code and monitor the ...
3
votes
0
answers
60
views
Polyfill for a legacy system: Attach "labels" to their corresponding checkboxes
I had to do some maintenance programming on a legacy software recently.
Most of the system's logic is done with Java and PL SQL.
The Java creates some special kind of XML. These XML is then ...
1
vote
1
answer
64
views
Showing the current view-position within the web page
I've made this coding for large web pages with lots of text, images etc. If the user scrolls down or up it shows where the current view approximately is. In relation to the overall document height.
I'...
1
vote
1
answer
45
views
Attach / detach navigation bar depending on scrolled position of the document
The idea is the following:
I have a large text with a header upon it and a navigation bar. The navigation bar is located between header and text.
If the user scrolls downwards then the header-part ...
5
votes
1
answer
123
views
Developer-tool: Creates large arrays with random-strings for testing-purposes
I've made this developer-tool for my own use. Perhaps for colleagues too.
Currently I'm thinking about enhancing it. So that different data-types could be chosen.
But before that I like it to be ...
0
votes
0
answers
48
views
Convert CSS-styled HTML to Word file without a server
I am building a non-jQuery port of jQuery-Word-Export, which is to my knowledge the best tool to convert CSS-styled HTML to a file that can be opened, edited, and saved on Microsoft Word (Windows and ...
1
vote
2
answers
1k
views
Leetcode 55. Jump Game solution
I was working on Jump Game problem on leetcode
Question
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ...
0
votes
0
answers
44
views
How can I make the webRTC and signaling feature code production ready?
I am learning webRTC and tried to implement signaling service through websockets. I am still a beginner in backend development so not sure how correct my code is. Can you please review it and let me ...
3
votes
1
answer
101
views
CPU emulation library
I've started to work on a JavaScript library called vCPU with the purpose of providing a framework for emulators. vCPU is designed to be able to emulate multiple types of CPUs, with setup only ...
2
votes
0
answers
183
views
Optimizing Performance of SAT Collisions
I've implemented a Collison Manager using the Separating Axis Theorem (SAT), and I'm looking for suggestions to enhance the performance of the Minimum Translation Vector (MTV) calculation. The ...
6
votes
5
answers
477
views
Fill missing data in between available data with default value
My raw data has values on some random times:
const rawData = [
{hour: 3, value: 3} ,
{hour: 5, value: 9} ,
{hour: 10, value: 5} ,
] as const
I would like to ...
4
votes
3
answers
198
views
Get the contents of a table cell for all selected rows
I have a table of user info. When you click the button, I want to get the email address from each selected row, output into a comma-separated string.
I got it to work with the following code, but I'm ...
4
votes
1
answer
96
views
rock paper scissors game in console
I've made a simple rock paper scissors game using javascript. Any feedback appreciated. This is a first project I've done with almost no help
...