Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JavaScript の厳格モードでは、eval 関数の使用が禁止されています。ただし、それなしで動的コードのロード/生成を実装する方法がわかりません。このための新しい API はありますか? 代替手段は何ですか?
それは非常に簡単です: Strict モードは eval を禁止しません。eval の動的スコープを無効にするだけです:
var x; function y(k) { eval(k); x = 4; //Under strict mode, this always references the outer x }