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)

-1
votes
0answers
3 views

what could be a useful script for internet explorer setting?

i was trying to find a way to edit some setting in IE like enabling and disabling active x setting and so on is there is any sort of script that i can use ?
11
votes
5answers
6k 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 ...
-2
votes
0answers
59 views

Should I remove logging statements on production?

I have a bunch of console.log statements in my AngularJS app. Should those be removed for production? Are there potential issues from leaving them on?
1
vote
1answer
103 views

Differences in design/thought process for OO in Java and JavaScript [duplicate]

Despite sharing a similar name and syntax, Java and JavaScript are quite different. However, they both have Object Oriented features. As a JavaScript novice, the main differences that I can see ...
-6
votes
0answers
50 views

Drawing shapes with JavaScript [on hold]

A javascript program. I don't want or can't use images. I want to represent countries. I'd like to know if there's somewhere a database, with countries shape coodinate, that you could use to draw ...
-3
votes
0answers
13 views

Mvc manage context and reusable components

I'm trying to create for a Web App an MVC Architecture with a Hierarchical Router. The goal is manage all the business logic and views with a clear pattern. Let me do some example: Route index ...
-3
votes
2answers
113 views

JavaScript form validation without clicking submit button [on hold]

I want to validate a form using java script before user clicks the submit button. <form role="form"> <div class="form-group"> <label for="email">*Email ...
12
votes
5answers
842 views

Can *any* program task be expressed without state?

This is a theoretical question, but after many years of programming in what I now realize is "normal" imperative technique, using C++ mainly, I've discovered this other world of functional ...
2
votes
1answer
73 views

How to design a serverside heartbeat with nodejs?

I would post this on http://stackoverflow.com/, but figured I am not looking for code, just an idea how to accomplish this. I have a gameserver that interacts with nodejs and uses the websocket ...
-5
votes
0answers
36 views

How to open Modal box after saving data to database and show result [on hold]

I need to open modal box for showing the error message or success result after uploading data from CSV in mysql . Please suggest me how can I made it possible ? $res = true //if no error $res = ...
-4
votes
0answers
66 views

Are there any serverside web languages like Javascript? [on hold]

Recently got into nodejs and absolutely love using Javascript for my gameserver. I've been working with PHP for years but.. I just find and love Javascript's object syntax and looping a lot easier. ...
1
vote
2answers
203 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 ...
-6
votes
1answer
37 views

How do you pass or fail performance tests? [closed]

If you need the tests to be consistent, define some failure criteria and measure. If you need the tests to be at least X fast (where X is ideally some metric gathered by usability testing) then do ...
0
votes
3answers
231 views

What arguments are there to use a coding style for each distinct language? [duplicate]

I recently had a discussion about our coding style for C# projects. Two things in particular were very hard to agree upon. Method Naming C# has the de-facto standard of naming (at least public, ...
0
votes
0answers
30 views

Trouble with a heightmap adjusting algorithm [migrated]

I have a 2D grid of integers. The user can pick any location and increase or decrease its number by one. The algorithm should adjust all eight adjacent locations so there is no more than a difference ...
2
votes
0answers
150 views

Javascript callback design: is it OK to have side effects?

