Thanks so much for this guide. Very helpful for a beginner like I.
I have a few questions though.
I found wording is a bit confusing in the last 2 code snippets. You are converting a function named brag to an anonymous function yet from the code it looks like the function was anonymous to begin with.
And the one that I'm more curious about, is there a way to do the same conversion but using an arrow function syntax instead? I tried it and keep getting the SyntaxError: missing ) after argument list
// Arrow function works okvarbrag=(count)=>{return ("Arrow: I can do "+count+" pushups")}console.log(brag (30))// Arrow: I can do 30 pushups// Embedded into console.log failsconsole.log((count)=>{return ("Arrow: I can do "+count+" pushups")}(30))//SyntaxError: missing ) after argument list
The way I understand things is in relation to other things: Analogy: what can it be compared to? Absence: what would we have to do without it? Example: how does it work?
@mail2lawi You are 100% correct! I meant to write a named function, but I wrote an anonymous function instead. I have now corrected it, thanks you you!
Thanks so much for this guide. Very helpful for a beginner like I.
I have a few questions though.
I found wording is a bit confusing in the last 2 code snippets. You are converting a function named brag to an anonymous function yet from the code it looks like the function was anonymous to begin with.
And the one that I'm more curious about, is there a way to do the same conversion but using an arrow function syntax instead? I tried it and keep getting the
SyntaxError: missing ) after argument list
Is there a rule against this kind of convention?
@mail2lawi You are 100% correct! I meant to write a named function, but I wrote an anonymous function instead. I have now corrected it, thanks you you!
here the IIFE syntax is incorrect, i.e. the round brackets around the arrow function are missing