上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: class Person { // 公有属性 name; // 私有属性 #age; #weight; // 构造方法 constructor(name,age,weight){ this.name = name; this.#age = age; this.#weight = weight; } 阅读全文
posted @ 2020-12-03 15:40 小蓉儿 阅读(101) 评论(0) 推荐(0) 编辑
摘要: // flat 将多维数组转为地位数组 const arr = [1,2,3,4,[5,6]]; console.log(arr); //[1,2,3,4,5,6] cosnt arr1 = [1,2,3,4,[5,6,[7,8]]]; console.log(arr1.flat(2)); //[1 阅读全文
posted @ 2020-12-03 15:23 小蓉儿 阅读(77) 评论(0) 推荐(0) 编辑
摘要: let str = ' iloveyou '; console.log(str); console.log(str.trimStart()); console.log(str.) 阅读全文
posted @ 2020-12-03 13:24 小蓉儿 阅读(74) 评论(0) 推荐(0) 编辑
摘要: // 二维数组 转为对象 const result = Object.fromEntries([ ['name','王蓉'],['study','skill'] ]) console.log(result); //{name:'wangrong',study:'skill'} //Map const 阅读全文
posted @ 2020-12-03 10:23 小蓉儿 阅读(282) 评论(0) 推荐(0) 编辑
摘要: let str = '<a href="http://www/baidu.com">百度</a>'; // 提取 url 和 文本 const reg = /<a href="(.*)>(.*)<\/a>/; const result = reg.exec(str); console.log(res 阅读全文
posted @ 2020-12-01 15:52 小蓉儿 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Rest 参数与 spread 扩展运算符在ES6中已经引入,不过ES6只针对于数组。 在ES9中为对象提供了像数组一样的 rest 参数和 扩展运算符 1. 输出 function connect({host,port,userName,password}){ console.log(host) 阅读全文
posted @ 2020-11-26 13:52 小蓉儿 阅读(222) 评论(0) 推荐(0) 编辑
摘要: // 声明对象 const school = { name: "上海华师大", cities: ['上海','北京','深圳'], skill: ['java','php','vue'] } Object.keys(school) // ["name", "cities", "skill"] Obj 阅读全文
posted @ 2020-11-26 13:26 小蓉儿 阅读(67) 评论(0) 推荐(0) 编辑
摘要: const fs = require('fs'); // 读取文件 function readStudy() { return new Promise((resolve,reject) = >{ fs.readFile("./resoureces/style.md",(err,data)=>{ // 阅读全文
posted @ 2020-11-26 11:39 小蓉儿 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 1.await 必须要在 async中使用 // 创建 promise 对象 (成功) const p = new Promise((resolve, reject)=>{ resolve('用户数据') }) // await 要放在 async 函数中使用 async function main 阅读全文
posted @ 2020-11-26 11:00 小蓉儿 阅读(87) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2020.cnblogs.com/blog/1164059/202011/1164059-20201125173909020-2092446269.png) ### ![](https://img2020.cnblogs.com/blog/1164059/202011/1164059-20201125173912332-624441493.png) 阅读全文
posted @ 2020-11-25 17:40 小蓉儿 阅读(80) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页