Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Why can let declare variables repeatedly?

Why can let declare variables repeatedly in the browser console?

I remember that I would have reported an error before. Is 21-year chrome based on that ECMA-specification?

let a=1
undefined

let a=12
undefined

navigator.userAgent
'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chro
me/93.0.4577.82 Safari/537.36'

Here's a screenshot:

enter image description here

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The console environment has a number of odd quirks. It's not like a standard <script> tag on the page.

One of the quirks is these. The way it used to be in Chrome was, re-declarations of variables with let was not permitted - you'd get the expected error that the re-declaration is invalid syntax. But as of Chrome 80 or so (spring 2020), it was changed to be permitted.

You still can't re-declare variables with let in a standard <script>, of course:

let foo = 5;
let foo = 10;

about 4 years ago · Juan Pablo Isaza Report

0

You cannot redeclare a variable previously declared with let in strict mode. Please see: What's the difference between using "let" and "var"?.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!