6

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?

CubeJockey
  • 2,209
  • 8
  • 24
  • 31
ameni
  • 393
  • 2
  • 8
  • 17

2 Answers2

1

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.

Jagger
  • 10,350
  • 9
  • 51
  • 93
Pacerier
  • 86,231
  • 106
  • 366
  • 634
-1

Short answer:

Upgrade.

The answer you want:

Use a polyfill. Object.defineProperty polyfill

Community
  • 1
  • 1
James_1x0
  • 931
  • 10
  • 20