จากเดิมโค้ดประมาณนี้
dom.style.left = left + 'px'
dom.style.top = top + 'px'
dom.style.width = width + 'px'
dom.style.height = height + 'px'
เราสามารถที่จะใช้ Object.assign
เพื่อทำให้โค้ดเหลือแค่นี้ได้
Object.assign(dom.style, { left: left + 'px', top: top + 'px', width: width + 'px', height: height + 'px' })
สั้นลงบานเลย