I am trying with JavaScript to do what I have done with jQuery for error handling for an API response.
I wrote this piece of code in jQuery that does what I want it to (different project):
var response = e.responseJSON;
$.each(response.errors, function(index, value){
var div = $("#error_" + index);
div.html(value[0]).addClass('error');
});
Then I tried to convert the code to JavaScript instead of jQuery, but I seem to be having issues with the object like array conversion to an array. For an e.forEach loop.
The code I currently have is this:
.catch(function(response){
let e = Object.values(response.response.data)
let data = Array.from(e[1])
console.log(e)
console.log(data)
});
When I log data it returns an empty array. While logging e returns the object like array.
I guess what I am looking for is, what am I doing wrong and is there a better way of going about what I am trying to achieve?

reponse.errors, while the second gets the first element ofresponse.response.data, and then converts that value to an array. Completely different, unrelated things.