본문 바로가기
Nexacro/예제

[Nexacro] String을 Object로 바꾸는 방법 (eval / this.components)

by bjgu97 2021. 11. 24.
반응형

*** eval 함수는 어떤 코드라도 무조건 실행하기 떄문에 보안 위배 문제가 있음.

 

eval 사용 <- 권장 X

var sGridID = this.grid.name;
sGridId = eval("this." + sGridID);

 

this.components 사용 <- 권장 O

var sGridID = this.grid.name;
var objGrid = this.componetns[sGridID];

    -> this.components에 넣었으면 object로 바뀐다.

댓글