Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [javascript]

ECMAScript or ES (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms as stand-alone interpreters or JIT compilers. Use this tag for questions regarding all versions of ES up to the current ES8 and its dialects / implementations: ...

-1
votes
0answers
4 views

Scaling issue for Server Sent Event with concurrent users over 10K

I am planning to user SSE to receive breaking news notification on my news website. It is build on Wordpress with PHP 7.0. I found that compared to ajax pooling SSE is a very good option to display ...
0
votes
2answers
29 views

Javascript/Jquery 3 way toggle show div [on hold]

The idea is to have 9 unique cases, that will come from combinations of my buttons. We have 2 groups of buttons. The combinations will display a box, and hide the others (we have one box for every ...
1
vote
0answers
32 views

Simple jumping game: continue with jquery or switch to html5 canvas?

I'm coding for fun with the secret ambition of making a fun little game for mobile. So I started out building this little jumping game with Javascript and jQuery. The game relies heavy on css ...
5
votes
1answer
56 views

Simple way to show popup

After small research I found following informations: In this closed question I found some solution which not works good when pop-up has height bigger than screen (and some jquery solution). Here is ...
3
votes
1answer
27 views

Implementing Passport authentication with promises

Here is code implementing Passport authentication with a Google Strategy. It uses Mongoose to store and retrieve user data. You might need to be familiar with both of these technologies to review ...
2
votes
1answer
23 views

Sierpinski’s Gasket Triangle in JavaScript

I wrote the Sierpinski’s Gasket Triangle in JavaScript, but I feel the code can be better, especially from L32 to L47. Could you make it more organized? ...
4
votes
2answers
32 views

MaxHeap implementation in JavaScript

Here is MaxHeap implementation in pure JavaScript: ...
0
votes
2answers
40 views

Interactive multiple choice code [on hold]

This isn't so much, HOW do I make it work, as this code works, rather how could I make it better. The way this code works is it guides a person to the correct answer by getting "Yes", "No" or "I don't ...
2
votes
1answer
59 views

This technique for functional programming, and testing functional programming

I've been playing around with functional programming and testing with jest recently. An issue I've run into, is that it's hard to mock ES6 module exports directly. See this Stack Overflow question ...
0
votes
1answer
33 views

Tile and grid abstraction

This question is a small subset of the problem I am trying to solve. I am trying to learn to break problems into better abstractions. The original problem I am trying to solve is: Write a JS ...
-1
votes
0answers
15 views

Is using callback here bad? [on hold]

Hello everyone can i have some feedback with this code?, i'm passing in an object to the callback since i don't want to pass something like this reply(null, {data}) ...
1
vote
0answers
57 views

Controller method to add a folder to a tree

I am using the jstree to get a tree structure in my MVC application. I am actually on showing javascript errors, when something is wrong. In this case, returning an alert to Javascript. Furthermore I ...
-3
votes
0answers
16 views

JavaScript Code Construction for recording Node Tree Changes [on hold]

I have a node tree structure that renders database information in the browser using vis.js - see this. I won't use the actual table entities, but suppose it's something like: ...
-5
votes
0answers
19 views

Yatzy JavaScript [closed]

Need help if anyone could help me with the following in JavaScript Depending on how many sexes you've hit, convert it to the following answers ...
5
votes
2answers
86 views

Replace anchor tags with spans, and place the href attribute into the span

I'm required to perform a slight conversion on a string which contains html. The conversion should transform a elements such that they become ...
0
votes
1answer
36 views

Custom indexOf for strings javascript with regex

I was wondering how efficient my code is creating custom indexOf for strings in JavaScript using regex instead of looping with a for statement the whole way in most ...
2
votes
1answer
27 views

Chart of answered CR posts percentages over time - Part 2

I created a graph to show the change in the percentage of questions answered over time and the first version fetched data from chat transcripts using PHP. The sub-domain I have registered for my ...
-2
votes
0answers
18 views

JavaScript basic dice (help) [closed]

Hey I need a basic solution to this task if anyone can help me by using JavaScript. a. First, the score for each dice is written (i.e., 5th prints) b. Count the number of sexes and store it in a ...
-3
votes
0answers
17 views

On click automatically draw rectangle on the SVG Map [closed]

I tried an example of drawing circle in SVG map but i want to draw rectangle and i am unable to do it. My task is to select one of the rectangle of particular shape from left panel and goto map and ...
2
votes
0answers
37 views

Event Calendar in JS, CSS, and HTML

I repeated a lot of code here and I'm trying to use more ES6 but I'm not sure where I should have used it in my code. I'd appreciate any input on where I could improve. GitHub ...
-4
votes
0answers
13 views

It's a leave calendar that takes new employee start employment date and calculates the remaining annual leave that employee is qualified for [closed]

I've spent hours going through this and I feel I am missing simething. Each employee has random annual leave totals somewhere it's broken
-1
votes
1answer
35 views

Recursive loop which returns a value according to a single condition

I have a method that takes as parameter an array of several depth (group) and a name as a string (currentFilterName) ...
2
votes
0answers
45 views

Network abstraction layer for a JavaScript JSON API client

I'm rewriting collection-json.js, a client for Collection+JSON. (Collection+JSON is a HATEAOS API media type built on top of JSON.) My Goals: Remove CoffeeScript webpack UMD so it can be used via ...
4
votes
0answers
42 views

Two player snake game

I created a 2 player Snake game from my original one player version. I am looking for some feedback on how I made it. I think I could use improvement when handling input (...
1
vote
1answer
58 views

My first ToDo list in JavaScript

I'm new to programming and in front-end. It's really hard for me to learn good practices. Right now I'm trying to learn javascript basics and bootstrap in addition. I did mine first ToDo list with ...
0
votes
0answers
16 views

Fibonacci-Counter implemented with React-Redux

After learning the basics of React-Redux I've made an app to familiarize myself more with the concepts. It's a counter which counts-up the Fibonacci-Number. Here's my code: ...
0
votes
1answer
43 views

Sleep and prolong sleep

What do you think about such an object function? ...
-2
votes
0answers
21 views

JavaScript simplify RegExp [closed]

I've this working RegExp in my JavaScript file: ...
0
votes
0answers
16 views

Wrapper to translate SOAP requests in to RESTFul API calls

I recently had a build a wrapper to translate SOAP requests in to RESTFul API calls to our server and return the results to the requester. Request SOAP -> nodejs wrapper / convert to RESTFul -> ...
-3
votes
0answers
18 views

Is there a vulnerability if users are allowed to call any URL from your hosted website? [closed]

I am developing a website in which one functionality allows users to give any URL which will be then converted into ajax request and called. This can happen through GET or POST methods but only ...
3
votes
2answers
72 views

Data formatting, splitting objects & deleting key's/values

I am quite bad at data manipulation and after a lot of time I was finally able to get it working how I wanted. The thing is I don't like all the delete operations, I think the code can be a lot ...
0
votes
0answers
15 views

Using mobx for a trivial singleton

I'm very new to mobx and unsure, how to use it properly. I'm used to OO, so I prefer using the class keyword and I found myself writing the following singleton ...
3
votes
3answers
100 views

Showing statistics of popular JavaScript frameworks from GitHub API

I am currently working on a simple app to check the stats of popular javascript frameworks. For this I am using the Github API to get certain data sets and have come close to finishing my project. <...
1
vote
0answers
22 views

A Ruby on Rails controller and JS code to add labels to products, like Gmail's labeling tool

My friend asked me to write a tool that lets users bulk add/edit labels (taxons) to store (spree commerce) products. I came up with this, curious to know if you guys find the code readable/...
0
votes
0answers
48 views

HTML CSS Javascript Index page

I think I've written myself in circles and am bodging elements to get them to work rather than understanding how the page and elements should work together. I've used contrasting colours in each of ...
4
votes
2answers
70 views

Count characters in a string

This code is supposed to count each character in a given string and account for error handling and type casting as well, and it should do it in the most efficient manner possible, with O(n) being an ...
0
votes
2answers
40 views

Simple cube that moves around the container with keys

I made a basic cube that can move around of container and jump too. It's basic but I want to know if I can use better methods, better formatting, or shorten the code. This my HTML: ...
1
vote
1answer
39 views

Request rate limiter

I'm looking for feedback on ways to improve the maintainability and readability of my code. I'm especially interested in hearing about ways I could improve the code's adherence to good object ...
4
votes
3answers
65 views

Take a limited number of items from a potentially infinite generator

Hypothetically, I have a bunch of generators that never end, like: function* progression() { let n = 0; while (true) { yield n++; } } I want to take ...
1
vote
2answers
35 views

Wireframe animation on canvas is slow

I'm recently working on a project that involves animation in the background. It works well on desktop but performance drops drastically on mobile. I'm using Paper.js to import a svg and animate it. ...
0
votes
0answers
34 views

Find if characters in string are present in another string

I need to match if the characters in a string are present in a haystack with following conditions: If match string has repeated characters, haystack must contain multiple characters. In case of ...
2
votes
1answer
21 views

Note Tool - Fill text box with template

I've been working on a note tool for my company to help streamline verifying and noting accounts. I've added in extra features that help with different aspects of the job as well. I'm wondering if ...
2
votes
2answers
42 views

Construct an 2D array of contiguous elements comparing master and incident arrays

Requirement: Based on mainArray which contains the master list of items, and compArray which has items of interest; construct a ...
-1
votes
0answers
23 views

Append in parsexml [migrated]

I need some help finishing my code because I'm having a bit of trouble getting the syntax correct. I have a parse XML and I am using append to display the data. I am also trying to do on click event ...
1
vote
2answers
42 views

Replace string of class of button by class so that only one button is filled in using bootstrap buttons

I'm using bootstrap buttons, and in this case I have 5 different buttons with 5 different classes. When one of the buttons is clicked on, I want it to be the only one filled in, and the others to only ...
0
votes
1answer
34 views

Preparing form data for a POST request with fetch

Acquiring a form’s data for asynchronous POST requests has been a long-standing problem. There is the FormData API, but there are still some obstacles when the form’s data is encoded as ...
3
votes
1answer
33 views

Cancelling ongoing http requests when next one is started - web app search feature

This piece of code is aimed to cancel any ongoing search requests sent from the web application if next request is started, e.g. after user updates the search term. I tested it in the final ...