codesandbox-client icon indicating copy to clipboard operation
codesandbox-client copied to clipboard

Lets and consts are initialised before declaration

Open aditya2337 opened this issue 5 years ago • 4 comments

🐛 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

aditya2337 avatar Jan 24 '21 13:01 aditya2337

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.

github-actions[bot] avatar Apr 25 '21 00:04 github-actions[bot]

Cuz nobody cares 😢

aditya2337 avatar May 05 '21 14:05 aditya2337

@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: Screen Shot 2021-05-05 at 16 42 28

DeMoorJasper avatar May 05 '21 14:05 DeMoorJasper

@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 🤗

aditya2337 avatar May 05 '21 16:05 aditya2337