xxxxxxxxxx
const fetch = require('node-fetch'); // Make sure to install the 'node-fetch' package if you haven't already
const cryptoSymbol = "bitcoin";
async function getCryptoPrice() {
try {
const response = await fetch(`https://api.coingecko.com/api/v3/simple/price?ids=${cryptoSymbol}&vs_currencies=usd`);
const data = await response.json();
const priceUsd = data[cryptoSymbol].usd;
console.log(`The current price of ${cryptoSymbol} is $${priceUsd}`);
} catch (error) {
console.error("Error fetching cryptocurrency price:", error);
}
}
getCryptoPrice();
xxxxxxxxxx
$("#Input_Id").change(function(){ // 1st way
// do your code here
// Use this when your element is already rendered
});
$("#Input_Id").on('change', function(){ // 2nd way
// do your code here
// This will specifically call onChange of your element
});
$("body").on('change', '#Input_Id', function(){ // 3rd way
// do your code here
// It will filter the element "Input_Id" from the "body" and apply "onChange effect" on it
});
xxxxxxxxxx
function(){
var items = [];
{{DLV - Ecommerce Object}}.click.map(function(arrayitem){
var itemObj = {};
itemObj.item_name = arrayitem.name;
})
return items
}