Closed
Description
Hi everyone. I only do JS for a couple of weeks now and could not find out, why the code
this.show = function(username, cb) {
var command = username ? "/users/"+username : "/user";
_request("GET", command, null, function(err, res) {
cb(err, res);
});
};
Works with
....show('dctr', myFunc);
and with
....show(myFunc);
Why doesn't command evaluate to something absurd and cb fails but myFunc is called in both cases? At least i would have expected something like
cb = username ? cb : username;
Thanks in advance for anwers...
Metadata
Metadata
Assignees
Labels
No labels