We can imagine the following array
:
var arr = ["a", "b", "c", "d"];
I know I can use join(", ")
to make it into a string type: "a, b, c, d"
, but I would like to create an element for each array item, which would be type: "<li>a</li> <li>b</li> <li>c</li> <li>d</li>"
, you can do this using the join()
?
Note: I know I can also loop and do this using other methods, I'd just like to reduce code myself.