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
5 views

Python DefaultDict implementation in JavaScript

I found Python's default dict and ordered dict incredibly useful, hence I attempted an implementation in JS. As JavaScript objects only supports string as key, it is not as powerful as the Python ...
0
votes
0answers
8 views

Change color of link if radio button is not checked

I have created an online exam system in PHP and JavaScript. In the HTML page, my questions are fetched from the database. If any question is unanswered or the radio button is unchecked, then the ...
0
votes
0answers
9 views

Module based todo list

This is my todo list based on the Module Pattern. This is working fine and just want to know two things. Can my code be simplified? Once I've added a list, if I refresh the page, then these lists are ...
1
vote
2answers
23 views

Alternate for nested Ajax requests

I have one button on clicking I need multiple things need to be done, so I went for AJAX and PHP: ...
3
votes
1answer
23 views

Removing duplicates from an array

I recently wrote this JavaScript algorithm for removing duplicates from an array as part of a job interview process, but was turned down for the position after submitting the code. I didn't receive ...
0
votes
1answer
13 views

Creating object Nodes an easier way

I am required to create a bunch of object nodes to an object: ...
3
votes
0answers
25 views

How can I speed up the reading and writing of pixels of BufferedImages?

I'm working on a project that takes in a video file and does some image processing on each individual frame. The first step in that processing is to take each source frame and generate three ...
1
vote
2answers
18 views

Handling with the 'error' parameter inside a callback function in node.js

I have multiple controllers and every controller has this error handler: if (error) { res.render('error', { error: error }); } Sometimes I have more ...
3
votes
0answers
228 views

Polyglot array_extend() function for Javascript and PHP

This is a polyglot function I've made out of fun. The goal is to grab n arrays (or Javascript Objects) and 'extend' them in ...
2
votes
1answer
36 views

Changing background colour

I am currently changing the background colour of a sidebar each time a menu item is clicked using the following code: ...
0
votes
0answers
31 views

My first Quine - javascript [on hold]

My first Quine: ...
2
votes
1answer
38 views

Method for parsing floats and adding totals

My intention is to create a nice DRY method (add) which will take care of parsing floats and adding totals internally and will be called by other methods. I feel ...
0
votes
0answers
25 views

JavaScript ForEach function [on hold]

Is this a good forEach-function? Is there something important I missed or is there a smarter/shorter way to do it? ...
0
votes
1answer
36 views

Implementing Command Pattern - How to make more readable if else statements for commands? [on hold]

I have a method, that execute some operations on a passed object. Accordingly to the object type (cmd.declaredClass) I need to run some specif logic. The execute ...
2
votes
1answer
31 views

Assembling a json object from an array

Is there a way to make this code shorter and more succinct? Thanks My objective is to: Take an array of objects (someArray) Use get() to get one specific ...
2
votes
1answer
67 views

Notepad5, a simple HTML5, JavaScript notepad webapp

I made a simple notepad webapp, called Notepad5. You can use it to make notes while browsing the web and don't want to open up a separate application or extension to put the notes down and don't want ...
0
votes
1answer
22 views

Natural sorting/comparing algorithm in TypeScript

This code sorts string that may contain numbers in natural order, that's it, "item 2" comes before than "item 10". It currently ignores case. I plan to implement options to handle case sensitivity and ...
3
votes
1answer
28 views

JavaScript/jQuery DatePicker

I created some functionality for JavaScript datepicker. I'm trying to store a value in the datepicker with the selected month along with which half it is. To do ...
3
votes
0answers
21 views

Custom dropdown selector

I'm working on improving my knowledge of OOP in JS. I just created this custom dropdown selector. It's working nicely, but I'm not super happy about the Filter ...
2
votes
2answers
41 views

Pulling data from different JSON files

I have a controller that pulls gets data from two different JSON files. One of the calls loadProducts happens when the controller is initiated. The other one, ...
0
votes
0answers
14 views

iterate through array with some undefined results [closed]

I'm iterating through array ,no errors found, but when i check the console, I get, 2 undefined results and it's pointing to the for loop code block, ...
2
votes
2answers
38 views

Quickly filter an object by keys

I am trying to optimize an object filter function. Given an array of keys, I need to filter an object. I feel that creating a new object each time may degrade performance. Is there a way to mock the ...
0
votes
1answer
15 views

Using app.use only in routes that start with /admin

I have several routes, and I need Facebook authentication only in the routes that start with /admin: ...
2
votes
1answer
57 views

Diamond kata in JavaScript

I'm just starting to learn JavaScript. I implemented the Diamond kata, and I would appreciate if anybody could give me some feedback. I'm particularly concerned about learning the most 'idiomatic' way ...
0
votes
0answers
12 views

jQuery cookie scroll position

I'm using jquery and cookie.jquery to remember the scroll position. Is there anything I can do to improve my code? Thanks! ...
0
votes
0answers
17 views

