Hi. It's me again. Actually I have thought about the order of return in JavaScript last night. Let's comeback to the first example. Because I actually called the "call" function inside "question" and then involve 'question' at global scope. My opinion is that when I execute 'question' outside, this function does its work, after all because I didn't return it so the final result of question() will be 'undefined', but I actually call 'call' inside and it returns a value. It makes me think that the final result of question() is the 'return value' of "call" (actually it's not :) ). So the question here is which one came first? The return of 'question' or the return of 'call'? Or I have a wrong question here, it doesn't mean the order of return?
Front end developer specialising in JavaScript and React. Experienced in all aspects of modern front end development. Passionate about making accessible, secure and performant software.
Hmm... I think from the previous replies I've given you should have your answer. I understand these things are difficult to understand at first, but at this point I would suggest checking out a resource that can explain it better than me and in more detail.
Hi. It's me again. Actually I have thought about the order of return in JavaScript last night. Let's comeback to the first example. Because I actually called the "call" function inside "question" and then involve 'question' at global scope. My opinion is that when I execute 'question' outside, this function does its work, after all because I didn't return it so the final result of question() will be 'undefined', but I actually call 'call' inside and it returns a value. It makes me think that the final result of question() is the 'return value' of "call" (actually it's not :) ). So the question here is which one came first? The return of 'question' or the return of 'call'? Or I have a wrong question here, it doesn't mean the order of return?
Hmm... I think from the previous replies I've given you should have your answer. I understand these things are difficult to understand at first, but at this point I would suggest checking out a resource that can explain it better than me and in more detail.
Generally recommended resources are:
Good luck and keep on learning :)