A less tedious method is to use the element.getBoundingClientRect as @Mehran Hatami mentioned.
Here's the code you need:
let elem = document.querySelector("<element>");
let rect = elem.getBoundingClientRect();
if(rect){
const { width, height } = rect;
console.log( width, height )
}