Could someone take a look at this and help me out? I've been working on it for a little while now and can't figure out what I'm missing.
I'm trying to set the inner HTML of a DOM element based upon the presence of a code within the message value of this response object
{
error: "{\"code\":-1121,\"msg\":\"Invalid symbol.\"}"
message: "400 - \"{\\\"code\\\":-1121,\\\"msg\\\":\\\"Invalid symbol.\\\"}\""
name: "StatusCodeError"
statusCode: 400
}
const data = await res.json();
if (data.statusCode == 400) {
let parsedData = data.toString();
if (parsedData.includes('1121')) {
statusMessage.className = 'alert alert-danger text-center err-message';
statusMessage.innerHTML = 'Invalid symbol.'
}
}