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

317
Visualizações
Return value of nested function to main function in JS undefined problem
chrome.storage.local.set({list : 'list1'});

function get_list() {

  function x() {
    chrome.storage.local.get(['list'], function (res) {
      return res.list;
    });
  }

  return x() ;

}

alert(get_list());

I have read this .But I didn't find any solution

It works very well if I don't use chrome.storage.local.get function in another function .I am used to write code in PHP that's why I am a bit confusing .Why it returns undefined ? Is it something they call "callback hell" ? Actually I created x function for returning response but then realized I created one function again ,I need to return nested function answer to function answer and then call it . Thanks in advance

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