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)

8
votes
6answers
686 views

JavaScript - Why do frameworks bind to $() [closed]

Disclaimer: I know there is no strictly correct answer to this, but I've come across something that does not make sense to me, and I'd like to try to understand it better by seeing what other people ...
8
votes
4answers
2k views

JavaScript application design patterns [duplicate]

I need to write a PhoneGap application with JavaScript and I'm thinking of the code design patterns. I've read some books of JavaScript design patterns but can't really see the ...
8
votes
3answers
711 views

Using CSS classes as decorators - a good pattern?

I've been building a web-app with a fairly complex GUI - many small elements alongside eachother and within other elements that need various behaviours (dragging, clicking, but context-sensitive). My ...
8
votes
3answers
1k views

Javascript simple code to understand prototype-based OOP basics [closed]

I know Javascript for some time, although I am not a heavy user, I know it the first from the time when Netscape was my browser. I pretty much understand the main things, but since JavaScript approach ...
8
votes
1answer
3k views

Confusion about dual license (MIT/GPL) javascript for use on my website

I've read all of the posts I can find on this and I'm still not sure of the answer. I'd like to use a jQuery plugin on my website that is dual licensed under MIT and GPL. Does the dual license mean ...
8
votes
1answer
2k views

Legal ramifications of use of the JavaScript trademark?

It's widely known that the name "JavaScript" is trademarked by Oracle (formerly a trademark of Sun, formerly a trademark of Netscape). However, others seem to have no problem using the JavaScript ...
8
votes
3answers
782 views

What should be tested in Javascript?

At work, we've just started on a heavily Javascript based application (actually using Coffeescript, but still), of which I've been implementing an automated test system using JsTestDriver and fabric. ...
8
votes
2answers
493 views

Do I need to paste open source license information at the top of my webpage?

I'm developing a JavaScript application that uses several open source JavaScript projects. All their licenses have a phrase like "You must give any other recipients of the Work or Derivative Works a ...
8
votes
2answers
696 views

Javascript MVC application design (canvas)

I'm having difficulty grasping how to structure/architect a canvas application using an MVC like approach in Javascript. UI will be fairly fluid and animated, the games fairly simplistic but with ...
8
votes
3answers
1k views

Different callbacks for error or error as first argument?

We (and the JS SO chat room) had a talk with @rlemon some days ago about his Little-XHR library about error handling. Basically, we wanted to decide which error handling pattern should be used: ...
8
votes
3answers
846 views

How to properly validate your code?

I have about 4000 lines of code for a web-application in JavaScript / PHP / CSS / HTML. How can I test it properly? I only support the latest version of IE and Safari. I've worked out all the bugs. ...
8
votes
1answer
1k views

JavaScript objects and Crockford's The Good Parts

I've been thinking quite a bit about how to do OOP in JS, especially when it comes to encapsulation and inheritance, recently. According to Crockford, classical is harmful because of new(), and both ...
8
votes
1answer
853 views

HTML5 video sprites

I'm currently working on a project where there is a requirement to dynamically composite multiple synchronised video sources onto a single canvas. The initial prototype I put together loaded the video ...
7
votes
13answers
4k views

Would a statically typed alternative to JavaScript on webpages be practical?

Preference for dynamic and static typing is largely a matter of taste, and different people find them more or less suitable in different situations. My question is, would it be technically possible ...
7
votes
3answers
2k views

Benefits to starting JavaScript “for” loops at 0, or just traditional? [duplicate]

Possible Duplicate: Defend zero-based arrays I'm running code that loops through an array of HTML IDs. With the HTML IDs named content1, content2, …, content12, my loop looks like: for ...
7
votes
9answers
2k views

Is it worth Learning XML as a web developer when JSON is better for AJAX? [duplicate]

Is it worth Learning XML as a web developer when JSON is better for AJAX? or is it better to concentrate on JSON/Javascript for AJAX?
7
votes
9answers
6k views

