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.
-4
votes
0answers
20 views
How does Stripe implement the fly-in particle effect on their open source page? [on hold]
https://stripe.com/open-source
When the page loads, the title OPEN SOURCE has the particle flying in animation. Is this done programmatically or otherwise? If programmatically, can someone shed some ...
1
vote
0answers
18 views
How to properly manage “business” constants with AngularJS?
I'm working with AngularJS on a browser game and I have a bunch of "business" constants.
These constants will be often updated during game testing (game balancing) and are used by different ...
0
votes
2answers
53 views
Multiple Canvas in the Browser — How to Proceed?
Here's something I wrote ages ago as Java applet. I want to convert it into JavaScript and run in html5 canvas in the browser. From what I can see, canvas makes the most sense here. (SVG / DIV ...
0
votes
0answers
29 views
How to convert JSON Stringify to Object JavaScript? [migrated]
I have example :
var data = [{"name":"eric","age":"24"},{"name":"goulding","age":"23"}]
I want to convert json above to object like this result :
[{name:"eric",age:24},{name:"goulding",age:23}]
...
0
votes
2answers
242 views
How are complex programs made? [duplicate]
I know a few languages, and can program in them. How do multiple languages blend together in a single program? For ex. https://github.com/facebook/watchman. This uses C, PHP, Python, Javascript, etc. ...
-1
votes
0answers
28 views
Given a set of N coordinates, how can I determine which of them are closer to each other? [on hold]
I would like to know what's the best way to solve the following problem;
Given a set coordinates:
coords = [
[ 6.200992, -75.578738 ],
[ 6.174297, -75.348264 ],
[ 6.199156, -75.573768 ],
[ ...
-2
votes
0answers
18 views
Writing my age in decimal format [migrated]
I'm trying to write my age in decimal format (eg. 28.232423424) in Javascript and have this number update in real time. An example of what I'm trying to do can be seen on this page.
So far, I have ...
0
votes
0answers
62 views
Monthly billing updated daily [on hold]
I'm currently working on handling a subscription payment with a monthly flat rate of say $34.90/month and an extra 10$/sub-user/month.
Since we don't want to prevent users to add sub-users until the ...
-5
votes
0answers
35 views
Meaning of LoopBack(Strongloop) licence [on hold]
I use LoopBack to build a software as Community Subscriber. Licence: https://strongloop.com/license/
Can I sell that software?
Do I need to give the source code of my
software away?
Is anyone ...
-2
votes
0answers
29 views
Why JavaScript regex implementation doesn't have lookbehind [closed]
Most regex implementations allow a lookbehind condition, so that such an expression:
(?<=hello )world
will match world only if it is preceded by hello. This functionality can prove useful at ...
0
votes
1answer
28 views
Connect different programming paradigms in a real app written in JavaScript [duplicate]
I am learning functional programming, working generally with JavaScript. Many things look promising, like immutable data and stateless flow.
Now, I want to build quite a basic CRUD app as a pet ...
0
votes
0answers
28 views
Hot swapping files and metaprogramming with front-end JavaScript
I was inspired by a video on hotswapping JS files with React + Webpack for the web. I started trying it out with React + Backbone + RequireJS.
Seems to work, as long as I stick to the stateless parts ...
2
votes
1answer
146 views
Is it a good idea to have separate UI components make their own webservice calls?
I have few UI components in an angularjs web-application. Each display data based upon same input. One shows stats which are calculated on the basis of a time period. Other shows a chart of daily ...
-1
votes
0answers
35 views
Javascript coding convention: capitalization with requirejs [closed]
We are having an argument, where it has been proposed (among other things) to change requirejs statements like this:
define(['thing', 'xyzzyView', 'backbone'],
function(thing, XyzzyView, backbone) {
...
2
votes
2answers
183 views
Should the ternary operator be used outside of assignment statements? [duplicate]
Edit This isn't a question of whether or not the ternary operator is harmful. It's about whether or not there's a consensus about whether or not it should be used outside of assignment statements. ...
2
votes
1answer
57 views
Is web sockets the best solution for my problem?
I have created a Slackbot that integrates with Submittable.com. For example, I can trigger a response that displays all current submissions in Slack.
I now need my Slackbot to post in Slack whenever ...
0
votes
1answer
56 views
Can 32/64 bit version of Dart SDK have any effect on produced javascript code?
I just started collaborating remotely on a project. Project manager explicitly asked me to download Dart SDK 32bit version. Since I have 64bit machine I asked why to find out more about it. I was told ...
0
votes
0answers
59 views
Shared data in functional programming
I have been working on a project in JavaScript which requires a data structure (read only), to be shared between two functions.
var mySharedData = ['hours', 'minutes', 'seconds'];
Now I have two ...
0
votes
1answer
69 views
Best Practices: URL Path Parameters [closed]
What's the current best practice around path parameters in URLs?
For instance
/artist/name
A long time ago I might have made artist.html and then passed in a query parameter /artist.html?name=name ...
-3
votes
0answers
35 views
I am misunderstanding a jQuery array [migrated]
This code doesn't work
var next = $("#orders").find(".next");
if (next.length == 1) {
var address = $(next[0]).find(".directionsAddress");
var destination ...
7
votes
2answers
167 views
Cross-language Test-Driven Development
The short question: How do you follow Test-Driven Development on a project that spans multiple languages?
Specifically, I'm writing a web application that uses JavaScript and PHP, and I want to ...
0
votes
0answers
15 views
Using Simile widget timeplot to overlay events on discrete data [migrated]
I was given the task of finding a way to graph my company's manufacturing data from each batch of material (specifically density) with an overlay of process changes in some sort of timeline format. It ...
-1
votes
2answers
123 views
What is an anonymous function? [closed]
I am new in programming and it's kind of difficult for me to understand what the context of an anonymous function is.
this is my code:
toevoegButton.addEventListener('click', function() {
...
0
votes
0answers
3 views
Div heights not the same after setting equal heights with javascript [migrated]
I have two divs which I would like to be of equal length. Div1 has text in it which determines its height. Div2 is a scroll box which should have apparent height the same as div1. The following code
...
0
votes
0answers
30 views
Authenticate Joomla User from an External App based on Node.js, Javascript and mongoDB
I have an iOS App which currently pulls in all the data from the MongoDB using a Node JS server. Currently my API / my node server handles all the data manipulation the iOS app/Swift only displays the ...
4
votes
3answers
287 views
Functions whose parameters are implicitly supplied
Callback functions are able to accept some parameters, but they are not explicitly declared when calling the function.
How does this actually work? What is going on that allows us to pass a function ...
0
votes
0answers
28 views
Is it better to store integer data or array references in a javascript visualization?
Say I have a tree that I'd like to visualize with d3. Nodes have various attributes produced by the d3 library, attributes like an index and position variables. Now, I could add more attributes to ...
3
votes
1answer
128 views
Node.js callbacks and this - how it should be solved?
Every JavaScript programmer is familiar with this "problem" (it can be considered as a feature, depending on various conditions) - this is lately binded:
let foo = {
bar(){return this;}
};
let ...
0
votes
1answer
70 views
Implementing the State Pattern with Object.setPrototypeOf()
Take a look at this implementation of the state pattern in JavaScript:
var ON = {
switch: function() {
Object.setPrototypeOf(this, OFF);
this.state = "OFF";
}
}
var OFF = {
...
0
votes
1answer
62 views
How to filter RSS feed results, according to a DOM element in its page content?
I've a "RSS feed", want to filter its results according to a DOM element in its content!
So, this is the mission I'm looking forward to do:
Monitor a "RSS feed" continuously.
If new RSS elements ...
1
vote
0answers
226 views
Why is deep plucking a bad idea?
Both underscore and lodash refuse to implement deep plucking, despite many requests from users and gists or modules that implement the feature.
...
0
votes
0answers
43 views
Is there an algorithm to avoid getting in hundreds of datapoints from API to represent a bar graph?
I am showing a graph on HTML5 canvas using the flot charting library for a between a start date and an end date. It's fine as long as the period is less than a year or so but if the user selects a big ...
0
votes
0answers
72 views
When and when not to use OOP in Javascript? [duplicate]
This post suggests that javascript code should be written in object oriented design. He gives a trivial example of making some ajax call and alerting the response. From the world I come from (c#) he's ...
0
votes
1answer
115 views
How to avoid circular patterns in Node?
I'm new to Node and JavaScript (well, asynchronous programming in general) and I noticed when I was working on a project that the following code is a circular pattern and that these are bad practice ...
28
votes
1answer
883 views
What is the term for an anonymous JavaScript function that's called immediately?
I'm writing a JavaScript style-guide for my team, so that we can organise and contribute our documents easier. But I've hit a small bump which is where my question applies...
What am I supposed to ...
2
votes
2answers
112 views
Javascript Password Security
I'm extremely new to javascript (so I know there's already a thread here), but I couldn't understand how to implement it. My code is pretty much identical:
<script language="javascript">
...
0
votes
1answer
48 views
Is it possible to use on focus event on form..?
I tried to find when and on what onfocus works.. Can some one tell me is it possible to trigger event when some one is viewing current form ??
I know it works on input,dropdown and textarea.. but ...
2
votes
6answers
733 views
Replacing C with JavaScript as an introductory programming language [closed]
I am a new teacher at polytechnic where we teach web development and basic software programming.
For years, the institution where I teach have taught C as their introductory programming language to ...
0
votes
2answers
77 views
Using PHP without mixing presentation logic
I'm conceptually designing a website / application and trying to come up with the correct separation of concerns.
The basic technologies I'm settling on are: MySQL, PHP (Laravel), HTML/JS (jQuery).
...
3
votes
2answers
75 views
why regex, when using global search and {0,} quantifier, match the end of the string?
I have asked a question here about js, regex, quantifiers and global search. I've understood finally how this works, but, let's take a concrete example and then I`ll write my question.
Based on the ...
2
votes
3answers
229 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 ...
0
votes
0answers
52 views
Vertical Single Page App libs/patterns?
Lately I've noticed a trend amongst some website homepages to present information in a vertical fashion, forcing the user to scroll down to continue reading the content. As you scroll down, a state ...
0
votes
0answers
34 views
dynamic api code generation in nodejs
We are using nodejs and cassandra for backend stuff. In past few months we wrote same CRUD code for different apps. I am thinking of some way to automatically generating CRUD code. I came across ...
1
vote
1answer
159 views
What would be a reason not to embed JS in C? [closed]
I'm working on an opensource application that processes JSON in C, because I would like to make it easier for people to help me in the project and because JSON is so close to JS. I want to embed a JS ...
1
vote
1answer
88 views
Which JavaScript Template (jst) syntax uses double-brackets, (e.g. [[ and ]] )?
I'm looking at the source code for a Rails application that uses Backbone and there are template files with .jst.ejs extensions.
The templates include HTML with lines of JavaScript wrapped in ...
0
votes
1answer
52 views
Is there a relationship between a data source (JSON) and the Model that consumes it?
I have put together a large quiz data structure. It is in JSON format but I guess it could be XML etc. It may look something like this simplified:
{
"quiz":{
"title": "Welcome to Quiz"
...
0
votes
2answers
103 views
How can I show and hide a single field across my web application through a checked value?
Let's say I have a field called "FooName" and I have "FooName" in several places across my web application (ASP.NET MVC4). I have a check box that allows me to turn "FooName" on and off across the ...
4
votes
2answers
358 views
Is localStorage under The Cookie Law?
I'd like to avoid having the cookies banner on my websites where possible. Could I store session id's in localStorage to bypass implementing the banner?
1
vote
1answer
74 views
Does requestAnimationFrame() really align with monitor refreshes?
Take this code:
requestAnimationFrame(function (timestamp) {
console.log('one', timestamp);
});
requestAnimationFrame(function (timestamp) {
console.log('two', timestamp);
});
// logs:
// ...
0
votes
1answer
236 views
Is writing code chronologically the best way for readability? [closed]
So I've been writing a lot of JavaScript lately. Despite what many people say I think JavaScript can be a simple and beautiful language.
What I've pondered of late is how to structure the code so it ...