node笔记
js对象
It is used to store various keyed collections and more complex entities.
对象是用来存储各种有键的集合(键控集合)和更复杂的实体。
querystring
QueryString模块是解析和序列化URL中的querystring组件的模块,是nodejs的遗留方法,不会更新不会维护,应该也不会被废弃,但是有漏洞也不会被修复
需要const querystring =require(’node:querystring’)导入,
querystring.parse()
querystring.stringify()
format()
URL类
url是一个包含许多功能组件的结构化的字符串,可以通过new URL(url:string)解析为一个url对象,这个对象是URL类的实例,对象的属性是分解的功能组件。
也就是说url字符串,但是可以被解析为对象,对象有诸多属性,这些属性都是字符串中代表不同的意义的部分
url.username
url.password
url.host
url.href
url.hostname
|————————————————————————————————-|
href |
---|
protocol |
———- |
" https: // user : pass @ sub.example.com : 8080 /p/a/t/h ? query=string #hash " |
protocol |
————- |
origin |
————————————————————————————————- |
href |
————————————————————————————————- |
(All spaces in the "" line should be ignored. They are purely for formatting.)