Javascript string functions in Spark Studio script

in the javascript code farther below at the end of this post (which I’m trying to use as a script in Spark AR), inString is a To Script consumer patch and outString01 is a from script producer patch - when it runs in Spark Studio it fails with a console message saying “Possible Unhandled Promise Rejection: TypeError: inString. charAt is not a function”

If I replace my inString variable with a specific text string (in quotes etc.) then it succeeds at outputting the specific character at the specified index, but somehow it’s not working when I try to do the same thing with the variable…

I have not done scripting in Spark AR very often so I’m hoping I’m just making some kind of basic mistake or missing something. To see a 2 minute screen record video with voiceover for clearer context and illustration take a look here… javascript string functions in Spark Studio script on Vimeo

The basic idea is that I want to be able to type a text string in the Spark Studio Patch Editor and have access to (and make use of) individual characters from that string - and it doesn’t seem that functionality can be achieved using only patches (and I was hoping to get it through a script with the Patch bridge etc.)

any comments or suggestions welcome - thanks in advance

const Patches = require('Patches');
const Scene = require('Scene');

(async function() {
  const inString = await Patches.outputs.getString('inString');
  const outString01 = inString.charAt(0);
  await Patches.inputs.setString('outString01', outString01);