function myfunc1() { var msg; // 변수를 선언했지만 초기화 하지 않음 if (msg == undefined) { // true alert(msg) // undefined } }
<button type="button" onclick="myfunc1()">test</button>