简体   繁体   中英

Object.defineProperty is not a function

I'm trying to execute JS code from ABAP and I'm getting the following error:

Object.defineProperty is not a function.

My code:

Object.defineProperty(object, sProperty, vValue)

I want to redefine the funcion to be supported, any advice?

Note that there's a nasty Chrome error bug.

This code:

Object.defineProperty({},'asd',{})()

..on Chrome throws:

Uncaught TypeError: Object.defineProperty(...) is not a function at :1:35

..but it should say that its the returned object of Object.defineProperty that is not a function.


For your case, it most probably mean that you are doing () (a function call) on the returned value of Object.defineProperty . And to fix it, the first return value of defineProperty must be a function, which means the first arg must be a function.

Short answer:

Upgrade.

The answer you want:

Use a polyfill. Object.defineProperty polyfill

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM