Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
Const variable issue in function in Safari

I was investigating one problem where content of web page is not getting loaded in Safari, on further investigation it was found that it is because of variable scope (const vs var).

if (1 == 1) {
  const a = 1;

  function f() {
    console.log(a);
  }
  f();
}

Error:

Can't find variable: a

With variable type as const was getting error in Safari browser and all browser in Iphone, And it was working in all other browser except Safari on desktop.

After changing it to var it has solved the issue. But still not able to find the justification why with const it was not working in Safari.

What is correct behaviour for const?

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda