|
|
|
|
|
by bmeck
4039 days ago
|
|
const can be used to denote that a reference to the variable is being passed around and should not change for the lifetime of a scope. function f() {
const queue = [];
consumer(queue);
return queue;
}
It could be important to note that removing const has benign effect, but that it is there to ensure a programmer does not change the value of queue between `consumer(queue)` and `return queue`. Easily reasoned about, but extra safeguards from introducing bugs is always nice. |
|