Fix output of sample code (#28971)
sample code to avoid using shared or mutable state has output commented as 2 while it should be 1.
This commit is contained in:
committed by
Randell Dawson
parent
36d1a7d369
commit
ef625c80c6
@ -55,7 +55,7 @@ Using parameters creates function-specific scope.
|
|||||||
function double(number) {
|
function double(number) {
|
||||||
return number * 2;
|
return number * 2;
|
||||||
}
|
}
|
||||||
console.log(count(1)); // 2
|
console.log(count(1)); // 1
|
||||||
console.log(double(1)); // 2
|
console.log(double(1)); // 2
|
||||||
```
|
```
|
||||||
Using shared, global variables means that changes might be unpredictable, especially when variables are shared between multiple files.
|
Using shared, global variables means that changes might be unpredictable, especially when variables are shared between multiple files.
|
||||||
|
Reference in New Issue
Block a user