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)

0
votes
0answers
4 views

Styling of charts externally [migrated]

Is it possible to translate(detach) bar colors stated in js file to separate css stylesheet. How to assign classes to this values? /* Bar dashboard chart */ Morris.Bar({ element: 'dashboard-bar-1', ...
-3
votes
0answers
16 views

softening binding in javascript [on hold]

Okay, another example from you don't know js... So this time, I have been spending lot of time on this one code as it really doesn't make any sense. I am really getting confused on the part where ...
0
votes
1answer
106 views

you don't know js book 'this' example

I am reading the book "you don't know js this & object" and I ran into below where they are explaining 'this'. Now, below example, I understand somewhat but I just do not understand what ...
0
votes
0answers
57 views

Should I attempt to learn web dev in a week? [on hold]

I need to write an application for managing files/records in a directory (the records themselves are related to patches/updates we send to clients [different clients have different versions of the ...
0
votes
0answers
2 views

$.when().done() not working as expected [migrated]

I need to load html on to a page via jquery ajax. Then, after the html has loaded, I want to parse it for certain data that will be in the loaded html, and use it to create map markers. So I need the ...
2
votes
1answer
66 views

Conceptual question whether to pass data between functions or use a Class

I have a hard time to find an ideal concept / design and would appreciate your thoughts on this. I have 16 "tissues" that I need to keep track on. Each tissue holds a pressure that need to be ...
-3
votes
0answers
45 views

How to draw pictures directly into JS program? [on hold]

I'm trying to insert a complex picture into my JavaScript program using ellipse, rect, etc. but I am far too lazy to type out the parameters for every little shape. Is there any way I can draw the ...
0
votes
1answer
54 views

JS Asynchronous Load Pattern

This is a specific problem but I believe the pattern here may be general enough to be useful to the audience here. I'm working on an offline JS application. In my JS application, I would like to run ...
-3
votes
0answers
17 views

how to create channel with backbone.radio,any example? [on hold]

I want create a channel which will fetch the data from a url (kind of global data). other models will use channel to get the urls by calling channel.reply(). Any input or guidance will be apperciated. ...
-1
votes
0answers
69 views

When should mixed PHP/JS snippets be refactored into a separate JS file? [duplicate]

This code snippet is from a teammate of mine, his title is "Full Stack Developer". He mostly write PHP code. I found this code at the end of a .php file and asked him to move it to a separate JS file ...
8
votes
2answers
359 views

Is automatically generating passwords during registration a good idea?

I'm developing a registration system for a project I'm working on. Since users tend not to sign up if the process is too long, I've thought to require (at least initially) just their email, where I ...
-4
votes
0answers
37 views

What Are The Benefits Of Coding A Website From Scratch? [closed]

please what advantages does a website written from scratch have over the one done by CMS. Does a web developer just choose to use CMS at his own volition, or is it always at the client's request? ...
2
votes
2answers
146 views

Algorithm and data structure to match groups of users (1-5 each) into 2 balanced sets of 5 users

I'm building a matchmaking queueing service for a 5v5 team-based game. I have a large set of users that are grouped into unique lobbies comprised of 1-5 users each. Each user has an integer based ...
1
vote
1answer
111 views

How to avoid tying these two methods together with global mutable state?

I'm in the process of reading Code Complete 2 and learned that using global state is a no-no. What can I do to avoid using global state in this situation? Some background information: I have two ...
0
votes
0answers
58 views

Is it possible to cast Javascript anonymous object to a typed object? How? [migrated]

I'm looking for a way to cast JavaScript anonymous object to a typed Object, ... Using MooTools library (You may create them manually or using other tools), i defined several type, and then Using ...
0
votes
0answers
39 views

Static classes vs prototype classes whats the difference really

I am manage to create both static and prototype classes in this JS code, Keeping in mind that I will always need 1 instance of prototype class "Fruits" here, what benefit could I get over static ...
0
votes
1answer
29 views

maintain rate of animation with requestAnimationFrame

I've noticed that HTML game developers are recommending the use of requestAnimationFrame as opposed to a timer for the animation loop. I understand that this can be optimized by the browser, but how ...
1
vote
1answer
42 views

Clear JQuery Listeners Before Ajax Load of Similar Data

I have a tree structure on the left side of my page from which the user can drill down and select items. Each branch has similar items. When clicking a leaf node, I make a JQuery .load(...) call that ...
2
votes
2answers
95 views

What's wrong about extending a class with prototype methods?

I was at a bar last night with a few of my colleagues. They said that it's a bad idea to extend the functionality of basic JavaScript Objects with a prototype method. For example, let's say you ...
2
votes
1answer
65 views

Javascript unit testing - mocks or fixtures?

Interested in some opnion... I'm introducing unit testing of JS into a team, it'll largely be testing modules with many dom interactions and updates. Traditionally I've always used mocks and spys ...
2
votes
2answers
127 views

Client-Side JavaScript Business Logic in .Net Solution Stack

Fellow developers on other teams I interface with seemingly question my judgement calls as they pertain to the placement of coded business logic in a .Net MVC/Knockout web application currently under ...
1
vote
1answer
106 views

Managing Massive Updates with Resource Access

I have a number of data servers that are pushing data to a main server as in this kind of architecture: These data points (points for short) are updated randomly from each server. On the server, ...
2
votes
1answer
66 views

How to research API usage?

I'd like to find out how often and if a certain pattern in a certain programming language is used. In my case - I'd like to find out how many/if people do eval("/"+regexString+"/") in JavaScript ...
13
votes
2answers
2k views

How Do News Websites E.g. Forbes / Zdnet Seamlessly Merge One Webpage into Another?

If you go to E.g: http://www.forbes.com/sites/adrianbridgwater/2015/06/12/why-technology-has-to-be-continuous/ OR ...
1
vote
1answer
68 views

JS Async: . Can I forget callbacks all together and replace with promises and/or generators

I've been using Nodejs and I really dislike callbacks (as i think most people do.) I'm starting to learn about promises and generators. Both are a lot cleaner and I'd like to forget the horrors of ...
76
votes
14answers
8k views

Is my mentor's concern for code quality excessive? [closed]

To tell you a little about myself: I'm a newbie programmer working internships and learning a lot from experienced programmers. I can't believe I used to think I was good in college. The one I'm ...
0
votes
3answers
154 views

What is the best way to go about storing application options: file system or db? [closed]

We are looking to find the best way to store user options (skills, degrees, industries, languages, etc.) for drop downs. The options are between a JSON file we can store on the server file system or ...
2
votes
1answer
43 views

Best-matching comparative values using all items in array

I have two arrays of objects (items) in the exact same format. Each item represents a wager, and each array represents one of two outcomes for that wager (ex: Team A vs Team B). Both arrays look ...
4
votes
1answer
80 views

Status Bar Timetracking Design

I'm currently developing an application in ASP.NET using SQL as the backend database. In my header, I have a status bar that displays the current status of the user and a timer that shows how long ...
0
votes
2answers
277 views

how do websites detect my screen resolution

http://whatsmyuseragent.com/ tells you your screen resolution, javascript enabled,user agent and local time etc? User agent is a part of HTTP header. How do they know about other information? I ...
0
votes
0answers
30 views

Any point in using ES6 Map when keys are all strings?

Plain object keys must be strings, whereas a Map can have keys of any type. But I have little use for this in practice. In nearly all cases, I find myself using strings as keys anyway. And presumably ...
-1
votes
1answer
89 views

Dictionary representation of an object

As python memory model is dictionaries of dictionaries, looks like any object in JavaScript has similar representation. Below code, > foo = {} makes foo as an empty dictionary {}. fine. If ...
0
votes
0answers
75 views

Why would I need node.js to run a javascript library?

I'm interested in using sigma.js, and I'm looking at the instructions here: https://github.com/jacomyal/sigma.js/wiki One of the prerequisites is that node.js is installed. If it's a client side ...
11
votes
3answers
730 views

Unit Testing Competition

My employers runs a monthly unit testing day competition. One entire day is dedicated to writing unit tests -- obviously we do more testing throughout the month, but this is an entire day -- and the ...
0
votes
1answer
85 views

What pattern to use when you have to hide/show different sections on a form depending on a dropdown value?

For example, let's say you have 8 sections to hide/show and depending on the value of a dropdown, you have to show or hide dynamically from 1 to 8 sections. 1) Is there any better way of doing this ...
0
votes
1answer
50 views

Looking for a way to interpolate a base URL that won't conflict with Underscore template code

At my workplace, we have dev and production environments, and a separate server that serves static files for each environment. In my code, I make references to the URL of this static file server. ...
-1
votes
1answer
127 views

Separating front end and back end using private api php [on hold]

I am using php only for basic CRUD operations with MySQL. I want to create private API in php. From what I came to know , these are the steps for a developer local server to get data from remote ...
1
vote
3answers
165 views

Auto-save user input - the smartest way?

I'm developing a social network website and I'm working with php/mysql/jquery and I want users to have the most user-friendly website experience. That's why I try to avoid a save (submit) button at ...
0
votes
1answer
70 views

Javascript Constants in ES6

What would be the preferred way to create constants in javascript, specifically with ES6? Currently I have a constants class which has methods that return the string I'm looking for. class ...
1
vote
1answer
203 views

Why can a constructor be used without `new` keyword in Javascript?

I found Date can be used without the new keyword. Date(1) > "Thu May 28 2015 15:54:20 GMT+0800 (CST)" new Date(1) > Thu Jan 01 1970 08:00:00 GMT+0800 (CST) I was wondering whether there is ...
1
vote
2answers
99 views

In javascript, should object properties be declared on top of the function?

I learned that it's good practice to declare variables before they are used. For example: function myFunction() { var i; var j; } Does the same thing go for object properties, and is there a ...
1
vote
1answer
108 views

html/css/javascript for game ui's

I've been looking into game ui's recently. My conclusion is that html/css/javascript would be the perfect solution IF it was wrapped up in a nice C++ library that allowed for easy integration into ...
1
vote
1answer
126 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 ...
2
votes
1answer
92 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 ...
0
votes
3answers
244 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
1answer
42 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
134 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 ...
0
votes
2answers
82 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 ...
8
votes
1answer
183 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 ...
-1
votes
1answer
45 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: ...