Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread function Length returns NaN for a string returned from a Javascript function
Wed, Oct 24 2018 12:11 PMPermanent Link

Jose Verger

Cybernav

Avatar

Hello,  I have a strange issue with a String result returned from a JavaScript function.  Using LogOutput I can see that the value is (29.519366883,-100.79244877)   but if I try to obtain the Length of such string the function Length returns NaN, and each character of the string returns Undefined, how is it possible ?   What could be wrong ?
Thu, Oct 25 2018 2:45 AMPermanent Link

ooptimum

Hello,

Are you sure it's a string value? Put this definition somewhere in the interface section of your unit:

external function typeof(o: variant): string;

and pass your presumably string value to it, like:

LogOutput(typeof(myvar));

So this might be able to shed some light.
Thu, Oct 25 2018 12:41 PMPermanent Link

Jose Verger

Cybernav

Avatar

Hello ooptimum,

Your comment has been very helpful, as the solution was looking for the type of result returned.

The result was taken from the latLng of occurrence of a google maps event, and instead of returning Event.latLng  the correct parameter has to be: Event.latLng.toString()    to ensure the type returned.

Thanks
Thu, Oct 25 2018 1:15 PMPermanent Link

ooptimum

Glad to help you.

Cybernav wrote:

Hello ooptimum,

Your comment has been very helpful, as the solution was looking for the type of result returned.

The result was taken from the latLng of occurrence of a google maps event, and instead of returning Event.latLng  the correct parameter has to be: Event.latLng.toString()    to ensure the type returned.

Thanks
Image