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

315
Views
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
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!