0

Declaring Global Constants in JavaScript.

How do we declare constants globally in JS? For var, we could do: var a; const func = () => { a = 10; } We can't do that with const.. it has to be initialized when it is declared. How to make it global scope inside a function? This gives an error with 'use strict': const func = () => { a = 10; }

3rd Aug 2020, 11:36 AM
Arnesh
Arnesh - avatar
1 Answer
0
Martin Taylor , the function wasn't what I was talking of.. It is just putting the a in it.
4th Aug 2020, 8:24 AM
Arnesh
Arnesh - avatar