JavaScript is the original and common name applied towards most flavors of a scripting language that originated on NetScape Navigator. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.

learn more… | top users | synonyms (1)

3
votes
6answers
661 views

When to use a API/Library and when to write your own?

I am working on a large website and having been thinking a lot about when I should be using a 3rd party API/Library and when I should be writing my own implementation from scratch. There is no Library ...
3
votes
4answers
219 views

What programming mindset to have towards JavaScript? [duplicate]

I used to program in Java. As a result of that I got well-versed with Object Oriented Paradigm. In my opinion it is a great approach to programming because it's easy to unit test, use design patterns, ...
1
vote
1answer
93 views

Why do browser Javascript libraries pass the window object as an argument?

While looking at various JavaScript libraries, I have noticed a relatively common practice of passing either the window or the document object as part of the arguments given to the library ...
0
votes
0answers
88 views

If a webpage invokes a javascript function on a click from a browser, why can't I invoke it programatically?

So I'm a complete javascript and web development noob, and this question might be betray a fundamental lack of understanding somewhere. I'm on a webpage with a button that invokes a javascript ...
0
votes
0answers
17 views

Is having a parent controller to manage a set of tabbed sections an anti-pattern for an angular application?

A lot of times, I have long forms that I divide into multiple tabbed sections. Each section is managed by it's own controller and there is a parent controller that manages the whole view. I use ...
1
vote
2answers
144 views

Live search/filter as you type in client approach

As an exercise for myself to practice my JavaScript "skills" I'm trying to write a client-side filter. It should be able to filter "content blocks" as the user types. By "content block", I mean a ...
0
votes
1answer
65 views

AJAX - What exactly does that encompass?

So I see on a lot of people's resumes they list AJAX in their technologies (or programming languages - and I recognize that it is not a language). To me, AJAX seems like such a small concept to be ...
1
vote
0answers
19 views

Compose nested EventEmitters elegantly

I am developing a server-side JavaScript tool, and trying to do so in a modular way. I have a Parser class that is an EventEmitter - you call parse and it will eventually emit data and end events. It ...
0
votes
0answers
6 views

Insert Dynamic HTML content for Electronic Catalogue - Magazine [migrated]

I am making an electronic book(magazine). But i have 200 pages(in jpg format). So, in order to avoid writing the same line code for 200 pages i want to find out how to do it with javascript and php. ...
-4
votes
0answers
15 views

How to change the options of a select tag b when select tag changes option? [on hold]

I have 2 select tags: 'a' and 'b'. What I want to do is upon selecting an option in select tag 'a' I want the options in select tag 'b' to change value. example: In option 'a' "Institute of Accounts, ...
1
vote
2answers
2k views

Using WebStorm for Razor Syntax MVC

I am building a lot of client-side heavy SPA-like apps with VS2010 and MVC3/4. VS2010 Javascript/HTML/CSS editing (mostly javascript) is interminably slow and sluggish. I'd love to use something ...
4
votes
1answer
98 views

(jQuery) What is wrong with methods such as .append?

tl;dr: What is wrong with the efficiency of methods such as .append() and what can be alternatives to this? Explanation: Hello everyone. I occasionally have to build A/B tests for websites, which ...
12
votes
2answers
486 views

Why does XMLHttpRequest not seem to follow a naming convention?

I've been working with the XMLHttpRequest object in JavaScript recently, and I couldn't help but notice that the casing of this name makes no sense. Why is 'XML' all in caps while 'Http' is not? ...
0
votes
0answers
23 views

Line wrapping with variable number of lines… almost there! [on hold]

I'm fiddling a way to split a string in a variable number of lines. It's working but I would like the lines to be a bit more even in size so that they take less space horizontally. I've been over it ...
124
votes
3answers
33k views

Pros and Cons of Facebook's React vs. Web Components (Polymer)

What are the main benefits of Facebook's React over the upcoming Web Components spec and vice versa (or perhaps a more apples-to-apples comparison would be to Google's Polymer library)? According to ...
-1
votes
0answers
39 views

How to avoid global state via the DOM in JavaScript? [on hold]

Much has been said about the practice of using global variables. After spending some time creating a JavaScript web application, it occurs to me that many of the issues I have encountered have come ...
6
votes
5answers
367 views

