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

0
votes
1answer
942 views

Switching between mobile webapp version using Ionic Framework and Desktop web app version?

I own a web application that make use of Twitter Bootstrap 3. This eases the design of the mobile version since it brings some responsive features. However, I would like a really native-mobile aspect ...
2
votes
1answer
162 views

Structuring asynchronous javascript code

I am working on an application that heavily depends on asynchronous data operations. I am dealing with those through promises. However, while my code works, I have the feel that it is getting chaotic ...
10
votes
6answers
1k views

Javascript naming conventions

I am from Java background and am new to JavaScript. I have noticed many JavaScript methods using single character parameter names, such as in the following example. doSomething(a,b,c) I don't like ...
43
votes
2answers
3k views

Are there any OO-principles that are practically applicable for Javascript?

Javascript is a prototype-based object oriented language but can become class-based in a variety of ways, either by: Writing the functions to be used as classes by yourself Use a nifty class system ...
0
votes
1answer
127 views

What's a similar functionality in JavaScript that insures the object has X data before any actions are taken?

If java/C#/etc one might do something like create a constructor with a parameter, the parameter being the thing the rest of the object may act upon. How is this done in JavaScript? I'm trying to ...
3
votes
1answer
209 views

Proper way to “compile” a javascript project?

I'm developing a small open-source javascript library, and I was wondering about the proper method for compiling the source into one javascript file. It's easier to develop if the code is split into ...
2
votes
2answers
338 views

Combination of asp.net server side + html/js/jQuery client side

While working with asp.net, I came to an approach that uses asp.net services for the data/business logic layer and html/javascript/jquery for the UI layer, because I could not reach the needed level ...
1
vote
1answer
235 views

Writing my own blog engine using PHP/JavaScript - am I doing it 'right'?

First, apologies in advance if this is in the wrong place - I wasn't sure if it should be here or in Code Review, but as I'm not actually asking for anyone to review my code . . . Here's my project: ...
2
votes
2answers
1k views

REST API at backend and MVC Javascript framework at client side

I am building an online social network. I have finished writing RESTful API service using Django. This will return only JSON response (No HTML will be generated from server side) so that this JSON ...
2
votes
0answers
67 views

How to organize legacy multi page web app with tons of Javascript spaghetti [duplicate]

I have inherited of an application and need to reorganize and I hope I will be able to modularize the tons of Javascript that is everywhere. It is a multi-page webapp. Each page has a script tag in ...
34
votes
5answers
2k views

Why not embed styles/scripts in HTML instead of linking?

We concatenate CSS and JavaScript files to reduce the number of HTTP requests, which improves performance. The result is HTML like this: <link rel="stylesheet" ...
1
vote
2answers
154 views

What parts of functionality should be refactored into a directive?

I am creating an application from legacy code using AngularJS. I wonder what parts of my code should be moved into a directive. For example, iI had thought of moving a table which is used multiple ...
2
votes
4answers
546 views

Learning to program after a 9-5 job [closed]

I'm currently working as an IT administrator, but I'm thinking of making a slight career change into programming. I want to focus my time and effort into learning some web-based languages, but does it ...
0
votes
3answers
369 views

If statements vs switch cases? in a JavaScript game and if to use a function [duplicate]

I am developing a game in JavaScript where you start with a user input, stored in the variable "controller". The options for the user consists of start to start the game or about to learn about the ...
-3
votes
2answers
462 views

Why is Javascript faster than Jquery? [closed]

I was reading a thread and saw this post, which says that Javascript is faster than Jquery because it uses native code. But why is the use of native code faster? Is this always the case? What ...
2
votes
2answers
671 views

Event-driven vs. 'reference'-driven programming (i.e. in JavaScript)

I haven't been able to find the appropriate terminology to search for content on the web related to what I'm asking, so I'm hoping someone on here can at least point me in the right direction. I'm a ...
0
votes
3answers
165 views

Javascript Naming Convention [closed]

I've been using Javascript for quite a while, but I've always ignored the common naming conventions that I see online (camelCase). I know it all depends on the developer's preference, but why camel ...
1
vote
3answers
330 views

