Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

52
Vistas
Is it bad to put all of the javascript code into a block scope?

I am making a website,and i don't want users to execute functions in the script from the javascript console.I figured out i can put all of the code into a block scope and declare everything with let.Is this bad practice?

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It's normal to want to limit the scope of any symbol (variable, function) to prevent unintended use. What you make global or as part of module exports is the 'published interface', anything else is likely to be private.

Immediately-invoked function expressions (IIFE) are a typical way to achieve this.

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos