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 is this programming style not used?

My website contains many sections. I tried so far to put variables and functions for each sections in block scope. Why isn't this programming style used anywhere? Why does no one use global block scopes in the main JavaScript file?

What I mean:

// Global Functions //

  ...

// End Global Functions //

// Scroll Scope //
{
   ...
}
// End Scroll Scope //

// Change Theme Scope //
{
   ...
}
// End Toggle Menu Scope //

// Filter Gallery Scope //
{
  ...
}
// End Filter Scope //
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think this style is not used, because the best practice is to split up code into small functions/classes/methods anyway. This way, the variable count in each scope is reduced without using scoping blocks.

Unlike other languages, like Rust, where scoping has immediate consequences on memory allocation, I don't see a huge benefit in JavaScript to declare scopes.

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!