What's the proper syntax? (Javascript) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the proper syntax? (Javascript)

div.style.background = "url('" +images[0]+"') no-repeat"; How to put the image path? Help asap. Thanks!

10th Sep 2020, 12:06 PM
night_cafe
night_cafe - avatar
2 Answers
+ 1
Use template literals https://www.sololearn.com/learn/JavaScript/2969/ div.style.background = `url(${images[0]}) no-repeat`;
10th Sep 2020, 12:14 PM
Ore
Ore - avatar
0
For more information please see the example: https://code.sololearn.com/WSLZPpBIFgr7/?ref=app
10th Sep 2020, 3:20 PM
JaScript
JaScript - avatar