[hello-dolly] wrap code in a block

This commit is contained in:
Pig Fang 2020-08-26 19:10:57 +08:00
parent 392d7855c1
commit f2aa09ad7c
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2

View File

@ -1,4 +1,5 @@
const lyrics = `Hello, Dolly
{
const lyrics = `Hello, Dolly
Well, hello, Dolly
It's so nice to have you back where you belong
You're lookin' swell, Dolly
@ -27,20 +28,19 @@ Dolly'll never go away
Dolly'll never go away
Dolly'll never go away again`.split('\n')
const length = lyrics.length
const length = lyrics.length
const hitokoto = document.createElement('div')
hitokoto.style.marginTop = '3px'
hitokoto.textContent = lyrics[Math.floor(Math.random() * length)]
const hitokoto = document.createElement('div')
hitokoto.style.marginTop = '3px'
hitokoto.textContent = lyrics[Math.floor(Math.random() * length)]
const container = document.querySelector('.breadcrumb')
if (container) {
container.appendChild(hitokoto)
} else {
const container = document.createElement('div')
container.className = 'breadcrumb'
container.appendChild(hitokoto)
document.querySelector('.content-header')?.appendChild(container)
const container = document.querySelector('.breadcrumb')
if (container) {
container.appendChild(hitokoto)
} else {
const container = document.createElement('div')
container.className = 'breadcrumb'
container.appendChild(hitokoto)
document.querySelector('.content-header')?.appendChild(container)
}
}
export default undefined