Lets and consts are initialised before declaration
🐛 bug report
Preflight Checklist
- [x] I have read the Contributing Guidelines for this project.
- [x] I agree to follow the Code of Conduct that this project adheres to.
- [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.
Description of the problem
Lets and consts are initialized before the declaration in vanilla JS.
How has this issue affected you? What are you trying to accomplish?
This invalidates the logic of a "const" it can be in 2 types now (undefined and any other type), which is not allowed in any other js platform. This is a different behaviour which shouldn't exist.
To Reproduce
console.log(typeof x);
const x = "";
console.log(typeof x);
Link to sandbox: https://codesandbox.io/s/weird-js-q4fyp?file=/src/index.js
Your Environment
Vanilla JS
| Software | Name/Version |
|---|---|
| Сodesandbox | Vanilla JS |
| Browser | Chrome |
| Operating System | MacOs |
This issue has automatically been marked stale because there has been no activity in a while. Please leave a comment if the issue has not been resolved, or if it is not stale for any other reason. After 2 weeks, this issue will automatically be closed, unless a comment is made or the stale label is removed.
Cuz nobody cares 😢
@aditya2337 sorry for the late reply. I've just looked into this and it does appear to be a bug, don't have time today to look into this. But if it still blocking you in some way I can have a look at it tomorrow, also please reopen this issue in that case.
For future reference, this is the behaviour in chrome console:

@DeMoorJasper thanks for following up, it's not blocking me in any ways, just that while trying to understand JavaScript better I was trying out this in codesandbox, got confused because of the behaviour would be helpful for for someone else trying the same but certainly nothing that can't wait, maybe just keep it in the backlog with low priority 🤗