Reflect API 👌 Simple words about the complex theory

added by JavaScript Kicks
10/15/2019 9:16:16 AM

303 Views

Reflect API is more convenient for error handling. For example, everyone knows the instruction: Object.defineProperty ( obj, name, desc ) In case of failure, an exception will be thrown. try { Object.defineProperty( obj, name, desc ); // property defined successfully } catch (e) { // possible failure and might accidentally catch the wrong exception } Reflect always returns the boolean value.


0 comments