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
13 views
alphanumeric validation javascript without regex [on hold]
if i run, validation just can be work only on symbol "/", if I input the other symbol except / didnt working. I'm not use regex. loop like stop work.
...
2
votes
2answers
44 views
JavaScript “with” operator removal
I recently ran into some issues with a plugin and outlined the issue in this post and wanted to know if the modifications I've made below cover the scenarios that the ...
1
vote
1answer
35 views
Display HTML based on user input (via checkbox selection)
I currently have this, which works. However, I would prefer to not have the HTML that displays being stored inline in array like this, but in a more flexible / optimal way so I can have more text / ...
8
votes
1answer
48 views
A dashboard for my university's commonly used resources
This is my first big JavaScript project and I wanted to know what I could improve in terms of coding practices and design. It is a Chrome extension made for Vanderbilt students (VandyTab) that takes ...
4
votes
2answers
232 views
Metal King: A JavaScript Game
I started to learn programming just a few days ago. And I've written code for a simple original game for practice, using some knowledge of JavaScript that I have gained so far.
Is the following code ...
2
votes
1answer
27 views
Removing spam from a database using NodeJS
I've written the following in NodeJS as I am trying to learn a bit more about that toolset. It 'works' but is not very robust. I am not concerned with security at this stage and the code will not be ...
6
votes
0answers
52 views
Editing Javascript and rendering HTML in one window v2
I wanted to revisit this site to post some recent work I put into this small project. I was able to add a console as suggested; but I thought I would ask here how my coding stying is before I work on ...
4
votes
1answer
29 views
A closable footer bar with a floating info box
I wrote this page with the goal in mind of having a footer that runs along the bottom of the page that can be closed, and has a floating info box that appears when the footer is hovered over. I'm just ...
1
vote
0answers
168 views
Node.js module architecture for third party API
(If my questions below code seems too broad for coderewiew, please feel free to downvote this topic)
I'm writing a node.js module that is basically a wrapper for some API functions of third party ...
5
votes
4answers
246 views
Audio player for a website
I'm fairly new to jQuery and have decided to make a jQuery audio player for a website.
There are two versions of the way it selects the audio:
Here
Here
I removed some basic, not connected with ...
1
vote
1answer
21 views
Unit Testing Express Middleware That Verifies Auth Tokens
I am writing an Express middleware component that'll run on Node 4, which has limited ES2015 support.
The fundamental purpose of this component is to verify JSON web tokens, using the jsonwebtoken ...
6
votes
3answers
807 views
Handling a maze in JavaScript
Is there a way to shorten the conditional statement below? As you can see, there's a lot of repetition. Is the if-statement the best approach here? Bearing in mind ...
0
votes
1answer
42 views
Writing Custom functions to grab data from JSON
I'm working on a project where i am using VueJS as front-end framework.
I've so much data in JSON format to work with for that i've written a helper function to retrieve data from JSON. much like we ...
2
votes
1answer
24 views
Handler for bidirectional unit conversion form
Building a form where values can be entered in either pounds or kilos.
Script is...
...
3
votes
0answers
51 views
QA form framework in Angular.js
I've just done my first Angular.js project and can't help but feel I have too much code outside of the framework.
jsFiddle
This is a QA form scoring page that will eventually store it's results in a ...
3
votes
0answers
41 views
RxJS Subscription Service in Webworker
Here is a plunker of my working demo.
I have the following code which I have created for a subscription service for data through a webworker. I was wondering if I was following functional-reactive ...
4
votes
2answers
85 views
Getting a substructure in a JSON-file
I'm currently playing with D3.js.
While doing so I use this JSON-file as a data source: http://codepen.io/chriscoyier/pen/taqCe
Example of the structure:
...
-4
votes
0answers
21 views
Need help understanding why this wont work [closed]
The bit on the bottom that reacts to !killMB does not work. can someone help me fix it please?
...
1
vote
0answers
19 views
AngularJS directive-oriented news app
In anticipation of the new Angular release and since I've only just begun learning it, I have been developing a project in a directive-oriented way. Below is a sample of a section that handles message ...
0
votes
1answer
26 views
Check if page was scrolled all the way to the end
I am not sure if this is the best way of doing this or if it works in all situations.
...
1
vote
2answers
34 views
Test if a key exists anywhere in a nested object
I have complex objects containing nested objects. I need to check if a key exists anywhere in the nested object. I wrote this code as a makeshift solution. Is there any other way to search for the ...
20
votes
6answers
3k views
To 'this' or not to 'this'?
I was given a homework and I have 2 solutions: one that uses this and other one that doesn't.
I tested it on jsPerf but sometimes it says the version with ...
0
votes
1answer
37 views
Designing a public API for a JavaScript module
I am writing a module that can access localStorage through a public API which exposes methods that allow string or array returns.
It doesn't feel as though I'm ...
1
vote
2answers
57 views
Reduce array of objects into object of arrays
I have an array of objects where each object has two keys: key (k) and value (v). I need to make an object that would take ...
1
vote
1answer
31 views
A Simple SortableDictionary for JavaScript
First, I must humbly admit that I've been a developer for many years but I've almost never had to work as a front-end, Web UI developer. I've been given an opportunity to work for an organization as ...
5
votes
1answer
47 views
Table component for scrolling through lines of data
I'm working on a table component that is able to scroll through millions of lines of data. Not bad for the front end. The way I'm doing this is to only render a small table with 10 rows and then, when ...
1
vote
1answer
39 views
Continuous integration tool
I am writing a trivial continuous integration tool using node.js to learn the platform. So far it can download a project from Github, and unzip it into a random folder in a predefined dropfolder. But ...
2
votes
1answer
245 views
Advent of Code - Day One
I tried to write a foolproof function for the first part of the first problem on adventofcode, which asks for the count of ( characters minus the count of ...
3
votes
0answers
15 views
Backbone learning piece, Movie Application using Views, Collection, Models, Routes and Localstorage
I have created a Backbone Movie app as part of a learning exercise, the app is hosted on codepen although I actually have it built on my local but thought this approach would be handier for code ...
5
votes
2answers
93 views
Functional, recursive FizzBuzz in JavaScript
I was talking to a coworker about over engineering things, which somehow lead to me over engineering the hell out of fizzbuzz. I went for a functional recursive solution in JavaScript. What do you ...
4
votes
0answers
47 views
JavaScript implementation of Conway's Game of Life
It took some time to make Conway's Game of Life in HTML, CSS, JavaScript and jQuery. I'd like suggestions, criticisms, and discussions on how it can be done better.
JSFiddle link
...
6
votes
1answer
85 views
A simple weather app in Node.js
while practicing Promises, I ended up with a simple weather application which works on the command line. I would highly appreciate it if you can point out any flaws ...
4
votes
2answers
41 views
Two duration widgets for a break timer, with ± buttons
I'm sure I can optimise this code, but I can't find how in order to be generic. I'm not sure that .parent and .child combination ...
2
votes
3answers
62 views
CSS animation via JavaScript
I call this animateElements function as part of an animation loop (inspired via Dave Gamache). Everything works as expected, but I would love to try and ...
12
votes
2answers
59 views
Stack Exchange moderation-action auto-comments
I've written a userscript that pops up a dialog before you take a moderation action (closing, deleting) with some pro-forma comments, so that you can add one of those before you cast your vote.
I'm ...
0
votes
2answers
48 views
Anti-pattern or acceptable way of using Promises? [closed]
Whenever I need to use a Promise interface in my NodeJs code and I don't have a promise to start off with, I do this:
...
4
votes
2answers
46 views
Bluebird: promisify xhr request
I use bluebird promises. I want to promisify my requests from communication layer:
Utils.js
...
1
vote
2answers
48 views
array_diff in JavaScript
In PHP exists a function array_diff (http://php.net/manual/de/function.array-diff.php) which returns the difference of two arrays.
I have tried the implement my own version in JavaScript.
Any ...
2
votes
1answer
33 views
Synchronizing two scrollbars to work in unison
This synchronizes the document’s vertical scrollbar and a DIV’s horizontal scrollbar so they can work in unison controlling the content simultaneously.
The code is operable and behaves how I want. I ...
1
vote
1answer
50 views
jQuery Responsive Carousel
I have developed a jQuery Responsive Carousel. When opened, the carousel in the browser and the Chrome task manager, I see that the memory usage of my page is higher than the rest of the opened tabs ...
2
votes
1answer
48 views
Tic Tac Toe with Minimax (memory management optimization)
I've made a Tic Tac Toe game with minimax in Javascript. It works but I have to use location.reload(true); to automatically reload the page every time user starts a ...
3
votes
1answer
44 views
Fireworks animation causing high CPU load
This web algorithm is causing even newer computers to freeze with CPU spikes from 20% to 90%! How can I make it more efficient?
EDIT: An idea is to somehow get rid of the filter:blur(); property ...
3
votes
1answer
68 views
Simple Password-Manager in Node.js
I have programmed a simple command line password-manager in Node.js during my learning process, and since I am done with it, I would highly appreciate a review.
Comments could be based on any topic. ...
0
votes
2answers
64 views
Reducing code complexity for UsergridClient constructor
I'm initializing a class in JavaScript with a bunch of complex property checks. Codacy is showing that this is bad design and recommends reducing cyclomatic complexity.
I'm at a loss for how to ...
5
votes
1answer
65 views
Rate limiting function calls
I wanted to write a function that when applied to another would rate limit it, but permit all calls to eventually make it through.
Comments and criticism welcome.
...
12
votes
3answers
498 views
A simple JavaScript library for arrays
I have developed a simple and easy to use JavaScript library called, Omega for practice. I would highly appreciate if you can point out all sorts of flaws in the ...
1
vote
1answer
20 views
Checking if a tag is on the screen
This function receives an HTMLElement as an argument and returns true if the tag is on the screen and ...
2
votes
0answers
49 views
Building HTML with JS (function expression vs comment for code clarity)
I'm currently building some HTML with JS (specifically using the jQuery library). My code is as follows:
...
1
vote
1answer
81 views
AngularJS: Http API Service - any improvements / remarks?
Could you please review the below AngularJS service. What it does is centralize all (relevant) HTTP action calls.
Do you see any chances for improvement?:
...
4
votes
1answer
55 views
canvas snake game
i made a simple js snake game with canvas, the code is all mine so it can have some drawbacks or not so good parts. I will be glad to hear some opinions.
https://github.com/vitaliyterziev/snake
...