Dev/HTML, CSS, Javascript

[Javascript] 함수 자신의 코드 얻기

공대나왔음 2018. 1. 15. 07:59

Code Snippet

function func() {
	// Get function code text
	var thisFuncText = arguments.callee.toString();

	// Print out function code
	console.log(thisFuncText);
}

// Function call
func();

Console Out

function func() {
	// Get function code text
	var thisFuncText = arguments.callee.toString();

	// Print out function code
	console.log(thisFuncText);
}