DEV Community

Cover image for why export default not accepting in const
Gobinath Varatharajan
Gobinath Varatharajan

Posted on

why export default not accepting in const

Uncovered part to javascript 1

const is a javascript keyword for decalring variable,
const a = 3
you can declare multiple vatiable in const like

const a = 4;
      b = 9;
Enter fullscreen mode Exit fullscreen mode

This work well but when you used export and default javascript does not support export and default together.

If you want to assign export in const you need to do the fellowing.

export const = [
name: 'jim',
work: 'FBI'
]
Enter fullscreen mode Exit fullscreen mode

Bonus: when you writing json last value and array should not end with ,.

If you want to use export and default in javascript means then you should used

function sum(a, b) {
return a + b;
}

javascript throw error when you write the export default in const.

Happy Learning

Top comments (0)

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay