I have a JSON packet, which has an object, which then has an array. I want to loop over that, in standard JS this would be easy enough, how do I go about achieving it here?
I’m using FetchJson which returns an Observerable object, so I’m accessing it via “value”, I don’t know if this is correct.
for (var i = 1; i<data.value.heroes.length; i++) { debug_log(i); }
The error is a type error, “undefined cannot be converted into an object”
FetchJson is asynchronous, so the value will not be available immediately. It is only meant for reactive programming, with operators such as .map() and then databinding the result.
If the result is not databound, the fetch will not be performed.
If you want to write imparative code in response to a HTTP request in Fuse, you can do it the “standard JS” way, with XMLHttpRequest instead