JS::리턴값

by Kim Ara

JavaScript

// 함수를 생성합니다.

function returnFunction() {
	document.write('문장 A');  
  return;  // 문장 A
  document.write('문장 B');
}

// 함수를 호출합니다.
returnFunction();



// 함수를 생성합니다.
function returnFunction() {
  return;  // undefined
	document.write('문장 A');  
  document.write('문장 B');
}

// 함수를 호출합니다.
returnFunction();



// 함수를 생성합니다.
function returnFunction() {
	document.write('문장 A');  
  document.write('문장 B');
  return;  // 문장 A문장 B
}

// 함수를 호출합니다.
returnFunction();