The Crockford’s subset does not include which function in JavaScript?
a) eval()
b) coeval()
c) equal()
d) equivalent()
Explanation: The Crockford’s subset does not include the with and continue statements or the eval() function. It defines functions using function definition expressions only and does not include the function definition statement.
What does javascript use instead of == and !=?
a) It uses bitwise checking
b) It uses === and !== instead
c) It uses equals() and notequals() instead
d) It uses equalto()
Explanation: The subset does not include the comma operator, the bitwise operators, or the ++ and — operators. It also disallows == and != because of the type conversion they perform, requiring use of === and !== instead.
What is being imposed on each subset to ensure that it conforms to the subset?
a) A parser to parse the code
b) A parser that parses and adds to the subset
c) A static verifier that parses code
d) A predefined function to parse the code
Explanation: Each subset is coupled with a static verifier that parses code to ensure that it conforms to the subset.
Why was “The Good Parts” designed as a language subset in JavaScript?
a) To improve programmer flexibility
b) To balance the workload of the programmer
c) To create an in-built compiler and interpreter
d) To improve programmer productivity
Explanation: The Good Parts is a language subset designed for aesthetic reasons and with a desire to improve programmer productivity. There is a larger class of subsets that have been designed for the purpose of safely running untrusted JavaScript in a secure container or “sandbox”.
Which is the subset that is a secure container designed for the purpose of safely running untrusted JavaScript?
a) Sandbox
b) The Good Parts
c) Both Sandbox and Good Parts
d) Web browser
Explanation: There is a larger class of subsets that have been designed for the purpose of safely running untrusted JavaScript in a secure container or “sandbox”.
Why is this keyword not preferred in JavaScript?
a) Highly memory consuming
b) Functions should access the global objects
c) Functions should not access the global objects
d) Very inefficient to use
Explanation: The this keyword is forbidden or restricted because functions (in non-strict mode) can access the global object through this. Preventing access to the global object is one of the key purposes of any sandboxing system.