I recently installed an external npm called consulta-dolar-venezuela (just in case, here is the read-me)
It’s getting very difficult for me to find what to do with that, but I know I need that npm (in short: it gets the cost in my currency of the cost of the USD, since in my country there is hyperinflation, the price changes every moment).
I don’t know if a file has to be created in the backend or similar, but if I write the example code on a normal frontend page, in the console it gives me all the results from different sources, but if I clean a little the search gives me exactly the value I’m looking for:
const { getMonitor } = require("consulta-dolar-venezuela");
getMonitor("bcv", "price").then($ => { console.log($) }) //36.12
How can I use that value for an element in the page? I have made several attempts but ended up in dead ends, if I add more code to try to use that value, the line gives me the correct value in the console for today which is 36.12
But the text element page doesn’t show it, instead on the web it says NaN and in the console it says Promise<>, no idea why, please help me?
const { getMonitor } = require("consulta-dolar-venezuela");
getMonitor("bcv", "price").then($ => { console.log($) }) //= result;
let dolarForText = getMonitor("bcv", "price")
console.log(dolarForText); // console says Promise<> and not the price
const planA = 6
const resultPlanA = (planA * dolarForText).toFixed(2);
$w('#yesText').text = resultPlanA.toString(); //text says NaN