Tagged Questions
2
votes
3answers
179 views
Should I place functions that are only used in one other function, within that function?
Specifically, I'm writing in JavaScript.
Let's say my primary function is Function A. If Function A makes several calls to Function B, but Function B is not used anywhere else, then should I just ...
0
votes
2answers
95 views
Alternatives to the use of the Id/Name properties with non-inputs elements in HTML
I'm migrating a website that use Javacsript/HTML/PHP using reusable javascript code, in certain moment I saw the opportunity to simplify code in functions that use almost the same code.
Let's say: I ...
8
votes
1answer
525 views
I know JavaScript really well, but i bomb coding interviews [closed]
So I'm currently on a hunt for a new position as a Front-End Developer. I know JavaScript very well and can wax poetically about Closures, Currying, Prototypal Inheritance, Design Patterns, App ...
0
votes
2answers
200 views
Whats the best way to build a HTML/AJAX site that requires login? [closed]
Let's say that hypothetically you wanted to build a website that delivered content to the visitors entirely using HTML and Javascript (AJAX to fetch server side data). The site would require login for ...
1
vote
0answers
78 views
Methods for structuring JavaScript SDKs
I've built a REST API and have been using Backbone models throughout a couple different applications to communicate to it.
I would really like to build a single JS SDK that can be used in any ...
2
votes
1answer
90 views
equivalence in callback and non-callback javascript
I'm pretty sure that the following two snippets are equivalent but I wanted to double check:
CALLBACK STYLE
function foo(input, callback) {
// do stuff with input
callback();
}
function ...
4
votes
2answers
2k views
How to structure a modern web application
Background
I recently developed, for two different projects, two web applications.
The two followed quite different approaches. The first one was a classic inventory application (lists of stuff to ...
1
vote
1answer
336 views
Make a flowchart to demonstrate closure behavior
I saw below test question the other day in which the authors used a flowchart to represent the logic of loops, and I got to thinking it would be interesting to do this with some more complex logic. ...
2
votes
1answer
511 views
Approaches to reduce cyclomatic complexity
I was running our code through JSHint, and decided to switch checks against cyclomatic complexity, and then went on long refactoring sprint. One place though baffled me, here is a code snippet:
var ...
0
votes
2answers
582 views
What is the best practice for method parameter validation in a library? [closed]
I develop a game library in javascript, containing many classes. I hesitate on the behavior that I should follow concerning method parameter validation:
Should I check the validity of parameters ...
1
vote
4answers
1k views
Switching from ActionScript to JavaScript, tips for writing code?
I am quite comfortable with using actionscript3 and flash. I also have some experience with Java. But recently, I started learning JavaScript and node.js. I ultimately want to make a 3d game in ...
3
votes
2answers
1k views
JavaScript and callback nesting
A lot of JavaScript libraries (notably jQuery) use chaining, which allows the reduction of this:
var foo = $(".foo");
foo.stop();
foo.show();
foo.animate({ top: 0 });
to this:
...
1
vote
0answers
52 views
Good practice and terminology of braces [duplicate]
Possible Duplicate:
Should curly braces appear on their own line?
I've come across two methods of using braces with if/for/switch/while/function blocks in Java, JS, C++, and PHP (any ...
5
votes
3answers
453 views
Weighing pros and cons for using jQuery for just one widget
I have been using html select boxes or textboxes for date input. On submit, the date is validated and if invalid an error is returned. I have avoided javascript calendars thus far, but jQuery ...