or azran or azran - 1 month ago 9
Node.js Question

Convert Simple String Variable To HTML

I know this should be super simple but I can׳t get it work like i expect.
In my

program I have a string
that is generated from some parameters.

var generatedString = "some string" + "other string";

I want to pass this variable to a method as
field so I used :


When it print out to the browser I see: generatedString not its content.
What is the simplest way to make it work?


Use the same principle as in your first example.

'<b>' + generatedString + '</b>'

Or as parameter to a method

alert('<b>' + generatedString + '</b>');

Use it in a variable like this

var htmlString = '<b>' + generatedString + '</b>';