Suppose consider the following example:
1st:
projectController.getProjectById = function(req,res){
return (res.status(200).send("Hey"));
}
2nd:
projectController.getProjectById = function(req,res){
res.status(200).send("Hey");
}
Look closely in both of my snippet, in 1st snippet I have written return (res.status(200).send("Hey"));
and in 2nd snippet I have written res.status(200).send("Hey");
.
My question is that if we don't write the return(...)
in res.send()
then also it will send the data to client side . Then what is meaning of wrapping res.send()
inside return(...)
.
I have searched in internet but remains unsatisfied with answer, can anyone provide the explanation of my question.