As someone who doesn't really use JavaScript much, what was wrong with the function declaration form and why are the rest needed? I learned JS before the newer ways existed and never really kept up.
They are handled differently by the compiler when it comes to where the function is scoped in memory. Variables are treated like other variables rather than globally like a traditional function.
A series of short gasps were heard, and the room fell silent as all eyes turned to /u/SparserLogic. Did they really know JavaScript, or are they an undercover desktop C programmer person trying to infiltrate the sub?
38
u/damnNamesAreTaken Apr 14 '24
As someone who doesn't really use JavaScript much, what was wrong with the function declaration form and why are the rest needed? I learned JS before the newer ways existed and never really kept up.