() is Null?
Go to solution
Solved by squirrl,
yes
i know
i had numbers inside of the ()
but without them it was stated as null right
I think i see what you are trying to say.
For example you could have
function takeAFunction(callback, number) { // usually you would have params before the callback though if (!number) { return callback && callback('number is null'); } callback && callback(null, number);}
and then call it like this:
takeAFunction(function(err, res) { console.log(err, res); // will print out "null 1"}, 1);
or like this
takeAFunction(function(err, res) { console.log(err, res); // since number wasn't passed in it will be null and handled as such in "takeAFunction". This will print "number is null null"});
or like this
takeAFunction(1, function() { console.log(err, res); // err and res would be passed in to the anonymous function when called by takeAFunction, but since this particular function does not define them, they will be undefined when logged.});
Basically () is not resolved to null or any other type. It's just formatting. Any parameters which would have been passed into that anonymous function will not be initialised and be undefined. (not null)
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now