0

I need to be able to convert a VBArray to a JavaScript Array using a Chromium JavaScript engine. This means the old IE method of var javascriptArray = new VBArray(input).toArray(); will not work. What would be alternatives to this?

In other words, is there a way to change a SafeArrays into a JavaScript array in newer versions of JavaScript on Edge?

clong
  • 1
  • 4
  • I do not believe there is a direct equivalent. You could create an object which behaves like that, or [use an array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)? – evolutionxbox Jul 13 '22 at 17:42
  • I've had issues trying both objects and arrays. Javascript seems to have difficulty reading the data present. Even the typeof returns "unknown". – clong Jul 13 '22 at 18:03
  • Reading what data? – evolutionxbox Jul 13 '22 at 18:07
  • I cannot set it to an Object or Array, iterate through it, or detect it's type. My code knows an object is there, but throws Type mismatch when I try to perform operations on it. – clong Jul 13 '22 at 18:09
  • What is a SafeArray when it comes to JavaScript? I don't think newer JS engines have any concept of a SafeArray – evolutionxbox Jul 18 '22 at 13:23
  • That's the issue I'm facing. JS detects the existence of an object, but doesn't have any methods to deal with it. – clong Jul 18 '22 at 18:51
  • May you provide a text-based [mcve]? – evolutionxbox Jul 19 '22 at 08:21
  • I am receiving a SafeArray from an internal object created by our development team. I am unsure how to put an example other than how I handle it. Using JScript on IE, to obtain a JavaScript Array from a SafeArray, you can use var jsArray = new VBArray(input).toArray(); – clong Jul 20 '22 at 13:08

0 Answers0