The previous version re-declared const variable. If you copied the entire sample code (e.g. using the copy button that GitHub adds to the upper right of the code block) into a file, you would get TypeScript errors and runtime errors.
By wrapping each example in a block statement, we avoid the const conflicts so that both snippets can live in the same source.
The previous version re-declared
const
variable. If you copied the entire sample code (e.g. using the copy button that GitHub adds to the upper right of the code block) into a file, you would get TypeScript errors and runtime errors.By wrapping each example in a block statement, we avoid the
const
conflicts so that both snippets can live in the same source.