Why the first approach is not working ?
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>append method</title> </head> <style></style> <body> <div> <ul id="listclass"> <li class="list">xyz</li> <li class="list">xyz</li> <li class="list">xyz</li> </ul> </div> <script> // approach 1 // const i = document.getElementById("listclass").innerHTML; // i += `<li>abc</li>`; // approach 2 const i = document.getElementById("listclass"); i.innerHTML += `<li>abc</li>`; </script> </body> </html> what is the difference between the two approaches ? I am getting the following error if i run the first approach. append.html:20 Uncaught TypeError: Assignment to constant variable. at append.html:20:11