JSFiddle - React, Tailwind, and code Playground
JavaScript
// 함수 선언식과 표현식에 따른 호이스팅
// 에러 예외처리
try {
hello1();
}catch(e) {
console.log(hello1);
}
try {
hello2();
}catch(e) {
console.log(hello2);
}
// hello1 - 리터럴 방식(함수 표현식)으로 선언
var hello1 = function() {
alert('안녕하세요');
};
// hello2 - 함수 선언식으로 선언
function hello2() {
alert('hello~!');
}