You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
445 B
17 lines
445 B
const container = document.querySelector('.container')
|
|
const unsplashURL = 'https://source.unsplash.com/random/'
|
|
const rows = 5
|
|
|
|
for(let i = 0; i < rows * 3; i++) {
|
|
const img = document.createElement('img')
|
|
img.src = `${unsplashURL}${getRandomSize()}`
|
|
container.appendChild(img)
|
|
}
|
|
|
|
function getRandomSize() {
|
|
return `${getRandomNr()}x${getRandomNr()}`
|
|
}
|
|
|
|
function getRandomNr() {
|
|
return Math.floor(Math.random() * 10) + 300
|
|
} |