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

6
votes
1answer
44 views

Three layout Gallery

I have made a gallery function, this function handles three different types of gallery, one with horizontal nav, other vertical and last one vertical with no nav. ...
3
votes
2answers
31 views

Multicriteria sort array javascript

I have an array of objects that I must sort based on two criteria. I've come up with a solution but I'd like to know if there is a better way to do it. Assume a list of devices: ...
3
votes
2answers
36 views

HTML/Attrs Tester Environment

I have a few objectives (which are working fine, but I want tips in case I can improve it). Let me try to make this as clear as possible, as this is a much larger project: There are three move ...
3
votes
1answer
47 views

Single Rotate Method

I just started coding a simulation-like application. It's about our solar system. Right now, I'm working on rotating the moon. I have this constructor ...
4
votes
1answer
37 views

Should I differentiate object types by calling methods via variables?

I have three JavaScript objects. The first one serves merely as a prototype. The other two are implementation of a specific type. ...
6
votes
1answer
42 views

Display text on video screen

The code displays a video that will play a video and then display some text on the screen at specific locations on the video screen. The code works but I would like to see if I could change ...
3
votes
1answer
49 views

Recursively reading a directory in node.js

I made a function for recursively reading a directory and it just seems kind of long and complicated. If you could take a look and tell me what's good or bad about it, that would be great. Reading ...
0
votes
0answers
9 views

properties of circle with proper units and decimal digits [on hold]

I have code for the circle, I must be able to select units for the diameter and set significant decimal digits for the area and circumference onchange. Somehow its not working....need help badly ...
1
vote
0answers
12 views

Is this a correct knockout ViewModel setup?

This is my first time using knockout. I'm reading/writing a JSON file with a fair bit of nested data. I had no problem creating the ViewModel to just write to the file, but now that I'm reading the ...
2
votes
0answers
50 views

AngularJS Tab Control

I'm experimenting with angular directives, and as a proof of concept I wanted to create a basic tab control. I'd like to know if anything can be changed to be more fluid, or if I'm doing things ...
4
votes
1answer
48 views

Price Slider using jQuery UI working in Java environment to be optimised

I am working on a price slider that is for a Java environment. It is working correctly but I would like to optimise it as much as possible. Any tips/advice? ...
4
votes
1answer
25 views

Communicating between plugins whilst maintaining context in Javascript

I'm making some changes to a JavaScript plugin on a site I've been made steward over. This main plugin has it's own sub-plugins and I'm trying to make certain aspects modular. Currently, I'm ...
5
votes
1answer
27 views

AngularFire Tic Tac Toe Game

I am building a Tic Tac Toe game with AngularJS and making it online playable with AngularFire. The Tic Tac Toe logic is all there so this question concerns Angularfire a little bit more. I want to ...
5
votes
1answer
68 views

Balancing Accounts Daily

I've written it for an assessment. It works but my assessment also requires a peer to review it in terms of how it could be improved, how it rates as a piece of JavaScript, etc, any comments would be ...
3
votes
1answer
60 views

Scraping reviews from Google Play using JavaScript

What I'm trying to do: Get user input for Google Play App page. e.g. https://play.google.com/store/apps/details?id=jp.scn.android Scrape 100 reviews from Google Play App and organize them into an ...
5
votes
1answer
82 views

BBCode to HTML converter using functional programming

I was inspired to write a BBCode to HTML converter as I'm currently learning functional programming. I wanted achieve functional cohesion. jsFiddle I'd like feedback on: structuring of the code. ...
2
votes
1answer
25 views

consolidate table td and th query

I have two statements that look like this: $('table tr td:nth-child(' + columnNumber + ')').toggle(); $('table tr th:nth-child(' + columnNumber + ')').toggle(); ...
1
vote
1answer
31 views

Optimize jQuery code includes autocomplete function for different input box with different autocomplete content

I have this code below for autocomplete feature of several inputTextbox. The input box also share same class".wikiInput". When user typed something in either of them, a relevant autocomplete dropdown ...
7
votes
2answers
343 views

My first accumulators

Notes I'm working my way through SICP, and as I got very confused by the section on folds, I decided to try to implement foldr in scheme and javascript to understand how it works differently with ...
4
votes
2answers
43 views

Accessible tabbed UI

I've started working on a script that turns sections with headings into a tabbed interface. The repo is at https://github.com/derekjohnson/tabs and a demo at http://derekjohnson.github.io/tabs/ It ...
4
votes
3answers
354 views

Basic JavaScript OOP model object

I'm relatively new to JavaScript OOP and would like to know the best practice when doing a simple object such as a Model. Here's a piece of code representing class named "Child". What I'm asking for ...
2
votes
2answers
41 views

Interupt redirect to catch potential newsletter signup

This is a piece of code I am working on to reuse in a few places on various websites. It is used to capture name and email addresses for people interesting in registering for something, we want to ...
5
votes
3answers
77 views

Converting KML/XML to Javascript

So, I have the boundaries of every states in the US, from the google map KML file. This KML file is actually a XML file. I'm converting this file to a JS file compatible with google map in order to ...
11
votes
6answers
4k views

Is my AI solution to Untrusted Game considered logical or “ethical”?

I am applying to a university to study Computational Linguistics, and as I read, it would be recommended to have a background in Artificial Intelligence. The Admission board asked me to prepare a ...
3
votes
1answer
105 views

Seeding a file with fake records - doing concurrent updates

I need to seed a database with user data. When trying to write records to a file using sqlite3 with node, I tried writing the logic in a naive manner, without any error checks - but it was failing ...
0
votes
0answers
35 views

