ECMAScript (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms and stand-alone interpreters / JIT engines. Use this tag for questions regarding ECMAScript 5 or 6 and its dialects / implementations: JavaScript, JScript, etc., excluding ...

learn more… | top users | synonyms

3
votes
0answers
20 views

HTML page compiling LaTeX code to nice mathematics display - 2nd attempt

I have this page that allows a user to quickly compile \$\LaTeX\$ code into a mathematical display. Whenever the user compiles the code, that page also generates an URL from which it is possible to ...
1
vote
0answers
14 views

Retrieving the lotto numbers - Node.js

I'm looking for feedback as to how I've structured the async calls, and If anything should be written differently. endpoints.js ...
0
votes
0answers
20 views

Flatten an array

I have got this interview question which has asked me to write a production level code which flattens the arbitrary nested array of arrays. Code ...
0
votes
0answers
15 views

Sorting and update 2D Dimension

Question is: Compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in arr1). If an item cannot be ...
1
vote
1answer
16 views

Basic arithmetic calculator in JavaScript

Task is basically: "Write a function which takes two number as the first two parameter. The third parameter is one of the arithmetic operators (+ , - , * , /). Execute the arithmetic operation (...
0
votes
1answer
12 views

Using JavaScript-bitwise AND and -bitwise NOT for setting a number to 0

Obviously is the XOR-operator is used in low-level programming-languages used a lot for setting a value back to all bits 0. For example: 11010 ^ 11010 => 00000 Brought my teacher to figuring a out ...
1
vote
0answers
13 views

Matching a current user's “liked / followed” items with results from a search query

This is pretty ugly now. My main objective is to perform a search query, which I do via mongoosastic / elastic search (the search paginates 12 items at time). Then, I want to match those results with ...
0
votes
0answers
15 views

Database to calculate Date/Time [on hold]

I'm trying to make a calculator to calculate the estimated delivery time for products from its producers, and since every producer has his own time cycles, I have to make a kind of database about them ...
7
votes
1answer
53 views

RPG Stack Exchange chat bot