String Hashing Function using JavaScript [closed]

On Line 5, I wanted to convert key+1 from a string to a number without using the JavaScript functions parseInt() or ...
1
vote
2answers
31 views

Work out if a string is “fieldname” or “tablename.fieldname”, and assign variables

Is there a neater way to write this code? ...
4
votes
2answers
78 views

Press any login button on any site

I'm working on a script that will be able to press the login button on any site for an app I'm working on. I have it working (still a few edge cases to work out such as multiple submit buttons and ...
4
votes
0answers
56 views

Another attempt of “real private” methods in JS

URL: http://jsfiddle.net/rabbit_aaron/ve7deecw/ This is again, a JUST FOR FUN project. In this attempt, I use a closure instead of validating caller to ensure only member methods can access private ...
0
votes
0answers
8 views

function that searches for user inputted characters in a string [closed]

It is working correctly as far as I can tell, the only problem being the title, trying to display the 'count' in there and it comes back as undefined? ...
-1
votes
1answer
18 views

Accordion/collapsible

The code I wrote to do this effect stays "fixed" on top or on bottom. I did it the manual hard-coded way and wanted some advice on the best way to write something like this. jsFiddle ...
2
votes
0answers
21 views

Iterating a list to make API calls

I'm new to JavaScript and was hoping there was a cleaner way to write this. It's a block of code that looks at a group of documents in a collection (called Messages), and makes a call to the GitHub ...
2
votes
0answers
16 views

handle drag and drop operations

I've come up with the following code to handle drag and drop operation. It's composed of a constructor function that returns an objects with methods to attach to event handlers. Notes about this ...
2
votes
2answers
49 views

Displaying current date and time using JavaScript and HTML time tag

I am creating a simple support ticket system. I thought It would be a nice little feature to show the current date and time. Since I want to show the current time I thought JavaScript would be best ...
0
votes
0answers
11 views

What makes more sense for an implementation of a stage/scene setup? [closed]

I have the setup for a game using a stage/scene model. Stage will handle a collection of scenes that can be changed from one scene to the other. The scene will handle what is displayed. What's inside ...
1
vote
0answers
20 views

jQuery remote validation plugin

I wrote this jquery plugin to do remote validations on the server. The code self explanatory. When the field blurs (event is customisable), the plugin checks to see if there is a value and sends the ...
1
vote
0answers
9 views

Javascript custom event hub

I'm creating an event hub object in for a large project I am building in Javascript. The project will have modules in charge of the UI, commands, and rendering. Each module will use this hub for ...
3
votes
1answer
42 views

Emulating class extending

I'm using the following piece of JavaScript to emulate class extending. Is this a valid way to go or does it have some drawbacks which should definitely be fixed? ...
0
votes
0answers
23 views

Using CasperJS to fetch and fill option values

I use the following CasperJS code to fetch data from an ASPX page with combo drop down box, which option values are dynamically populated via __doPostBack(). the ...
1
vote
0answers
18 views

Chaining HTTP requests becoming unreadable

I'm dealing with some very frustrating API's that requires a bit of filtering/processing data in order to get the results I need. I need to make 2 API calls, one of which returns a list of asset ...
0
votes
0answers
13 views

Code enhancement for existing npm package

I am trying to improve the code in the npm package. I have looked through the code but don't have any ideas how to write proper code. GitHub ...
-1
votes
0answers
16 views

Optimize Javascript with JQuery code

I have this form where if you enter the customer number the alternate ID is disabled and visa-versa when I submit a bad form via Ajax. When the response comes back both fields are able to be edited. ...
2
votes
0answers
26 views

Online store for pies - Part 2: User authentication

I'm building an angular application using AngularJS and AngularFire. As this is the second part of this "series" it might be a good idea to also check out part 1 to gain an even better overview of the ...
3
votes
0answers
22 views

Optimizing image generation in Perlin noise generator

I've created a simple Perlin noise generator in JavaScript and am trying to find ways to optimize it. It lives inside a webpage and generates an image using nothing more than random number generator ...
1
vote
1answer
25 views

Updating height of the rows in tables with jQuery

Does it make any sense and how to modify the JavaScript/jQuery code below to increase the performance? The working code is: ...
0
votes
1answer
46 views

JavaScript naming and grouping

I'm fairly new to JavaScript. I would like some feedback on the naming and grouping of the following code. Is there any change that will make it more readable? ...
0
votes
1answer
28 views

Colour-changing clock

I am fairly new to javascript and I would like to write my code on a more readable and efficient way. Any critique of what I've written would be greatly appreciated, especially the section of ...
2
votes
0answers
22 views

Macala Game made with Meteor

This is my first project I've written totally from scratch. It hasn't been styled yet so it's pretty ugly and it's missing some features but the core functionality works. I would love to get feedback ...
1
vote
0answers
20 views

Asynchronous Angular Promise and Variable Initialization

I have a factory that looks like such: ...