Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
3 votes
0 answers
417 views

Mern stack app on error handling, async await, try-catch and avoiding DRY in controller functions

I'm looking for a review of my backend code on how to keep it more DRY. I see a lot of repetition in validation part of email and password, also I need some advice on if I have used the try-catch and ...
-1 votes
1 answer
198 views

Test the log in functionality of a web page with incorrect credentials [closed]

I'm new to playwright, so I'm unsure if this is the correct or best way to go about testing. I basically want multiple tests on the same webpage. I've been able to successfully accomplish this using ...
1 vote
1 answer
69 views

Convert filter button from plain Javascript to Jquery

I have the following function written in JS: ...
1 vote
1 answer
148 views

First big project using vanilla js and pure css

If i can get a some reviews and suggestion on the code it would be highly appreciated. ( Please check the flowchart i've created first https://github.com/chetinn/Memory-Map-JS/blob/main/Memory%20Map%...
4 votes
3 answers
2k views

Increment counter on button click

I've written a simple JavaScript function to increment a counter after clicking on a button. Here's my code: ...
2 votes
2 answers
263 views

React component which uses another component for rendering

Having this React component: ...
2 votes
1 answer
943 views

Basic quiz game in HTML and JavaScript

I wanted to know whether this approach is correct or not for a basic quiz game. I have not used object oriented programming style, Defining the quiz questions as array elements and looping through the ...
10 votes
1 answer
3k views

Check for balanced brackets in JavaScript

Rules: You should create a function that receives a string with brackets, parentheses, or curly brackets, an example: test('{A}') The function must check that the ...
2 votes
0 answers
35 views

"Github contribution"-clone made with VueJs. Any logic improvements?

I took a shoot at writing a Github contribution clone using Vuej, tippy.js and tailwindcss. Githubs looks like this: My working clone looks like this: Its not an exact look-a-like but im getting ...
3 votes
1 answer
44 views

Generate total property sold for given postcode

I had to implement the below as a coding challenge. There are two http endpoints. The first http endpoints returns a list of postcodes. The second http endpoint takes a postcode as a parameter and ...
-2 votes
1 answer
66 views

Reducing complexity and making it more readable [closed]

I have this NodeJS code which I need to Reduce complexity and making it more readable coz it has to many repeatable loops, and the api is very slow how do i fix this. ...
2 votes
0 answers
42 views

Reactive objects, like in vue

I like the reactivity of vue and created a function that makes Object's reactive. Just like in vue 3 .reactive I wonder if my ...
3 votes
1 answer
131 views

How can I condense my code in node.js for sorting unique values within an array?

Kattis problem - ("I've been everywhere") I would highly recommend looking at the problem through the link, however I will summarize it a bit here and explain the functionality of each part ...
0 votes
1 answer
73 views

Convert strConflictedYesReviewers data into a single object which is grouped by ownerid and make array of opportunityid

I get a dynamic string(strConflictedYesReviewers) which contains multiple user recordswhere each record is separated by semicolon and then each record represents ownerid and opportunityid separated by ...
1 vote
1 answer
200 views

Terminal War Game

First I would like to thank everyone for whatever help you may offer me. In full disclosure this is a project for a bootcamp class I have. My problem is, and I've asked them about this, that they aren'...
0 votes
1 answer
90 views

Ajax to load data for company products without refreshing the page

I am using AJAX script to fetch data from a database. For example, it has Motorola Samsung Apple as company and I use AJAX to fetch models of it, so that when Apple is selected then it shows Apple ...
0 votes
1 answer
61 views

AJAX script to load data for mobile phones from table

Am using AJAX script to have data fetched from database. For example has Motorola Samsung Apple as company and using AJAX to fetch models of it. Like when apple is selected then it shows apple ...
1 vote
1 answer
241 views

Chrome bookmarklet to expand examples elements on a dictionary webpage

I created the following Chrome bookmarklet to open all elements with text Extra Examples boxes on this page. For example - the element labeled with text Extra Examples below can be clicked: When it ...
0 votes
2 answers
170 views

simple countdown to halloween project

I just started to learning JavaScript and i did this below code for a simple countdown to halloween project ...
2 votes
2 answers
251 views

How to handle optional date parameters?

When creating a function to be reusable throughout the project I came across something strange. After looking at this function it looks very much like it could be refactored. The function should only ...
2 votes
1 answer
7k views

Filtering array of nested objects

The following code is producing the desired output but I'm wondering if there's a way to accomplish the same result by applying .filter() to ...
4 votes
3 answers
2k views

Quadratic equation solver in JavaScript

The task is to implement a solveEquation function, which solves the Quadratic equation. Each equality has exact 2 integer solutions. Return those numbers as an ...
2 votes
1 answer
1k views

Text notifications for Facebook Marketplace posting

Application Summary I received a call from a client asking for a "simple app" that notified him via text message whenever a "Jeep Wrangler" is posted to Facebook Marketplace. It ...
5 votes
5 answers
17k views

Optimizing a nested for loop over JS array of objects

NOTE: I'm bringing this question up in code review rather than stack overflow since I already have a working solution. I just am looking for ways to do it better. I have two arrays. One is an array of ...
1 vote
2 answers
195 views

Implementation of aho corasick algorithm - slow suffix construction

EDIT: Dequeu was the correct guess EDIT: I did the BFS method for the suffix link/output link construction I'm doing a hackerrank challenge and I came up with this implementation of the aho corasick ...
5 votes
1 answer
285 views

Function to format time, from seconds to a particular expresion

From an integer X representing a time duration in seconds produce a simplified string representation. For example, given X=100, you should output: "1m40s" Use the following abbreviations w,d,...
0 votes
2 answers
108 views

Is this a watertight javascript sandbox?

I am making a sandbox environment for javascript. For this I create a webworker with this function: (self is a webworkers global context) ...
2 votes
2 answers
289 views

Is this JS Widget written correctly and production-ready?

I created a JS widget library for distribution purpose on external websites and would like your thoughts on it. What widget does: It adds an always visible text on the screen. When user clicks on ...
1 vote
1 answer
54 views

Javascipt non stackable level generator

My task was to create a function that returns the level of a user. A user has a certain amount of XP. Each level is level * 10 xp so for example level 1 would be ...
5 votes
1 answer
794 views

Flash embed angular directive

I have an app that uses HTML5 video and our customer still needs to support IE8 - Gross. Anyway, I came up with this directive in AngularJS for embedding a SWF object for when I need to fallback to ...
0 votes
1 answer
419 views

Using localStorage to set and get values for date fields

My input fields for the dates are not saved when the User presses the submit button. The page reloads and the values for the input fields are empty. So I'm using localStorage to save the values when ...
2 votes
2 answers
205 views

Extracting records of type "withdraw_rewards" from a multi-level data structure

Re-posting from StackOverflow as this is a place to review code that is already working. I would like to know if there is a better way to deal with nested forEach ...
2 votes
1 answer
165 views

Building HTML in JS and append

I am working on this project where I need to building html from this object. There a a lot of loops and counter and wanted to see if there is a better way to do this Any suggestions/comments are ...
2 votes
1 answer
137 views

Finding the 4 squares that sums up to a given number

I wrote this algorithm in JS with the main goal that it will give an answer for 10^750-10^1000 in 2-3 seconds but it solves 10^150 in 2-3 seconds so I am a little far from my goal, the problem is ...
0 votes
1 answer
389 views

Calculate multiple form field values as you type

I'm making a down payment form where the user enters a purchase price and can then enter the amount they want to pay as a down payment as either a dollar amount, a percent down or by using a range ...
0 votes
3 answers
74 views

Filter the array of values from array of another value

I am doing the filter declaring a final array. it seems that the codes are much. it can be shortened? code : ...
1 vote
1 answer
4k views

Answer checking script

I got this basic script which I'll be using to check if the answer is right. The only problem is that I'll be using with many forms. That's why I need this code to be more like DRY code. ...
2 votes
2 answers
112 views

Find differences between two arrays

I have to identify added and deleted items between two objects with the same structure. ...
0 votes
1 answer
85 views

Build JS object that will be pass into the Handler [closed]

I am working on a web page where I am creating a JS object using {} and []. This object is passed into a handler. I wanted to see if there is a better way to create the object in JavaScript My logic ...
5 votes
1 answer
612 views

JavaScript function to create 2 soccer teams as even as possible, from a list of players

? Given a list of players with their respective scores (how well does a player play soccer, from 1 to 5 points), return two teams that are as even as possible. I've created this code, which is a ...
0 votes
1 answer
167 views

Random music plays when one stops

I have this script and I want to ask if it's good/optimal and if it's not how should I change it? What it's doing is when the website loads music, it starts to play when the user clicks prevent play() ...
3 votes
1 answer
237 views

Responsive Navigation with hamburger menu

This script creates a hamburger menu when the window is resized. It will also create a sticky navigation when the window is scrolled down, which will also create a hamburger menu when the window is ...
2 votes
1 answer
817 views

jQuery code to add / remove classes depending on the button clicked

What the code does What the JQuery code does is add / remove classes on div's elsewhere on the page, depending on the button clicked. Button 1 clicked → add class ...
3 votes
1 answer
645 views

Client side Pagination implementation in vanilla js

I have made this Pagination Class in JS which takes the following configurations :- Total records Records per page Visible pages The idea is simple that any instance created using this Pagination ...
9 votes
2 answers
6k views

"Block a website" script with vanilla JavaScript

I use this script to block access to a one or more websites with vanilla JavaScript. I find that it helps me avoid some addictive news websites that make me depressed. (Credit to Marat Tanalin for ...
2 votes
3 answers
2k views

Box Blur algorithm

This is a challenge from CodeSignal. For image = [[1, 1, 1], [1, 7, 1], [1, 1, 1]] the output should be ...
7 votes
3 answers
2k views

Wordle color algorithm in JavaScript

A lot of Wordle clones get the tile-coloring algorithm wrong: for example, if the word is BURNT and you guess TOAST, the colors should be ----G (not Y---G) if the word is MAXIM and you guess MAMMA, ...
2 votes
1 answer
34 views

Sort events by order-process stage, and modify the "entry" field

I have a map with the following data ...
3 votes
1 answer
76 views

I made a webpage that simulates sharks eating fish in the torrid world of Wa-tor

I've been self-studying HTML/CSS/JS. I read about Wa-tor. It's a population dynamics simulation which simulates fish and sharks breeding and predating. This seemed cool so I decided to implement it....
0 votes
1 answer
108 views

Creating custom setTimout function using requestAnimationFrame loop

I created a function using requestAnimationFrame loop that works pretty much like the plain JS setTimeout function (except that ...

1
6 7
8
9 10
188