How to become an expert in Python, PHP and Javascript? [closed]

So I've been programming for about 9ish months now, and I've taught myself some Python, some PHP and some Javascript. I want to become better at these languages - I can hack something out, but a lot ...
7
votes
3answers
4k views

Why do browsers leak memory?

A colleague and I were speaking about browsers (using a browser control object in a project), and it appears as plain as day that all browsers (Firefox, Chrome, IE, Opera) display the same ...
7
votes
4answers
683 views

Readability of || statements

On HTML5 Boilerplate they use this code for jQuery: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script>window.jQuery || ...
7
votes
8answers
444 views

Is there a way to play the role of Javascript with any other language like C#?

Is there a way to play the role of Javascript with any other language like C#? One way came up in my head is, having silverlight installed, using C# instead of Javascript for all the client side ...
7
votes
4answers
596 views

Could a programming language work as well without statements?

As programming in JavaScript, I've noticed everything that can be done with statements and blocks can be done with expressions alone. Can a programming language work fine with only expressions? And, ...
7
votes
3answers
723 views

Have they missunderstood currying or have I?

This question is similar to the question posted on Does groovy call partial application 'currying'?, but not completely the same, and the answers given there do not really satisfy me. I would ...
7
votes
5answers
506 views

Is it considered bad practice to run different JavaScript for IE

Is it considered bad practice (and how bad) to run different JavaScript for IE? Currently im writing some JavaScript and the simplist way to work arround IE quirks seems to be to check for browser ...
7
votes
3answers
2k views

Ajax race conditions

