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)