Tagged Questions
18
votes
4answers
8k views
Function declaration as var instead of function
More and more I'm seeing functions being declared like
var foo = function() {
// things
};
Instead of how I had learned, like
function foo() {
// things
}
What's the difference? Better ...
6
votes
4answers
1k views
What is the name for a NON-self-calling function?
I have a collection of normal functions and self-calling functions within a javascript file. In my comments i want to say something along the lines of "This script can contain both self-calling and ...
1
vote
1answer
150 views
Documenting Function That Takes Random Parameters?
What's the best approach to creating documentation (displaying the function prototype if you will) for functions that take a variety of different forms in terms of parameters.
Let's say there are 10 ...
1
vote
3answers
806 views
If statements vs switch cases? in a JavaScript game and if to use a function [duplicate]
I am developing a game in JavaScript where you start with a user input, stored in the variable "controller". The options for the user consists of start to start the game or about to learn about the ...
0
votes
1answer
135 views
Using functions as statements on Python
A great feature of Javascript is function statements. You can do this:
(function myFunc(){
doSomething();
doSomethingElse();
})();
Which is a way to declare a function and call it without ...
0
votes
1answer
123 views
design patterns in Javascript - toggle functionality [duplicate]
My goal is to add some functionality to the bxslider script - in this case, I want to be able to enable/disable a keyboard event handler AFTER a slider is instantiated.
I guess this code is self ...