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
votes
0answers
14 views

Equally distributing child nodes around parent nodes [on hold]

I'm trying to generate random "artistic" visual graphs with this piece of code that I wrote. Basically, there are different "levels" when creating this graph - as it gets deeper the smaller and dimmer ...
-3
votes
0answers
26 views

How should this code be unit tested? [on hold]

I have some code that I have some end-to-end tests written for, but am unsure if this code needs to be unit tested and what those tests should look like. To try to be clear, I don't expect an answer ...
4
votes
1answer
29 views

Testing code that changes the DOM on page load

I am in the process of writing tests for my JS code with CasperJS and Mocha. I have a function that changes the DOM and gets run on page load (through jQuery's ...
3
votes
1answer
49 views

Simple Tic-Tac-Toe App Using Knockout.JS

This is really the first full app I've written in JavaScript minus CSS styling which I plan on adding later. Are there any ways it can be improved? Any ways I can make it cleaner or easier to read? ...
-1
votes
0answers
6 views

Avoiding duplicate values in jQuery array [on hold]

I have the following code for using with select2. I am using Ajax to get the JSON from Mashape API. I received the object and can retrieve the value into tags. But I am having few values repeating. ...
0
votes
0answers
11 views

Timing issues on Image Slideshow (input via clipboard) [on hold]

I have been tinkering with pasting an image into a browser through extracting the data via the clipboard... I have managed to create a reasonable slideshow script working, but the problem is that the ...
7
votes
2answers
63 views

Animating a block of HTML on scroll

I'm pretty new to client side scripting and I'm still learning. I've written this JS plugin which animates blocks of HTML (fade-in from left/top/right/bottom) as you scroll down the page. Everything ...
1
vote
0answers
16 views

Extensible actions for same element

In order to avoid boilerplate code and make an extensible pool of actions for the same portion of code (a row of texts to edit), I've prepared this code. HTML ...
0
votes
1answer
31 views

Image slider demo

Since I'm new to web development, I've decided to create this carousel, to practice a bit of JavaScript, more specifically jQuery. I'm really happy with the result, but I'm sure that to an expert my ...
3
votes
1answer
32 views

Improving jQuery scrolldown animations

I'm pretty new to client side scripting and I'm still learning. I've written this JS plugin which animates blocks of HTML (fade-in from left/top/right/bottom) as you scroll down the page. Everything ...
1
vote
1answer
24 views

Node.JS Twitter Count Module

I would like someone review this code and tell if it can be done better, or if the code is elegant and simple enough for the task at hand. I used code climate and I got 4/4 and my test coverage is ...
3
votes
0answers
16 views

RSS parser for Node.JS

I would like someone review this code and tell if it can be done better, or if the code is elegant and simple enough for the task at hand. I used code climate and I got 4/4 and my test coverage is ...
3
votes
2answers
327 views

Adding a bookmark, or changing an existing one

I have a very problematic nested if/else/for that I'm sure it could use some love. Here's how it looks originally: ...
-1
votes
0answers
12 views

Push sent only to one person [on hold]

I am running a piece of cloud code: ...
0
votes
0answers
9 views

Adding two tinyMCE buttons to the WordPress editor

I'm pretty new to JavaScript, and I built a plugin that adds two tinyMCE buttons to the WordPress editor. The buttons wrap a selected text with shortcodes. One of the two buttons is a menubutton, and ...
1
vote
1answer
46 views

Using singleton in jQuery [on hold]

I want ideas on how to improve my code. I would like to get information on how the singleton pattern looks in jQuery, and how to let a user pick a file from which to load and count characters. I ...
-2
votes
0answers
43 views

Refactor if else in function [on hold]

ANy ideas how to improve this code? //productPath arrives ...
0
votes
2answers
60 views

Click handlers for edit and save buttons

I have the following code from a JavaScript file: ...
7
votes
3answers
73 views

On hover, hide text and display options

Recently I learned HTML+CSS and a bit of jQuery and am building various web-things to stretch my skills and learn more about how to do things the right way. I was a bit surprised at just how many ...
-1
votes
0answers
8 views

JavaScript Table Sorting - tablesorter (parse on the fly) vs stupidtable (`data-` attributes) [on hold]

I am trying to get a grasp as to which jQuery table sorting method/plugin is better. Tablesorter Parses all the table data to sortable data. Stupid Table Plugin Allows the dev to add sortable ...
5
votes
0answers
23 views

ECMAScript text component

At the moment, I'm learing ES6 and how to write classes. And I'd like to know if I'm doing things right and I have some points that are not clear to me. Please find my code here at bitbucket and ...
3
votes
0answers
22 views

Using setTimeout to get scrolling chat window to work, but doesn't feel like the ideal solution

My friend and I are working on a bare-bones chat web app, using Angular on the front end. He's using Swampdragon for some of the real-time stuff. My task that I set out to achieve was to get the chat ...
0
votes
0answers
14 views

Conway's Game of Life-JavaScript [on hold]

I cannot figure out how to move to the next generation or if my "rules" even make sense or work. I have the neighbors declared and working. I do not know where to go from here or how to do it. I ...
3
votes
1answer
41 views

Simple AJAX script calling a number

I wanted to create a basic interaction which does 1 outcome but with 2 possible actions: get a number from an other document, by either clicking on a button or waiting a fixed amount of time. I wrote ...
2
votes
0answers
31 views

Java JSON Stringifier with the Nashorn API

I have written a Java JSON stringifier with the Nashorn API. Since this code is slow, I wanted to ask if I can improve it. My target is the highest possible performance to make it an alternative to ...
2
votes
0answers
16 views

Practicing recursion with getElementsByClassName

I'm trying to get a good grasp on recursion by implementing document.getElementByClassName. I've made something that works but I'd like to know if there is some ...
1
vote
0answers
12 views

Semaphore with Node and Redis

I'm learning Node and Redis and created a semaphore for master/slaves. ...
0
votes
0answers
16 views

Sharing app methods to routes in Expressjs 4

I would like to know the right way to execute an action(a method) from my app into my routes. I have to do this because I have a POST route waiting to be call from other pages (like an API call) but ...
0
votes
0answers
6 views

Retrieve and cache web SPI results, then display on page

I'm writing some code to return results from a web service and display them on screen. If the service is down I want to use Lawnchair to serve cached results. ...
4
votes
1answer
28 views

Handler for a screencast submission form

I have a monolithic script that powers this form: Here it is: ...
-4
votes
0answers
11 views
0
votes
0answers
37 views

Cross-site request forgery defense for code to count Likes

I have the following code which is supposed to insert a row into a DB table "clicks" (consisting of 1 Primary AI column "id" and another column "user" which contains the user's session ID) upon ...
0
votes
0answers
18 views

Nesting views in Backbone

I have a parent view with the el say divcontent: ...
1
vote
0answers
21 views

Appropriate use of bind for elasticsearch callback

I'm starting a new project with Node. I'm learning the object model, and the code below is my first module. One of the things threw me was the behavior of this ...
0
votes
0answers
11 views

I want my if statement to play tic tac toe if the user responds to the prompt box appropriately [closed]

http://jsfiddle.net/g6rgptrg/2/ Below is the function that is supposed to check if the prompt was responded to correctly and play tic tac toe (if true). ...
5
votes
1answer
47 views

Simple syntax highlighter - part 2

I've completely revamped my old syntax highlighter, and made it more flexible and easy to use. It works the same way as the previous one, wrapping <span> ...
6
votes
1answer
88 views

Simple syntax highlighter in Javascript - SQL highlighting

Yesterday and today I've made a very basic syntax highlight. It creates a function in the window object that handles part of the job: ...
3
votes
0answers
52 views

jQuery selector function in JavaScript

I've reproduced the jQuery selector function in JavaScript. Here are the two rules that come with this function: You may not use any JavaScript libraries. ...
3
votes
0answers
58 views

JavaScript 8-bit floating point

To start, I am in the wrong language and I think it is time learn some C++ and compile it as an add-on for NodeJS. For now, though, I have a few code snippets that work that may be interesting or may ...
7
votes
0answers
85 views

Code to convert number to words

I am trying to practice objects and functions (specifically closures & higher order functions) in javascript. There is no specific reason why I chose this program but it struck my mind to work out ...
1
vote
1answer
50 views

Element selectors for a RepeatButtonView

I have a large application with a wide-reaching amount of views and sub-views. I have a need to decorate DOM elements with identifiers so that my framework of choice can bind views to the DOM ...
1
vote
0answers
27 views

jQuery mobile application listing beers and breweries

I have been working on a jQuery Mobile (1.4.5) application for the past week. In short, the application is a bunch of pages that show listings of beers, breweries, and other things. There are few ...
-1
votes
0answers
24 views

Number to words using jquery javascript towords [closed]

I want to convert money value from number to words i found a tutorial its free so i tried it the tutorial is from here. it is looking good but here are some things that needs changing like for example ...
1
vote
1answer
42 views

JavaScript dropdown component

How can I improve this component with using event delegation rather than doing a lookup using parentNode so that I can change the markup around without having to ...
0
votes
1answer
47 views

Auto generate text input and checkboxes when value of text input changes

In these fiddles I am generating the number of textboxes and checkboxes depending on the input of user. This first fiddle deals with the first problem generate number of textboxes onchange of the ...
0
votes
0answers
20 views

Customer ViewModel with optional JSON initialization parameter

I have a situation where I have a ViewModel e.g. // Main_ViewModel ...
2
votes
2answers
35 views

Countdown to multiple update times each day

I'm creating an update function to show my users when the next update will be available. I'm using the jQuery countdown plugin to show the time. What is a more efficient way to write this? ...
-1
votes
0answers
19 views

updateBuildChart method with a lot of dependencies

I've some refactoring issue with one method. This method has a lot of dependencies ...
1
vote
2answers
64 views

Handling errors of nested promises

This is in one of my AngularJS controllers: ...
0
votes
0answers
14 views

Middleware code for preventing repetitive identical requests in Express

I have problems when some of my users starts to frenzy click the save button generating duplicate records on the database. I wanted to create a generic solution so I could reuse it on another projects ...