Recently, I made a small bot to simulate an ASCII-based RPG in a chat room. The other users can enter commands (.left, .right, <...
1
vote
1answer
25 views

Using promises to GET and process data

I'm working on a Meteor application which integrates a user's contacts from external sources (Google in the case of this example). I'm currently writing the server side code to retrieve this data and ...
-1
votes
0answers
33 views

WebGL performance with ~5000 movable rectangles (ivanK)

Here's my runnable code in webpackbin (drag the little rectangles). The code for dragging could probably be more concise, but this is just what I hacked together. ivanK graphics library Basically, I ...
3
votes
0answers
47 views

HTML5 canvas snake game

My most recent project is this simple snake game, and I would like to know what you guys think of it and if you have any suggestions. All feedback is welcome, constructive criticism is appreciated. <...
3
votes
0answers
20 views

Join arrays of objects by some identifier

The following is some JavaScript that I wrote to join two arrays of objects by an identifier. The goal is to extend the objects in a1 to include the extra fields in ...
0
votes
0answers
11 views

ENOBUFS when creating to many sockets with socket.io [on hold]

What I am trying to do: I write a node.js client/server application which uses persistent websocket connections (no longpolling). I want to stress test my server in order to tune it's performance and ...
5
votes
0answers
32 views

Animate and play sounds in Simon Says 'the Angular way'

I am a newbie coder and I'm trying to learn good coding habits. I'm making a Simon Says game challenge from Free Code Camp in Angular JS. Codepen I have an array that keeps random integers between ...
-2
votes
0answers
11 views

Auto-filling text field using JS/HTML [on hold]

I am trying to create a bookmark that will auto fill a text field of a webpage. However; I'm receiving the following error code: (program):1 Uncaught TypeError: Cannot set property 'text' of null ...
0
votes
1answer
37 views

Simple login using ReactJS

I have successfully implemented a simple login page using ReactJS by coding it all in JavaScript (a flexibility that I like) but I am still a beginner in React and would like to know whether this is ...
2
votes
1answer
25 views

A utility class for fractions

I've been working though Project Euler problems using JavaScript, and along the way I've found it useful to create "classes" for different types of numbers (like an integer that can be arbitrarily ...
-7
votes
0answers
18 views

Issue with Windows authenticated user login on IIS [on hold]

I got assigned to fix a problem left by another developer who just changed jobs, and I'm not having very much luck with it. The application is a time entry site that allows users to log in with their ...
3
votes
0answers
89 views

Jarvis the discord.js chat bot

Just finished creating my first bot using Discord.js for the chat application, Discord. This is my first bot and first javascript program I have ever created. I'm mainly interested in ways I can ...
1
vote
0answers
43 views

Form validation library

I am writing an open source library but its been to long since I have worked in JavaScript. Here is the initial working code fragment: ...
0
votes
0answers
25 views

Loading an animation with an Ajax request

I am not sure if this is the correct way to make an Ajax request and do the typical loading/processing GIF/animation while processing is happening and displaying the response. HTML: ...
-1
votes
0answers
8 views

Differential Equations Solver [closed]

this is my first time on this board so I apologize if I seem a little lost. I am also fairly new using JavaScript as well, so just keep that in mind. I am using Sublime Text if it helps. I want to ...
3
votes
1answer
63 views

Basic Nim game vs computer in JavaScript

This is my first time writing a basic program/game in any programming language. It is supposed to a be a Nim game vs a computer with these basic parameters: Use ...
4
votes
2answers
87 views

Calculating quiz score, with weights and partial credit

There is a quiz-game with simple rules. You have to guess one of three options. Each option has a particular weight, for example: Option 1: 20 points Option 2: 30 points Option 3: 50 points If ...
3
votes
1answer
38 views

Reactjs Tab Component

I made a simple bare bones Tab component, i'm a beginner when it comes to ReactJS so any advice regarding the codes functionality is greatly appreciated. Tab.js Component ...
0
votes
0answers
20 views

Modular JS revealing module pattern

I am just getting started with Modular JS and I am converting a spaghetti coded jQuery UI using the revealing module pattern. My concern is, basically, if I am doing it right. tab_template: ...
3
votes
0answers
32 views

Tiny Image Editor

I made a small(ish) image editor for a client that is supposed to be able to do the following: initially scale image to preset size to avoid tiny/huge images initially center image in canvas resize ...
2
votes
0answers
14 views

Function to grab all windows and nested windows on a page

I wrote the following function which takes in a window and returns all nested windows on a webpage (I can get all the windows by calling the function with window.top). Is there a more elegant/...
0
votes
0answers
13 views

Add and merge 2D array items so no nested duplicates on the outer array

this.collisions is a 2D array containing a list of collisions that, when bodies collide, they should be added to it. Here's an example: ...
2
votes
1answer
24 views

JavaScript image-Carousel with using IIFE

I have to implement an image-Carousel. Because I'll reuse the snippet within other projects which might contain all kinds of external libraries I used an immediately invoked function expression. ...
-1
votes
0answers
10 views

Javascript charAt Method [closed]

So, a while back, I made a JavaScript program for fun. It took a sentence or any kind of text input from the user and determined how many words, spaces, characters, and average characters. I worked on ...
1
vote
1answer
20 views

Sidebar menu to hide or expand parts of a form

I have some of my code that I have tried to improve on to make it cleaner and efficient and I would like some feedback to see if I am going in the right direction with what I am trying to do. I have ...
1
vote
2answers
126 views

Tasks organizer app

I've created my first complete JS app, which lets you add tasks and control how much time you spend on them. I posted this to get some ideas how to improve readability, efficiency and the speed of my ...
1
vote
1answer
57 views

Handling post-registration action

This code is Express NodeJS code that handles post registration .post action where the user must select a custom username. The username is validated, and if valid, ...
2
votes
2answers
73 views

Returning a filtered list of iPhones

I have just received feedback regarding a junior dev test that I submitted. It was unfortunately not great, and the recruiter could not articulate the issues, I tried to show that I was thinking about ...
3
votes
3answers
124 views

“Prev” / “Next” buttons for a circular list

I have an array of strings and on click of the "NEXT" button it displays the next array item in a <p> tag while on click of the "PREV" button it displays the ...
1
vote
1answer
50 views

Math expression parser in JavaScript

I've written the second iteration of my math expression parser, utilising what I learned from the first attempt to make a more reliable, maintainable piece of code. If anybody wants to see the first ...
2
votes
1answer
29 views

Displaying user selection in the browser

I have the following script that reads JSONified data from within a DIV, generates HTML with values using JavaScript, then sends them to another DIV. What I'd like to improve is to remove HTML from ...
3
votes
1answer
51 views

Merging multiple sorted arrays into one sorted array

I would like to merge multiple arrays that are already sorted, into one sorted array. My arrays look like this : ...
0
votes
0answers
39 views

Generating a random ObjectID

We want to ensure that certain documents in our DB get distributed well across the shards. Currently the documents are sharded by their _id, but they are often ...
4
votes
1answer
140 views

Given hexadecimal rgb color, find the closest predefined color

The following is a function that accepts a hex value (with or without a #, 3 or 6 character) and returns another hex value that is "closest" to it from a set of static hex values defined within the ...
4
votes
1answer
32 views

Determine which range a character falls into

I am categorizing terms depending on what letter the term starts with. What is the cleanest way to do so? ...
0
votes
1answer
29 views

Value-added tax calculator app

The app calculates the tax which is included in a (given) amount. Because I'm new with both libraries (React.js and Foundation) I would appreciate hints and improvement suggestions. Live demo on ...
3
votes
0answers
53 views

Subtraction in a spreadsheet column numbering scheme

The idea of the algorithm is to decrease a number from a word. Is there a better way to write this algorithm? limitiation: it is important to decrease with a limit, if BB is the word we decrease ...
4
votes
1answer
49 views

ROT13 JavaScript

I wrote a ROT13 cipher script. Can this function be improved? ROT13 Wikipedia article ...
1
vote
1answer
37 views

Event handler for conditions

I am trying to detect whether a condition is being returned true or false. The only problem is, I have a bunch of if/else ...
3
votes
0answers
68 views

Showing the slide named in the query string and hiding the others

I have this all figured out now thanks to the help of a mod. Here's the working code: ...