Getting data out of object variable

when i execute this function

const stronaDyskusji = "Some_mediawiki_discussion_page_name";

async function sekcje() {
    var zwrot;
    const params = {
        action: "parse",
        page: stronaDyskusji,
        prop: "sections",
    };
    const api = new mw.Api();

    await api.get(params).done((data) => {
        zwrot = data.parse["sections"];
    });
    return zwrot;
}


var PIT = sekcje()
console.log(PIT)

the console logs this kind of object.
Is there any way to get this array out of this [[PromiseResoult]]: to for example other variable?

132 thoughts on “Getting data out of object variable”

Leave a Comment