上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 16 下一页
摘要: { console.log("abc".padStart(10)) console.log("abc".padStart(10, "foo")) console.log("abc".padStart(6, "123465")) console.log("abc".padStart(8, "0")) 阅读全文
posted @ 2021-02-27 15:56 abcdefgab 阅读(53) 评论(0) 推荐(0)
摘要: { //对象属性遍历 let obj1 = { a: 1 } let obj2 = { b1: 2 } Object.defineProperty(obj2, "b2", { enumerable: false, value: 3 }) Object.setPrototypeOf(obj2, obj 阅读全文
posted @ 2021-02-27 15:49 abcdefgab 阅读(69) 评论(0) 推荐(0)
摘要: { let task1 = () => new Promise((resolve, reject) => { console.log("task1 begin") setTimeout(() => resolve("task1 end.返回结果"), 1000) }) let task2 = () 阅读全文
posted @ 2021-02-27 15:44 abcdefgab 阅读(49) 评论(0) 推荐(0)
摘要: { // //异常处理。失败回调函数处理 // let task1 = () => Promise.reject("task1 error") // async function fun() { // return await task1() // } // fun().then( // res = 阅读全文
posted @ 2021-02-27 15:39 abcdefgab 阅读(86) 评论(0) 推荐(0)
摘要: { // let task1 = function () { // return new Promise(function (resovle, reject) { // setTimeout(function () { // resovle("task1的返回结果") // }, 1000) // 阅读全文
posted @ 2021-02-27 11:41 abcdefgab 阅读(82) 评论(0) 推荐(0)
摘要: include: let arr1 = [1, 2, 3] console.log(arr1.includes(2)) console.log(arr1.includes(4)) console.log(arr1.includes(2,1)) console.log(arr1.includes(2, 阅读全文
posted @ 2021-02-27 11:22 abcdefgab 阅读(70) 评论(0) 推荐(0)
摘要: index.html: <script src="../dist/bundle.js"></script> app.js: //引入模块 //使用解构的方式来获取模块中的暴露出内容 import { foo, bar } from "./modules/module1" import { MODUL 阅读全文
posted @ 2021-02-27 11:03 abcdefgab 阅读(71) 评论(0) 推荐(0)
摘要: index.html: <script src="./script/libs/sea.js"></script> <script> seajs.use("./script/main") </script> main.js: define(function(require){ //模块引入 //let 阅读全文
posted @ 2021-02-27 10:42 abcdefgab 阅读(88) 评论(0) 推荐(0)
摘要: index.html: <script src="./script/lib/require.js" data-main="./script/main.js"></script> main.js: (function () { require.config({ //模块名=>模块路劲映射 paths: 阅读全文
posted @ 2021-02-27 10:23 abcdefgab 阅读(122) 评论(0) 推荐(0)
摘要: //定义和暴露模块 module.exports = { foo() { console.log("module1 foo() is called") } } //定义和暴露模块 module.exports = function () { console.log("module2 function 阅读全文
posted @ 2021-02-27 09:19 abcdefgab 阅读(159) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 16 下一页