Tengo dificultades para seleccionar el precio_cambio de esta matriz.
Intenté así pero no funciona:
response.data[0].[1d].price_change¡Cualquier ayuda es apreciada!
var stockDiff = document.getElementById("stockDiffCrypto"); var thePrice = response.data[0].["1d"].price_change; if (thePrice > 0) { stockDiff.innerHTML = `<i class='fas fa-angle-double-up'></i>` stockDiff.style.color = "green" } else { stockDiff.innerHTML = `<i class='fas fa-angle-double-down'></i>` stockDiff.style.color = "red" }variable.["property"] no es una sintaxis válida. Estos 2 son válidos:
variable.property variable["property"]Esto es lo mismo con las matrices
array[0][0]en tu caso deberia ser este
var thePrice = response.data[0]["1d"].price_change