From c581ac7c5b0ba9552a0e34f467c4f62050e0c455 Mon Sep 17 00:00:00 2001 From: DevJo Date: Mon, 13 Dec 2021 19:50:12 +0900 Subject: remove: notranslate in web/javascript/reference/global_objects --- files/ko/web/javascript/reference/global_objects/eval/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/ko/web/javascript/reference/global_objects/eval') diff --git a/files/ko/web/javascript/reference/global_objects/eval/index.html b/files/ko/web/javascript/reference/global_objects/eval/index.html index 52ec8665e2..d599cadbe9 100644 --- a/files/ko/web/javascript/reference/global_objects/eval/index.html +++ b/files/ko/web/javascript/reference/global_objects/eval/index.html @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/eval

구문

-
eval(string)
+
eval(string)

매개변수

@@ -42,19 +42,19 @@ translation_of: Web/JavaScript/Reference/Global_Objects/eval

eval()의 인자가 문자열이 아니면 eval()은 인자를 그대로 반환합니다. 다음 예시에서, String 생성자가 명시된 경우 문자열을 계산하는 대신 String 객체를 반환합니다.

-
eval(new String("2 + 2")); // "2 + 2"를 포함한 String 객체를 반환
+
eval(new String("2 + 2")); // "2 + 2"를 포함한 String 객체를 반환
 eval("2 + 2");             // 4를 반환
 

toString()을 사용하는 일반적인 방식으로 제약을 피할 수 있습니다.

-
var expression = new String("2 + 2");
+
var expression = new String("2 + 2");
 eval(expression.toString());            // 4를 반환
 

eval을 직접 호출하지 않고 참조를 통해 간접적으로 사용한다면 ECMAScript 5부터는 지역 범위가 아니라 전역 범위에서 동작합니다. 예를 들어 eval()로 함수를 선언하면 전역 함수가 되고, 실행되는 코드는 실행되는 위치의 지역 범위에 접근할 수 없습니다.

-
function test() {
+
function test() {
   var x = 2, y = 4;
   console.log(eval('x + y'));  // 직접 호출, 지역 범위 사용, 결과값은 6
   var geval = eval; // eval을 전역 범위로 호출하는 것과 같음
-- 
cgit v1.2.3-54-g00ecf