Help! Dont understand how to get my external javascript to function
I am trying to use the length property of the array to loop through all the selected elements. basically run through and change all <p> tag content to "Hi there". I don't understand how to make the JavaScript work externally. ..................."NewDemo.html".............................. <!DOCTYPE html> <html> <head> <title>External javaScript</title> </head> <body> <p>hey</p> <p>hi</p> <p>hello</p> <script src="NewDemo.js"> </script> </body> </html> ...................................External JavaScript.................................... ................."NewDemo.js"............................. var arr = document.getElementsByTagName("p"); for(var x=0;x<arr.length;x++){ arr[x].innerHTML = "Hi there"; }