How to display text with blank spaces online

URL of the experiment:

Description of the problem:
I have a simple experiment where I want to display several words in two lines that I’ll get from an excel list. Some of these words have some additional blank spaces at the end (e.g.: "HOUSE ") and sometimes, the “word” consists only of blank spaces (e.g. " ").

I managed to display the lists of words, including the blank spaces perfectly fine in PsychoPy, however when synchronizing the experiment to Pavlovia the blank spaces behind the words do not get displayed, and instead of the blank-spaced-“words” it is written “NaN”. It seems that Javascript does not accept the display of any blank spaces.

To avoid the display of “NaN” in Javascript, I added the following code:

if ((trial_2_text === "NaN")) {
    trial_2_text = " ";

This works fine online. However, I could not find a way to display the blank spaces at the end of the individual words, so that the words would be displayed as: "HOUSE " instead of “HOUSE”. Obviously, the code-component from above does not work in this case. Do you have any idea how it is possible to display the blank spaces in javascript, so that they are also “visible” in Pavlovia?