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

1
vote
0answers
29 views

Javascript Class System

Warning: The code snippet does run two alerts, just so you know. I wrote a javascript class system with the idea of making declaration simple and clean and instantiation even simpler, along with ...
0
votes
0answers
25 views

Inline editing for modifying field that requires supplementary inputs (such as password)

I've been using x-editable, but recently needed to perform in-line editing, but required the user to enter one or more additional fields. For instance, to change ...
3
votes
1answer
21 views

Framework to define and require JavaScript modules

I'm working on a webapp that I use gulp to build. It uses useref to gather and concatenate/uglify the assets used in the HTML files. In this case, as things are getting concatenated, it doesn't make ...
0
votes
0answers
10 views

issue extending angular-ui-bootstrap tooltip [on hold]

I'm attempting to build an extended version of the Angular UI Bootstrap tooltip although it's really more of a translation of the $modal provider into a tooltip provider my intent is to create a ...
5
votes
1answer
28 views

JSDoc for TCG game entity configuration

The Cardshifter team has been working at "translating" a very complex Java class into JavaScript, to make it more accessible to somebody who would want to fork the game and make their own ...
1
vote
0answers
17 views

ScopeFactory - Best way to share $scopes across Controllers in Angular?

Previously I use to always navigate through the $parent $scopes in order to send or change data from one Controller into/in ...
6
votes
3answers
332 views

Bubble sort algorithm in JavaScript

I'm new to JavaScript (and programming) and taking a course. I was tasked with creating a bubble sort on any array using JavaScript. Of course, since this is an algorithm challenge, no sort method ...
2
votes
2answers
26 views

Toggling classes on many elements when a button is tapped

I have this very easy functionality to find, toggle and remove classes from my html elements. The thing is that I find my self repeating the same code with just different name classes. I basically ...
0
votes
0answers
15 views

Method for realtime form validation

A quick little method for validating form input with jQuery (and some built in bootstrap classes). I know the regex isn't perfect but it's close enough. Thoughts? ...
0
votes
0answers
13 views

JavaScript application design method to cut down on code vs readability and organization [on hold]

I am building a Project Management Application. A key feature is that Project Task records are shown in Task Lists and can be opened into a ...
2
votes
2answers
34 views

Grab Facebook Graph share count and abbreviate it

I have this code that requests the graph API from Facebook to respond with a shared count for a particular URL (could be multiple on the page). Graph returns a full number (135934) and I take that ...
4
votes
1answer
60 views

Shopping cart simulator

I have tried to simulate a cart (only partially completed). I just wanted to see how the code upto this point can be enhanced. I am trying to learn about the usage of ...
0
votes
0answers
26 views

Schedule AI Challenge: recursive function crashes browser [on hold]

I am doing the 'schedule' AI challenge and worked a lot on producing the code below. It works great for the Easy test (10 courses), but crashes the browser on the Harder one (250 courses). I suspect ...
0
votes
0answers
16 views

React: Set state in life cycle events from props

This is a ReactJS component that accepts a date and displays how long ago this date was (5 seconds ago, 3 minutes ago, 5 hours ago, ...) + it uses a setTimeout to ...
0
votes
1answer
28 views

Functional implementation of collecting objects into groups

Trying to write more functional Javascript with the underscore library. Any thoughts on how to improve this to be more functional than imperative? Also, any way to do this without ...
4
votes
1answer
37 views

D3.js interpolating line on circumference of circle

For now, I've tried to make a line rotate on the path of a circle, but used setInterval multiple times and there might be other ways of achieving the same. I would ...
2
votes
1answer
22 views

Toggling a panel and the clicker text

I have written some jQuery that slides open a panel on click, and changes the toggles of the clickable bit from 'Show All' to 'Hide All'. It works, but I'm trying to figure out what would be the most ...
6
votes
1answer
46 views

Basic physics simulation

I've been fooling around in JavaScript again, and I've come up with this simple physics simulation. I think it has a pretty simple setup, here's "psuedocode" of sorts to explain it. Constructor ...
3
votes
0answers
27 views

YouTube video intro, and autoscroll when video ends

This code creates an intro video using the Youtube API, screen text written by JavaScript with a typewriter kind of effect. How can I rewrite this as succinct object-oriented code? Also, I'm not sure ...
2
votes
3answers
79 views

Object to query string

An object (POJO) holds query arguments and has two-binding to a form using some MVC framework. later the object needs to be converted to a query string that will be appended to an HTTP request. ...
0
votes
0answers
24 views

Is Angular the best choice of front-end framework? [closed]

I'm starting a personal project soon and I've been investigating whether to use Angular or not when I came across these; ...
3
votes
2answers
60 views

Parsing a URL from a document and matching it from an array

I need help in improving this script that I have written to parse a URL and check it from an array. This is what I have done till now: (fiddle) This is working fine. Was this done correctly? What ...
2
votes
0answers
17 views

Lightbox plugin

Well, I'm writing a plugin that will work as a lightbox, and I wonder if there are other methods which I could use to improve the code ... ...
3
votes
1answer
171 views

