psychopy.org | Reference | Downloads | Github

Converting string formatting to Javascript

Using the code component in the builder I have this error:

It looks like string formatting is not yet supported.

The code runs and the Python is syntactically valid. I have also tried the string.format() method but the results are the same.

Is there any other way to write this?

I haven’t tried this out, but if I remember correctly this could work:

number1 = 42
stringVar = 'this is a string' + str(number1)

Thanks Lukas that works well.