Feedback on architecture for backbone application [closed]

Since I had a pretty strict deadline, I made an attempt to implement in an MVC fashion without using additional libraries. I really got into a mess with all the functions in my views, and decided that ...
2
votes
2answers
35 views

Is it ok to have NaN while comparing fields in JavaScript?

I am comparing two integer values, but there is chance of parseInt giving NaN. I would like to know if I need to do any additional checks. ...
6
votes
1answer
67 views

Plan to make a small game - got a hang of canvas and made a cube fly around

I'm planning to make a small game for learning purposes. So far, I've got the hang of the canvas element and using the context to draw things on it, as well as object notation and classes in ...
4
votes
1answer
57 views

Reducing code duplication in a geometric function

Given a large bounding rectangle ("envelope"), a list of points, and a maximal aspect ratio, the goal is to find a rectangle within the envelope, whose aspect ratio is bounded within the given aspect ...
-2
votes
0answers
41 views

Im trying to find out what is allowing users to withdraw twice the amount or more, of what is in their accounts [closed]

I have a section of my site that allows users to withdraw dogecoins in their accounts to another wallet. Its newly launched today. Today I noticed a user depositing and withdrawing multiple times in a ...
3
votes
1answer
37 views

Horrible nested if statement for changing CSS based on RadioButton selection

I'm writing away for this website, and I've come into a problem. I need to display only one td based on the corresponding radio button pressed. However, there are ...
4
votes
1answer
47 views

Smoothen page transition for mobile devices

I have next/previous buttons on my site and all they do is slide sections of the site from left to right and vice versa, it is smooth and looks good on a desktop but on mobile devices it is a bit slow ...
5
votes
2answers
47 views

Adding a bulk of items in the middle of a sparse array

I'd like to add a bulk of items into a sparse array, starting at a certain index. I came along this requirement in order to accomplish client side pagination while not retrieving all data from server ...
3
votes
1answer
70 views

Google Maps Javascript API v3: Sorting Markers with Check Boxes

Recently I built a map with custom markers (pins) and a sorting function to display each by type (Member, Supplier, Prospect, New Member). The HTML (check boxes wired up with ...
4
votes
3answers
63 views

New Game - Am I going down the right path for DOM manipulation?

I find myself using a lot of .find functions within what I'm developing. The reason being that I need to run this same function on a TON of different characters ...
5
votes
1answer
44 views

Dynamic matrix in web browser

Today, my project was to make a matrix in my web browser. It is really slow, so help with optimizing it would be nice. It runs slow on my PC, yet alone my iPod 4 which this is going to be for. ...
1
vote
2answers
73 views

What are practical issues using this code with common JavaScript libraries?

I'm not a JavaScript programmer. I have next to no idea about "what's out there" of libraries and so on. Therefore it's not unlikely that the referred to Windows HTML Application (HTA) code here, ...
3
votes
1answer
33 views

Testing async API calls using Jasmine 2.0

I'm upgrading my project from YouTube's V2 API to their V3 API. I'm also taking the time to upgrade to Jasmine 2.0 since I already need to look at my test cases. Here's a couple of test cases and the ...
3
votes
1answer
25 views

Re-writing rough JS code with loads of jQuery plugins

I want to include about 10 jQuery plugins in a project but do so in a better way than just pasting them into a JS file. I want to capture various device data and other data passed from the ...
4
votes
2answers
45 views

Good way to write extend method of a contructor?

I've been following along a blog post on JavaScript inheritance. I wanted to slightly adapt this and try to write something more like I've seen in Backbone (extend method). See I set about it, and run ...
6
votes
2answers
67 views

Performance tuning on a text file to object conversion

I'm using an API which returns text in the following format: ...
1
vote
1answer
31 views

Auto-Format GPA while typing : REVISED

I need to further simplify this solution to auto-format a text-box field intended only for the user to enter their college Grade Point Average (GPA). Here is my code: ...
1
vote
1answer
46 views

AJAX chat client

I have here a set of code that is used for retrieving and storing conversation for a chat application if found this from a tutorial and tweak it a little bit. This script works fine but my concern is ...
1
vote
1answer
33 views

Is there a way to avoid calling the document with jQuery on click?

I have taken a look at several answered questions on Stack Overflow about jQuery's new (since 1.9.1 upgrade) .on('click','',function(){} and that you need to ...
2
votes
1answer
35 views

jQuery tooltip optimization

This is my second jQuery script: a universal tooltip for my entire web page. It took me a couple of days to research and make it work. Now, I need help from the experts to optimize my newbie code. ...
1
vote
1answer
25 views

Object Oriented Modular Closure

The following is some code I just wrote. I keep wondering as always what I can do to make this more efficient. Please help me make this code object oriented and if anyone could help me write ...
5
votes
1answer
34 views

Form generator for inputting URL, description and link

This is a form generator I created so users can input a URL, description and link. The output will eventually be a JavaScript news slider. The HTML the form generated is irrelevant for now but I'd ...
7
votes
4answers
400 views

Basic Calculator

I'm in a beginner JavaScript class and I feel like I have a pretty good grasp on all the intro material. All of my homework assignments work but they seem longer than they have to be, especially my ...
7
votes
2answers
65 views

Handling packets in nodejs for MMORPG

Writing a MMORPG server in nodejs, I have to handle packets. These packets have a structure of <length> <id> <data> So what I did was use a ...
2
votes
1answer
45 views

Efficiency of moving ball

Here is another example of a moving ball. I would like to see how to make it more efficient and better. I think that moving the variables to the top of the function would be better but then I tried ...