Rendering function for total player points

I have a render function: ...
0
votes
0answers
25 views

Parsing sentences to create a chat bot

I am developing a chat bot with Node.Js. I am trying to find efficient way to parsing sentence. ...
3
votes
0answers
34 views

Von Neumann extractor to remove bias from pseudorandom array

Von Neumann extraction is a technique to remove bias from a source of entropy. You extract an unbiased array of bits from a biased one by comparing consecutive pairs of bits in the array and returning ...
0
votes
0answers
18 views

Unit testing UI related modules

Inspired by various jQuery UI unit tests, I write my unit tests in a similar fashion, since they, just as jQuery UI, relies a lot on user interaction. The thing I'm most concerned about is that I'm ...
2
votes
1answer
54 views

console.log() 'relay' to the document

This is very complicated code, with the goal to show all the messages sent to console.log() on the document or another element. The code simply replaces the ...
6
votes
1answer
79 views

Emulating Conway's Game of Life using JavaScript

I am currently reading Eloquent JavaScript and am trying to solve the exercise problems. One of the exercises in chapter 18 asks to emulate Conway's game of life using checkboxes in JavaScript. ...
-1
votes
0answers
21 views

Coderbyte longest string [closed]

So I am currently working on a problem set for Coderbyte and I cannot seem to figure out why my code is not returning any value at all. JS lint is not seeing any issues with, but when I run the code ...
8
votes
1answer
109 views

The effect of typing a sentence out

The following code is complete and works perfectly. What I want to do to is make it more modular in a way where I can use the code again - similar to an api. I also hardly ever code in javascript, ...
2
votes
0answers
20 views

Backbone/requireJs and circular dependencies

I'm trying to have a main App view with references of all my views to manage and call transitions between theses views. But, I have circular dependencies. app.js ...
5
votes
0answers
147 views
+50

LiveDate version 2

LiveDate has the ability to display the current date either by asynchronously fetching the time from a server or by just using the client system date. It's only as ...
0
votes
0answers
16 views

Send Ajax Request Function v2

I would like to get a full on review on my sendAjaxRequest function. Suggestions for any improvement are always welcome! sendAjaxRequest.js ...
0
votes
1answer
32 views

Efficient data migration

I'm trying to make a market depth chart with data from a exchange and a Google JS chart. The good news is I got it working, but the bad news is the code to prepare the data to be used by google ...
2
votes
1answer
46 views

JavaScript Dropdown Selector

I am just getting into front-end web development and to practice, I made a dropdown selector that allows for more styling than the regular <select> element. ...
-1
votes
0answers
50 views
+50

Expanding/contracting panel widget

Right now I'm studying OOP with js/jquery and so far upon reading tutorials over the internet and with the helping hand of google, I come up with a way to do it based on my understanding. ...
0
votes
0answers
13 views

Setting Sass environment variables in Grunt

I am into building functional prototypes, but also for outputting CSS and JS, which means we have 2 times we build out our code, once as a demo with HTML files (we are using assemble.io) and another, ...
3
votes
2answers
59 views

Sliding effect with bounce

I have used animate.css and jQuery as external libs. Is there a better way of doing what I have done with jQuery? DEMO ...
2
votes
1answer
38 views

Generating Calendar month information using JavaScript

I am using the below function to set month information on context passed. It is working fine, but please review it and let me know if there are any potential flaws or any improvements in this code. ...
1
vote
0answers
33 views

Yet Another Javascript Dependency Injector

I got bored had time to kill in work and was creating a few things using plain JS (no frameworks allowed! I wanted to get used to progressive enhancement). I realized I would run into a problem if I ...
1
vote
0answers
23 views

Simple AJAX library in JavaScript

I've created two simple methods: one to instantiate a new XMLHttpRequest object and open the request and another to handle the request. Can you please point out ...
2
votes
1answer
58 views

Fast merge sort in JavaScript

When developing a user interface that allows sorting by various different fields, I noticed that Array.prototype.sort() is extremely slow for large inputs. After ...
3
votes
2answers
59 views
0
votes
0answers
29 views

Pagination with static data

I am using following code to implement pagination functionality. All items are rendering on page load and li elements greater than page set are hidden with CSS. I ...
6
votes
2answers
177 views

Checking validity of NxN Sudoku

Given a multi-dimensional array representing a board in Sudoku, the function should be able to return whether the sudoku is valid or not. Examples: ...
2
votes
3answers
62 views

Functions between certain times of the day

I'm working on something for my school's laptops that will disable videos/games between 8:00 AM and 3:15 PM. Due to the giant time gap, I will not be waiting to see if the code functions properly or ...
3
votes
2answers
56 views

Check if variable is sent

I have this piece of code in my Node.js API and I feel like it could (should) be optimized. ...
1
vote
2answers
64 views

jQuery pullout functions

I am using a simple page with 2 pullout functions, one on the left and one on the right side. I would like to simplify or combine the two functions into one and make one pullout close, when I click on ...