![](https://jiang-xia.top/x-api/blog-server/static/uploads/2022-08-10/8ojhda8gzvyx3rdhgyq2zg-tiger.jpg)
主 题
常用的浏览器API
这些URI方法encodeURI、encodeURIComponent
、decodeURI、decodeURIComponent
代替了BOM的escape
和unescape
方法。URI方法更可取,因为它们对所有Unicode符号编码,而BOM方法只能对ASCII符号正确编码。尽量避免使用escape()
和unescape
方法。
数字格式化toLocaleString
Element.getBoundingClientRect
方法返回元素的大小及其相对于视口的位置。 getBoundingClientRect
// exp
const num = 1000000.toLocaleString('en', { style: 'decimal' })
console.log(num)// 1,000,000
全部评论(13)