This particular block of code functions exactly as anticipated:
let vw, vh
[vw, vh] = [document.body.clientWidth, document.body.clientHeight]
console.log(vw)
However, the behavior of this next snippet is not what I expected. It appears that simply having an extra assignment without any usage alters the outcome.
let vw, vh
const thebody = document.body // Aside from merely assigning a value unnecessarily, what mistake did I make??
[vw, vh] = [document.body.clientWidth, document.body.clientHeight]
console.log(vw)
To add to the confusion, printing out the body element results in it being displayed, but then leads to an error during the subsequent assignment...
let vw, vh
const thebody = document.body
console.log(thebody) // Besides logging something that wasn't needed, what other error did I make??
[vw, vh] = [document.body.clientWidth, document.body.clientHeight]
console.log(vw)