Ian Pierce
Sep 2, 2018 · 1 min read

Great explanation! Once I understood that exports and module.exports refer to the same Object this became crystal clear.

So the only way to fall into this trap is if you re-assign exports like demonstrated.

exports = {  
divide(a,b) { return a/b }
}

Otherwise you can use the two interchangeably.

I’m not sure why you’d ever re-assign exports. Maybe someone else can explain.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade