<div>function aaa()</div> <div>{</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>var asdf = "1234";</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>var s = eval("asdf");</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span></div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>alert(s);</div> <div>}</div> <div><br></div> <div>위 와 같은 로직 이 있습니다. </div> <div><br></div> <div>alert 결과는 1234 가 될겁니다. </div> <div><br></div> <div>1. eval 을 안쓰고 "asdf" 라는 문자열을 1234 로 치환 하고 싶습니다. </div> <div>var s = asdf; 라고 쓰면 되지만 asdf 는 문자열 형태라고 가정 합니다. </div> <div><br></div> <div>var s = 'asdf'; 위와 같이 사용하면 alert 경과는 asdf 로 됩니다. </div> <div><br></div> <div><br></div> <div>이런경우 eval 함수를 안쓰고 1234 를 얻어 올수 있을 까요? </div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.