let globalMessage = 'hello(global)'; // glabal variable (전역변수)

function printMessage() {
  let message = 'hello(local)'; // local variable (지역변수)

  console.log(message);      // hello(local)
  console.log(globalMessage);// hello(global)

  function printAnother() {
    console.log(message);      
		// -> 자식함수에서 부모함수 변수에 접근 가능

    let childMessage = 'hello'; // local variable (지역변수2)
  }

  console.log(childMessage); // error 
  // -> 부모함수 에서는 자식함수 변수 접근 불가능

  //return undefined; // 평소엔 생략이 되어있다.
}

printMessage();