I am trying to figure out how to hide the last 12 numbers on price in the button, as it is way to long.
I am using a JSON api, and insertAjacentHTML markup.
This is the code.
`
<script>
fetch('https://free-api.vestige.fi/asset/467518794/price')
.then(res => {
console.log(res);
return res.json();
})
.then(data => {
console.log(data.price);
const markup = `<a>${data.price}</a>`;
document.querySelector('button').insertAdjacentHTML('beforeEnd', markup);
})
.catch(error => console.log(error));
</script>
`
I tried a couple of different methods, but I am just not too great with json and javascript together.