Consider this javascript function: function(){ var someArr = [...]; var someObj = {...}; someArr.forEach(function(item){ if (matchItem(item)){ ...
2
votes
1answer
388 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 ...
-4
votes
0answers
23 views

Javascript Automatic Class Structuring Code [closed]

This is designed to make it easy to structure a large javascript project into its own independent classes/modules, then make those classes have easy access to their parent classes, all while keeping ...
0
votes
1answer
32 views

Bundling and minifying options for MVC2

I've just been handed an MVC2 application and noticed that there is no bundling or minifying of the JavaScript or Stylesheets. I've used the built in bundling and minifying logic that comes out the ...
0
votes
1answer
82 views

Measure and locate areas of similar value in an image

I saw this picture online and wanted to see if I could create an algorithm to give ordinary images an effect like this: http://justinlivi.net/wp-content/uploads/2011/01/Living_In_Digital.jpg My idea ...
0
votes
1answer
47 views

JSP in Javascript file or multiple AJAX requests

I've been thinking about how I want to load my data for some checkboxes in an AngularJS app. I'm generating multiple checkboxes based on 2 JSON objects that are currenty hard-coded in the a Javascript ...
3
votes
1answer
302 views

What is the most efficient / fastest way to keep a list in order?

I implemented Dijkstra's path finding algorithm in JavaScript and a big part of it involves storing the distances to nodes and fetching the smallest. The distances change often and the smallest is ...
0
votes
2answers
76 views

How to protect controller endpoint from abuse?

I am building a web app that will first validate a promotion code via AJAX call and then if it is valid, allow the user to fill out the rest of the form, I use KnockoutJS to reveal and hide the ...
0
votes
1answer
31 views

node deep file indexer module cannot go deep [closed]

I'm trying to make a file indexer by node.js. The program is supposed to index files and folders in an array and also check inside folders and add all sub folders and files I wrote: ...
7
votes
1answer
168 views

Why create a Global-ish Object.create function?

I'm a fairly experienced programmer in the .NET and Java realms, and I've started reading up on JavaScript. I bought Douglas Crockford's "The Good Parts" book, and I'm immediately put off by a few ...
0
votes
0answers
116 views

Right way to design javascript flow?

My question is because I believe that maybe there is a better way to design my code when I need to do sync tasks in JS and wait for the response. I'm working on Node and I need to save some data (I ...
24
votes
10answers
12k views

Why Should I Avoid Inline Scripting?

A knowledgeable friend recently looked at a website I helped launch, and commented something like "very cool site, shame about the inline scripting in the source code". I'm definitely in a position ...
28
votes
5answers
14k views

Is JavaScript interpreted by design?

I am cautious of asking this question because it might appear overly fastidious. I just opened up JavaScript: The Definitive Guide, and it states of the first page of chapter 1 "JavaScript is a ...
2
votes
2answers
182 views

Pre-Processors vs Pure Web [closed]

It seems like within the last few years or so HTML/CSS/JavaScript Preprocessors have exploded in quantity and general use. They're still not as common as pure HTML, CSS, and JS/jQuery, but their ...
7
votes
1answer
303 views

Is obtrusive JavaScript required to support a feature of AngularJS?

I'll start by saying I'm just learning about AngularJS, and I was reading this article, which seems to advocate for obtrusive JavaScript as the right thing: ...
0
votes
1answer
38 views

Is there any reason not to allow negative numbers to be entered into a JSP field labeled for positive numbers?

Our application, a fairly complicated money ledger, has a JSP field for entering a certain type of money due, balanced by payments made towards that amount due. In the application, this field is ...
16
votes
3answers
5k views

Why would I use Angular?

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 ...
0
votes
1answer
128 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 ...
2
votes
1answer
48 views

Reuse already fetched data for request

I have action that fetches user model from db to check access. Then I have method that in some cases requires same model. function checkAccess(req, res, next) { var data = ...
5
votes
2answers
2k views

Every function is a closure?

Wikipedia says, that closure - is a function, which has an access to variables, declared outside of the function. There is even an example: function startAt(x) function incrementBy(y) ...
1
vote
4answers
591 views

What should I “forget” when going to Javascript? [closed]

I went from C=64 Basic and assembler to FORTRAN and C to C++ and Java. Professionally I started in Visual Basic for applications then to Visual Basic 4, 5, 6. After that VB.NET AND C# with some Java ...
4
votes
1answer
93 views

Nested classes via a getter (to emulate namespacing)

So, we all know that ES6's introduced syntax is definitely sugar over what we've been doing, previously. That being said, we still don't have namespaces (which would be nice...) The problem that I'm ...
0
votes
1answer
74 views

Ideal export in terms of size for asynchronous module definitions in JavaScript?

When creating AMD modules you can export whatever you like whether it be an object or a function. I vaguely recall reading a recommendation somewhere to export just one thing; the idea being "keep it ...
15
votes
6answers
2k 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 ...
1
vote
1answer
247 views

Why is it common to put an underscore before a method in JavaScript? [closed]

For example, I noticed that in the jQuery UI widget factory, methods like _init, _start, _on, ect.
27
votes
7answers
3k views

Referencing external javascript vs. hosting my own copy

Say I have a web app that uses jQuery. Is it better practice to host the necessary javascript files on my own servers along with my website files, or to reference them on jQuery's CDN (example: ...
4
votes
1answer
1k views

How should I structure modules in an Angular.js application?

I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS ...
3
votes
1answer
175 views

Is there any reason not to make a webapp be client-side only?

I recently started writing a path-finding algorithm simulation application in python. It takes user inputs, randomly generates a 2d graph, and shows displays the simulation via GUI. Now, what I ...
1
vote
1answer
65 views

React and simple UI state

I'm starting to playing around with React and have a basic question regarding state. I understand that in React state should only contain data which may change and cannot be computed from elsewhere, ...
0
votes
0answers
59 views

“Python interpreter vs Javascript engine” memory model

I learnt that memory model of python interpreter is dictionaries of dictionaries, where each module is a dictionary. Let me elaborate more on this with an example, After i run >>> python ...
2
votes
1answer
438 views

How many Angular Controllers and/or Directives is too many?

I'm building a large, editable data table with angular, and I'm trying to figure out what the best practice is. The table will be a couple of hundred rows, with a couple of dozen columns, so upwards ...
1
vote
1answer
56 views

Keeping client side model and server side in sync in SPAs

Since SPAs have most of their domain logic client side, how do you keep your domain model in sync with the back end? For example, let's say I have a .NET WebAPI web service that uses the Entity ...
0
votes
1answer
108 views

How do I design a Javascript Object to not use any public properties?

I have been playing with the Object creation outlined by Douglas Crockford in his new talk "The Better Parts" function constructor(spec){ var that = otherConstructor(spec), member, ...
1
vote
0answers
72 views

Were Java and Flash necessary pre-cursors to JavaScript and HTML5? [closed]

Java appeared in the Netscape browser in 1995, with Javascript and Flash very soon after (I think). Java and Flash allowed programmers to add rich interactions to otherwise static sites, which can now ...
190
votes
3answers
65k 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 ...