javascript-tutorial / en.javascript.info

Modern JavaScript Tutorial
https://javascript.info
Other
23.13k stars 3.84k forks source link

fix: possible JS error while convert Symbol to number #3646

Open lumosmind opened 6 months ago

lumosmind commented 6 months ago

in the solution, prop can be string or Symbol.

while prop is a symbol; prop < 0
causes JS Error. "Error: Cannot convert a Symbol value to a number" And Reflect.set never executed to handle Symbol prop.