Tagged Questions
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 ...
0
votes
0answers
6 views
What is doing every part of this React components?
I am trying to understand how the props and states comes and goes. I am commenting the pieces of code that I understand, but there are some others that I can't because I didn't get what is happening.
...
0
votes
1answer
11 views
Function to ensure that at least one choice is selected
First here is my settings object below. insight, spike and ...
1
vote
1answer
13 views
Vim command parser
I have a parser which consumes an ordered list of tokens (based on Vim's command grammar) and returns either:
an error object, or
an object that can be directly ...
5
votes
0answers
51 views
Simple restaurant menu
As stated in the title, the code produces a simple drop-down menu that allows you to select your Starter, Main and ...
0
votes
1answer
33 views
replacing DOM elements that have no attributes?
The institution I work for uses an application that has an awful software bug causing useless span tags to appear next to "misspelled" words in iframes. For ...
3
votes
0answers
14 views
Photoshop Script to Rename Layers to be Unique
I recently tried to dip back into my old JavaScript 'skills' to make a script for Photoshop. It's simply a recursive function that will loop over all the layers in a file and renames any duplicate ...
0
votes
0answers
17 views
JavaScript constructor-function for currency-conversion
I've made this constructor-function for currency-conversion.
It shall be incorporated into an app I'm planning to implement.
So therefore: Any hints concernings flaws as well as suggestions are ...
2
votes
1answer
20 views
Sort Facebook Messenger contacts by idle time
I wrote a UserScript that auto-sorts contacts by offline time using the MutationObserver API. I tried to make it as DRY as I could think, and I also tried to make my code as straight-forward as ...
0
votes
1answer
17 views
Node function to walk through file system and make sure it has a matching db record
I have an app that uses the file system a lot to store generated files (zip files and scss/css fil). When a user generates a file, the metadata and other information is stored in the db for later ...
0
votes
1answer
30 views
While focus on input check if empty
I made a small function that is getting looped when an input is getting focus and stopping the loop when the input is losing focus. Now I would like to know if there is a better way to write this ...
0
votes
1answer
20 views
Caling AJAX Method for multiple hidden ids aspx
I am calling a ajax method for a number of hidden client ids on an aspx page. The ajax method returns some html to a div provided.
So the code looks like below:
...
0
votes
0answers
17 views
Using expressions instead of statements [on hold]
In javascript you can't use statements in expressions. Because of this you are forced to use logic and ternary operators in an expression when you want to use if or switch etc.. Since I didn't want to ...
0
votes
0answers
11 views
Promisify NodeJS and Mongose callback even further
I've recently started to experience writing Node.js code, and JavaScript in general.
Right now I am planning to promisify (with Q) some of the node.js callback code I had, and I come to this.
The ...
4
votes
0answers
31 views
Reading and updating an XML address file
I have some code that reads from an XML file and updates if needed. I want to move some of the stuff around. Here is the code overall:
...
0
votes
0answers
48 views
Register a node-client code through an API call efficiently?
I've got a node_module that reads ArcValues for a user and updates the config of the node client at user's local (root). Like so:
...
0
votes
0answers
36 views
JS timer plugin
This code operates as intended, but with only with two operational timers running. I need the resize event in the match section as I need to retrieve the window ...
3
votes
0answers
68 views
+50
Data model for complex tree (multiple children and multiple parents)
I'd like to have a discussion on the data model (mostly) for a tree with nodes having multiple children and multiple parents.
I already have a working algorithm, but I'm looking for improvements.
The ...
0
votes
0answers
26 views
Currency Converter as first React.js
After reading a few React.js beginner-tutorials I decided to make this web app. Just for to get some practical experience ...
Moreover I used Twitter Boostrap for the layout.
The app works as ...
4
votes
0answers
62 views
Simple color flooding game in Javascript/HTML5 canvas area
I'm learining JS. I have prepared a simple color flooding game, like Pixelated.
The engine below works, though scoring is not implemented. Please help me find out how this code could be made better, ...
3
votes
0answers
65 views
Quickly applying gravity force between bodies
I have a function for applying gravity forces between every possible pair of bodies on my game. It is the most used function, and can run more than 100k times per frame so every minor improvement on ...
-3
votes
0answers
23 views
Html Canvas + JavaScript code feedback
I would like some feedback on how to optimize and improve my code:
HTML:
...
3
votes
3answers
64 views
Wikipedia Viewer
This is one of the projects on freecodecamp. I would like a review on my code. Thanks in advance.
Javascript:
...
0
votes
0answers
6 views
Binary Tree Paths - what is wrong with my code [migrated]
Here is the binary tree paths problem:
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
...
5
votes
3answers
146 views
Parse a CSV file and return an object or array
I recently published a JavaScript module for NPM which is also available on Github by the name of rawiki-parse-csv. The code takes raw CSV data and returns an array. The method has one option to ...
6
votes
1answer
65 views
Counting newlines in a file
I've started to go through Node tutorials on nodeschool.io, and the second assignment was to write a program that will count the number of newlines in a file and print it out. My solution looks like ...
5
votes
0answers
62 views
“Stardust” 2D Gravity Simulator - Follow Up 1: The Planets
This is a follow up for the 2D Gravity Simulator-like Game question.
Since then I have developed my javascript skills further, and now I'm using ES6 mainly. Note that even through this code uses ...
3
votes
1answer
40 views
Add functionality to object then remove those functions on export
Outline
I have a form that needs validation. The problem is that the software requires custom validation that depends on multiple parameters.
I decided to pass the object into a function which will ...
4
votes
1answer
54 views
A Game Of Simon
This is one of the projects from freeCodeCamp. It's a game of Simon (a memory game). I would like a review on my code.
...
2
votes
1answer
33 views
Stranded messaging Angular web app - main template for all views to live within
I'm making an Angular web app to solve a pain with traditional messaging my friend and I had, of sending batches of messages (on multiple different topics) to each other every few hours and not having ...
3
votes
0answers
32 views
Simple gallery with scroll
I just created a simple gallery with scroll. Everything works fine but I'm not sure how should I optimize this code:
...
3
votes
2answers
62 views
Validating multiple parameters by regex and length
I have a set of validation functions which return a response code along with an error message if the validation fails. Requests can be of three types, and each of them contains a different type of ...
2
votes
0answers
87 views
Setting up require.js for a static website and loading custom code
I am a new SO/SE user and I initially asked this question on SO, but i was 'sent' here -for some reason i don't clearly understand but anyway- so here I am..! I was actually curious about my ...
2
votes
1answer
30 views
Shortening Divs
I have a project here that looks pretty good and does exactly what I want it to do. The codepen is here. What I need to find out is if these divs that flip can be shortened in any way:
...
1
vote
0answers
14 views
Retrieving the Currently Logged in User's Department
I hope this is the right place for this. I basically wrote the below script for a SharePoint 2013 where I needed to get the department of the currently logged in user.
I was finally able to get it ...
3
votes
4answers
44 views
Verifying that all form fields are filled in
I grabbed the form from some random site because I'm only interested writing the javascript at the moment.
I am trying to check that a user has selected or entered text for all fields. I've made it a ...
2
votes
3answers
301 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
0answers
20 views
A simple list of objects to display and edit with Angular
I want to create a simple CRUD app using angular on the frontend.
I'm not really happy with the logic here, it seems a bit convoluted for fairly simple functionality.
...
3
votes
1answer
42 views
1
vote
1answer
50 views
Javascript Parallax Scrolling Text
I built a 404 page which involves parallax scrolling text. The program updates the position of 100-200 text nodes at each animation frame called with ...
2
votes
0answers
37 views
Implementation of the Minimum Stop Algorithm in Javascript
I started taking the Algorithm design class from Coursera. So into the third week they talk about Greedy algorithms and walks through a sample problem.
This is the Problem Statement that I could find ...
1
vote
0answers
15 views
JavaScript-function for to attach CSS-animations
The purpose of the function is to attach CSS-animations to HTML-elements with a text-content property. Like for example h1, div, p etc.
It's not fully elaborated. Nevertheless have I decided to put ...
5
votes
2answers
177 views
Express middleware to validate URL and tags
I am building an API where the client can send a url and some comma-delimited tags:
...
4
votes
1answer
42 views
Userscript to tighten security in Mozilla Firefox
I have recently started writing a userscript for Mozilla Firefox to tighten security and make it more private, but before I want to start publishing it, I would like to have some experts take a look ...
2
votes
2answers
41 views
Async Implementation
I'm seeking code review comments for the following implementation.
jsFiddle
...
3
votes
2answers
63 views
Javascript bar graph representation using CSS
This js was written strictly for a visualization of a graph redesign included in a stats report within our game systems. It all works properly, but I know there has to be a much neater way to organize ...
1
vote
0answers
45 views
JavaScript Image-Slider
An implementation of an image-slider I figured out.
Could it be further improved? Or should I do it in a completely different way?
Not sure if the technique of assigning a function to ...
4
votes
1answer
105 views
A very basic JavaScript calculator
I'm just starting out with code. I created a very basic JavaScript calculator.
While writing, I couldn't help but think that there must be easier, faster and less redundant ways to write this. For ...
5
votes
2answers
147 views
My online hangman solver
I've created a simple hangman solver at solver.lukesalamone.com, and although I'd consider myself proficient in webdev I am by no means an expert. The trick with this is that since HTTP is stateless, ...
1
vote
1answer
51 views
Create new array by filter origin array
I'm getting an array and I needed to find a duplicate ID inside:
...
1
vote
1answer
54 views
Tic Tac Toe Algorithm revisited
I had previously submitted a tic tac toe code. I followed some of the changes suggested. This is my new code.
...