Q: 1
A developer has an ErrorHandler module that contains multiple functions.
What kind of export should be leveraged so that multiple functions can be used?
Options
Discussion
B . Only named exports let you explicitly export and import multiple functions from a module. Default (D) is just for a single value, not for several top-level functions. Saw similar wording in practice tests too. Some people get tripped up thinking default can do this, but not in this context.
B tbh
Wouldn't named exports (B) be the expected way here since the question is about accessing multiple separate functions, not just one object or value as with default export?
Maybe D, since default export could handle exporting a main object with functions. Not 100 percent though, anyone else think so?
A is wrong, B. Named exports let you pull multiple functions directly without bundling into an object. Pretty sure that's what the question wants since default is just one per file. Correct me if I missed something.
B fits here. Named exports let you export several functions by their own names, which is what the question wants. Saw similar in practice sets, pretty sure that's their intent but chime in if you see it differently.
D or B. You can technically use a default export with an object to group all the functions, then just import that object. I remember seeing this in some official guide examples. But named exports (B) are more common for multiple separate functions. Not totally sure here, anyone else read the question as supporting D?
D , I encountered exactly similar question in my exam and default export with an object lets you include multiple functions.
D , trap is B but default export with an object works too.
D , since you can default export an object holding all the functions and then import them as properties. It works, even if it's not the "standard" ES6 way. Open to other takes here if I'm off.
Be respectful. No spam.