1

I come from world of java but have been working in nodejs + angularjs for my current project. I have some "key Strings" which are frequently used at many places both in client and server side.

In java it is practice to declare all key strings as final variables and use through the final variables so as to avoid typing mistake while using them. Is there any similar concept in javascript?

public static final String KEY_WORD = "frequently used string"    
public static final String KEY_WORD2 = "another frequently used string"
raju
  • 4,752
  • 11
  • 56
  • 110

1 Answers1

3

ECMAScript 6 introduces constants though the const keyword, but browser support is limited.

const KEY_WORD =  "frequently used word";
Quentin
  • 800,325
  • 104
  • 1,079
  • 1,205