Unconvertable code component

JavaScript’s built in Math library doesn’t seem to have a ones() function. I suspect you’ve come across that function in the 3rd party math.js package:

I don’t know enough about JavaScript to advise whether or how you could install that library and access its functions from your script, but this thread might be useful: