> For the complete documentation index, see [llms.txt](https://hemantajax-2.gitbook.io/es6-in-depth/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hemantajax-2.gitbook.io/es6-in-depth/block-scope/let-const-usecases.md).

# Use cases

## Use case 1

```javascript
// Before
(function(){
    let x = 10; // x not available outside
})();

// Now
{
    let x = 10; // x not available outside 
}
```

## Use Case 2

```javascript
for(let i=0; i<10; i++){
    setTimeout(function(){
        console.log("number " + i);
    }, 1000);
}
```
