Without context answering these questions are not really a good fit for Stackoverflow, but here are some answers.
Without the context of what frameworks you are using, yes finding an element with
document.getElementById() and then updating it’s content with
.innerHTML is probably the simiplest way forward
This question is totally unanswerable with out any context for what you are actually working with. The
.push() method is how you append an item to an existing array.
A few questions and I apologise if they seem unprofessional, I am a beginner programmer. But I would really appreciate any and all help you’d provide!
Currently, I have used an MQTT program to receive messages over websockets. I can view my message in the console.log but I would like to ask how can I convert it to the html output messages. is it by document.getElementById ? or is there a more better way to do that?
What is the benefit of using JSON for the messages?
What is the purpose of using variable.push(entry.anothervariable) is the push entry better and perhaps I should use an array to store the messages and then push them out?
As I said in my answer we have absolutely no context for these questions, we can only guess. You need to include a LOT more information in your questions.