Am Unable to Get Data from a Function ;

@muthu

Perhaps this one?

var details = []

$w.onReady(async function () {
 await getName()
    console.log(details[0]);
    console.log(details[1]);
});


function getName() {
    $w("#productPage").getProduct()
    .then((product) =>{
 let productName = product.name;
 let productPrice = product.price;
        details = [productName, productPrice];
    })
    .catch((error)=>{
        console.log(error);
    })
}