Is there a pattern or standard way to handle Ajax race conditions? Take the following example. You have two tables. Clicking a row on table 1 removes the data from DB and then updates table 2 (which ...
7
votes
4answers
3k views

Where to master HTML, CSS and Javascript? [duplicate]

Possible Duplicate: What should a developer know before building a public web site? I gotten interested in web-development lately. I am still a student. I learnt basics of HTML, CSS and ...
7
votes
1answer
4k views

How do I decide what testing framework to use?

The situation is this. I'm a junior developer for a small government IT project. We don't have anything of continuous integration or a automated testing framework. But the idea is to be developing ...
7
votes
4answers
854 views

Building a web application that is almost completely rendered by Javascript, while back end only delivers Json. Do or don't?

As a programmer, and taking into account the overall "funness" of the process, I'm tempted to start a project in Sinatra where the back end's sole concern is the logic, and returning a Json API, and ...
7
votes
3answers
897 views

Significance and role of Node.js in Web development

I have read that Node.js is a server-side javascript enviroment. This has put few thought and tinkers in my mind. Can we develop a complete data-drivent web application utilizing just JavaScript ...
7
votes
4answers
2k views

What are the best practices for rapid prototyping using exclusively HTML/CSS/JS [closed]

I'm developing a prototype of a web application. I want to only use HTML, CSS and Javascript. I prefer to use my text editor and not having to learn (or pay, for that matter) a new tool like Axure. ...
7
votes
3answers
458 views

What is your most unusual javascript concept you've ever seen?

I've learned javascript at school but since I'm working with it and study about it every day, I've found very particular aspect of javascript that I didn't know about. Which at first, was very hard to ...
7
votes
5answers
707 views

Algorithm for flattening overlapping ranges

I am looking for a nice way of flattening (splitting) a list of potentially-overlapping numeric ranges. The problem is very similar to that of this question: Fastest way to split overlapping date ...
7
votes
3answers
5k views

Backbone/JQuery, ExtJs 4… is there something else worth looking?

Im currently evaluating a front-end architecture for a big app that will be developed by a team of about 6 developers + 1 web designer so that said, having a robust SVN friendly architecture is a ...
7
votes
3answers
1k views

What common programming problems are best solved by using prototypes and closures?

As much as I understand both concepts, I can't see how can I take advantage of JavaScript's closures and prototypes aside from using them for creating instantiable and/or encapsulated class-like ...
7
votes
2answers
3k views

Common mistakes with javascript arithmetic

I've ran into several oddities using javascripts floating point arithmetic, but I can never recall them off the top of my head! What are some common mistakes when using JavaScript to do math?
7
votes
5answers
1k views

What are the steps to learn AJAX based web application development? [closed]

I am a complete starter in web development, as I know only basics of HTML and CSS, although I have a history of desktop development. What is the usual roadmap to get started in web apps, based on ...
7
votes
2answers
942 views

Moving all UI logic to Client Side?

Our team originally consisted of mostly server side developers with minimum expertise in Javascript. In ASP.NET we used to write a lot of UI logic in code-behind or more recently through controllers ...
7
votes
2answers
947 views

Is it considered bad practice to compile into Javascript as a matter of language preference? [closed]

I understand that compiling into Javascript is sometimes necessary and even in some cases results in a faster application. However I'm wondering if compiling into Javascript, for building web ...
7
votes
3answers
450 views

is this javascript property defaulting pattern a code smell?

In some javascript code I'm working on refactoring I've handled cases where I wanted to default an object property to true without having to go through the code-base and add the property to every ...
7
votes
3answers
960 views

JavaScript for a non-programmer

2 years ago I starded learning AS3 in order to get hired at a web design company. A few months later, I ditched it, because I discovered that I'm better at design; so now I'm a web designer. ...
7
votes
3answers
447 views

Is there a web-specific reason for the design choices behind the JavaScript language?

With the advent of "the web is the platform", JavaScript is fast becoming the most widely used programming language in the world. However, many tasks that are easy to accomplish in other modern ...
7
votes
6answers
2k views

Triggering custom events in AJAX callbacks

I'm pretty new to JavaScript, but one of the things that's been frustrating is that our AJAX callbacks have been getting packed with different functionality, making it difficult to keep everything ...
7
votes
2answers
732 views

Are side-effects in Array's “every”, or “some” bad?

I've always been taught that having side-effects in an if condition are bad. What I mean is; if (conditionThenHandle()) { // do effectively nothing } ... as opposed to; if (condition()) { ...
7
votes
2answers
734 views

If I drop cookies with JavaScript will it still be compliant with the EU ICO Cookie Law?

The challenge proposed to me as to create a widget to apply in other sites that makes a website compliant with the cookie law[1]. Can I do this without changing server code? I mean, if there's code ...
7
votes
1answer
149 views

Restructuring a large Chrome Extension/WebApp

I have a very complex Chrome Extension that has gotten too large to maintain in its current format. I'd like to restructure it, but I'm 15 and this is the first webapp or extension of it's type I've ...
7
votes
1answer
483 views

Defining classes in JavaScript that exist in your back-end

Doesn't it seem relatively duplicative to define your Models in your backend code AND on your front end for a rich internet application? I'm porting a GUI application I had written to have a web ...
6
votes
4answers
1k views

What is the name for a NON-self-calling function?

I have a collection of normal functions and self-calling functions within a javascript file. In my comments i want to say something along the lines of "This script can contain both self-calling and ...
6
votes
2answers
10k 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 ...
6
votes
6answers
608 views

Returning an object or false in dynamic languages

Consider the following JavaScript function: function Foo() { function getPreferences() { if ([there is an existing preferences object]) { return preferences; } return false; } } ...
6
votes
3answers
544 views

When and Where should we use hoisting in Javascript [closed]

I'm new to Javascript. I'm learning the concept of hoisting in Javascript. Based on the Javacsript tutorials in Mozilla website, I came across this word hoisting. According to those tutorials, ...
6
votes
6answers
697 views

Would a programming certificate teach me anything? [duplicate]

I'm 16-years old, and due to being placed in accelerated programs during my whole academic career, I just finished high school over the holiday season. For the past year or so I've been teaching ...