Placing a variable in a java textnode

So basically I’m using textnodes which I’m not overly familiar with in an html document.
It uses IDs to go to the next part of the code and outputs text to screen.
My problem is I want to use a variable in the text but it wont let me, here is the code:

//This is one of the middle text nodes I didn't copy all the code
  },
    {
        id: 5,
        text: 'Welcome ' + name + ' let us start the day!',
        options: [
            {
                text: "Let's go",
                nextText: 6
            }

        ]
    },

Any suggestions? the output right now is just:
Welcome Let us start the day
but I know that name isn’t null.