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

0
votes
0answers
5 views

Calculate Parking Hours using javascript functions [on hold]

This is the full question Write a complete for charging the parking fee for each customer based on the number of hour parking. Ask user to enter the total hour using prompt() Calculate the ...
2
votes
1answer
22 views

Calculating top position of elements based on their heights

I have a data representing several elements (that could be rendered at some point as div), composed of y position (property top) and its height (property height). ...
1
vote
1answer
42 views

Add multiple data attributes to elements using jQuery

I'm looking for some help on how I can optimize adding multiple data attribute tags to elements, and really, any feedback at all. Background Client uses a analytics tool through a tag management ...
-1
votes
0answers
13 views

Lodash chain implementation

I am mainly trying to avoid the nested forEach statements and am trying to move towards a lazy evaluation type solution. jsFiddle ...
0
votes
0answers
5 views

Assigning default values from envvar in node [migrated]

When attempting to set default values for parameters that may exist in environment variables in JavaScript, I often see this pattern: ...
1
vote
0answers
12 views

SQL Server to MongoDB Template

Looking for feedback on a set of templates I've just created. I'm planning on converting them to Yeoman but want to make sure they're ready for prime time before doing so. They are currently in ...
3
votes
1answer
41 views

HTML5 Video player

I do HTML5 Video player with some controls. I have a button, where I change classname for make play, pause or replay button. I have a mute/unmute button, volume range slider, timer and fullscreen mode ...
2
votes
1answer
50 views

Generating a random number of progress bars

I have this JSFiddle that generates a random number of progress bars then assigns a random number and percent to them. I am wondering if you know how to better optimize this code to have better ...
1
vote
0answers
14 views

Bootstrap Data Table generation

I am generating a searchable and sortable data table using ...
0
votes
1answer
18 views

Handling the column of an HTML table using jQuery

I have the following table: ...
1
vote
0answers
12 views

JavaScript nesting XMLHttp requests and in a loop

I am new to JavaScript, especially the wonders of async and closures and would like some help on the attached code. It is in a Chrome extension and retrieves a list of users albums with the Picasa Web ...
1
vote
0answers
14 views

AngularJS select box

This is my first open source release and I'd like to get some feedback on my code styling/organization. Implementation tips are appreciated as well. The code is for an AngularJS select box that ...
2
votes
1answer
39 views

Changing Component Style

I have a component that I want to render with certain styling based upon the props that it will receive. I'm currently defaulting the prop types, and then creating the styling at render as such: ...
0
votes
0answers
22 views

Search box in JavaScript for blogger.com

I wanted to build a search box for Blogspot which goes through every label and filters them so remains just the match and every other label is hidden. I work with this through the firefox developer ...
2
votes
0answers
28 views

Custom backend app with require.js approach

I'm working on a small custom backend app in PHP for personal use (and practice MVC) and I thought it was a nice opportunity to try (and learn) requirejs to 'organize' my scripts and load just what ...
2
votes
0answers
51 views

Number processing slower with asm.js

I did a few times ago what I called a plasma in plain JavaScript: jsFiddle The idea is to use 2 oscillators (LFO) which have their frequency + phase driven by two oscillators each. Then we use ...
1
vote
1answer
45 views

Loop through object and send analytics code based on objects properties value

The code I have now is currently working, but I'm looking for ways to optimize it, and really, to just get any feedback. I'm implementing this code through Ensighten (a tag management platform) as a ...
12
votes
1answer
76 views

Parsing log files of HearthStone: Loading card data without external libraries for JSON

I'm still working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show ...
2
votes
1answer
20 views

Refactor two jQuery filter functions into one function

I have two separate lists both sitting side by side. How can I refactor the code below to only have one filter function for both lists? ...
4
votes
0answers
33 views

Creating an async consumable object in Node

Background I have a situation where I have fixed number of objects with their own routines that would need to be called with the same initial message. To accomplish this, I have a Factory that ...
-1
votes
0answers
7 views

merging array of objects based on common property [on hold]

I need to merge two arrays of objects and I know there are many ways to do it but I am just curious what would be the best way to do it. e.g - I have the following arrays, ...
1
vote
0answers
23 views

Improving JavaScript processing of Ruby Regex

I have a basic webapp that basically serves the same purpose as Rubular.com, but for gsub. It runs some simple JavaScript, which POST's to a Sinatra app, which then updates page with the results. ...
3
votes
1answer
36 views

Grid walk problem and solving it recursively

On CodeEval, there's a Grid Walk challenge: There is a monkey which can walk around on a planar grid. The monkey can move one space at a time left, right, up or down. That is, from (x, y) the ...
2
votes
0answers
32 views

Drawing tarot cards

The goal is to draw random tarot cards from the suit, number of cards is determined by the amount of HTML elements with 'card-container' class on given page. The deck is structured as follows: ...
3
votes
2answers
43 views

Transform a string into an array based on grouping rules

I've got a simple spec for defining character sets, ranges, or wildcards. I'd like to take the string and appropriately create an array based on these rules. I have a solution but I'm sure there is a ...
5
votes
1answer
290 views

