To combine literal strings with variables, you can concatenate them with the +
operator.
loremipsum = 'Ambulatory Blood Pressure Report\nPatient name:' + patientname;
And just to be sure that I address the question in the title,
- there's no built-in facility that provides the same formatting functionality as
printf
- there's no one "standard out" in JavaScript, so displaying text is different depending on how you want it to show up
(this is assuming the JavaScript is for a browser)