A
A
Alexey Kisilev2019-07-15 21:46:09
JavaScript
Alexey Kisilev, 2019-07-15 21:46:09

How to display image in html?

On the server, I have an array that stores paths to images.
["image/2.jpg", "image/1.jpg", "image/3.jpg"]
Using socket.io I send it to the client
5d2cc94f863a7997523629.png
On the client I receive it
5d2cc96da4f59868381754.png
Question: how do I display all these images on the screen in a specific block(all_image) ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2019-07-15
@Reshk_0

// arr = ["image/2.jpg", "image/1.jpg", "image/3.jpg"]
all_image.innerHTML = arr.map(img => `<img src="${img}">`).join('')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question