2048 (game) solver 2.0

Follow-up of 2048 (game) solver I improved the script, using standard search methods like expectimax. Now it goes easily to 2048, but not really further, the difference with the highly efficient ...
3
votes
2answers
26 views

Star rating: Update stars on click and don't lose the actual vote on re-hover

I'm trying to make a star based rating system. First of all, I don't like to make it all with JS and only inner html the rated stars in a given div. I want to make it more like a plugin with the ...
1
vote
0answers
11 views

Input a web page with poker events, output a gcal compatible CSV file

This script takes input from poker tournament pages at pokeratlas dot com, and outputs a CSV file that I can import to Google Calendar, listing each of the tournament events, start time, location, and ...
2
votes
1answer
55 views

Getting duration between two dates

I'm developing on a web application where I have a start and a finish date and time and have to set the duration between it. There are inputs for dates and times. Then, I have this function which ...
2
votes
3answers
75 views

Returns an array of all inputs with specified name

I've made a nice little function to return a NodeList array containing all the inputs that have a specified name attribute: ...
3
votes
0answers
43 views

Google material ripple button effect

I have "translated" this example built with jQuery in vanilla JavaScript, but I'd like to know if there are better ways to do it. The jQuery version uses offset() ...
0
votes
0answers
17 views

Widget for collecting leads

I have JavaScript widget code for collecting leads: ...
0
votes
0answers
28 views

Counting the number of a word in a string [closed]

I'm having a problem finding the number of the profane words in a sentence. I couldn't find out how should I do it. This is my code: ...
1
vote
0answers
24 views

Web Audio Oscillator Waveform

I'm currently working with Web Audio for creating a simple synth like project in the browser and implementing controls for the Oscillators via jQuery/jQueryUI: ...
4
votes
1answer
75 views

Binary search that returns bitwise complement of missing index

While re-writing some old JavaScript code to better handle large arrays, I ended up writing my own binary search method. I found many examples of binary search methods written in JavaScript, but all ...
0
votes
0answers
27 views

Sign-up controller and service

I'm programing server side node for a huge project. And I'm thinking my brains out about the best programming pattern that will be suitable for fast modification and changes. Tell me what you think ...
0
votes
0answers
32 views

Passing an array in a hyperlink

Maybe this is fine the way it is, but it seems messy. Basically I have dynamically generated HTML that will display a list of songs in a given folder. Each song has an ID, and I want to add a button ...
2
votes
0answers
24 views

Rewriting authentication controller using promises

I am in the process of refactoring some complex code that uses callbacks to instead use promises. I am trying to figure out if my proposed approaches make sense. ...
4
votes
0answers
32 views

Minimax for Tic-Tac-Toe

I have written AI for Tic-Tac-Toe using Negamax in JavaScript. The Negamax object is translated from an implementation written in Python. The code runs on a Node.js server and the player interacts ...
2
votes
1answer
33 views

Angular user creation process

I've written 3 factories as a part of a sign up process in AngularJS and Firebase. After completing them, I thought to myself, would any of these fit better as a service instead of a factory? From my ...
0
votes
1answer
19 views

More efficient columnar transposition decryption

Below, I have created a rudimentary script to decipher a columnar transposition. I am wondering if there is a more efficient way to determine the number of the rows in a column? Also, is there a way ...
-1
votes
1answer
30 views

Mixing assignment and expressions- good or bad? [closed]

As far as mixing assignment and expressions.... is it better to do or not to do? For cleaner code and readability. mixing: ...
-2
votes
1answer
38 views

How to do the same thing for many objects

I use the following code and I want instead to repeat it over and over again to write it in short/better way,is it possible in JS? ...
3
votes
1answer
65 views

Checking checkboxes

I wrote this code for checking checkboxes. There are two groups of checkbox: each group's checkboxes have one common class all_perks and one individual class ...
10
votes
2answers
113 views

Mission impossible: beat everyone else to the queue

Your mission, should you chose to accept it, is to beat everyone else to the review tab so you get a chance to help out. This is a problem I've been running into lately. I go over to review tab, ...
2
votes
0answers
35 views

To-do app in node.js

I get the feeling this code for a to-do app is not secure, and as I am just a beginner, I don't know about my coding style, is it conventional/elegant? Please don't hesitate to criticize me. ...
3
votes
1answer
44 views

Toggling menus based on an ID

I have recently started using browserify and have created a custom module to toggle two menus based on the ID clicked and apply a transparent overlay effect behind the menu. I have got it working but ...
2
votes
0answers
25 views

Parallax multibrowser jQuery plugin

I'm working on website with a parallax effect. The jQuery code is working, but I wonder if there could be made any improvements made to the code. At the moment it works totally smooth in Firefox, but ...
1
vote
0answers
28 views

Testing input validation and an AJAX request with Javascript and QUnit

I have a simple web page. The user enters the name and rank of a soldier and hits submit. If the input is invalid, an appropriate error message gets displayed. Otherwise, it adds the soldier to a ...
1
vote
0answers
12 views

Fetching ALL data set from API iterating via response data

Does this make sense? How would you achieve the same thing, with cleaner code? ...