I just spent a long time figuring out that I shouldn\'t use clear() as the name of a function in Javascript:
Good question. I think the problem is a scoping issue - your onClick="clear()" is not going to the clear function you defined, but I'm not sure where it's going. Changing it to window.clear() or a new function that simply calls your clear works.
onClick="clear()"
clear
window.clear()
Hello!!!! Shoo! window.clear! clear2! Add a few elements Check the array Results will appear here.
Results will appear here.