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.
0
votes
1answer
12 views
Java 8 Optional in JavaScript
I like the idea of Optional in Java which we can use to say that the object may or may not be available.
I am now learning JavaScript and when trying to find an equivalent, came only across ...
0
votes
0answers
20 views
Best practice for storing external text to then place in html
Sorry if I'm not explaining the question well in the title, I'm not sure of the correct lingo. Let me give you an example instead.
So this is a normal HTML file.
<span>Well to the ...
-1
votes
0answers
21 views
Javascript execute code in a Parameter
How can I write a function that executes the code in a Parameter?
Something like:
function exeCode(code){
whatever(code)
}
exeCode(alert('It works!'));
and this should do what I write into the ...
0
votes
0answers
38 views
What are all the variables that can make a difference between computers or browsers? [on hold]
I have two computers that are giving different behavior. What are the difference that can happen between computers and browsers, assuming they are both served the same HTML, CSS, and JS. These are ...
-4
votes
0answers
37 views
Where can I get a perfect, quick and easy guide/tutorial of JavaScript for free. Basically for Facebook App development using JS SDK [on hold]
I just want to create an app using Facebook API. It will be hosted on my server. It will only have access to data from the Facebook Server. From the www, I have found multiple documents (PDF, video ...
-4
votes
1answer
33 views
Load files with Python in JavaScript [on hold]
I have some data in files (10mb x 10 files) that need to be loaded with Python. I would like to pass a file name from JavaScript to a Python server to load and then get a json/array back in a ...
-7
votes
0answers
47 views
Javascript scope [on hold]
How can I in Javascript do something like:
function a(){
var somevariable = 123;
}
function b(){
print(somevariable)
}
a();
b();
You can of course replace the 'print' with any code you want.
0
votes
0answers
5 views
iron-ajax chaining polymer
I am looking for a way to nicely chain promises in polymer. Now I define a method in my on-response to send the result of my first request to. Upon response, I fire my second request. This flow makes ...
0
votes
3answers
161 views
Are browser console errors 'compiler errors', 'runtime errors', or neither?
I was trying to communicate with a coworker about a JavaScript error I was being notified about in my browser's console window when I realized that I wasn't sure if I should refer to this as a ...
0
votes
0answers
22 views
Syncing file data and form data uploaded at separate times
I have a web application where users can upload office documents. In addition to uploading files users also specify extra information about them that's not contained in the files themselves but is ...
2
votes
1answer
111 views
When making a change to a single table in our app, should we minimize the scope of our change, or follow best practice for css/jsp coding?
My co-worker has been assigned the task of editing one of our Java application's tables. She is almost done, but needs to make one final adjustment to the table - this requires her to add a CSS ...
0
votes
3answers
78 views
Does setTimeout() really execute in parallel?
Consider following JavaScript code:
function foo(ary) {
// some long operation on ary
}
function bar(ary) {
// some long operation on ary
}
function baz(ary) {
// some long operation on ary
}
...
-3
votes
0answers
31 views
Facebook not giving access to javascript global objects like window and document [closed]
I am making a chrome plugin that needs to be able to have access to javascripts document object but it seems like Facebook has disabled or removed them.
I try to open devtools and type window or ...
0
votes
1answer
48 views
Should models be returning data directly to the client, or to the controller instead?
Disclaimer: This is my first time: using node, creating a REST API, and trying out MVC server side. (so, just statistically speaking, I'm probably doing something wrong ¯\_(ツ)_/¯)
I'm working on ...
4
votes
2answers
69 views
What does “initialize event handler” mean in this context?
In file1.js I read:
// NOTE: initialize your app event handlers here, see file2.js for a simple event handler example
// TODO: configure following to work with both touch and click events (mouse + ...
-2
votes
0answers
16 views
Form Filter and Calculator for Tabular Data [closed]
I am looking to create a new website but I am lost as to how best to go about things and where to start.
I am wanting to create a website to store all data in a tabular form just like a spreadsheet. ...
12
votes
3answers
253 views
Providing Local JS and CSS Resources for CDN Fallbacks
Given that
CDNs are a Good Thing because they can serve resources closer to the client, the client can cache them, and you can reduce load on your own server.
In recent browsers, loading resources ...
-5
votes
0answers
48 views
Programmitically scrape quora's reading list
Making a get request to the url will only fetch some questions/answers but not the ones which are received in subsequent ajax requests.How can I programmitically get all questions and answers in my ...
2
votes
2answers
54 views
Cleanly generating several 0-airty JavaScript functions with slightly different bodies
Say I have a bunch of JavaScript functions similar to:
message = [“000”, “111”, “222”, “333”];
function F0(){
alert (message[0]);
}
function F1(){
alert (message[1]);
}
function F2(){
...
1
vote
3answers
111 views
Where should I do localization (server-side or client-side)?
I am currently developing a new web application based on a rich JavaScript client which communicates with multiple REST web services on my server. That application is intended to be used in at least ...
0
votes
3answers
132 views
Which of these promise methods is considered a best practice?
I have a couple of async method that is basically a yes and no reply
isUsernameAvalible() isOnline() isImage() yada yada... you probably get the point by now.
As a demonstration... try to think of ...
-3
votes
1answer
57 views
How to compare and replace value from two object inside array?
Here i want to replace price in data1 to price from data2, and it updated if the id is same.
Is it possible to do that without nested loop?
var data1 = [{
"id": "56e641d4864e5b780bb992c6",
...
0
votes
1answer
78 views
Drawing a data-grid on canvas - whats the point?
To simplify my question let's assume for a minute that all users are using the latest version of Chrome to view a particular website.
Using the latest libraries (Polymer for example), I can render a ...
5
votes
1answer
413 views
What does Google mean here when they say “don't copy and paste this code”?
Here is an excerpt from code from Google's recaptcha API (https://www.google.com/recaptcha/api.js):
/* PLEASE DO NOT COPY AND PASTE THIS CODE. */
(function() {
if (!window['___grecaptcha_cfg']) { ...
-5
votes
2answers
79 views
How do I make such a page that opens different link in web (PC) and different in mobile (phones)?
I am building a website that looks beautiful in Web but worst in mobiles. I want to build the same site but different designing for mobile. Whenever user opens site.com then it auto redirect to ...
-2
votes
0answers
29 views
Simple inherit question? with javascript [migrated]
I am trying to figure out why object three won't access traits from object two when i use the document.write feature.
when I try to use this code on JS Bin "hello does not pop up on the screen like i ...
-4
votes
2answers
137 views
How to find all occurrences of a variable within a source code?
The title is pretty self-explanatory. I have a minified JavaScript code (100k+ lines) and would like to find all occurrences of a particular variable so I could rename it to better understand code. Is ...
1
vote
1answer
63 views
Why does JavaScript console.log of objects sometimes show prototype/constructor pattern forever
I've always noticed this, but never actually understood what's happening here. I have a fairly simple object that I've put in a console.log. It has a seemingly never ending pattern of prototype -> ...
1
vote
1answer
136 views
How should I implement a full text search into my meteor web app?
I am making a web application using the javascript framework Meteor, which runs with mongodb. In the web app I have a db set up that holds individual video games in the documents. An example of this ...
7
votes
3answers
1k views
Is a function getting a value from another function considered pure?
I'm trying to figure out a way to handle default variable values when making functions without side effects and have ended up with the following:
function getDefaultSeparator() {
return ':';
}
...
-1
votes
4answers
152 views
Nested For Loops JavaScript
I have an app which gets data from the database (MongoDB) in JSON format. The returned data contains nested arrays and I want to access the values in the nested arrays. The returned JSON format looks ...
0
votes
0answers
41 views
Deciding on a Portable Platform (given a set of requirements)
Background
Before asking this question, I researched this site and found the following 3 most similar questions have already been asked:
When would using a scripting language within a larger program ...
0
votes
1answer
55 views
Can a browser script detect SSL MITM?
Is there a standard mechanism for javascript to detect TLS MITM?
I'm looking for something along the lines of reading the fingerprint for a server cert out of the browser, and comparing to an inlined ...
9
votes
2answers
235 views
Benefits of Structured Logging vs basic logging
We're building a new app and I'd like to include structured logging. My ideal setup would be something like Serilog for our C# code, and Bunyan for our JS. These would feed into fluentd and then could ...
2
votes
2answers
101 views
When should I nest one module inside another?
Assume I'm working on a JavaScript application and make extensive use of the module pattern with one file per module. Now suppose I have two folders/modules: one for module A and another for module B. ...
1
vote
1answer
120 views
For Web front end, if there are 20 JavaScript files loading, how to track down the mouseover handler?
For Web front end programming, since any JavaScript can set up an event listener for "mouseover" or "mouseenter" for an element, if we are to track down what is the code that is responsible for making ...
2
votes
0answers
43 views
Dealing with conditional verification logic using guard assertion
I have parametrized test with 2 variants:
NULL value
and
any NOT NULL value
From this value is depends one assert:
In case NULL it should be checked if object has field1 with value1
In ...
0
votes
0answers
57 views
How to effectively log while avoiding a bottleneck
I have a fuzzer for x86 Internet Explorer (in HTML) that I've heavily modified to have reproducible, determinisitic crashes (so that I may perform root cause analysis faster). I'm attempting to ...
2
votes
0answers
100 views
Best way to verify that a user has completed a task on another website.
We are developing a website for students on which they first have to fulfill specific tasks in order to use our service. The problem is, that those tasks are on another website, which has nothing to ...
1
vote
4answers
111 views
How and where to test if the JSON request objects generated by the front-end is valid
We have built a complex Angular application that sends multiple HTTP request to a REST service that is also built in house.
Since both the frontend and the backend is being developed in parallel, ...
4
votes
1answer
73 views
What is the best way to selectively load transpiled code or polyfills for downlevel browsers?
There's no escaping Internet Explorer 11 as it will be around until 2023 as the default browser of the most popular desktop operating system. Yet, Internet Explorer 11 will not get new updates to ...
2
votes
1answer
130 views
Redistribution in binary form - Copyright notice in Javascript
I want to distribute a single exe file, which is a simple http web server. This exe contains all the dependency html/js files (mostly licensed under MIT and New BSD)
I really don't know if that's ...
23
votes
2answers
1k views
Why is passing large anonymous functions as arguments to other functions so widely accepted in JavaScript?
I have an opinion (which I am sure will be shared by some) that passing anonymous functions which contain more than a few lines of code, as arguments to other functions affects readability and ...
2
votes
0answers
40 views
How to architect rule matching with multiple conditionals and outcomes
I'm working on allowing my users to create their own ruleset for data that's coming in. All of the data below is sample mock data and not in relation to our product. Example of a rule (there can be ...
2
votes
2answers
101 views
Generate pips on a die based on value
Is there an algorithm to generate the pips on a die or domino?
I know that there is usually an odd number of columns and even number of rows (unless the max number of pips is not a perfect root).
...
2
votes
0answers
91 views
Javascript: How to get the Object an object is prototype of
Javascript in the DOM has a peculiar characteristic. There's a different Object object that an object (by default) inherits per window.
In order to find what kind of object is being sent to a ...
2
votes
0answers
66 views
Confused about how to 'design' my (leaflet.js) map application; OOP
I asked another question recently regarding constructors calling constructors in order to organise my code properly but the answers really ended up giving me more questions than answers (which is good ...
15
votes
0answers
723 views
Is there a reason for not using JavaScript for direct database connections on a web site? [duplicate]
I am thinking about using JavaScript for direct connection to our database server. I think I have solutions to all the possible problems about it.
Security: Modern database management systems ...
1
vote
2answers
72 views
Software design for Client side form validation
So Im using the MEAN framework to build my web app. Like all other apps it requires a login & registration.
My Approach so far has been:
Every major function of my app has its own AngularJS ...
1
vote
1answer
73 views
What is the approach for implementing FLUX in a CRUD application that pulls JSON data from the server?
While using FLUX in a CRUD application,
according to what I understood, initially the data is returned from an AJAX call and then stored in the STORE. So, all the data that is currently viewed is only ...