Constants : Uppercase constants

Uppercase constants

Such constants are named using capital letters and underscores.

Onst COLOR_RED = "#F00";
const COLOR_GREEN = "#0F0";
const COLOR_BLUE = "#00F";
const COLOR_ORANGE = "#FF7F00";

// ...when we need to pick a color
let color = COLOR_ORANGE;
alert(color); // #FF7F00

There is a widespread practice to use constants as aliases for difficult-to-remember values that are known prior to execution.

Related concepts

Uppercase constants

Constants : Uppercase constants — Structure map

Clickable & Draggable!

Constants : Uppercase constants — Related pages: