Questions tagged [javascript]

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.

Filter by
Sorted by
Tagged with
24
votes
5answers
20k views

Performance: recursion vs. iteration in Javascript

I have read recently some articles (e.g. http://dailyjs.com/2012/09/14/functional-programming/) about the functional aspects of Javascript and the relationship between Scheme and Javascript (the ...
24
votes
4answers
12k views

Why coffeescript instead of javascript? [closed]

I think somehow building a language which compiles to another language feels like a bad idea from the start, instead of learning javascript properly from the start. Look into Douglas Crockfords Good ...
24
votes
3answers
8k 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 ...
23
votes
6answers
17k 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 ...
22
votes
6answers
16k views

Why do we still use JavaScript? [duplicate]

Possible Duplicate: Why aren't there other client-side scripting languages for websites? It seems to me that, despite being one of the world's most used languages, even some of the leading ...
22
votes
4answers
35k 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 ...
22
votes
10answers
3k views

Good resources and tools for modern, heavy JavaScript development? [closed]

I am interested in doing some projects that involve heavy use of JavaScript. Namely HTML5 based canvas games, potentially using node.js as well. I am interested in learning modern best practices, ...
22
votes
2answers
12k 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 ...
22
votes
1answer
3k views

Module Requiring vs Dependency Injection in Javascript

These days a question popped out in my mind: Does the way we Javascript go against almost everything that is considered a good practice in traditional Software Development? I have a series of ...
21
votes
12answers
2k views

How to talk a client out of a Flash website? [closed]

I have recently been doing a bunch of web side projects through word of mouth recommendations only. Although I am much more a of a programmer than a designer by any means, my design skills are not ...
21
votes
5answers
2k views

How do I convince my boss (and other devs) to use/consider Unobtrusive JavaScript

I'm pretty new in our develepors team. I need some strong arguments and/or "pitfall" examples, so my boss will finally understand the advantages of Unobtrusive JavaScript, so that he, and the rest of ...
21
votes
3answers
2k views

Why do so many languages treat numbers starting with 0 as octal?

I've read Where are octals useful? and it seems like octals are something that were once upon a time useful. Many languages treat numbers preceding with a 0 as octal, so the literal 010 is actually 8....
21
votes
3answers
34k 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 ...
20
votes
4answers
20k views

JavaScript's prompt, confirm and alert considered “old-fashioned” [closed]

Lately I've been developing a web-based management system for a gym. Their previous app was developed in Visual Basic. For the new app, all the front-end scripting uses jQuery, the server is running ...
20
votes
5answers
5k views

What is the motivation behind TypeScript?

We had JavaScript, then we had Flash, then we had Silverlight and then HTML5 ownd them all. So what is the motivation behind TypeScript? What problems are going to be tackled and what improvements ...
20
votes
3answers
16k views

Why would I use Angular? [closed]

From the basic Angular tutorial, it seems like all it does is fetch some JSON from an API and display it. Also, there's its double binding magic. But why would I use it instead of a backend solution (...
20
votes
3answers
6k views

Why there are no compound assignment operators for logical operators (such as ||, && etc)?

According to ECMA-262, part 11.13, following is the exhaustive list of compound assignment operators: *= /= %= += -= <<= >>= >>>= &= ^= |=. According to the part 11.11, var c ...
20
votes
5answers
135k views

How should data be passed between client-side Javascript and C# code behind an ASP.NET app?

I'm looking for the most efficient / standard way of passing data between client-side JavaScript code and C# code behind an ASP.NET application. I've been using the following methods to achieve this ...
20
votes
4answers
7k views

Why is JSX good, when JSP scriptlets are bad?

React.js provides JSX as an XHTML-like syntax for constructing a tree of components and elements. JSX compiles to Javascript, and instead of providing loops or conditionals in JSX proper, you use ...
19
votes
6answers
2k views

Has anyone used Sproutcore?

Has anyone used Sproutcore for a web application? If so, can you give me a description of your experience? I am currently considering it, but I have a few concerns. First, the documentation is bad/...
19
votes
5answers
2k views

Is Google Closure a true compiler?

This question is inspired by the debate in the comments on this Stack Overflow question. The Google Closure Compiler documentation states the following (emphasis added): The Closure Compiler is a ...
19
votes
6answers
6k views

Is it a good idea to do UI 100% in Javascript and provide data through an API?

My primary day job is making HTML applications. With that I mean internally used CRUD-type applications with lots of editable gridviews, textboxes, dropdowns, etc. We're currently using ASP.NET ...
19
votes
6answers
8k views

Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?

I asked this question on SO but was suggested to try here. So here it goes: My understanding of Javascript so far has been that it is a client-side language that capture events and makes a web-page ...
19
votes
6answers
29k views

Advantages and disadvantages to using XAML/C# or HTML5/JavaScipt for Metro apps? [closed]

I was just wondering if there are any major advantages or disadvantages to using either XAML/C# or HTML5/JavaScript for Metro Apps.
19
votes
5answers
11k views

What advantages are conferred by using server-side page rendering?

I am developing a web app and I have currently written the entire website in html/js/css and on the backend I have servlets that host some RESTFUL services. All the presentation logic is done through ...
19
votes
5answers
3k views

Dev approaches to complex JavaScript UI's [closed]

I am trying to understand the landscape of different approaches, and best practices, around the development of complex client-side JavaScript. I'm not sure what to label this class of application, ...
18
votes
4answers
15k views

How does Chrome V8 work? And why was JavaScript not JIT-Compiled in the first place?

I have been researching Interpreters/Compilers, then I stumbled across JIT-Compilation - specifically Google Chrome's V8 Javascript Engine. My questions are - How can it be faster than standard ...
18
votes
3answers
30k views

Certifications for Javascript developers? [closed]

I'm looking for a solid and but fast paced entry in field of javascript development. The following topics come to my mind: Javascript advanced concepts, OOP jQuery, jQuery-UI, jQuery-Mobile backbone....
18
votes
4answers
6k views

Inheritance vs mixins in dynamic languages?

When should you prefer inheritance patterns over mixins in dynamic languages? By mixins, I mean actual proper mixing in, as in inserting functions and data members into an object in runtime. When ...
18
votes
6answers
20k views

What Special characters should one allow for a Phone Number?

So I am designing a webpage which will be used for global users, includes users from Canada, US, India, UK etc. I need to apply validations for this phone number field, but I'm not sure the best way ...
18
votes
9answers
2k views

What is the path to JavaScript mastery? [closed]

I know how we start with JavaScript, we cut-and-paste a snippit to gain a little client-side functionality or validation. But if you follow this path in trying to implement rich interactive behavior, ...
18
votes
6answers
2k views

Self-referencing anonymous closures: is JavaScript incomplete?

Does the fact that anonymous self-referencing function closures are so prevelant in JavaScript suggest that JavaScript is an incomplete specification? We see so much of this: (function () { /* do ...
18
votes
1answer
27k views

different between ES6 and Javascript [closed]

What is ES6? Is it JavaScript? Or multiple language supporter? I searched for it but can't understand it, especially the page on Wikipedia. Is it better than Javascript? And what can I do in my web ...
18
votes
2answers
47k views

Why does Javascript use JSON.stringify instead of JSON.serialize?

I'm just wondering about "stringify" vs "serialize". To me they're the same thing (though I could be wrong), but in my past experience (mostly with asp.net) I use Serialize() and never use Stringify()....
18
votes
1answer
1k views

Dollar Sign Blues: Javascript and PHP

I grew up programming C++ and Java where everything was safe and beautiful. Compilers made sure to keep me in check if I ever strayed. Of course, everyone did a little Perl in college, but I didn't ...
17
votes
1answer
2k views

Why does Math.min work with a one element array

According to MDN Math.min accepts only numbers, and if one of the arguments is not a number, it'll return NaN. It's true that if we pass an array with multiple numbers we get NaN, like this: Math.min([...
17
votes
6answers
10k views

Can JavaScript be used as a general scripting language?

I've used JavaScript and some frameworks (jQuery, Prototype, some node.js) for client-side web programming, but never on the desktop, where I do most of my scripting work in either Python or Bash. ...
17
votes
7answers
9k views

Would Python be too slow for client-side use in Browsers?

I've heard the statement that Python would be too slow to be of any use in browsers. I reckon Javascript is only superior in this aspect because of companies like Google who need it fast (and made it ...
17
votes
2answers
11k views

Javascript Ternary Operator vs. ||

I was taking a look at some node.js code earlier, and I noticed that the guy who wrote it seemed to favour the following syntax: var fn = function (param) { var paramWithDefault = null == param ? ...
17
votes
1answer
2k views

Are generator functions valid in functional programming?

The questions are: Do generators break the functional programming paradigm? Why or why not? If yes, can generators be used in functional programming and how? Consider the following: function * ...
16
votes
5answers
10k views

Avoiding new operator in JavaScript — the better way

Warning: This is a long post. Let's keep it simple. I want to avoid having to prefix the new operator every time I call a constructor in JavaScript. This is because I tend to forget it, and my code ...
16
votes
4answers
1k views

Unable to solve mystery of functions in Javascript

I am trying to understand behind the curtain scenes of Javascript and kind of stuck in understanding the creation of built in objects, specially Object and Function and the relation between them. ...
16
votes
12answers
4k views

When learning JS, what was your your Aha-moment? [closed]

Do you remember when you were learning JavaScript? What was the moment that you suddenly "got it"? (For example, my CSS aha-moment was when I learnt about the box model...) The reason I´m asking is ...
16
votes
4answers
3k views

Can't grasp programming design patterns

I've been working with javascript for the past 4 years. I'm very confident about my problem solving skills and I can see that my code quality is improving. I try to stay up to date with the community ...
16
votes
8answers
7k views

Chromebook - is it interesting for Programmers? [closed]

Google announced the chromebook yesterday (11 May 2011). While this is surely a nice thing, I have no clue whether it was interesting to buy one for a (non-javascript)-programmer. What do you think? ...
16
votes
6answers
5k views

Why is closure important for JavaScript?

C#'s lambda expression also has closures but is rarely discussed by the C# communities or books. I see far more JavaScript people and books talk about its closures than they do in the C# world. Why is ...
16
votes
1answer
38k views

Why sending a file is so difficult using angular? [closed]

I have to send a file (very large file) to a server. I'm studying what options I have and how to do it. I'm using angular + express + nodejs. If I use a simple form, I could catch the file on the ...
16
votes
5answers
8k 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 ...
16
votes
2answers
2k views

Creating nested functions for purely aesthetic reasons?

I've always wondered what other programmers think about the idea of creating pure aesthetic functions. Say I have a function that processes a chunk of data: Function ProcessBigData. Say I need ...
15
votes
10answers
14k views

Best approach for writing a chess engine? [closed]

I'm a chess enthusiast and a programmer. I recently decided to start making a chess engine using my chess and programming knowledge. So here's my question: What language (I'm familiar with Java, C++ ...