Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda