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
1answer
41 views

Sound Control System

This is my sound system that allows for the following functionality: One master volume that controls every sound. A function to stop/pause every playing sound A function to control every instance ...
9
votes
2answers
443 views

Checking all checkboxes

Problems: Wanting to check all checkboxes when the checkbox w/id=checkall is checked. Wanting to uncheck the "checkall" box when any other checkbox is unchecked. Solution: ...
1
vote
0answers
11 views

AngularJS Cookie Manager

Just looking for an initial steer on my AngularJS implementation. Background Started work on a clients new site which uses a popular CMS as the backend and AngularJS has been chosen as the client ...
0
votes
1answer
36 views

YUIDoc syntax for optionally static constructor

In JavaScript, I wrote a class that can be optionally instantiated with the new keyword, but can also be called statically as well. What is the best way to ...
0
votes
0answers
14 views

Stacking 2 fixed header [on hold]

I would like to stack 2 fixed header together while scrolling Is it possible with only HTML and CSS? If not, where can I find a short and clean javascript to achieve it? Code: http://goo.gl/KqAM2R ...
6
votes
2answers
192 views

Another JavaScript Stack Exchange chat bot

I've been inspired by @SirPython's SirAlfred JavaScript chat bot, so I went and made my own. This one is slightly different though, in the fact that it can accept input in a more lenient way. For ...
1
vote
3answers
38 views

Date composition from day, month and year input

I need to concatenate 3 input fields into a string which is formatted as a date dd-mm-yyyy, using type="date" or ...
2
votes
1answer
42 views

Dropdown UI component

I've implement a custom dropdown, that help to find users from data. Each item have a userpic, first name and last name. And my task is create a dropdown with settings like use picture or not. I coded ...
2
votes
0answers
31 views

Object Depth Manager

I have just finished up making an object Depth Management system that I will be using for drawing and explicitly drawing. Because we all know that the order in which things are drawn heavily effects ...
14
votes
4answers
194 views

The chatbot for The Community Post Pimping Board

I recently wrote a chat bot for a chat room here at Code Review. The chatroom is meant to be a place where people can come and pimp a post. That chat bot is meant to handle a list of subscribed ...
7
votes
2answers
227 views

Random value excluding both limits

The javascript method Math.random() returns a (pseudo-)random float between 0 (inclusive) and 1 (exclusive). In some use cases, I need both limits to be excluded, ...
1
vote
1answer
46 views

Scroll to specific sections

I have a jQuery code that helps me to scroll to specific sections on mouse scroll. To handle mouse scroll events I am using the jQuery mousewheel plugin. ...
3
votes
1answer
28 views

“Offset position on scroll” JavaScript snippet

I'm at a loss as to how I could optimize this bit of code. I realize I could place these objects into some sort of array, but I'm not sure how to go about this. ...
-1
votes
1answer
60 views

Filtering/mapping strategies

This is real JavaScript/Lodash code used in a project I'm currently working on, but actually this particular question bothers me quite often regardless of the language. Say, I need to generate some ...
-1
votes
1answer
25 views

Properly Structured Angular Application

I've been writing a somewhat complicated service that involves a lot of API function calls in Angular. After a somewhat tortured first attempt I have tried to take more of an MVC approach rewritten ...
3
votes
2answers
92 views

Showing and hiding text excerpts

Below is my jQuery scriptfile, all the functionality works (except for the click events on IE). I bring this before you guys to ensure I am effectively separating concerns and writing efficient ...
0
votes
1answer
17 views

Handling multiple async functions

I want to run multiple asynchronous functions and use their results in a final function that is called after all async functions have finished. For example, reading 2 files at the same time and doing ...
5
votes
1answer
62 views

Longest Increasing Subsequence

I am learning dynamic programming and I have written down some code for longest increasing subsequence. I would like to know if there is any case or any area of improvement in the terms of ...
3
votes
1answer
42 views

Single button use to create light box that brings up different content based on the div

My goal is: when you click on the button "word" it will turn into a lightbox. The button will bring up another content box that holds the same profile image as before with a small bio with image ...
4
votes
1answer
57 views

Tic-Tac-Toe command line

I created a simple Tic-Tac-Toe. I'm looking for any critiques from a code standpoint: general structure / style / efficiency. Unfortunately I couldn't get a live demo working because of the ...
-1
votes
1answer
25 views

methods with variable names and alias methods [closed]

