basicFunctions.js Uncaught TypeError


One of my app users has been using my native app (Android) for a few months.
Today when they went to use it, they got an Uncaught TypeError as below:

What can cause this?


That’s inside a call to the Mid() function. My guess is that you are passing an undefined value to it (or a function which calls it).

Thanks, i need to do some digging.

Also, is it an issue to use the Mid() function if my language is set to javascript, but the Basic library is included?

So long as the BASIC library is included, you can use the BASIC functions in JavaScript code.

As far as I can remember correctly there always were errors when I converted Basic code to JavaScript and when there were string functions like e.g. Left(… I replaced these former Basic functions with the equivalent JavaScript functions and turned the inclusion of BASIC library off. Everything worked fine afterwards.

I’ve had these errors and always found it to be in the data, either undefined or null. I’m not sure if uninstalling the app will help because the localStorage or SQL data on the device may not be removed containing this data. And if the data is from a server, again uninstall won’t help. I’ve gone so far as to use localStorage.clear to start with a clean slate. I would suggest you try to reproduce the error on your computer by creating as much null or undefined data as you can to see what happens. Note that with this type of ‘substr’ error the Console won’t point a code line in the app since it is a general routine that caused the error. As suggested, mid, left, trim come to mind as possible culprits.


Thanks for your replies.
I use SQL but not localStorage, and i do a call to get data from my server but that happens after the error shows.
I’ll break it down and see where these are used at the start.
Thanks for your suggestions.