javascript variable declaration error
<script> var test1="hello"; console.log(test1 + test2); var test2="world"; </script> I thought this code will give error "test2 is not defined" because till second line var test2 was not defined but when i run i surprised it outputs without any error on console "helloundefined"; can someone explain please;