Add javascript to all pages (for caching), or only to the pages that require the scripts (for a smaller page size)?

I'm using bits of javascript on my website for an image gallery, smooth scrolling, etc. These scripts are not used on every page (not every page has an image gallery for example). However, the scripts ...
4
votes
3answers
159 views

Javascript Use of Window Object through alternate means

Disregard your usual paradigms for a mere moment here.... I've seen a few sites who have used the following logic: a=[]; b=a["sort"]; c=(b)(); c["alert"](1); // intended output: Alert displaying ...
1
vote
1answer
140 views

What is the best implementation strategy for this html + javascript widget?

The Problem I came up with this select-box variant in answer to a question on UX.SE: http://ux.stackexchange.com/a/48951/16187 However, working out how to implement it has been driving me mad ever ...
1
vote
1answer
143 views

Making a decentralized system utilizing JavaScript/HTML5?

I am interested in decentralized systems, and am currently considering building one myself. I am considering using JavaScript and HTML5, simply because it makes it very easy to use the system (they ...
0
votes
3answers
381 views

Backbone.js app pulling large data sets with fetch()

I'm currently making some improvements for a client on a backbone.js app. The app is a web store and inventory management system. One thing that bothers me about this app (and other backbone.js apps ...
1
vote
2answers
456 views

How Client Side Programming Works

I'm not coming from web-development at all, but am looking to build a web application. So far, I've looked into all the server-side stuff (for example, I think my stack will be Linux + node.js + ...
0
votes
1answer
108 views

Should my statefull widget generate necessary html itself?

What behaviour should be preferred for widget initialization: 1) Required HTML is generated by widget itself: Layout: <div id="my-widget"/> Initialization: $('#my-widget').myWidget(); // ...
0
votes
2answers
359 views

Is $.proxy a code smell?

I've been writing most of my javascript applications in an OO style close to what I would use for most other languages. However, this means that most callbacks need to have a reference to an object, ...
1
vote
1answer
177 views

Text conversion - Javascript before saving to db, or php when retrieving?

Long story short, I have a social networking site I wrote a while back as a "proof of concept" to myself that I had the skills to do it. I decided to revisit it, and "improve" a lot of the bad ...
2
votes
3answers
323 views

Why is a click event triggered only after mouse click and release?

Every click event on the web works on mouse click and release. Is there a way to do a action on a click event before mouse release??
4
votes
3answers
937 views

How do you unit test a User Interface? [closed]

I use JavaScript with JQuery for a Rails application. I have some dynamic behaviour in this one. As a Ruby developper, I like TDD/BDD, specialy with RSpec. For the moment, I test my JavaScript ...
0
votes
2answers
211 views

Is there a special name for a condition which will break a loop if it increments a set number of times

Is there a name for including a limitation in a loop structure to prevent it from running if its primary condition becomes unwieldy. For example for (var i = 0; i < len; i++){ ...
4
votes
2answers
297 views

How do you build debugging messages into your programs/scripts?

General, high-level question for people who work with code regularly. I was repurposing some old, outdated Javascript code into a Chrome extension, and to help me understand it, I wrote some quick ...
2
votes
4answers
2k views

Pros of start learning programming with Python if what I really want is Javascript? [closed]

A friend of mine seeks to learn Javascript programming but he never programmed before. I've found Python as a quite nice language that takes most unneeded "strangeness" out of learning programming ...
-1
votes
1answer
65 views

Mobile compatible JEE application [closed]

Does using frameworks like AngularJS/Backbone JS/Bootstrap/Foundation etc. automatically make the web application mobile device compatible? Is there a framework/design approach to make applications ...
2
votes
1answer
262 views

HG: fork web app project to separate API code from app code [closed]

I have a web app thats been in active development for about 8 months now and its becoming apparent that the project has a need to maintain a separation between app specific code and our OO Javascript ...
0
votes
0answers
160 views

Cost Benefit Analysis of choice of javascript framework for excel-like web app

I am engaged by a telco company sales team to develop a web application to replace their current workflow. Their current workflow consists of many spreadsheets containing product, pricing, and sales ...
30
votes
3answers
6k views

What does Douglas Crockford mean when he says jQuery doesn't scale?

In the Q&A section of this talk, Douglas Crockford says that jQuery doesn't scale as well as some other popular libraries. What does he mean by that, and what is it about the other libraries that ...
0
votes
2answers
99 views

Approach to develop an inline editor for enumerated lists

Background Looking to develop a WYSIWYG editor for ordered lists so that people can directly edit lists of instructions on a web page. Problem The contentEditable attribute is woefully immature for ...
0
votes
1answer
89 views

Technique to deal with occasionally blocking json api?

I have a web app that occasionally (after some idleness) will block a very simple request for small chunks of data (30~50 kb) up to 20 or so seconds. Assuming I can't refactor or modify the API, is ...
12
votes
3answers
917 views

Novice to node.js, what is the advantage gained using callbacks over events?

I am a novice JavaScripter and have no real knowledge of what goes on inside the V8 engine. Having said that, I am really enjoying my early forays into the node.js environment but I find that I am ...
0
votes
0answers
74 views

MVC structure suggestions

I want to create an application i.e svg-edit that use javascript for client side operations but I want to integrate it with ExpressJS. Svg-Edit on the client side contains the folder containing the ...
-3
votes
1answer
351 views

Real-World node.js [closed]

I am 14 years old, and have been studying web/app/software development. I am trying to learn a backend language, and am considering node.js. I have heard awesome things about it, plus I like that fact ...
3
votes
2answers
3k views

Should I still make my site work in non-javascript capable browsers?

Apparently less than 1% had javascript off in 2010: http://developer.yahoo.com/blogs/ydn/posts/2010/10/how-many-users-have-javascript-disabled/ So is it worth it to still support browsing without ...
1
vote
1answer
113 views

How to calculate the worst-case runtime of this search-algorithm

I've written a special indexOf function for a list of unsorted unique values. I can search for one or multiple (unsorted) values, passed as array/list, and the function will return me an array/list ...
0
votes
3answers
1k views

What is the need of Odata when I have JSON ?

I am trying to understand the point of Odata and when it would make sense. Right now how I work is I use ASP.NET and MVC/WebApi controller to serialize/deserialize objects into JSON and have ...
-1
votes
2answers
141 views

How Challenging is it to Mix Pure JS with CoffeeScript on a Team? [closed]

I keep running into Senior JS positions where they want CoffeeScript. The reason I don't use CoffeeScript is that my first impression of it was that it puts limitations on JS OOP features that I find ...
2
votes
4answers
568 views

Disadvantages to using “associative arrays” in JavaScript

I'm working with some people are are used to making "associative arrays" in JavaScript like this: var arr = new Array(); arr.prop_1 = "asdf"; or arr['prop 2'] = "1234"; It works just like an ...
1
vote
2answers
315 views

Forcing users to use Javascript

This is more of a business / ethics type of question that incorporates programming principles. So I as a developer will be selling a database driven web application to a local college university. I am ...
1
vote
1answer
163 views

Javascript heavy page/application - best practice for handling errors

Consider an application that contains a number of pages with a relatively large amount of javascript present, or a predominantly JS powered application. The script handles a number things, such as: ...
1
vote
0answers
260 views

JavaScript Class Module: How to avoid an antipattern

I've seen a number of different methodologies when it comes to applying class-based inheritance to JS/ECMA-based projects. Over the past several months, I've been applying IIFE Namespaces to my class ...
5
votes
2answers
362 views

Initializing a variable as undefined [closed]

Doing some refactoring, I noticed an unusual pattern I'm not familiar with. Properties and variables that do not yet have a value are initiated with undefined declared explicitly, despite the fact ...
5
votes
2answers
463 views

Javascript Architectural Model

Are there any obvious flaws to this OO architectural model which I intend to implement using javascript? It is similar to the MVP model but instead the role of the model is broken down into three ...