(function(){// 创建一个1cm宽的元素插入到页面,然后坐等出结果let div = document.createElement("div");div.id = "cm";div.style.width = "1cm";document.querySelector("body").appendChild(div);// 原生方法获取浏览器对元素的计算值let cm1 = document.getElementById("cm").getBoundingClientRect();console.log(cm1);return cm1.width;})()


