I wonder what is the difference between creating HTML by innerHTML and document.createElement?
For example, I want to create a new DIV inside of parent DIV.
Let's assume parent DIV has no content.
One option is parent.innerHTML = '<div></div>';
Another option is parent.append(document.createElement('div'));
I was asked this during an interview.
Personally, I think that creating an HTML object gives us the flexibility to add more elements later on compared to using innerHTML.
Wondering if there is a better reason.