I'm writing a javascript code that runs functions depending on a variable let's assume that there are two domains called (example.com and foo.com), "example.com" has subdomains (a.example.com and ...
3
votes
0answers
63 views

JavaScript API for REST

I have a REST API, which naturally you can just use HTTP calls (mainly Ajax) in order to send and receive data. I am building a layer of abstraction on top of the raw REST API for JavaScript ...
0
votes
3answers
43 views

Rewriting hours

I am just trying to rewrite hours; say 1:24PM, if 24 > 30 then it is 2PM, otherwise it is 1PM. I really doubt that I am doing it right, first I am sure it looks so amateur, second I am not sure if it ...
0
votes
1answer
29 views

Choosing between local and server data

I have some working code, but it seems a bit clunky. I need to get data from a service. The service will hold the data in local storage if possible (to make it speedier), but if it's not been ...
0
votes
0answers
23 views

Custom post carousel

I created a post carousel (it's being used on a WordPress theme initially), but I've adapted it to just HTML/CSS/JS one. CodePen ...
3
votes
2answers
60 views

Banner Picker in jQuery

I would like to know if my current jQuery code could be improved? If yes, can you give me improvements? ...
4
votes
1answer
39 views

Storing get call data on same function

I basically have a folder view structure, that each time I call grabs the value of the selected field and gets that specific folder data. I was wondering if there's a better way to do this by caching ...
0
votes
1answer
30 views

Watch for CRUD state changes and make sure only one is active at once

I'm using AngularJS and I have a watch task in my controller that needs to be dried up if possible. Basically it watches for state changes in my front end. I have 3 buttons: add, edit, and delete ...
2
votes
1answer
36 views

Todo List Application Code in Pure JavaScript

I'd highly appreciate it if you can: Spot flaws, especially bad practices and suggest a possible alternative method. Spot inefficiencies and suggest how to perform that task efficiently. You may ...
3
votes
1answer
42 views

Converting Procedural JS Code to Object

I'm new to JS and trying to improve my code with the use of more organised objects. I have the following procedural code which I have converted to an object. It does an ajax load within main. Aside ...
2
votes
1answer
45 views

sed-like attempt from database in node

The following code and test data works, but I have had to add delays between writes to MySQL otherwise it acts funny (especially on the target data set which is over 700 rows). The table is simply a ...
2
votes
1answer
74 views

JavaScript Image Slideshow

I've created a JavaScript image slideshow, using only JavaScript (no jQuery). I want to become more familiar with JavaScript, which is why I didn't use jQuery. My four requirements were: It must ...
1
vote
1answer
32 views

Organize dynamic HTML generation function for audio player

I have some code that's part of my music-js library, and most of it is very organized, using object-oriented design for my AudioAnalyser and ...
1
vote
0answers
25 views

Filter CSV file and display it using Highcharts

I created a function which reads CSV file and displays those values in a graphical form using Highcharts. Although it works, I have to read the CSV file twice because first: I need to get all the ...
1
vote
0answers
85 views

jQuery plugin for dynamically sticky headers and footers

I am creating a jQuery plugin to be used to stick the headers and footers of tables (or other list data) to the top and bottom of the viewport while scrolling. (i.e. scrolling down the page, the ...
4
votes
2answers
76 views

Even Fibonacci numbers under 4,000,000 (Project Euler #2)

Prompt: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, ...
2
votes
2answers
72 views

Selecting security questions and entering answers

I have a dialog that houses 6 security questions and 6 security question answers. I want to pass the data the user selects and enters from the view to the controller to save the data in session. ...
4
votes
2answers
67 views

Marking a new dataTable row as consumed or cancelled

This is working code from a dataTable, which shows the function executed after the row is created: ...
1
vote
1answer
50 views

Taking and saving pictures using promises

I have the following 4 functions that work, however, I am sure that utilising promises will improve my code. I just find them so confusing. ...
3
votes
1answer
58 views
5
votes
2answers
73 views

Finding the sum of all the multiples of 3 or 5 below any given number

I wrote the following simple function in JavaScript that finds the sum of all the multiples of 3 or 5 below a value, given from a text-box. I have used \$\dfrac{n}{2(a_1 + a_n)}\$ (sum of arithmetic ...
3
votes
1answer
28 views

Date validation with html5 dates

This code validates the following: enddate should not be less than or equal to startdate. ...
3
votes
1answer
40 views

Opening & closing active items with jQuery

I'm trying to have the 3 buttons to each open its own list below whilst closing any current active lists open. I've tried my best with jQuery, but it seems so bloated. Is there a way to streamline ...
1
vote
1answer
43 views

Opening and closing active items

I'm trying to have the 3 buttons to each open its own list below whilst closing any current active lists open. I've tried my best with the jQuery, but it seems so bloated. Is there a way to streamline ...
2
votes
0answers
32 views

Passing functions using higher order components in React

After reading this, I'm on board, however it doesn't get into passing methods from the parent class. In my mixins right now I have a lot of helper functions that are used across the various components ...
2
votes
1answer
50 views

Iterate through properties of an object

I need to round numeric values for properties of a given object. The following code works fine, but I am concerned if there is a way to make it faster. I am targeting latest Chrome and Firefox. ...
0
votes
1answer
36 views

jQuery-loaded financial report taxes the browser

I load a table in a div using the .load() method. If I look on the console I see the times taken to display the table: 4.98 seconds that firebugs says are spent ...
2
votes
1answer
42 views

Idle Miner part 2: levels service

My previous post had no response, so there is part of the whole - levels service. It stores levels with it's attributes. I'd like to hear any suggestions about code readability and code performance. ...
-2
votes
2answers
63 views

Fasten single line of code for div resize [closed]

I have this one single line of code I wanted to improve. My main concern is the execution and rendering speed of it. Even though I am happy with its speed, could it be improved? ...
-3
votes
1answer
37 views

best way to determine if a string is unique in javascript [closed]

Assume there is a list of unique strings. The implementation of that list is unknown. You need to check if a given string is unique after comparing with all elements in that list, and add it to that ...