I'm not sure I grasp your question fully, but const is a way of declaring a variable. The reason I prefer it to var is because it offers a more reliable mechanism for instantiating variables. When a variable does not need to be reassigned within the scope it is defined in, a const variable is always preferred. Using const, you avoid common trap doors like accidental global variables, naming conflicts, and the like. Does this answer your question?
Thanks! I'm glad you liked it.
I'm not sure I grasp your question fully, but
const
is a way of declaring a variable. The reason I prefer it tovar
is because it offers a more reliable mechanism for instantiating variables. When a variable does not need to be reassigned within the scope it is defined in, aconst
variable is always preferred. Usingconst
, you avoid common trap doors like accidental global variables, naming conflicts, and the like. Does this answer your question?Ah, so it is more for explicitly defining what it does than it is for memory management.