Vidyalelo
JavaScript · Q45

Classes And Modules

Programming · JavaScript · question 45

Q45

Which are the two functions that are not allowed in any secure subset?

A.
evaluate() and restrict()
B.
eval() and the Function() constructor
Answer
C.
debugger() and test()
D.
eval() and debugger()

Answer: Option B

Solution

Answer: Option B
Solution:
eval() and the Function() constructor are not allowed in any secure subset because they allow the execution of arbitrary strings of code, and these strings cannot be statically analyzed.