Variable being assigned within google chrome method not keeping its value

I am assigning the variable ‘responseData’ to the value of a variable in chrome local storage. When I console.log the value of response data right after assigning it, it prints out the value perfectly fine, however, if i do the exact same console.log statement a couple lines below it it says the value is undefined?

The JS code:

 else if( request.message === "fetch-local-storage" ){ //popup is reopening and fetching data cached in local storage
    console.log('Booting up popup....');
    var responseData;'localSearchList', function(query){
        responseData = query.localSearchList;
        console.log("responseData within conditional: " + JSON.stringify(responseData));
    }); //fetch the local storage data 

    console.log("Actual value being sent out:" + JSON.stringify(responseData));

    sendResponse({message: "local-storage-data", data: JSON.stringify(responseData)}); //send it as a JSON-ifiable object

Console.log output:

Booting up popup....
Actual output of content.js:undefined
responseData within conditional: "[{"word":"q","color":"rgb(0,128,0)","id":"0"}]"

Does this have to do with synchronality of the ‘get’ method, where sendResponse is executing before the get can finish so its left undefined?