What can i use in JS as #define in C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What can i use in JS as #define in C?

As #define is used to add constant in C. What can i use in JS instead of this.?

23rd Aug 2018, 4:56 PM
Sourav Kumar Suman
Sourav Kumar Suman - avatar
2 Answers
+ 4
Learn Webassembly, it compiles C codes into browser's assembly codes that could work together with Javascript functions.
24th Aug 2018, 2:43 AM
Calviղ
Calviղ - avatar
+ 2
From what I read in the following article, before ES6 there is no easy and standard way to define a constant, but it all changed with ES6 and its const keyword. However, in other articles I found some mentioned that the const keyword is not cross-browsers feature, can't verify that fact still. https://dzone.com/articles/how-to-create-constants-in-javascript
23rd Aug 2018, 10:11 PM
Ipang