Using π, φ, λ etc. as variable names while programming? [duplicate]

This is a function in the d3.v3.js file (the graph library D3.js): function d3_geo_areaRingStart() { var λ00, φ00, λ0, cosφ0, sinφ0; d3_geo_area.point = function(λ, φ) { ...
0
votes
2answers
2k views

Javascript storing data [closed]

Hi I am a beginner web developer and am trying to build the interface of a simple e-commerce site as a personal project.The site has multiple pages with checkboxes. When someone checks an element, it ...
2
votes
1answer
230 views

Local Updates in Persistent/Immutable Data Structures

I'm getting into ReactJS and am intrigued but also confused about persistent data structures. I love the idea, but I'm not sure how to take my MV*, Mutable, Observable Bindings experience in designing ...
-5
votes
0answers
59 views

Should I learn Java or Javascript? [closed]

I am a college graduate living in Southern California with a very basic understanding of java and programming in general. If my goal were to get my first job(or internship) as soon as possible, which ...
-6
votes
0answers
40 views

I have problems to validate dialogs in javascript [closed]

I have problems to validate dialogs in javascript. Please look at the following configuration When I press the submit button, no valation is done. Does anybody have an idea? ...
-2
votes
0answers
23 views

Javascript animation based on mouse click? [migrated]

So I'm attempting to make it such that when you click it creates a circle on the mouse's position, and on the second click, the circle moves towards the second click's location. So on and so forth. ...
0
votes
2answers
87 views

Porting an algorithm implementation licensed under GNU GPL v3

I'm working on a JavaScript port of a red-black tree implementation in Java from the book Algorithms 4th Edition, by Sedgewick and Wayne. I believe that my JavaScript port qualifies as a derivative ...
-5
votes
0answers
68 views

how to scan a document using client side scanner in asp.net Web application [closed]

I'm using Asp.net web application (C# language). Want to Scan a document from clicking a button in web application (i.e. Browser). I already tried Twain tools But I need any other way to scan a image ...
43
votes
2answers
21k views

When not to use Google Web Toolkit? [closed]

I'm considering use of GWT on a major in-house web app development project, namely it's major advantage in my eyes is the cross-compilation to Javascript which would (at least theoretically) help my ...
3
votes
3answers
182 views

Easy way to make old javascript files conform to new quoting standard?

We've just started putting linting in place at my workplace, and a lot of the devs didn't realize our standards called for double-quotes everywhere. About 50% of the codebase uses single-quotes, so ...
-4
votes
2answers
71 views

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the in javascript [closed]

I am trying to get header of a url from my website Using this code: var req = new XMLHttpRequest(); req.open('GET', 'http://example.com', false); req.send(null); var headers = ...
5
votes
2answers
8k views

How to run C++ code in browser using asm.js?

An asm.js application is very fast (near native C++ speed): http://kripken.github.io/mloc_emscripten_talk/micro4b.png But how is it possible to write one in C++, convert it to LLVM code, then do ...
5
votes
4answers
660 views

Design Patterns for Coordinating Change Event Listeners

I've been working with the Observer pattern in JavaScript using various popular libraries for a number of years (YUI & jQuery). It's often that I need to observe a set of property value changes ...
0
votes
0answers
49 views

Excel-like column numbering [migrated]

I have a working code (below) to convert a number to Excel-like (A...Z AA...AZ BA...BZ ...ZA-ZZ) column codes (headers). For simplicity I limited it to 1 or 2 character codes. My question is: ...
58
votes
14answers
6k views

Is it a bad idea to return different data types from a single function in a dynamically typed language?

My primary language is statically typed (Java). In Java, you have to return a single type from every method. For example, you can't have a method that conditionally returns a String or conditionally ...
0
votes
0answers
4 views

Javascript code executing before its supposed to [migrated]

I have some javascript code that is being executed before it is supposed to be and I do not know why. Basically, I have a for loop that is supposed to be executed 50,000 times. However, this takes a ...
8
votes
0answers
1k views

Do uncatchable exceptions exist in Javascript? [migrated]

Do any javascript runtimes (browsers, Node, etc.) ever throw uncatchable exceptions? Are any and all exceptions ever encountered in a javascript environment catchable in a try/catch statement?
2
votes
0answers
66 views

What is the best way to format complex SQL queries in Node?

I am using node-mysql to query a MySQL database via Express and Node. My queries are getting fairly complex and I want to format them across multiple lines. However, the only way I could accomplish ...
2
votes
1answer
117 views

moving around virtual keyboard

I'm creating virtual keyboard using javascript/html/css. And I can't find a good algorithm for moving from one button to another in different directions (top-bottom, left-right). Lets say I ...
1
vote
1answer
122 views

Should I use composition or inheritance for sharing configuration items?

I'm working on a fairly new project where I'd like to share some config items used by a JavaScript plugin. Specifically, the project is using jQuery dataTables and I want to find a good way of sharing ...
0
votes
2answers
57 views

Running an HTML/JS/CSS only app on Android without external Phonegap/Cordova etc

Is it possible to run a small and simple game on android using only CSS/JS/HTML? E.g I have built a small game using the all too known 3 folder stucture and I was wondering if there is any easy way ...
0
votes
1answer
119 views

Creating a voting platform for submissions during timeperiod

I have a site where stories are submitted at any time by users. The staff would like the ability to create a voting period at any time. For example, they can choose to open up voting from today until ...
1
vote
2answers
168 views

XSLT equivalent for JSON

I was interested in finding (or if necessary developing) an XSLT equivalent for JSON. As I have not found any, I was considering the possible query language to use for matching JSON paths so as to ...
2
votes
1answer
93 views

Use cases and usage patterns of futures vs callbacks

I've become interested in futures lately, mostly due to their inclusion in standard C++ - but I see there is an active debate over futures vs. callbacks in many programming areas, such as Node.js. ...
1
vote
0answers
104 views

What is the best way to approach building search functionality for a large website using PHP, MySQL and JQuery [closed]

I've a question I'm hoping I can get some assistance on because It's causing me a lot of stress in work trying to get it sorted. I figured this was the best place to ask it as it's not a specific ...
1
vote
0answers
42 views

Unit Testing a stateful framework such as Phaser?

I'm currently writing a game in TypeScript and the Phaser framework. Phaser describes itself as an HTML5 game framework that tries as little as possible to restrict the structure of your code. This ...
0
votes
2answers
74 views

What do you mean by Javascript component development? [closed]

I was recently asked by a recruiter if i knew component development with javascript. Since i was hearing this for the first time, i said i had no idea regarding it. I google it and got very few ...
-1
votes
4answers
81 views

What exactly is the meaning of “node” in Document Object Model (DOM)?

I've searched for the definition of a "node" in a programming language and I am still finding it hard to understand. Could anyone advice me in simple, layman's terms: What is a node?
-3
votes
0answers
20 views

Why is my use of .getJSON not consistently reading local JSON files? [migrated]

Here is a simple working example that reads two local data files and appends the results to the DOM displaying a card and then an unordered list representing a hand of cards. app.js var main = ...
13
votes
5answers
5k views

Are UML class diagrams adequate to design javascript systems?

Given that UML is oriented towards a more classic approach to object orientation, is it still usable in a reliable way to design javascript systems? One specific problem that I can see is that class ...
21
votes
6answers
2k views

Why the recent shift to removing/omitting semicolons from Javascript?

It seems to be fashionable recently to omit semicolons from Javascript. There was a blog post a few years ago emphasising that in Javascript, semicolons are optional and the gist of the post seemed to ...
-2
votes
1answer
60 views

Front-end or Back-end Implementation of API? [closed]

Lets say I want to implement an API from an external website, for example like Dribbble or Last.fm. I'm fairly new to this new generation of front-end MVC's (angular, etc), and most example's I've ...
2
votes
2answers
128 views

Is doing Parent.call from the child object a right way to implement Inheritance in JavaScript?

I came across this piece of code it didnt look that right to me. Is it the right way to implement SUPER in javascript. if not what is the right way? function Person(name){ this.name = name; } ...
0
votes
1answer
2k views

Looking to create a custom, graphical editor for a data model using HTML5 and SVG

I need to create a graphical editor for our data model that works in an HTML5 compliant browser. I am looking for a proper library/framework to build on. The model is stored as xml, but that should be ...