How do I add a variable value into the () of a document.write function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How do I add a variable value into the () of a document.write function?

6th May 2017, 6:37 PM
Ben Galbraith
4 Answers
+ 15
var x= "Hello" function myFunc(){ document.write(x) } myFunc() ???
6th May 2017, 6:53 PM
Ghaffaru Mudashiru
Ghaffaru Mudashiru - avatar
+ 5
var s = "world"; document.write("hello "+s+"!");
7th May 2017, 12:46 AM
visph
visph - avatar
+ 2
var x="hi" console.log (x) // print hi
7th May 2017, 12:34 AM
Calviղ
Calviղ - avatar
0
I am interesting with this
7th May 2017, 4:46 PM
Hamze Fabio
Hamze Fabio - avatar