Intermediate
JavaScript
Q76 / 100
What is a JavaScript Proxy handler's set trap used for?
Correct! Well done.
Incorrect.
The correct answer is B) Intercepting property assignment to add validation, logging, or transformation
B
Correct Answer
Intercepting property assignment to add validation, logging, or transformation
Explanation
new Proxy({}, { set(t, k, v) { if (typeof v !== "number") throw TypeError(); return Reflect.set(t, k, v); } }) validates all assignments.
Progress
76/100