JS::함수
by Kim Ara
JavaScript
/* 익명 함수 */
// 변수를 생성합니다.
var a = function(){
var output = prompt('숫자를 입력해주세요.', '숫자');
document.write( output );
};
// 출력합니다.
document.write(a); //문자열처럼 보이지만 함수 자료형이다.
document.write( typeof(a)); //function
/////////////////////////////////////////////////////////////////////////////////////
// 함수 호출
var b = function(){
var output = prompt('숫자를 입력하세요', '숫자');
document.write(output);
};
// 함수를 호출합니다.
b();
/////////////////////////////////////////////////////////////////////////////////////