├── ES6-10 ├── ES2019 │ ├── .gitignore │ ├── js │ │ ├── index.js │ │ ├── lesson3-1.js │ │ ├── lesson2-1.js │ │ ├── test0728.js │ │ ├── test0731.js │ │ ├── 1.module.js │ │ ├── lesson4-3.js │ │ ├── lesson4-4.js │ │ ├── test0722.js │ │ ├── lesson5-2.js │ │ ├── lesson5-3.js │ │ ├── lesson2-2.js │ │ ├── lesson4-1.js │ │ ├── lesson2-6.js │ │ ├── test0621.js │ │ ├── lesson2-14.js │ │ ├── lesson2-7.js │ │ ├── lesson4-2.js │ │ ├── lesson5-4.js │ │ ├── lesson2-8.js │ │ ├── lesson5-1.js │ │ ├── lesson2-13.js │ │ ├── lesson2-10.js │ │ ├── lesson2-5.js │ │ ├── lesson2-14-mod.js │ │ ├── lesson2-4.js │ │ ├── lesson6-1.js │ │ └── lesson2-11.js │ ├── static │ │ ├── 1.js │ │ ├── 2.js │ │ ├── 3.js │ │ ├── es10.png │ │ ├── koa.png │ │ ├── es2019.jpg │ │ └── index.css │ ├── .babelrc │ ├── views │ │ ├── index.ejs │ │ └── layout.ejs │ ├── routes │ │ └── user.js │ ├── .eslintrc.js │ ├── webpack.config.babel.js │ ├── .vscode │ │ └── launch.json │ ├── app.js │ └── package.json ├── webpack-test │ ├── .babelrc │ ├── index.js │ ├── dist │ │ └── index.html │ ├── package.json │ └── webpack.config.js ├── vue-lesson │ ├── src │ │ ├── mock │ │ │ ├── proxy.json │ │ │ ├── user.json │ │ │ ├── list.json │ │ │ └── author.json │ │ ├── assets │ │ │ └── logo.png │ │ ├── main.js │ │ ├── directive │ │ │ └── make-red.js │ │ ├── components │ │ │ ├── list.vue │ │ │ ├── proxy.vue │ │ │ ├── author.vue │ │ │ └── HelloWorld.vue │ │ └── App.vue │ ├── babel.config.js │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ ├── .gitignore │ ├── .eslintrc.js │ ├── README.md │ ├── vue.config.js │ └── package.json └── .gitignore ├── fast-interview-code ├── js-web-api │ ├── data │ │ ├── jsonp.js │ │ └── test.json │ ├── ajax.html │ ├── dom-3.js │ ├── jsonp.html │ ├── dom-2.js │ ├── dom.html │ ├── dom-1.js │ ├── event.html │ ├── ajax.js │ └── event.js ├── webpack-demo │ ├── .babelrc │ ├── src │ │ ├── fn.js │ │ ├── index.html │ │ └── index.js │ ├── dist │ │ ├── index.html │ │ ├── bundle.js │ │ └── bundle.58cf28598ed2e217d4b3.js │ ├── package.json │ ├── webpack.prod.js │ └── webpack.config.js ├── 前端面试课-思维导图.png ├── js-base │ ├── async-demo.js │ ├── scope-demo.js │ ├── cache-demo.js │ ├── index.html │ ├── closure.js │ ├── bind-demo.js │ ├── class-demo-1.js │ ├── deepClone.js │ ├── class-demo-2.js │ ├── jquery-demo.js │ └── promise-demo.js ├── questions-demo │ ├── reg.js │ ├── var-let-const.js │ ├── fn.js │ ├── flat.js │ ├── unique.js │ ├── object.js │ ├── query.js │ ├── RAF.js │ ├── index.html │ ├── scope.js │ ├── isEqual.js │ └── array-api.js ├── prod-env │ ├── index.js │ ├── debounce.html │ ├── xss.html │ ├── throttle.html │ ├── index.html │ ├── throttle.js │ └── debounce.js ├── js-异步进阶 │ ├── 02-event-loop.md │ ├── 05-微任务和宏任务.md │ ├── 01-题目.md │ └── 03-promise.md ├── css │ ├── 11-line-height-继承.html │ ├── 02-margin-纵向重叠.html │ ├── 01-盒模型.html │ ├── 14-vw-wh.html │ ├── 04-bfc.html │ ├── 12-rem.html │ ├── 08-定位.html │ ├── 07-色子.html │ ├── 13-响应式.html │ ├── 06-双飞翼布局.html │ ├── 09-水平对齐.html │ ├── 03-margin-负值.html │ ├── 05-圣杯布局.html │ └── 10-垂直对齐.html └── myTest │ └── test.html ├── JavaScript_code ├── css │ ├── grey.css │ ├── black.css │ └── reset.css ├── img │ ├── 0.png │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png ├── images │ ├── 0.png │ ├── 1.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ ├── bg.jpg │ ├── 11_07.png │ ├── 1_07.png │ ├── ara.png │ ├── logo.png │ ├── footer.png │ ├── kat-alt.png │ ├── kat-bas.png │ ├── album │ │ ├── 1.jpeg │ │ ├── 2.jpeg │ │ ├── 3.jpeg │ │ ├── 4.jpeg │ │ ├── 5.jpeg │ │ └── 6.jpeg │ ├── arabutton.png │ ├── kat-orta.png │ ├── menu-hover.png │ ├── shoppingset-bg.png │ ├── shoppingcartlogo.png │ └── images │ │ ├── slider_btn_icon_01.png │ │ ├── slider_btn_icon_02.png │ │ ├── slider_btn_icon_04.png │ │ ├── slider_btn_icon_09.png │ │ ├── slider_btn_icon_left.png │ │ └── slider_btn_icon_right.png ├── 26.面向对象的拖拽.html ├── lib │ ├── LimitDrag.js │ ├── Drag.js │ ├── move.js │ ├── move3.js │ └── move2.js ├── 28.0.cookie基础与应用.html ├── 19.1.键盘事件仿select下拉框.html ├── 24.基础面对对象.html ├── 22.0.事件绑定.html ├── 9.1.流程控制和JSON.html ├── 27.BOM应用.html ├── 10.数码时钟.html ├── 22.3.鼠标滚轮滚动.html ├── 21.0.阻止默认事件自定义右键菜单限定输入框.html ├── 28.1.登陆后cookie读取用户名.html ├── 23.ajax.html ├── 7.变量类型转换.html ├── 2.网页换肤.html ├── 30.0.template.html ├── 21.1.基本拖拽.html ├── 1.第一个JS效果.html ├── 12.创建插入删除元素.html ├── 3.函数传参.html ├── 19.0.跟随鼠标一串div.html ├── 5.导航选项卡.html └── 22.1.高级拖拽.html ├── typescript ├── readme.md ├── src │ ├── index.js │ ├── index.ts │ ├── nowcoder │ │ ├── microTask.js │ │ └── quickSort.js │ └── utilityType.ts ├── nodemon.json ├── .prettierrc.cjs ├── .eslintrc.cjs ├── package.json └── tsconfig.json ├── JavaScriptES6-10.assets ├── t81ye74b8w.png ├── 4194814978-5d11dad0ea8bf_articlex.png └── 97a52475c433362e41ffb7cf6e9bd775-1580129648099.png ├── JavaScript高级程序设计第四版-笔记.assets ├── 图片_55.Png ├── image-20210605161656189.png ├── image-20210710161827359.png ├── image-20210710225957749.png ├── image-20210710232601499.png ├── image-20210711153109588.png ├── image-20210711153732577.png ├── image-20210711154422125.png ├── image-20210711160141212.png ├── image-20210711193851091.png ├── image-20210711205301182.png ├── image-20210711205332837.png ├── image-20210711205531624.png ├── image-20210711210425719.png ├── image-20210712212850089.png ├── image-20210716163550713.png ├── image-20210716173022784.png ├── image-20210716211907832.png ├── image-20210718100442699.png ├── image-20210718102100840.png ├── image-20210718162123729.png ├── image-20210718162138045.png ├── image-20210726162710016.png ├── image-20210726175624236.png ├── image-20210801162254455.png ├── image-20210801163047155.png └── image-20210801163102430.png ├── readme.assets ├── image-20200126152808449.png ├── image-20200126152827260.png ├── image-20200126152842459.png └── image-20200126152920878.png ├── HTML前端工程师面试必备技巧.assets ├── image-20210527214757978.png ├── image-20210528162727704.png └── image-20210529212303649.png ├── .gitignore ├── readme.md └── .vscode └── settings.json /ES6-10/ES2019/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/index.js: -------------------------------------------------------------------------------- 1 | import './test0731' -------------------------------------------------------------------------------- /ES6-10/ES2019/static/1.js: -------------------------------------------------------------------------------- 1 | console.log(1) 2 | -------------------------------------------------------------------------------- /ES6-10/ES2019/static/2.js: -------------------------------------------------------------------------------- 1 | console.log(2) 2 | -------------------------------------------------------------------------------- /ES6-10/ES2019/static/3.js: -------------------------------------------------------------------------------- 1 | console.log(3) 2 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/data/jsonp.js: -------------------------------------------------------------------------------- 1 | abc( 2 | { name: 'xxx' } 3 | ) -------------------------------------------------------------------------------- /ES6-10/webpack-test/.babelrc: -------------------------------------------------------------------------------- 1 | options: { 2 | presets: ['@babel/preset-env'] 3 | } -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/data/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zhangsan" 3 | } -------------------------------------------------------------------------------- /ES6-10/webpack-test/index.js: -------------------------------------------------------------------------------- 1 | let say = () => { 2 | console.log('hello webpack'); 3 | } 4 | say() -------------------------------------------------------------------------------- /JavaScript_code/css/grey.css: -------------------------------------------------------------------------------- 1 | div { 2 | background: grey; 3 | width: 100px; 4 | height: 50px; 5 | } -------------------------------------------------------------------------------- /ES6-10/ES2019/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env" 5 | ] 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /JavaScript_code/img/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/0.png -------------------------------------------------------------------------------- /JavaScript_code/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/1.png -------------------------------------------------------------------------------- /JavaScript_code/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/2.png -------------------------------------------------------------------------------- /JavaScript_code/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/3.png -------------------------------------------------------------------------------- /JavaScript_code/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/4.png -------------------------------------------------------------------------------- /JavaScript_code/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/5.png -------------------------------------------------------------------------------- /JavaScript_code/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/6.png -------------------------------------------------------------------------------- /JavaScript_code/img/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/7.png -------------------------------------------------------------------------------- /JavaScript_code/img/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/8.png -------------------------------------------------------------------------------- /JavaScript_code/img/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/img/9.png -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "plugins": [] 4 | } -------------------------------------------------------------------------------- /typescript/readme.md: -------------------------------------------------------------------------------- 1 | ## nodemon 2 | 3 | https://github.com/remy/nodemon/blob/master/doc/sample-nodemon.md 4 | -------------------------------------------------------------------------------- /ES6-10/ES2019/static/es10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/ES6-10/ES2019/static/es10.png -------------------------------------------------------------------------------- /ES6-10/ES2019/static/koa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/ES6-10/ES2019/static/koa.png -------------------------------------------------------------------------------- /ES6-10/ES2019/views/index.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/mock/proxy.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": "0", 3 | "price": [13.02, 2.43, 4.6, 65.3, 45.9, 0.67] 4 | } -------------------------------------------------------------------------------- /JavaScript_code/css/black.css: -------------------------------------------------------------------------------- 1 | div { 2 | background: black; 3 | width: 100px; 4 | height: 50px; 5 | } 6 | -------------------------------------------------------------------------------- /JavaScript_code/images/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/0.png -------------------------------------------------------------------------------- /JavaScript_code/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/1.png -------------------------------------------------------------------------------- /JavaScript_code/images/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/11.png -------------------------------------------------------------------------------- /JavaScript_code/images/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/12.png -------------------------------------------------------------------------------- /JavaScript_code/images/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/13.png -------------------------------------------------------------------------------- /JavaScript_code/images/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/14.png -------------------------------------------------------------------------------- /JavaScript_code/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/2.png -------------------------------------------------------------------------------- /JavaScript_code/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/3.png -------------------------------------------------------------------------------- /JavaScript_code/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/4.png -------------------------------------------------------------------------------- /JavaScript_code/images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/5.png -------------------------------------------------------------------------------- /JavaScript_code/images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/6.png -------------------------------------------------------------------------------- /JavaScript_code/images/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/7.png -------------------------------------------------------------------------------- /JavaScript_code/images/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/8.png -------------------------------------------------------------------------------- /JavaScript_code/images/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/9.png -------------------------------------------------------------------------------- /JavaScript_code/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/bg.jpg -------------------------------------------------------------------------------- /ES6-10/ES2019/static/es2019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/ES6-10/ES2019/static/es2019.jpg -------------------------------------------------------------------------------- /JavaScript_code/images/11_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/11_07.png -------------------------------------------------------------------------------- /JavaScript_code/images/1_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/1_07.png -------------------------------------------------------------------------------- /JavaScript_code/images/ara.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/ara.png -------------------------------------------------------------------------------- /JavaScript_code/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/logo.png -------------------------------------------------------------------------------- /ES6-10/vue-lesson/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /JavaScript_code/images/footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/footer.png -------------------------------------------------------------------------------- /JavaScript_code/images/kat-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/kat-alt.png -------------------------------------------------------------------------------- /JavaScript_code/images/kat-bas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/kat-bas.png -------------------------------------------------------------------------------- /fast-interview-code/前端面试课-思维导图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/fast-interview-code/前端面试课-思维导图.png -------------------------------------------------------------------------------- /ES6-10/vue-lesson/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/ES6-10/vue-lesson/public/favicon.ico -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/ES6-10/vue-lesson/src/assets/logo.png -------------------------------------------------------------------------------- /JavaScript_code/images/album/1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/album/1.jpeg -------------------------------------------------------------------------------- /JavaScript_code/images/album/2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/album/2.jpeg -------------------------------------------------------------------------------- /JavaScript_code/images/album/3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/album/3.jpeg -------------------------------------------------------------------------------- /JavaScript_code/images/album/4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/album/4.jpeg -------------------------------------------------------------------------------- /JavaScript_code/images/album/5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/album/5.jpeg -------------------------------------------------------------------------------- /JavaScript_code/images/album/6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/album/6.jpeg -------------------------------------------------------------------------------- /JavaScript_code/images/arabutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/arabutton.png -------------------------------------------------------------------------------- /JavaScript_code/images/kat-orta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/kat-orta.png -------------------------------------------------------------------------------- /JavaScript_code/images/menu-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/menu-hover.png -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/mock/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": "0", 3 | "user": { 4 | "name": "lilei", 5 | "addr": "北京海定区" 6 | } 7 | } -------------------------------------------------------------------------------- /JavaScriptES6-10.assets/t81ye74b8w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScriptES6-10.assets/t81ye74b8w.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/图片_55.Png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/图片_55.Png -------------------------------------------------------------------------------- /JavaScript_code/images/shoppingset-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/shoppingset-bg.png -------------------------------------------------------------------------------- /readme.assets/image-20200126152808449.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/readme.assets/image-20200126152808449.png -------------------------------------------------------------------------------- /readme.assets/image-20200126152827260.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/readme.assets/image-20200126152827260.png -------------------------------------------------------------------------------- /readme.assets/image-20200126152842459.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/readme.assets/image-20200126152842459.png -------------------------------------------------------------------------------- /readme.assets/image-20200126152920878.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/readme.assets/image-20200126152920878.png -------------------------------------------------------------------------------- /JavaScript_code/images/shoppingcartlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/shoppingcartlogo.png -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson3-1.js: -------------------------------------------------------------------------------- 1 | // const arr = [1, 2, 3] 2 | // console.log(arr.includes(4)) 3 | 4 | console.log(Math.pow(2, 5)) 5 | console.log(2 ** 5) 6 | -------------------------------------------------------------------------------- /HTML前端工程师面试必备技巧.assets/image-20210527214757978.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/HTML前端工程师面试必备技巧.assets/image-20210527214757978.png -------------------------------------------------------------------------------- /HTML前端工程师面试必备技巧.assets/image-20210528162727704.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/HTML前端工程师面试必备技巧.assets/image-20210528162727704.png -------------------------------------------------------------------------------- /HTML前端工程师面试必备技巧.assets/image-20210529212303649.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/HTML前端工程师面试必备技巧.assets/image-20210529212303649.png -------------------------------------------------------------------------------- /JavaScript_code/images/images/slider_btn_icon_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/images/slider_btn_icon_01.png -------------------------------------------------------------------------------- /JavaScript_code/images/images/slider_btn_icon_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/images/slider_btn_icon_02.png -------------------------------------------------------------------------------- /JavaScript_code/images/images/slider_btn_icon_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/images/slider_btn_icon_04.png -------------------------------------------------------------------------------- /JavaScript_code/images/images/slider_btn_icon_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/images/slider_btn_icon_09.png -------------------------------------------------------------------------------- /JavaScript_code/images/images/slider_btn_icon_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/images/slider_btn_icon_left.png -------------------------------------------------------------------------------- /JavaScript_code/images/images/slider_btn_icon_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript_code/images/images/slider_btn_icon_right.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210605161656189.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210605161656189.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210710161827359.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210710161827359.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210710225957749.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210710225957749.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210710232601499.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210710232601499.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711153109588.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711153109588.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711153732577.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711153732577.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711154422125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711154422125.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711160141212.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711160141212.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711193851091.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711193851091.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711205301182.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711205301182.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711205332837.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711205332837.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711205531624.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711205531624.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210711210425719.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210711210425719.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210712212850089.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210712212850089.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210716163550713.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210716163550713.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210716173022784.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210716173022784.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210716211907832.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210716211907832.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210718100442699.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210718100442699.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210718102100840.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210718102100840.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210718162123729.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210718162123729.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210718162138045.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210718162138045.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210726162710016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210726162710016.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210726175624236.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210726175624236.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210801162254455.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210801162254455.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210801163047155.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210801163047155.png -------------------------------------------------------------------------------- /JavaScript高级程序设计第四版-笔记.assets/image-20210801163102430.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScript高级程序设计第四版-笔记.assets/image-20210801163102430.png -------------------------------------------------------------------------------- /typescript/src/index.js: -------------------------------------------------------------------------------- 1 | import './nowcoder/examHuawei.js' 2 | import './nowcoder/examTop101.js' 3 | import './nowcoder/quickSort.js' 4 | import './nowcoder/microTask.js' 5 | -------------------------------------------------------------------------------- /JavaScriptES6-10.assets/4194814978-5d11dad0ea8bf_articlex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScriptES6-10.assets/4194814978-5d11dad0ea8bf_articlex.png -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-1.js: -------------------------------------------------------------------------------- 1 | const arr = [{ 'a': 1 }, { 'b': 3 }, { 'c': 4 }] 2 | for (let item of arr) { 3 | console.log(item.a) 4 | console.log(item.b) 5 | console.log(item.c) 6 | } 7 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/mock/list.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": "0", 3 | "list": [{ 4 | "name": "li lei", 5 | "addr": "北京 朝阳" 6 | }, { 7 | "name": "han mei", 8 | "addr": "南京" 9 | }] 10 | } -------------------------------------------------------------------------------- /JavaScriptES6-10.assets/97a52475c433362e41ffb7cf6e9bd775-1580129648099.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Eished/JavaScript_notes/HEAD/JavaScriptES6-10.assets/97a52475c433362e41ffb7cf6e9bd775-1580129648099.png -------------------------------------------------------------------------------- /typescript/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts,js", 4 | "ignore": ["*.test.ts"], 5 | "delay": "0", 6 | "execMap": { 7 | "ts": "ts-node", 8 | "js": "node --harmony" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | import './utilityType' 2 | 3 | const welcome = 'App is running...' 4 | 5 | export function hello(who: string = welcome): string { 6 | return `[INFO] ${who}` 7 | } 8 | 9 | console.log(hello()) 10 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import './directive/make-red' 4 | 5 | Vue.config.productionTip = false 6 | 7 | new Vue({ 8 | render: h => h(App) 9 | }).$mount('#app') 10 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/test0728.js: -------------------------------------------------------------------------------- 1 | import { 2 | bye, 3 | default as abc, 4 | hi as Hi 5 | } from "./1.module"; 6 | import { 7 | run, 8 | say 9 | } from "./lesson2-14-mod"; 10 | 11 | Hi(); 12 | bye(); 13 | abc(); 14 | say("hello"); 15 | run(); -------------------------------------------------------------------------------- /ES6-10/webpack-test/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/mock/author.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": "0", 3 | "allAuthors": { 4 | "fiction": ["Agatha Chars", "bAS", "C", "D.F.S"], 5 | "science": ["Neal", "Arthis", "sad", "asd.S"], 6 | "fantasy": ["Doctor", "OAAas", "Adslkjfo", "oiuqr"] 7 | } 8 | } -------------------------------------------------------------------------------- /ES6-10/ES2019/js/test0731.js: -------------------------------------------------------------------------------- 1 | const thrSet = new Map([ 2 | ["tid", 1], 3 | ["touseruid", 1], 4 | ["touser", 1], 5 | ["replyIndex", 1], 6 | ["replyLen", 1], 7 | ["randomTime", 1], 8 | ]); 9 | 10 | const jsonStr = JSON.stringify(thrSet); 11 | console.log(jsonStr); -------------------------------------------------------------------------------- /fast-interview-code/js-base/async-demo.js: -------------------------------------------------------------------------------- 1 | // // 异步 (callback 回调函数) 2 | // console.log(100) 3 | // setTimeout(() => { 4 | // console.log(200) 5 | // }, 1000) 6 | // console.log(300) 7 | // console.log(400) 8 | 9 | // 同步 10 | console.log(100) 11 | alert(200) 12 | console.log(300) 13 | -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/src/fn.js: -------------------------------------------------------------------------------- 1 | // export function fn() { 2 | // console.log('fn') 3 | // } 4 | // export const name = 'b' 5 | 6 | function fn() { 7 | console.log('fn') 8 | } 9 | const name = 'b' 10 | 11 | export { // 注意这里不能有 default !!! 12 | fn, 13 | name 14 | } -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/reg.js: -------------------------------------------------------------------------------- 1 | 2 | // 邮政编码 3 | /\d{6}/ 4 | 5 | // 小写英文字母 6 | /^[a-z]+$/ 7 | 8 | // 英文字母 9 | /^[a-zA-Z]+$/ 10 | 11 | // 日期格式 2019.12.1 12 | /^\d{4}-\d{1,2}-\d{1,2}$/ 13 | 14 | // 用户名 15 | /^[a-zA-Z]\w{5, 17}$/ 16 | 17 | // 简单的 IP 地址匹配 18 | /\d+\.\d+\.\d+\.\d+/ 19 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/var-let-const.js: -------------------------------------------------------------------------------- 1 | // // 变量提升 ES5 2 | // console.log(a) // undefined 3 | // var a = 200 4 | 5 | // var a 6 | // console.log(a) // undefined 7 | // a = 200 8 | 9 | // 块级作用域 10 | for (let i = 0; i < 10; i++) { 11 | let j = i + 1 12 | } 13 | console.log(j) 14 | -------------------------------------------------------------------------------- /ES6-10/ES2019/views/layout.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 脚手架-ES2019从入门到精通 4 | 5 | 6 | 7 | <%- body %> 8 | 9 | 10 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/directive/make-red.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | // Vue.directive('make-red', { 3 | // inserted: function (el) { 4 | // el.style.color = 'red' 5 | // } 6 | // }) 7 | 8 | // 样式变红 9 | Vue.directive('make-red', { 10 | inserted (el) { 11 | el.style.color = 'red' 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/scope-demo.js: -------------------------------------------------------------------------------- 1 | let a 2 | for (let i = 0; i < 10; i++) { 3 | a = document.createElement('a') 4 | a.innerHTML = i + '
' 5 | a.addEventListener('click', function (e) { 6 | e.preventDefault() 7 | alert(i) 8 | }) 9 | document.body.appendChild(a) 10 | } 11 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/fn.js: -------------------------------------------------------------------------------- 1 | // // 函数声明 2 | // const res = sum(10, 20) 3 | // console.log(res) 4 | // function sum(x, y) { 5 | // return x + y 6 | // } 7 | 8 | // // 函数表达式 9 | // var res = sum(10, 20) 10 | // console.log(res) 11 | // var sum = function (x, y) { 12 | // return x + y 13 | // } 14 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/1.module.js: -------------------------------------------------------------------------------- 1 | export function hi() { 2 | console.log(`Hello`); 3 | } 4 | 5 | export function bye() { 6 | console.log(`Bye`); 7 | } 8 | 9 | export default function () { 10 | console.log("Module loaded (export default)!"); 11 | } 12 | 13 | export { 14 | run, 15 | say 16 | } 17 | from "./lesson2-14-mod"; -------------------------------------------------------------------------------- /ES6-10/vue-lesson/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson4-3.js: -------------------------------------------------------------------------------- 1 | // for (let i = 1; i < 32; i++) { 2 | // if (i < 10) { 3 | // console.log(`0${i}`) 4 | // } else { 5 | // console.log(i) 6 | // } 7 | // } 8 | 9 | for (let i = 1; i < 32011; i += 100) { 10 | // console.log(i.toString().padStart(5, '*#')) 11 | console.log(i.toString().padEnd(5, '*#')) 12 | } 13 | -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

一段文字

11 | 12 | -------------------------------------------------------------------------------- /fast-interview-code/prod-env/index.js: -------------------------------------------------------------------------------- 1 | const img1 = document.getElementById('img1') 2 | img1.onload = function () { 3 | console.log('img loaded') 4 | } 5 | 6 | window.addEventListener('load', function () { 7 | console.log('window loaded') 8 | }) 9 | 10 | document.addEventListener('DOMContentLoaded', function () { 11 | console.log('dom content loaded') 12 | }) -------------------------------------------------------------------------------- /ES6-10/ES2019/routes/user.js: -------------------------------------------------------------------------------- 1 | import Router from 'koa-router' 2 | 3 | const router = new Router() 4 | 5 | router.get('/', async ctx => { 6 | await ctx.render('index') 7 | }) 8 | 9 | router.get('/add', async ctx => { 10 | await ctx.render('index') 11 | }) 12 | 13 | router.get('/test', async ctx => { 14 | ctx.body = { 15 | code: 0 16 | } 17 | }) 18 | 19 | export default router 20 | -------------------------------------------------------------------------------- /ES6-10/ES2019/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | "extends": "standard", 7 | "globals": { 8 | "Atomics": "readonly", 9 | "SharedArrayBuffer": "readonly", 10 | 'BigInt':true 11 | }, 12 | "parserOptions": { 13 | "ecmaVersion": 2019 14 | }, 15 | "rules": { 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/cache-demo.js: -------------------------------------------------------------------------------- 1 | // 闭包隐藏数据,只提供 API 2 | function createCache() { 3 | const data = {} // 闭包中的数据,被隐藏,不被外界访问 4 | return { 5 | set: function (key, val) { 6 | data[key] = val 7 | }, 8 | get: function (key) { 9 | return data[key] 10 | } 11 | } 12 | } 13 | 14 | const c = createCache() 15 | c.set('a', 100) 16 | console.log( c.get('a') ) 17 | 18 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson4-4.js: -------------------------------------------------------------------------------- 1 | const data = { 2 | PortLand: '78/50', 3 | Dublin: '88/53', 4 | Lima: '32/54' 5 | } 6 | 7 | Object.defineProperty(data, 'Lima', { 8 | // 描述符 9 | enumerable: false, 10 | writable: false 11 | }) 12 | 13 | data.Lima = '23/23' 14 | console.log(Object.keys(data)) 15 | // 查询属性描述符 16 | console.log(Object.getOwnPropertyDescriptors(data)) 17 | console.log(Object.getOwnPropertyDescriptor(data, 'Lima')) 18 | -------------------------------------------------------------------------------- /ES6-10/ES2019/webpack.config.babel.js: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import webpack from 'webpack' 3 | export default ({ 4 | entry: ['webpack-hot-middleware/client?noInfo=true&reload=true&timeout=100', './js/index.js'], 5 | output: { 6 | path: path.join(__dirname, '/static/'), 7 | filename: 'index.min.js' 8 | }, 9 | mode: 'development', 10 | plugins: [ 11 | new webpack.HotModuleReplacementPlugin() 12 | ] 13 | }) 14 | -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

一段文字

11 | 12 | -------------------------------------------------------------------------------- /ES6-10/ES2019/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "pwa-chrome", 9 | "request": "launch", 10 | "name": "Launch Chrome against localhost", 11 | "url": "http://localhost:8080", 12 | "webRoot": "${workspaceFolder}" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/ajax.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ajax 演示 8 | 9 | 10 |

一段文字 1

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/flat.js: -------------------------------------------------------------------------------- 1 | function flat(arr) { 2 | // 验证 arr 中,还有没有深层数组 [1, 2, [3, 4]] 3 | const isDeep = arr.some(item => item instanceof Array) 4 | if (!isDeep) { 5 | return arr // 已经是 flatern [1, 2, 3, 4] 6 | } 7 | 8 | const res = Array.prototype.concat.apply([], arr) 9 | return flat(res) // 递归 10 | } 11 | 12 | const res = flat( [1, 2, [3, 4, [10, 20, [100, 200]]], 5] ) 13 | console.log(res) 14 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/dom-3.js: -------------------------------------------------------------------------------- 1 | const list = document.getElementById('list') 2 | 3 | // 创建一个文档片段,此时还没有插入到 DOM 结构中 4 | const frag = document.createDocumentFragment() 5 | 6 | for (let i = 0; i < 20; i++) { 7 | const li = document.createElement('li') 8 | li.innerHTML = `List item ${i}` 9 | 10 | // 先插入文档片段中 11 | frag.appendChild(li) 12 | } 13 | 14 | // 都完成之后,再统一插入到 DOM 结构中 15 | list.appendChild(frag) 16 | 17 | console.log(list) 18 | -------------------------------------------------------------------------------- /fast-interview-code/prod-env/debounce.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | debounce 演示 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/test0722.js: -------------------------------------------------------------------------------- 1 | function all(text) { 2 | return new Promise((resolve) => { 3 | run(text, resolve); 4 | }) 5 | } 6 | 7 | function run(text, resolve) { 8 | setTimeout(() => { 9 | i++; 10 | console.log(i); 11 | if (i == limit) { 12 | resolve(text); 13 | return; 14 | } 15 | run(text, resolve); 16 | }, 1000) 17 | } 18 | 19 | let i = 0; 20 | let limit = 2; 21 | 22 | all("hello").then((d) => { 23 | console.log(d); 24 | }); -------------------------------------------------------------------------------- /ES6-10/vue-lesson/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es6: true 5 | }, 6 | extends: [ 7 | 'plugin:vue/essential', 8 | 'standard' 9 | ], 10 | globals: { 11 | Atomics: 'readonly', 12 | SharedArrayBuffer: 'readonly' 13 | }, 14 | parserOptions: { 15 | ecmaVersion: 2018, 16 | sourceType: 'module' 17 | }, 18 | plugins: [ 19 | 'vue' 20 | ], 21 | rules: { 22 | 'generator-star-spacing': 'off' 23 | } 24 | } -------------------------------------------------------------------------------- /typescript/.prettierrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 120, //一行的字符数,如果超过会进行换行,默认为80 3 | tabWidth: 2, //一个tab代表几个空格数,默认为80 4 | useTabs: false, //是否使用tab进行缩进,默认为false,表示用空格进行缩减 5 | singleQuote: true, //字符串是否使用单引号,默认为false,使用双引号 6 | semi: false, //行位是否使用分号,默认为true 7 | trailingComma: 'es5', //是否使用尾逗号,有三个可选值"" 8 | bracketSpacing: true, //对象大括号直接是否有空格,默认为true,效果:{ foo: bar } 9 | arrowParens: 'always', // 箭头函数单个参数加分号 10 | bracketSameLine: true, 11 | }; 12 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/unique.js: -------------------------------------------------------------------------------- 1 | // // 传统方式 2 | // function unique(arr) { 3 | // const res = [] 4 | // arr.forEach(item => { 5 | // if (res.indexOf(item) < 0) { 6 | // res.push(item) 7 | // } 8 | // }) 9 | // return res 10 | // } 11 | 12 | // 使用 Set (无序,不能重复) 13 | function unique(arr) { 14 | const set = new Set(arr) 15 | return [...set] 16 | } 17 | 18 | const res = unique([30, 10, 20, 30, 40, 10]) 19 | console.log(res) 20 | 21 | 22 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | js 基础知识 演示 8 | 9 | 10 |

一段文字 1

11 |

一段文字 2

12 |

一段文字 3

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /fast-interview-code/prod-env/xss.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | xss 演示 8 | 9 | 10 |

一段文字1

11 |

一段文字2

12 |

一段文字3

13 | <script>alert(document.cookie);</script> 14 | 15 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/closure.js: -------------------------------------------------------------------------------- 1 | // 函数作为返回值 2 | // function create() { 3 | // const a = 100 4 | // return function () { 5 | // console.log(a) 6 | // } 7 | // } 8 | 9 | // const fn = create() 10 | // const a = 200 11 | // fn() // 100 12 | 13 | // 函数作为参数被传递 14 | function print(fn) { 15 | const a = 200 16 | fn() 17 | } 18 | const a = 100 19 | function fn() { 20 | console.log(a) 21 | } 22 | print(fn) // 100 23 | 24 | // 所有的自由变量的查找,是在函数定义的地方,向上级作用域查找 25 | // 不是在执行的地方!!! 26 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/README.md: -------------------------------------------------------------------------------- 1 | # vue-lesson 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | npm run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson5-2.js: -------------------------------------------------------------------------------- 1 | // Promise 生成器 2 | function Gen (time) { 3 | return new Promise((resolve, reject) => { 4 | setTimeout(function () { 5 | if (time < 500) { 6 | reject(time) 7 | } else { 8 | resolve(time) 9 | } 10 | }, time) 11 | }) 12 | } 13 | // 异步调用函数 无论成功还是失败都会执行 finally 的内容 14 | Gen(Math.random() * 1000) 15 | .then(val => console.log('resolve', val)) 16 | .catch(err => console.log('reject', err)) 17 | .finally(() => { 18 | console.log('finish') 19 | }) 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | *.swp 10 | 11 | pids 12 | logs 13 | results 14 | tmp 15 | 16 | # Build 17 | public/css/main.css 18 | 19 | # Coverage reports 20 | coverage 21 | 22 | # API keys and secrets 23 | .env 24 | 25 | # Dependency directory 26 | node_modules 27 | bower_components 28 | 29 | # Editors 30 | .idea 31 | *.iml 32 | 33 | # OS metadata 34 | .DS_Store 35 | Thumbs.db 36 | 37 | # Ignore built ts files 38 | dist/**/* 39 | 40 | # ignore yarn.lock 41 | yarn.lock -------------------------------------------------------------------------------- /ES6-10/webpack-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-test", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "@babel/core": "^7.8.3", 13 | "@babel/preset-env": "^7.8.3", 14 | "babel-loader": "^8.0.6", 15 | "html-webpack-plugin": "^3.2.0", 16 | "webpack": "^4.41.5", 17 | "webpack-cli": "^4.7.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /fast-interview-code/js-异步进阶/02-event-loop.md: -------------------------------------------------------------------------------- 1 | # event loop 2 | 3 | 图片可参考 ppt 4 | 5 | ```js 6 | console.log('Hi') 7 | 8 | setTimeout(function cb1() { 9 | console.log('cb1') // cb 即 callback 10 | }, 5000) 11 | 12 | console.log('Bye') 13 | ``` 14 | 15 | ------ 16 | 17 | DOM 事件,也用 event loop 18 | 19 | ```html 20 | 21 | 22 | 31 | ``` 32 | -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/src/index.js: -------------------------------------------------------------------------------- 1 | console.log('index js') 2 | 3 | // 导入 4 | import { fn, name } from './fn' 5 | fn() 6 | console.log('name is ', name) 7 | 8 | // 箭头函数 9 | const sum = (a, b) => a + b 10 | const result = sum(10, 20) 11 | console.log(result) 12 | 13 | // class 14 | class People { 15 | constructor(name) { 16 | this.name = name 17 | } 18 | sayHi() { 19 | console.log(`${this.name} say hi`) 20 | } 21 | } 22 | const zhangsan = new People('张三') 23 | console.log(zhangsan.sayHi()) 24 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson5-3.js: -------------------------------------------------------------------------------- 1 | // // spread 2 | // const input = { 3 | // a: 1, 4 | // b: 2 5 | // } 6 | 7 | // const test = { 8 | // d: 5 9 | // } 10 | 11 | // const output = { 12 | // // spread 扩展, 是深拷贝, 不是引用 13 | // ...input, 14 | // ...test, 15 | // c: 3 16 | // } 17 | 18 | // console.log(input, output) 19 | // input.a = 4 20 | // console.log(input, output) 21 | 22 | // rest 23 | const input = { 24 | a: 1, 25 | b: 2, 26 | c: 3, 27 | d: 4 28 | } 29 | 30 | const { a, b, ...rest } = input 31 | console.log(a, b, rest) 32 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/object.js: -------------------------------------------------------------------------------- 1 | const obj1 = { 2 | a: 10, 3 | b: 20, 4 | sum() { 5 | return this.a + this.b 6 | } 7 | } 8 | 9 | const obj2 = new Object({ 10 | a: 10, 11 | b: 20, 12 | sum() { 13 | return this.a + this.b 14 | } 15 | }) 16 | 17 | const obj21 = new Object(obj1) // obj1 === obj2 18 | 19 | const obj3 = Object.create(null) 20 | const obj4 = new Object() // {} 21 | 22 | const obj5 = Object.create({ 23 | a: 10, 24 | b: 20, 25 | sum() { 26 | return this.a + this.b 27 | } 28 | }) 29 | 30 | const obj6 = Object.create(obj1) 31 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/components/list.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 26 | 27 | 29 | -------------------------------------------------------------------------------- /fast-interview-code/css/11-line-height-继承.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | line-height 继承问题 8 | 18 | 19 | 20 |

这是一行文字

21 | 22 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/query.js: -------------------------------------------------------------------------------- 1 | // // 传统方式 2 | // function query(name) { 3 | // const search = location.search.substr(1) // 类似 array.slice(1) 4 | // // search: 'a=10&b=20&c=30' 5 | // const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i') 6 | // const res = search.match(reg) 7 | // if (res === null) { 8 | // return null 9 | // } 10 | // return res[2] 11 | // } 12 | // query('d') 13 | 14 | // URLSearchParams 15 | function query(name) { 16 | const search = location.search 17 | const p = new URLSearchParams(search) 18 | return p.get(name) 19 | } 20 | console.log( query('b') ) 21 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/jsonp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | jsonp 演示 8 | 9 | 10 |

一段文字 1

11 | 12 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/bind-demo.js: -------------------------------------------------------------------------------- 1 | // 模拟 bind 2 | Function.prototype.bind1 = function () { 3 | // 将参数拆解为数组 4 | const args = Array.prototype.slice.call(arguments) 5 | 6 | // 获取 this(数组第一项) 7 | const t = args.shift() 8 | 9 | // fn1.bind(...) 中的 fn1 10 | const self = this 11 | 12 | // 返回一个函数 13 | return function () { 14 | return self.apply(t, args) 15 | } 16 | } 17 | 18 | function fn1(a, b, c) { 19 | console.log('this', this) 20 | console.log(a, b, c) 21 | return 'this is fn1' 22 | } 23 | 24 | const fn2 = fn1.bind1({x: 100}, 10, 20, 30) 25 | const res = fn2() 26 | console.log(res) 27 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # JavaScript 学习笔记集和代码库 2 | 3 | ## 1. [JavaScript 从入门到精通.md](JavaScript从入门到精通+w3school.md) 4 | 5 | - [代码](JavaScript_code) 6 | 7 | ## 2. [再学 JavaScript ES6-10.md](JavaScriptES6-10.md) 8 | 9 | - [代码](ES6-10) 10 | 11 | ## 3. [JavaScript 高级程序设计第四版-笔记.md](JavaScript高级程序设计第四版-笔记.md) 12 | 13 | ## 4. [再学 JavaScript ES6-ES11.md](再学JavaScriptES6-ES11.md) 14 | 15 | ## 5. [HTML 前端工程师面试必备技巧.md](HTML前端工程师面试必备技巧.md) 16 | 17 | ## 6. [快速搞定前端技术一面 匹配大厂面试要求.md](快速搞定前端技术一面%20匹配大厂面试要求.md) 18 | 19 | - [代码](fast-interview-code) 20 | 21 | ## 7. [Typescript 学习笔记](Typescript学习笔记.md) 22 | 23 | - [支持热重载、代码格式化的 TypeScript 模板](typescript) 24 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-lesson 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /fast-interview-code/css/02-margin-纵向重叠.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | margin 纵向重叠 8 | 16 | 17 | 18 | 19 |

AAA

20 |

21 |

22 |

23 |

BBB

24 | 25 | 26 | -------------------------------------------------------------------------------- /fast-interview-code/prod-env/throttle.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | throttle 演示 8 | 15 | 16 | 17 |
可拖拽
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-2.js: -------------------------------------------------------------------------------- 1 | for (var i = 0; i < 3; i++) { 2 | setTimeout(function () { 3 | // console.log(i) 4 | }, 1000) 5 | } 6 | 7 | // console.log(a) 8 | // let a = 9 9 | // console.log(a) 10 | // let array = Array.from({ length: 5}, function () { return 1}) 11 | // console.log(array) 12 | // let array = Array.of(1, 4, 5, 2, 67) 13 | // console.log(array) 14 | // let array = Array(10).fill(1) 15 | // console.log(array.fill(9, 5, 8)) 16 | 17 | let array = Array.of(1, 4, 5, 2, 67) 18 | // let find = array.filter(function (item) { 19 | // return item % 2 === 0 20 | // }) 21 | let find = array.findIndex(function (item) { 22 | return item === 0 23 | }) 24 | console.log(find); -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson4-1.js: -------------------------------------------------------------------------------- 1 | // async function firstAsync () { 2 | // return 27 3 | // // return Promise.resolve(28) 4 | // } 5 | 6 | // firstAsync().then(val => { 7 | // console.log(val) 8 | // }) 9 | 10 | // console.log(firstAsync() instanceof Promise) 11 | 12 | // await 异步操作 13 | async function firstAsync () { 14 | let promise = new Promise((resolve, reject) => { 15 | setTimeout(function () { 16 | resolve('now it is done') 17 | }, 1000) 18 | }) 19 | console.log(await promise) 20 | console.log(await Promise.resolve(48)) 21 | console.log(2) 22 | return Promise.resolve(28) 23 | } 24 | 25 | firstAsync().then(val => { 26 | console.log(val) 27 | }) 28 | -------------------------------------------------------------------------------- /ES6-10/webpack-test/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const HtmlWebpackPlugin = require('html-webpack-plugin') 3 | 4 | module.exports = { 5 | entry: './index.js', 6 | output: { 7 | path: path.resolve(__dirname, 'dist'), 8 | filename: './index.min.js' 9 | }, 10 | mode: 'development', 11 | // mode: 'production', 12 | module: { 13 | rules: [{ 14 | test: /\.m?js$/, 15 | exclude: /(node_modules|bower_components)/, 16 | use: { 17 | loader: 'babel-loader', 18 | options: { 19 | presets: ['@babel/preset-env'] 20 | } 21 | } 22 | }] 23 | }, 24 | plugins: [ 25 | new HtmlWebpackPlugin() 26 | ] 27 | }; -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/RAF.js: -------------------------------------------------------------------------------- 1 | // 3s 把宽度从 100px 变为 640px ,即增加 540px 2 | // 60帧/s ,3s 180 帧 ,每次变化 3px 3 | 4 | const $div1 = $('#div1') 5 | let curWidth = 100 6 | const maxWidth = 640 7 | 8 | // // setTimeout 9 | // function animate() { 10 | // curWidth = curWidth + 3 11 | // $div1.css('width', curWidth) 12 | // if (curWidth < maxWidth) { 13 | // setTimeout(animate, 16.7) // 自己控制时间 14 | // } 15 | // } 16 | // animate() 17 | 18 | // RAF 19 | function animate() { 20 | curWidth = curWidth + 3 21 | $div1.css('width', curWidth) 22 | if (curWidth < maxWidth) { 23 | window.requestAnimationFrame(animate) // 时间不用自己控制 24 | } 25 | } 26 | animate() 27 | -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "build": "webpack --config webpack.prod.js", 9 | "dev": "webpack-dev-server" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "devDependencies": { 15 | "@babel/core": "^7.6.2", 16 | "@babel/preset-env": "^7.6.2", 17 | "babel-loader": "^8.0.6", 18 | "html-webpack-plugin": "^3.2.0", 19 | "webpack": "^4.41.0", 20 | "webpack-cli": "^3.3.9", 21 | "webpack-dev-server": "^3.8.1" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ES6-10/.gitignore: -------------------------------------------------------------------------------- 1 | # Numerous always-ignore extensions 2 | *.bak 3 | *.patch 4 | *.diff 5 | *.err 6 | 7 | # temp file for git conflict merging 8 | *.orig 9 | *.log 10 | *.rej 11 | *.swo 12 | *.swp 13 | # *.zip 14 | *.vi 15 | *~ 16 | *.sass-cache 17 | *.tmp.html 18 | *.dump 19 | 20 | # OS or Editor folders 21 | .DS_Store 22 | ._* 23 | .cache 24 | # .project 25 | # .settings 26 | .tmproj 27 | *.esproj 28 | *.sublime-project 29 | *.sublime-workspace 30 | nbproject 31 | thumbs.db 32 | *.iml 33 | 34 | # Folders to ignore 35 | .hg 36 | .svn 37 | .CVS 38 | .idea 39 | node_modules/ 40 | jscoverage_lib/ 41 | bower_components/ 42 | # dist/ 43 | -------------------------------------------------------------------------------- /fast-interview-code/css/01-盒模型.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 盒模型 8 | 17 | 18 | 19 |
this is div1
20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /typescript/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', // 定义ESLint的解析器 3 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], // 定义文件继承的子规范 4 | plugins: ['prettier'], // 定义了该eslint文件所依赖的插件 5 | env: { 6 | // 指定代码的运行环境 7 | browser: true, 8 | node: true, 9 | es2021: true, 10 | }, 11 | parserOptions: { 12 | // 指定ESLint可以解析JSX语法 13 | ecmaFeatures: { 14 | jsx: true, 15 | }, 16 | ecmaVersion: 'latest', 17 | sourceType: 'module', 18 | }, 19 | rules: { 20 | 'no-console': 'off', 21 | 'import/prefer-default-export': 'off', 22 | '@typescript-eslint/no-unused-vars': 'warn', 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /fast-interview-code/css/14-vw-wh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | vw vh test 7 | 19 | 20 | 21 |

vw vh 测试

22 |
23 |
24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "dev:ts": "nodemon src/index.ts", 7 | "dev:js": "nodemon src/index.js", 8 | "lint": "eslint ./src --fix" 9 | }, 10 | "author": "", 11 | "type": "module", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "@types/node": "^18.6.5", 15 | "@typescript-eslint/eslint-plugin": "^5.33.0", 16 | "@typescript-eslint/parser": "^5.33.0", 17 | "eslint": "^8.21.0", 18 | "eslint-config-prettier": "^8.5.0", 19 | "eslint-plugin-prettier": "^4.2.1", 20 | "nodemon": "^2.0.19", 21 | "prettier": "^2.7.1", 22 | "ts-node": "^10.9.1", 23 | "typescript": "^4.7.4" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-6.js: -------------------------------------------------------------------------------- 1 | // const s = 'a_aa_aaa_aa_a' 2 | // const r1 = /a+/g 3 | // const r2 = /a+/y 4 | // console.log(r1.exec(s)) 5 | // console.log(r2.exec(s)) 6 | // console.log(r1.exec(s)) 7 | // console.log(r2.exec(s)) 8 | 9 | // unicode u修饰符 大于 \uffff 10 | let s = '𠮷' 11 | let s2 = '\uD842\uDF87' 12 | 13 | console.log(/^\uD842/.test(s2)) 14 | console.log(/^\uD842/u.test(s2)) // 无法匹配 15 | 16 | console.log(/^.$/.test(s)) // 无法匹配 17 | console.log(/^.$/u.test(s)) // 正确匹配, 使用 "." 大于两个字节要加 u 18 | 19 | console.log(/^\u{20BB7}$/u.test(s)) 20 | console.log(/^\u{61}$/u.test('a')) // 使用码点时,加 u 才能匹配 \u 21 | 22 | console.log(/𠮷{2}/u.test('𠮷𠮷')) // 加 u 才能匹配,所有中文都加 u 23 | 24 | console.log(/[a-z]/i.test('\u212A')) 25 | console.log(/[a-z]/iu.test('\u212A')) 26 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 真题演示 8 | 9 | 16 | 17 | 18 |

JS 真题演示

19 | 20 |
21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/class-demo-1.js: -------------------------------------------------------------------------------- 1 | // 类 2 | class Student { 3 | constructor(name, number) { 4 | this.name = name 5 | this.number = number 6 | // this.gender = 'male' 7 | } 8 | sayHi() { 9 | console.log( 10 | `姓名 ${this.name} ,学号 ${this.number}` 11 | ) 12 | // console.log( 13 | // '姓名 ' + this.name + ' ,学号 ' + this.number 14 | // ) 15 | } 16 | // study() { 17 | 18 | // } 19 | } 20 | 21 | // 通过类 new 对象/实例 22 | const xialuo = new Student('夏洛', 100) 23 | console.log(xialuo.name) 24 | console.log(xialuo.number) 25 | xialuo.sayHi() 26 | 27 | const madongmei = new Student('马冬梅', 101) 28 | console.log(madongmei.name) 29 | console.log(madongmei.number) 30 | madongmei.sayHi() 31 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/scope.js: -------------------------------------------------------------------------------- 1 | // // 自由变量示例 —— 内存会被释放 2 | // let a = 0 3 | // function fn1() { 4 | // let a1 = 100 5 | 6 | // function fn2() { 7 | // let a2 = 200 8 | 9 | // function fn3() { 10 | // let a3 = 300 11 | // return a + a1 + a2 + a3 12 | // } 13 | // fn3() 14 | // } 15 | // fn2() 16 | // } 17 | // fn1() 18 | 19 | // // 闭包 函数作为返回值 —— 内存不会被释放 20 | // function create() { 21 | // let a = 100 22 | // return function () { 23 | // console.log(a) 24 | // } 25 | // } 26 | // let fn = create() 27 | // let a = 200 28 | // fn() // 100 29 | 30 | function print(fn) { 31 | let a = 200 32 | fn() 33 | } 34 | let a = 100 35 | function fn() { 36 | console.log(a) 37 | } 38 | print(fn) // 100 -------------------------------------------------------------------------------- /ES6-10/vue-lesson/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // 必须配置, 固定语法 3 | devServer: { 4 | proxy: { 5 | '/user': { 6 | target: 'http://localhost:8081', 7 | pathRewrite: { 8 | '/user': '/src/mock/user.json' 9 | } 10 | }, 11 | '/list': { 12 | target: 'http://localhost:8081', 13 | pathRewrite: { 14 | '/list': '/src/mock/list.json' 15 | } 16 | }, 17 | '/proxy': { 18 | target: 'http://localhost:8081', 19 | pathRewrite: { 20 | '/proxy': '/src/mock/proxy.json' 21 | } 22 | }, 23 | '/author': { 24 | target: 'http://localhost:8081', 25 | pathRewrite: { 26 | '/author': '/src/mock/author.json' 27 | } 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /fast-interview-code/css/04-bfc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 19 | 20 | 21 |
22 | 23 |

某一段文字……

24 |
25 | 26 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/dom-2.js: -------------------------------------------------------------------------------- 1 | const div1 = document.getElementById('div1') 2 | const div2 = document.getElementById('div2') 3 | 4 | // 新建节点 5 | const newP = document.createElement('p') 6 | newP.innerHTML = 'this is newP' 7 | // 插入节点 8 | div1.appendChild(newP) 9 | 10 | // 移动节点 11 | const p1 = document.getElementById('p1') 12 | div2.appendChild(p1) 13 | 14 | // 获取父元素 15 | console.log( p1.parentNode ) 16 | 17 | // 获取子元素列表 18 | const div1ChildNodes = div1.childNodes 19 | console.log( div1.childNodes ) 20 | const div1ChildNodesP = Array.prototype.slice.call(div1.childNodes).filter(child => { 21 | if (child.nodeType === 1) { 22 | return true 23 | } 24 | return false 25 | }) 26 | console.log('div1ChildNodesP', div1ChildNodesP) 27 | 28 | div1.removeChild( div1ChildNodesP[0] ) 29 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 25 | 26 | 36 | -------------------------------------------------------------------------------- /fast-interview-code/prod-env/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 运行环境 演示 8 | 9 | 10 |

一段文字 1

11 |

一段文字 2

12 |

一段文字 3

13 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/test0621.js: -------------------------------------------------------------------------------- 1 | const waitFor = (ms) => new Promise(r => setTimeout(r, ms)); 2 | 3 | // function func() { 4 | // [1, 2, 3].forEach(async (num) => { 5 | // await waitFor(1000); 6 | // console.log(num); 7 | // }); 8 | // console.log('Done'); 9 | // } 10 | // async function func() { 11 | // const array = [1, 2, 3]; 12 | // for (let index = 0; index < array.length; index++) { 13 | // await waitFor(1000); 14 | // console.log(index); 15 | // } 16 | // console.log('Done'); 17 | // } 18 | // func() 19 | 20 | // const waitFor = (ms) => new Promise(r => setTimeout(r, ms)); 21 | // [1, 2, 3].forEach(async (num) => { 22 | // await waitFor(1000); 23 | // console.log(num); 24 | // }); 25 | // console.log('Done'); 26 | 27 | // function waitFor(foo, ms) { 28 | // return new Promise((r, s) => setInterval(foo, ms)); 29 | // } -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/webpack.prod.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const HtmlWebpackPlugin = require('html-webpack-plugin') 3 | 4 | module.exports = { 5 | mode: 'production', 6 | entry: path.join(__dirname, 'src', 'index'), 7 | output: { 8 | filename: 'bundle.[contenthash].js', 9 | path: path.join(__dirname, 'dist') 10 | }, 11 | module: { 12 | rules: [ 13 | { 14 | test: /\.js$/, 15 | loader: ['babel-loader'], 16 | include: path.join(__dirname, 'src'), 17 | exclude: /node_modules/ 18 | }, 19 | ] 20 | }, 21 | plugins: [ 22 | new HtmlWebpackPlugin({ 23 | template: path.join(__dirname, 'src', 'index.html'), 24 | filename: 'index.html' 25 | }) 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-14.js: -------------------------------------------------------------------------------- 1 | // import name, { addr as addr2, arr } from './lesson2-14-mod' 2 | // console.log(name, addr2, arr) 3 | 4 | // import name2 from './lesson2-14-mod' 5 | // console.log(name2) 6 | 7 | // 导入函数 8 | import { say, run } from './lesson2-14-mod' 9 | say('hello world') 10 | run() 11 | 12 | // 导入对象 13 | // import obj from './lesson2-14-mod' 14 | // let { data, des } = obj 15 | // console.log(data, des) 16 | 17 | // 导入类 18 | // // import { Test } from './lesson2-14-mod' 19 | // import Test from './lesson2-14-mod' 20 | // let test = new Test() 21 | // console.log(test.id) 22 | 23 | // 批量导入 24 | // import * as Mod from './lesson2-14-mod' 25 | // let test = new Mod.Test() 26 | // console.log(test.id) 27 | // let animal = new Mod.Animal() 28 | // console.log(animal.name) 29 | // let people = new Mod.default() 30 | // console.log(people.id) 31 | -------------------------------------------------------------------------------- /fast-interview-code/myTest/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |
11 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /fast-interview-code/prod-env/throttle.js: -------------------------------------------------------------------------------- 1 | const div1 = document.getElementById('div1') 2 | 3 | // let timer = null 4 | // div1.addEventListener('drag', function (e) { 5 | // if (timer) { 6 | // return 7 | // } 8 | // timer = setTimeout(() => { 9 | // console.log(e.offsetX, e.offsetY) 10 | 11 | // timer = null 12 | // }, 100) 13 | // }) 14 | 15 | // 节流 16 | function throttle(fn, delay = 100) { 17 | let timer = null 18 | 19 | return function () { 20 | if (timer) { 21 | return 22 | } 23 | timer = setTimeout(() => { 24 | fn.apply(this, arguments) 25 | timer = null 26 | }, delay) 27 | } 28 | } 29 | 30 | div1.addEventListener('drag', throttle(function (e) { 31 | console.log(e.offsetX, e.offsetY) 32 | })) 33 | 34 | div1.addEventListener('drag', function(event) { 35 | 36 | }) 37 | -------------------------------------------------------------------------------- /fast-interview-code/prod-env/debounce.js: -------------------------------------------------------------------------------- 1 | const input1 = document.getElementById('input1') 2 | 3 | // let timer = null 4 | // input1.addEventListener('keyup', function () { 5 | // if (timer) { 6 | // clearTimeout(timer) 7 | // } 8 | // timer = setTimeout(() => { 9 | // // 模拟触发 change 事件 10 | // console.log(input1.value) 11 | 12 | // // 清空定时器 13 | // timer = null 14 | // }, 500) 15 | // }) 16 | 17 | // 防抖 18 | function debounce(fn, delay = 500) { 19 | // timer 是闭包中的 20 | let timer = null 21 | 22 | return function () { 23 | if (timer) { 24 | clearTimeout(timer) 25 | } 26 | timer = setTimeout(() => { 27 | fn.apply(this, arguments) 28 | timer = null 29 | }, delay) 30 | } 31 | } 32 | 33 | input1.addEventListener('keyup', debounce(function (e) { 34 | console.log(e.target) 35 | console.log(input1.value) 36 | }, 600)) 37 | -------------------------------------------------------------------------------- /fast-interview-code/css/12-rem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | rem 演示 8 | 18 | 19 | 20 | 21 |

rem 1

22 |

rem 1

23 |

rem 1

24 | 25 |
26 | this is div1 27 |
28 |
29 | this is div2 30 |
31 |
32 | this is div3 33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/dom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | dom 演示 8 | 9 | 17 | 18 | 19 |
20 |

一段文字 1

21 |

一段文字 2

22 |

一段文字 3

23 |
24 |
25 | 26 |
27 |
    28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-7.js: -------------------------------------------------------------------------------- 1 | // const a = 20 2 | // const b = 10 3 | // const c = 'javascript' 4 | 5 | // // const str = 'my age is ' + (a + b) + ' i love' + c 6 | // const str = `my age is ${a + b} i love ${c}` 7 | // console.log(str) 8 | 9 | // const retailPrice = 20 10 | // const wholeSalePrice = 16 11 | // const type = 'retail' 12 | // let showTxt = '' 13 | // if (type === 'retail') { 14 | // showTxt = '单价是:' + retailPrice 15 | // } else { 16 | // showTxt = '批发价是:' + wholeSalePrice 17 | // } 18 | // console.log(showTxt) 19 | 20 | function Price (strings, type) { 21 | let s1 = strings[0] 22 | const retailPrice = 20 23 | const wholeSalePrice = 16 24 | let showTxt = '' 25 | if (type === 'retail') { 26 | showTxt = '单价是:' + retailPrice 27 | } else { 28 | showTxt = '批发价是:' + wholeSalePrice 29 | } 30 | return `${s1}${showTxt}` 31 | } 32 | let showTxt = Price`您此次的${'retail'}` 33 | console.log(showTxt) 34 | 35 | let s1 = `我是第一行 36 | 我是第二行` 37 | console.log(s1) 38 | -------------------------------------------------------------------------------- /JavaScript_code/26.面向对象的拖拽.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 面对对象的拖拽 7 | 8 | 25 | 26 | 27 | 33 | 34 | 35 | 36 |
普通拖拽
37 |
限制范围的拖拽
38 | 39 | 40 | -------------------------------------------------------------------------------- /JavaScript_code/lib/LimitDrag.js: -------------------------------------------------------------------------------- 1 | // 继承属性 2 | function LimitDrag(id) { 3 | Drag.call(this, id); 4 | } 5 | // 继承原型 6 | for (var i in Drag.prototype) { 7 | LimitDrag.prototype[i] = Drag.prototype[i]; 8 | } 9 | 10 | LimitDrag.prototype.mouseMove = function(ev) { 11 | // 不断获取Event 对象,坐标才会不断更新 12 | var ev = event||ev; 13 | // console.log('可视区鼠标X:', ev.clientX, '鼠标Y:',ev.clientY); 14 | // div位置 = 鼠标可视区新的位置 - 鼠标与div的距离 15 | var l = ev.clientX - this.disX; 16 | var t = ev.clientY - this.disY; 17 | if (l < 0) { 18 | l = 0; 19 | } else if (l > document.documentElement.clientWidth - this.oDiv.offsetWidth) { 20 | l = document.documentElement.clientWidth - this.oDiv.offsetWidth; 21 | } 22 | if ( t < 0) { 23 | t = 0; 24 | } else if (t > document.documentElement.clientHeight - this.oDiv.offsetHeight) { 25 | t = document.documentElement.clientHeight - this.oDiv.offsetHeight; 26 | } 27 | this.oDiv.style.top = t + 'px'; 28 | this.oDiv.style.left = l + 'px'; 29 | } -------------------------------------------------------------------------------- /fast-interview-code/js-base/deepClone.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 深拷贝 3 | */ 4 | 5 | const obj1 = { 6 | age: 20, 7 | name: 'xxx', 8 | address: { 9 | city: 'beijing' 10 | }, 11 | arr: ['a', 'b', 'c'] 12 | } 13 | 14 | const obj2 = deepClone(obj1) 15 | obj2.address.city = 'shanghai' 16 | obj2.arr[0] = 'a1' 17 | console.log(obj1.address.city) 18 | console.log(obj1.arr[0]) 19 | 20 | /** 21 | * 深拷贝 22 | * @param {Object} obj 要拷贝的对象 23 | */ 24 | function deepClone(obj = {}) { 25 | if (typeof obj !== 'object' || obj == null) { 26 | // obj 是 null ,或者不是对象和数组,直接返回 27 | return obj 28 | } 29 | 30 | // 初始化返回结果 31 | let result 32 | if (obj instanceof Array) { 33 | result = [] 34 | } else { 35 | result = {} 36 | } 37 | 38 | for (let key in obj) { 39 | // 保证 key 不是原型的属性 40 | if (obj.hasOwnProperty(key)) { 41 | // 递归调用!!! 42 | result[key] = deepClone(obj[key]) 43 | } 44 | } 45 | 46 | // 返回结果 47 | return result 48 | } 49 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/class-demo-2.js: -------------------------------------------------------------------------------- 1 | // 父类 2 | class People { 3 | constructor(name) { 4 | this.name = name 5 | } 6 | eat() { 7 | console.log(`${this.name} eat something`) 8 | } 9 | } 10 | 11 | // 子类 12 | class Student extends People { 13 | constructor(name, number) { 14 | super(name) 15 | this.number = number 16 | } 17 | sayHi() { 18 | console.log(`姓名 ${this.name} 学号 ${this.number}`) 19 | } 20 | } 21 | 22 | // 子类 23 | class Teacher extends People { 24 | constructor(name, major) { 25 | super(name) 26 | this.major = major 27 | } 28 | teach() { 29 | console.log(`${this.name} 教授 ${this.major}`) 30 | } 31 | } 32 | 33 | // 实例 34 | const xialuo = new Student('夏洛', 100) 35 | console.log(xialuo.name) 36 | console.log(xialuo.number) 37 | xialuo.sayHi() 38 | xialuo.eat() 39 | 40 | // 实例 41 | const wanglaoshi = new Teacher('王老师', '语文') 42 | console.log(wanglaoshi.name) 43 | console.log(wanglaoshi.major) 44 | wanglaoshi.teach() 45 | wanglaoshi.eat() 46 | -------------------------------------------------------------------------------- /ES6-10/ES2019/app.js: -------------------------------------------------------------------------------- 1 | import Koa from 'koa' 2 | import path from 'path' 3 | import BodyParser from 'koa-bodyparser' 4 | import Views from 'koa-ejs' 5 | import Static from 'koa-static' 6 | import webpackConfig from './webpack.config.babel.js' 7 | import webpack from 'webpack' 8 | import webpackDevMiddleware from 'koa-webpack-dev-middleware' 9 | import webpackHotMiddleware from 'koa-webpack-hot-middleware' 10 | import Users from './routes/user.js' 11 | 12 | const app = new Koa() 13 | 14 | Views(app, { 15 | root: path.join(__dirname, 'views'), 16 | layout: 'layout', 17 | viewExt: 'ejs', 18 | cache: false, 19 | debug: false 20 | }) 21 | 22 | const compiler = webpack(webpackConfig) 23 | 24 | const wdm = webpackDevMiddleware(compiler, { 25 | noInfo: true 26 | // publicPath: config.output.publicPath 27 | }) 28 | app.use(wdm) 29 | app.use(webpackHotMiddleware(compiler)) 30 | app.use(Static(path.join(__dirname, 'static'))) 31 | app.use(BodyParser()) 32 | 33 | app.use(Users.routes()).use(Users.allowedMethods()) 34 | app.listen(8080) 35 | 36 | global.console.log(`server is listen, http://localhost:8080`) -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const HtmlWebpackPlugin = require('html-webpack-plugin') 3 | 4 | module.exports = { 5 | // mode 可选 development 或 production ,默认为后者 6 | // production 会默认压缩代码并进行其他优化(如 tree shaking) 7 | mode: 'development', 8 | entry: path.join(__dirname, 'src', 'index'), 9 | output: { 10 | filename: 'bundle.js', 11 | path: path.join(__dirname, 'dist') 12 | }, 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.js$/, 17 | loader: ['babel-loader'], 18 | include: path.join(__dirname, 'src'), 19 | exclude: /node_modules/ 20 | }, 21 | ] 22 | }, 23 | plugins: [ 24 | new HtmlWebpackPlugin({ 25 | template: path.join(__dirname, 'src', 'index.html'), 26 | filename: 'index.html' 27 | }) 28 | ], 29 | devServer: { 30 | port: 3000, 31 | contentBase: path.join(__dirname, 'dist'), // 根目录 32 | open: true, // 自动打开浏览器 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /fast-interview-code/css/08-定位.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | absote relative 定位问题 8 | 31 | 32 | 33 | 34 |

absolute 和 relative 定位问题

35 |
36 |
37 | this is absolute 38 |
39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/dom-1.js: -------------------------------------------------------------------------------- 1 | // const div1 = document.getElementById('div1') 2 | // console.log('div1', div1) 3 | 4 | // const divList = document.getElementsByTagName('div') // 集合 5 | // console.log('divList.length', divList.length) 6 | // console.log('divList[1]', divList[1]) 7 | 8 | // const containerList = document.getElementsByClassName('container') // 集合 9 | // console.log('containerList.length', containerList.length) 10 | // console.log('containerList[1]', containerList[1]) 11 | 12 | // const pList = document.querySelectorAll('p') 13 | // console.log('pList', pList) 14 | 15 | // const pList = document.querySelectorAll('p') 16 | // const p1 = pList[0] 17 | 18 | // // property 形式 19 | // p1.style.width = '100px' 20 | // console.log( p1.style.width ) 21 | // p1.className = 'red' 22 | // console.log( p1.className ) 23 | // console.log(p1.nodeName) 24 | // console.log(p1.nodeType) // 1 25 | 26 | // // attribute 27 | // p1.setAttribute('data-name', 'imooc') 28 | // console.log( p1.getAttribute('data-name') ) 29 | // p1.setAttribute('style', 'font-size: 50px;') 30 | // console.log( p1.getAttribute('style') ) 31 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson4-2.js: -------------------------------------------------------------------------------- 1 | let grade = { 2 | 'lilei': 95, 3 | 'hanmei': 97, 4 | 'lisi': 99 5 | } 6 | 7 | // Iterator方式遍历 8 | // grade[Symbol.iterator] = function () { 9 | // let All = this 10 | // let keys = Reflect.ownKeys(grade) 11 | // let values = [] 12 | // console.log(All, keys, values.length, '内部数据') 13 | // return { 14 | // next () { 15 | // if (!values.length) { 16 | // if (keys.length - 1) { 17 | // values.push(All[keys[0]]) 18 | // keys.shift() 19 | // // console.log(values, values.length, All[keys[0]], keys, '内部') 20 | // } 21 | // } 22 | // return { 23 | // done: !values.length, 24 | // value: values.shift() 25 | // } 26 | // } 27 | // } 28 | // } 29 | // let result = [] 30 | // for (let v of grade) { 31 | // result.push(v) 32 | // } 33 | // console.log(result) 34 | 35 | // ES6方式遍历 36 | // let r = [] 37 | // for (let [, v] of Object.entries(grade)) { 38 | // r.push(v) 39 | // } 40 | // console.log(r) 41 | 42 | // ES8方式 43 | console.log(Object.keys(grade)) 44 | console.log(Object.values(grade)) 45 | console.log(Object.entries(grade)) 46 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson5-4.js: -------------------------------------------------------------------------------- 1 | // 正则后面加 s 增强点的匹配能力 \ 2 | // 四字节字符则加 u, ES6中已经讲过 3 | // console.log(/foo.bar/s.test('foo\nbar')) 4 | // console.log(/foo.bar/.test('foo\nbar')) 5 | 6 | // // 是否启用 dotAll 模式 7 | // const re = /foo.bar/sgiu 8 | // console.log(re.dotAll) 9 | // // 查看修饰符 10 | // console.log(re.flags) 11 | 12 | // 命名分组捕获 13 | // // console.log('12-2019-06-07'.match(/(\d{4})-(\d{2})-(\d{2})/)) 14 | 15 | // const t = '12-2019-06-07'.match(/(?\d{4})-(?\d{2})-(?\d{2})/) 16 | // // console.log(t[1]) 17 | // // console.log(t[2]) 18 | // // console.log(t[3]) 19 | // console.log(t) 20 | // console.log(t.groups.year, t.groups.mouth, t.groups.day) 21 | 22 | // 先行断言 23 | let test = 'hello world' 24 | console.log(test.match(/hello(?=\sworld)/)) 25 | // 后行断言 26 | console.log(test.match(/(?<=hello\s)world/)) 27 | 28 | // 1. 请把 `'$foo %foo foo'`字符串中前面是$符号的foo 替换成bar 29 | const re = /(?<=\$)foo/ 30 | let str = '$foo %foo foo' 31 | // console.log(re.test(str)) 32 | str = str.replace(re, 'bar') 33 | console.log(str) 34 | 35 | // 2. 请提取 `'$1 is worth about ¥123'` 36 | const re2 = /(?<=\$)\d/ 37 | let str2 = '$1 is worth about ¥123' 38 | str2 = str2.match(re2) 39 | console.log(str2) 40 | -------------------------------------------------------------------------------- /fast-interview-code/css/07-色子.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | flex 画骰子 8 | 34 | 35 | 36 |
37 | 38 | 39 | 40 |
41 | 42 | -------------------------------------------------------------------------------- /JavaScript_code/28.0.cookie基础与应用.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | cookie 6 | 8 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /JavaScript_code/19.1.键盘事件仿select下拉框.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 键盘事件和仿select下拉框 7 | 8 | 17 | 38 | 39 | 40 | 41 | 42 |
43 | 44 | 45 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/event.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 事件 演示 8 | 15 | 16 | 17 | 18 | 19 | 29 | 30 |
31 | a1
32 | a2
33 | a3
34 | a4
35 | 36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /JavaScript_code/lib/Drag.js: -------------------------------------------------------------------------------- 1 | function Drag(id) { 2 | this.disX = ''; 3 | this.disY = ''; 4 | this.oDiv = document.getElementById(id); 5 | var _this = this; 6 | this.oDiv.onmousedown = function (ev) { 7 | _this.fnDown(ev); 8 | return false; 9 | }; 10 | } 11 | Drag.prototype.fnDown = function (ev) { 12 | var ev = event||ev; 13 | var _this = this; 14 | // 鼠标可视区位置 - div左边距 = 鼠标在div内的位置 15 | this.disX = ev.clientX - this.oDiv.offsetLeft; 16 | this.disY = ev.clientY - this.oDiv.offsetTop; 17 | console.log(this.disX,'可视区鼠标X:', ev.clientX, '鼠标Y:',ev.clientY); 18 | document.onmousemove = function (ev) { 19 | _this.mouseMove(ev); 20 | } 21 | document.onmouseup = function (ev) { 22 | _this.mouseUp(ev); 23 | } 24 | } 25 | Drag.prototype.mouseMove = function(ev) { 26 | // 不断获取Event 对象,坐标才会不断更新 27 | var ev = event||ev; 28 | // console.log('可视区鼠标X:', ev.clientX, '鼠标Y:',ev.clientY); 29 | // div位置 = 鼠标可视区新的位置 - 鼠标与div的距离 30 | this.oDiv.style.left = ev.clientX - this.disX + 'px'; 31 | this.oDiv.style.top = ev.clientY - this.disY + 'px'; 32 | } 33 | Drag.prototype.mouseUp = function () { 34 | document.onmousemove = ''; 35 | document.onmouseup = ''; 36 | } -------------------------------------------------------------------------------- /fast-interview-code/js-base/jquery-demo.js: -------------------------------------------------------------------------------- 1 | class jQuery { 2 | constructor(selector) { 3 | const result = document.querySelectorAll(selector) 4 | const length = result.length 5 | for (let i = 0; i < length; i++) { 6 | this[i] = result[i] 7 | } 8 | this.length = length 9 | this.selector = selector 10 | } 11 | get(index) { 12 | return this[index] 13 | } 14 | each(fn) { 15 | for (let i = 0; i < this.length; i++) { 16 | const elem = this[i] 17 | fn(elem) 18 | } 19 | } 20 | on(type, fn) { 21 | return this.each(elem => { 22 | elem.addEventListener(type, fn, false) 23 | }) 24 | } 25 | // 扩展很多 DOM API 26 | } 27 | 28 | // 插件 29 | jQuery.prototype.dialog = function (info) { 30 | alert(info) 31 | } 32 | 33 | // “造轮子” 34 | class myJQuery extends jQuery { 35 | constructor(selector) { 36 | super(selector) 37 | } 38 | // 扩展自己的方法 39 | addClass(className) { 40 | 41 | } 42 | style(data) { 43 | 44 | } 45 | } 46 | 47 | // const $p = new jQuery('p') 48 | // $p.get(1) 49 | // $p.each((elem) => console.log(elem.nodeName)) 50 | // $p.on('click', () => alert('clicked')) 51 | -------------------------------------------------------------------------------- /fast-interview-code/css/13-响应式.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 响应式布局 8 | 37 | 38 | 39 |
40 | this is div 41 |
42 | 43 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/isEqual.js: -------------------------------------------------------------------------------- 1 | // 判断是否是对象或数组 2 | function isObject(obj) { 3 | return typeof obj === 'object' && obj !== null 4 | } 5 | // 全相等(深度) 6 | function isEqual(obj1, obj2) { 7 | if (!isObject(obj1) || !isObject(obj2)) { 8 | // 值类型(注意,参与 equal 的一般不会是函数) 9 | return obj1 === obj2 10 | } 11 | if (obj1 === obj2) { 12 | return true 13 | } 14 | // 两个都是对象或数组,而且不相等 15 | // 1. 先取出 obj1 和 obj2 的 keys ,比较个数 16 | const obj1Keys = Object.keys(obj1) 17 | const obj2Keys = Object.keys(obj2) 18 | if (obj1Keys.length !== obj2Keys.length) { 19 | return false 20 | } 21 | // 2. 以 obj1 为基准,和 obj2 一次递归比较 22 | for (let key in obj1) { 23 | // 比较当前 key 的 val —— 递归!!! 24 | const res = isEqual(obj1[key], obj2[key]) 25 | if (!res) { 26 | return false 27 | } 28 | } 29 | // 3. 全相等 30 | return true 31 | } 32 | 33 | // 测试 34 | const obj1 = { 35 | a: 100, 36 | b: { 37 | x: 100, 38 | y: 200 39 | } 40 | } 41 | const obj2 = { 42 | a: 100, 43 | b: { 44 | x: 100, 45 | y: 200 46 | } 47 | } 48 | // console.log( obj1 === obj2 ) 49 | console.log( isEqual(obj1, obj2) ) 50 | 51 | const arr1 = [1, 2, 3] 52 | const arr2 = [1, 2, 3, 4] 53 | -------------------------------------------------------------------------------- /typescript/src/nowcoder/microTask.js: -------------------------------------------------------------------------------- 1 | // 面试题目一 2 | 3 | function events() { 4 | async function async1() { 5 | console.log('async1 start') // 2 6 | await async2() 7 | console.log('async1 end') // 7 8 | } 9 | 10 | async function async2() { 11 | console.log('async2') // 3 12 | } 13 | 14 | console.log('script start') // 1 15 | 16 | setTimeout(function () { 17 | console.log('setTimeout0') 18 | }, 0) // 12 19 | 20 | setTimeout(function () { 21 | console.log('setTimeout2') 22 | }, 300) // 13 23 | 24 | setImmediate(() => console.log('setImmediate')) // 11 25 | 26 | process.nextTick(() => console.log('nextTick1')) // 9 27 | 28 | async1() // 2 29 | 30 | new Promise(function (resolve) { 31 | console.log('promise1') // 4 32 | resolve() 33 | console.log('promise2') // 5 34 | }).then(function () { 35 | console.log('promise3') // 8 36 | }) 37 | 38 | process.nextTick(() => console.log('nextTick2')) // 10 39 | 40 | console.log('script end') // 6 41 | } 42 | // events() 43 | 44 | /** 45 | * script start 46 | async1 start 47 | async2 48 | promise1 49 | promise2 50 | script end 51 | async1 end 52 | promise3 53 | nextTick1 54 | nextTick2 55 | setImmediate 56 | setTimeout0 57 | setTimeout2 58 | */ 59 | -------------------------------------------------------------------------------- /fast-interview-code/js-base/promise-demo.js: -------------------------------------------------------------------------------- 1 | function loadImg(src) { 2 | const p = new Promise( 3 | (resolve, reject) => { 4 | const img = document.createElement('img') 5 | img.onload = () => { 6 | resolve(img) 7 | } 8 | img.onerror = () => { 9 | const err = new Error(`图片加载失败 ${src}`) 10 | reject(err) 11 | } 12 | img.src = src 13 | } 14 | ) 15 | return p 16 | } 17 | 18 | // const url = 'https://img.mukewang.com/5a9fc8070001a82402060220-140-140.jpg' 19 | // loadImg(url).then(img => { 20 | // console.log(img.width) 21 | // return img 22 | // }).then(img => { 23 | // console.log(img.height) 24 | // }).catch(ex => console.error(ex)) 25 | 26 | const url1 = 'https://img.mukewang.com/5a9fc8070001a82402060220-140-140.jpg' 27 | const url2 = 'https://img3.mukewang.com/5a9fc8070001a82402060220-100-100.jpg' 28 | 29 | loadImg(url1).then(img1 => { 30 | console.log(img1.width) 31 | return img1 // 普通对象 32 | }).then(img1 => { 33 | console.log(img1.height) 34 | return loadImg(url2) // promise 实例 35 | }).then(img2 => { 36 | console.log(img2.width) 37 | return img2 38 | }).then(img2 => { 39 | console.log(img2.height) 40 | }).catch(ex => console.error(ex)) 41 | -------------------------------------------------------------------------------- /JavaScript_code/24.基础面对对象.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 面对对象基础 6 | 8 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /fast-interview-code/js-web-api/ajax.js: -------------------------------------------------------------------------------- 1 | // const xhr = new XMLHttpRequest() 2 | // xhr.open('GET', '/data/test.json', true) 3 | // xhr.onreadystatechange = function () { 4 | // if (xhr.readyState === 4) { 5 | // if (xhr.status === 200) { 6 | // // console.log( 7 | // // JSON.parse(xhr.responseText) 8 | // // ) 9 | // alert(xhr.responseText) 10 | // } else if (xhr.status === 404) { 11 | // console.log('404 not found') 12 | // } 13 | // } 14 | // } 15 | // xhr.send(null) 16 | 17 | function ajax(url) { 18 | const p = new Promise((resolve, reject) => { 19 | const xhr = new XMLHttpRequest() 20 | xhr.open('GET', url, true) 21 | xhr.onreadystatechange = function () { 22 | if (xhr.readyState === 4) { 23 | if (xhr.status === 200) { 24 | resolve( 25 | JSON.parse(xhr.responseText) 26 | ) 27 | } else if (xhr.status === 404 || xhr.status === 500) { 28 | reject(new Error('404 not found')) 29 | } 30 | } 31 | } 32 | xhr.send(null) 33 | }) 34 | return p 35 | } 36 | 37 | const url = '/data/test.json' 38 | ajax(url) 39 | .then(res => console.log(res)) 40 | .catch(err => console.error(err)) 41 | -------------------------------------------------------------------------------- /fast-interview-code/css/06-双飞翼布局.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 双飞翼布局 8 | 38 | 39 | 40 |
41 |
42 | this is main 43 |
44 |
45 |
46 | this is left 47 |
48 | 51 | 52 | -------------------------------------------------------------------------------- /ES6-10/ES2019/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "koa2-es10", 3 | "version": "1.0.0", 4 | "description": "koa2-es development kit", 5 | "main": "index.js", 6 | "scripts": { 7 | "babel": "babel-node app.js", 8 | "start": "nodemon --exec npm run babel", 9 | "webpack": "webpack -w" 10 | }, 11 | "repository": "git@github.com:cucygh/es-cli.git", 12 | "keywords": [ 13 | "cuc_ygh" 14 | ], 15 | "author": "cuc_ygh", 16 | "license": "Apache-2.0", 17 | "dependencies": { 18 | "axios": "^0.18.0", 19 | "koa": "2.7.0", 20 | "koa-bodyparser": "4.2.1", 21 | "koa-ejs": "4.2.0", 22 | "koa-router": "7.4.0", 23 | "koa-static": "5.0.0" 24 | }, 25 | "devDependencies": { 26 | "@babel/core": "7.4.4", 27 | "@babel/node": "7.2.2", 28 | "@babel/preset-env": "7.4.4", 29 | "eslint": "5.16.0", 30 | "eslint-config-standard": "12.0.0", 31 | "eslint-plugin-import": "2.17.2", 32 | "eslint-plugin-node": "9.0.1", 33 | "eslint-plugin-promise": "4.1.1", 34 | "eslint-plugin-standard": "4.0.0", 35 | "eventsource-polyfill": "0.9.6", 36 | "koa-webpack-dev-middleware": "2.0.2", 37 | "koa-webpack-hot-middleware": "1.0.3", 38 | "koa-webpack-middleware": "1.0.7", 39 | "koa2-webpack4-dev-middleware": "1.0.1", 40 | "nodemon": "1.19.0", 41 | "webpack": "4.31.0", 42 | "webpack-cli": "3.3.2" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-8.js: -------------------------------------------------------------------------------- 1 | // let arr = ['hello', 'world', 'three'] 2 | // let [firstName, , surName] = arr 3 | // console.log(firstName, surName) 4 | 5 | // let [firstName,, thirdName] = new Set([1, 2, 3, 4]) 6 | // console.log(firstName, thirdName) 7 | 8 | // // 修改内容 9 | // let user = { 10 | // name: 's', 11 | // surname: 't' 12 | // }; 13 | // [user.name, user.surname] = [1, 2] 14 | // console.log(user) 15 | // for (let [k, v] of Object.entries(user)) { 16 | // // 隐式赋值,显式索引 17 | // console.log(k, v) 18 | // } 19 | 20 | // // 防止回收 21 | // let arr = [1, 2, 3, 3, 4, 5, 6, 7] 22 | // let [firstName, curName, ...last] = arr 23 | // console.log(firstName, curName, last) 24 | 25 | // // 无数据就是 未定义 26 | // let arr = [] 27 | // // 解构赋值取决于里面有没有值 28 | // let [firstName, curName, ...last] = arr 29 | // console.log(firstName, curName, last) 30 | 31 | // Object 的解构赋值 32 | let options = { 33 | title: 'menu', 34 | width: 100, 35 | height: 200 36 | } 37 | let { title: title2, width = 130, height } = options 38 | let { title, ...last } = options 39 | console.log(title, last) 40 | 41 | // 多层结构的解构赋值 42 | // let options = { 43 | // size: { 44 | // width: 100, 45 | // height: 200 46 | // }, 47 | // items: ['Cake', 'Donut'], 48 | // extra: true 49 | // } 50 | // let { size: { width, height }, items: [, item2], extra } = options 51 | // console.log(width, height, item2, extra) 52 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-lesson", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.21.2", 12 | "core-js": "^3.4.4", 13 | "vue": "^2.6.10" 14 | }, 15 | "devDependencies": { 16 | "@vue/cli-plugin-babel": "^4.1.0", 17 | "@vue/cli-plugin-eslint": "^4.1.0", 18 | "@vue/cli-service": "^4.1.0", 19 | "babel-eslint": "^10.0.3", 20 | "eslint": "^6.8.0", 21 | "eslint-config-standard": "^14.1.0", 22 | "eslint-plugin-import": "^2.20.0", 23 | "eslint-plugin-node": "^11.0.0", 24 | "eslint-plugin-promise": "^4.2.1", 25 | "eslint-plugin-standard": "^4.0.1", 26 | "eslint-plugin-vue": "^6.1.2", 27 | "vue-template-compiler": "^2.6.10" 28 | }, 29 | "eslintConfig": { 30 | "root": true, 31 | "env": { 32 | "node": true 33 | }, 34 | "extends": [ 35 | "plugin:vue/essential", 36 | "eslint:recommended" 37 | ], 38 | "rules": {}, 39 | "parserOptions": { 40 | "parser": "babel-eslint" 41 | } 42 | }, 43 | "browserslist": [ 44 | "> 1%", 45 | "last 2 versions" 46 | ], 47 | "description": "## Project setup ``` npm install ```", 48 | "main": ".eslintrc.js", 49 | "author": "", 50 | "license": "ISC" 51 | } 52 | -------------------------------------------------------------------------------- /JavaScript_code/lib/move.js: -------------------------------------------------------------------------------- 1 | 2 | // 封装获取计算后元素样式函数,返回小数 3 | function getStyle(obj, name) { 4 | if (obj.currentStyle) { 5 | return obj.currentStyle[name]; 6 | } else { 7 | return getComputedStyle(obj, '') [name]; 8 | } 9 | } 10 | // 任意值运动框架 11 | function startMove(obj, name, iTarget ) { 12 | clearInterval(obj.timer); 13 | obj.timer = setInterval(move, 30); 14 | function move() { 15 | var current = 0; 16 | if (name === 'opacity') { 17 | // 用 parseFloat 保留小数并去掉后面 px ,从左至右提取数字,遇到不是数字跳出 18 | // Math.round() 四舍五入取整 19 | current = Math.round(parseFloat(getStyle(obj, name))*100); 20 | } else { 21 | // 用 parseInt 去掉后面 px ,从左至右提取数字,遇到不是数字跳出 22 | current = parseInt(getStyle(obj, name)); 23 | } 24 | var speed = (iTarget - current)/3; 25 | if (speed < 0) { 26 | speed = Math.floor(speed); 27 | } else { 28 | speed = Math.ceil(speed); 29 | } 30 | if (iTarget === current) { 31 | clearInterval(obj.timer); 32 | } else { 33 | if (name === 'opacity') { 34 | obj.style[name] = (current + speed)/100; 35 | obj.style.filter = "alpha("+[name]+ "=" + (current + speed) + ")"; 36 | } else { 37 | obj.style[name] = current + speed + 'px'; 38 | } 39 | } 40 | // console.log('iTarget',iTarget,'current',current,'getStyle',getStyle(obj, name),speed) 41 | } 42 | } -------------------------------------------------------------------------------- /JavaScript_code/22.0.事件绑定.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 事件绑定 7 | 8 | 16 | 46 | 47 | 48 | 49 | 50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /JavaScript_code/9.1.流程控制和JSON.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 程序流程控制 6 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /fast-interview-code/css/09-水平对齐.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 水平对齐 8 | 39 | 40 | 41 |
42 | 一段文字 43 |
44 | 45 |
46 |
47 | this is block item 48 |
49 |
50 | 51 |
52 |
53 | this is absolute item 54 |
55 |
56 | 57 | -------------------------------------------------------------------------------- /fast-interview-code/questions-demo/array-api.js: -------------------------------------------------------------------------------- 1 | // const arr = [10, 20, 30, 40] 2 | 3 | // // pop 4 | // const popRes = arr.pop() 5 | // console.log(popRes, arr) 6 | 7 | // // shift 8 | // const shiftRes = arr.shift() 9 | // console.log(shiftRes, arr) 10 | 11 | // // push 12 | // const pushRes = arr.push(50) // 返回 length 13 | // console.log(pushRes, arr) 14 | 15 | // // unshift 16 | // const unshiftRes = arr.unshift(5) // 返回 length 17 | // console.log(unshiftRes, arr) 18 | 19 | 20 | 21 | // // 纯函数:1. 不改变源数组(没有副作用);2. 返回一个数组 22 | // const arr = [10, 20, 30, 40] 23 | 24 | // // concat 25 | // const arr1 = arr.concat([50, 60, 70]) 26 | // // map 27 | // const arr2 = arr.map(num => num * 10) 28 | // // filter 29 | // const arr3 = arr.filter(num => num > 25) 30 | // // slice 31 | // const arr4 = arr.slice() 32 | 33 | // // 非纯函数 34 | // // push pop shift unshift 35 | // // forEach 36 | // // some every 37 | // // reduce 38 | 39 | // const arr = [10, 20, 30, 40, 50] 40 | 41 | // // slice 纯函数 42 | // const arr1 = arr.slice() 43 | // const arr2 = arr.slice(1, 4) 44 | // const arr3 = arr.slice(2) 45 | // const arr4 = arr.slice(-3) 46 | 47 | // // splice 非纯函数 48 | // const spliceRes = arr.splice(1, 2, 'a', 'b', 'c') 49 | // // const spliceRes1 = arr.splice(1, 2) 50 | // // const spliceRes2 = arr.splice(1, 0, 'a', 'b', 'c') 51 | // console.log(spliceRes, arr) 52 | 53 | const res = [10, 20, 30].map(parseInt) 54 | console.log(res) 55 | 56 | // 拆解 57 | [10, 20, 30].map((num, index) => { 58 | return parseInt(num, index) 59 | }) 60 | -------------------------------------------------------------------------------- /typescript/src/nowcoder/quickSort.js: -------------------------------------------------------------------------------- 1 | function partition(arr, start, end) { 2 | // 以最后一个元素为基准 3 | const pivotValue = arr[end] 4 | let pivotIndex = start 5 | for (let i = start; i < end; i++) { 6 | if (arr[i] < pivotValue) { 7 | // 交换元素 8 | ;[arr[i], arr[pivotIndex]] = [arr[pivotIndex], arr[i]] 9 | // 移动到下一个元素 10 | pivotIndex++ 11 | } 12 | } 13 | 14 | // 把基准值放在中间 15 | ;[arr[pivotIndex], arr[end]] = [arr[end], arr[pivotIndex]] 16 | return pivotIndex 17 | } 18 | 19 | function quickSortRecursive(arr, start, end) { 20 | // 终止条件 21 | if (start >= end) { 22 | return 23 | } 24 | 25 | // 返回 pivotIndex 26 | let index = partition(arr, start, end) 27 | 28 | // 将相同的逻辑递归地用于左右子数组 29 | quickSortRecursive(arr, start, index - 1) 30 | quickSortRecursive(arr, index + 1, end) 31 | } 32 | const array = [7, -2, 4, 7, 1, 3, 6, 5, 3, 0, -4, 2] 33 | // quickSortRecursive(array, 0, array.length - 1) 34 | // console.log(array) 35 | 36 | const myQuickSort = (arr) => { 37 | if (arr.length <= 1) { 38 | return arr 39 | } 40 | const pivotIndex = Math.floor(arr.length / 2) 41 | const pivot = arr.splice(pivotIndex, 1)[0] 42 | const left = [] 43 | const right = [] 44 | 45 | arr.forEach((num) => { 46 | if (num < pivot) { 47 | left.push(num) 48 | } else { 49 | right.push(num) 50 | } 51 | }) 52 | return myQuickSort(left).concat([pivot], myQuickSort(right)) 53 | } 54 | // console.log(myQuickSort(array)) 55 | -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/dist/bundle.js: -------------------------------------------------------------------------------- 1 | !function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";t.r(n);function o(e,n){for(var t=0;t { 4 | // setTimeout(function () { 5 | // resolve(time) 6 | // }, time) 7 | // }) 8 | // } 9 | 10 | // ES8 11 | // async function test () { 12 | // let arr = [Gen(2000), Gen(100), Gen(3000)] 13 | // for (let item of arr) { 14 | // console.log(Date.now(), await item.then(console.log)) 15 | // } 16 | // } 17 | // test() 18 | 19 | // ES9 20 | // async function test () { 21 | // let arr = [Gen(2000), Gen(100), Gen(3000)] 22 | // for await (let item of arr) { 23 | // console.log(Date.now(), item) 24 | // } 25 | // } 26 | // test() 27 | 28 | // 对异步自定义数据结构遍历 29 | const obj = { 30 | count: 0, 31 | // 生成器 32 | Gen (time) { 33 | return new Promise((resolve, reject) => { 34 | setTimeout(function () { 35 | resolve({ 36 | done: false, 37 | value: time 38 | }) 39 | }, time) 40 | }) 41 | }, 42 | // 声明遍历方式,迭代器 43 | [Symbol.asyncIterator] () { 44 | let self = this 45 | return { 46 | next () { 47 | self.count++ 48 | if (self.count < 4) { 49 | return self.Gen(Math.random() * 1000) 50 | } else { 51 | return Promise.resolve({ 52 | done: true, 53 | value: '' 54 | }) 55 | } 56 | } 57 | } 58 | } 59 | } 60 | 61 | async function test () { 62 | for await (let item of obj) { 63 | console.log(Date.now(), item) 64 | } 65 | } 66 | test() 67 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/components/proxy.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 49 | 50 | 56 | -------------------------------------------------------------------------------- /fast-interview-code/webpack-demo/dist/bundle.58cf28598ed2e217d4b3.js: -------------------------------------------------------------------------------- 1 | !function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";t.r(n);function o(e,n){for(var t=0;t { 11 | const target = event.target 12 | if (selector) { 13 | // 代理绑定 14 | if (target.matches(selector)) { 15 | fn.call(target, event) 16 | } 17 | } else { 18 | // 普通绑定 19 | fn.call(target, event) 20 | } 21 | }) 22 | } 23 | 24 | // 普通绑定 25 | const btn1 = document.getElementById('btn1') 26 | bindEvent(btn1, 'click', function (event) { 27 | // console.log(event.target) // 获取触发的元素 28 | event.preventDefault() // 阻止默认行为 29 | alert(this.innerHTML) 30 | }) 31 | 32 | // 代理绑定 33 | const div3 = document.getElementById('div3') 34 | bindEvent(div3, 'click', 'a', function (event) { 35 | event.preventDefault() 36 | alert(this.innerHTML) 37 | }) 38 | 39 | // const p1 = document.getElementById('p1') 40 | // bindEvent(p1, 'click', event => { 41 | // event.stopPropagation() // 阻止冒泡 42 | // console.log('激活') 43 | // }) 44 | // const body = document.body 45 | // bindEvent(body, 'click', event => { 46 | // console.log('取消') 47 | // // console.log(event.target) 48 | // }) 49 | // const div2 = document.getElementById('div2') 50 | // bindEvent(div2, 'click', event => { 51 | // console.log('div2 clicked') 52 | // console.log(event.target) 53 | // }) 54 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/components/author.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 57 | 58 | 64 | -------------------------------------------------------------------------------- /JavaScript_code/27.BOM应用.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Bom应用 6 | 11 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-13.js: -------------------------------------------------------------------------------- 1 | let authors = { 2 | allAuthors: { 3 | fiction: ['Agla', 'Skks', 'Lp'], 4 | scienceFiction: ['Neal', 'Arthru', 'Ribert'], 5 | fantasy: ['J.R.Tole', 'J.M.R', 'Terry P.K'] 6 | }, 7 | Addres: [] 8 | } 9 | 10 | // // ES5 11 | // let r = [] 12 | // for (let [k, v] of Object.entries(authors.allAuthors)) { 13 | // r = r.concat(v) 14 | // } 15 | // console.log(r) 16 | 17 | // authors is not iterable(迭代) 18 | // ES6 19 | // authors[Symbol.iterator] = function () { 20 | // let allAuthors = this.allAuthors 21 | // let keys = Reflect.ownKeys(allAuthors) 22 | // let values = [] 23 | // return { 24 | // next () { 25 | // if (!values.length) { 26 | // if (keys.length) { 27 | // values = allAuthors[keys[0]] 28 | // keys.shift() 29 | // console.log(values, keys) 30 | // } 31 | // } 32 | // return { 33 | // done: !values.length, 34 | // value: values.shift() 35 | // } 36 | // } 37 | // } 38 | // } 39 | 40 | // 使用 Generator 给自定义数据结构写个遍历器 41 | authors[Symbol.iterator] = function * () { 42 | let allAuthors = this.allAuthors 43 | let keys = Reflect.ownKeys(allAuthors) 44 | let values = [] 45 | while (true) { 46 | if (!values.length) { 47 | if (keys.length) { 48 | values = allAuthors[keys[0]] 49 | keys.shift() 50 | yield values.shift() 51 | } else { 52 | return false 53 | } 54 | } else { 55 | yield values.shift() 56 | } 57 | } 58 | } 59 | 60 | let r = [] 61 | for (let v of authors) { 62 | r.push(v) 63 | } 64 | console.log(r) 65 | -------------------------------------------------------------------------------- /fast-interview-code/css/03-margin-负值.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | margin 负值 8 | 37 | 38 | 39 | 40 |

用于测试 margin top bottom 的负数情况

41 |
42 |
43 | this is item 1 44 |
45 |
46 | this is item 2 47 |
48 |
49 | 50 |

用于测试 margin left right 的负数情况

51 |
52 |
53 | this is item 3 54 |
55 |
56 | this is item 4 57 |
58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-10.js: -------------------------------------------------------------------------------- 1 | // console.log(Math.floor.apply(null, [3.111])) 2 | 3 | // console.log(Reflect.apply(Math.floor, null, [2.33])) 4 | 5 | // let price = 90.12 6 | // console.log(Reflect.apply(price > 100 ? Math.floor : Math.ceil, null, [price])) 7 | 8 | // let d = Reflect.construct(Date, []) 9 | // console.log(d.getTime(), d instanceof Date) 10 | 11 | // const student = {} 12 | // const r2 = Object.defineProperty(student, 'name', { value: 'Mike' }) 13 | // // console.log(student) 14 | // const r = Reflect.defineProperty(student, 'name', { value: 'Mike2' }) 15 | // console.log(student, r, r2) 16 | 17 | // const obj = { x: 1, y: 2 } 18 | // Reflect.deleteProperty(obj, 'x') 19 | // console.log(obj) 20 | // console.log(Reflect.get(obj, 'y')) 21 | // console.log(Reflect.get([3, 4], 1)) 22 | 23 | const obj = { 24 | x: 1, 25 | y: 2 26 | } 27 | // console.log(Reflect.getOwnPropertyDescriptor(obj, 'x')) 28 | // console.log(Object.getOwnPropertyDescriptor(obj, 'y')) 29 | 30 | // let d = new Date() 31 | // console.log(Reflect.getPrototypeOf(d)) 32 | // console.log(Object.getPrototypeOf(obj)) 33 | 34 | // console.log(Reflect.has(obj, 'y')) 35 | // Object.freeze(obj) 36 | // obj.z = 3 37 | 38 | // console.log(Reflect.isExtensible(obj), obj) 39 | // console.log(Reflect.ownKeys(obj)) 40 | // console.log(Reflect.ownKeys([1, 2, 3])) 41 | // Symbol 42 | 43 | // Reflect.preventExtensions(obj) // 效果和 freeze 相同 44 | // console.log(Reflect.isExtensible(obj)) 45 | 46 | Reflect.set(obj, 'z', 1) 47 | console.log(obj) 48 | const arr = ['a', 'w', 's'] 49 | Reflect.set(arr, 3, 'oioo') 50 | console.log(arr) 51 | 52 | console.log(Reflect.getPrototypeOf(arr)) 53 | Reflect.setPrototypeOf(arr, String.prototype) 54 | console.log(Reflect.getPrototypeOf(arr)) -------------------------------------------------------------------------------- /JavaScript_code/lib/move3.js: -------------------------------------------------------------------------------- 1 | // ./lib/move.js 2 | // 封装获取计算后元素样式函数,返回小数 3 | function getStyle(obj, name) { 4 | if (obj.currentStyle) { 5 | return obj.currentStyle[name]; 6 | } else { 7 | return getComputedStyle(obj, '') [name]; 8 | } 9 | } 10 | // 任意值运动框架 11 | function startMove(obj, json, fnEnd ) { 12 | clearInterval(obj.timer); 13 | obj.timer = setInterval(move, 30); 14 | function move() { 15 | var current = 0; 16 | var stop = true; 17 | for (const attr in json) { 18 | if (attr === 'opacity') { 19 | // 用 parseFloat 保留小数并去掉后面 px ,从左至右提取数字,遇到不是数字跳出 20 | // Math.round() 四舍五入取整 21 | current = Math.round(parseFloat(getStyle(obj, attr))*100); 22 | } else { 23 | // 用 parseInt 去掉后面 px ,从左至右提取数字,遇到不是数字跳出 24 | current = parseInt(getStyle(obj, attr)); 25 | } 26 | var speed = (json[attr] - current)/4; 27 | if (speed < 0) { 28 | speed = Math.floor(speed); 29 | } else { 30 | speed = Math.ceil(speed); 31 | } 32 | if (json[attr] === current) { 33 | stop = true; 34 | } else { 35 | stop = false; 36 | if (attr === 'opacity') { 37 | obj.style[attr] = (current + speed)/100; 38 | obj.style.filter = "alpha("+[attr]+ "=" + (current + speed) + ")"; 39 | } else { 40 | obj.style[attr] = current + speed + 'px'; 41 | } 42 | } 43 | console.log('json[attr]:',json[attr],'attr:', attr,'current:',current,'getStyle:',getStyle(obj, attr),'speed:',speed); 44 | } 45 | if (stop === true) { 46 | clearInterval(obj.timer); 47 | if (fnEnd) { 48 | fnEnd() 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /JavaScript_code/lib/move2.js: -------------------------------------------------------------------------------- 1 | // ./lib/move.js 2 | // 封装获取计算后元素样式函数,返回小数 3 | function getStyle(obj, name) { 4 | if (obj.currentStyle) { 5 | return obj.currentStyle[name]; 6 | } else { 7 | return getComputedStyle(obj, '') [name]; 8 | } 9 | } 10 | // 任意值运动框架 11 | function startMove(obj, json, fnEnd ) { 12 | clearInterval(obj.timer); 13 | obj.timer = setInterval(move, 30); 14 | function move() { 15 | var current = 0; 16 | var stop = true; 17 | for (const attr in json) { 18 | if (attr === 'opacity') { 19 | // 用 parseFloat 保留小数并去掉后面 px ,从左至右提取数字,遇到不是数字跳出 20 | // Math.round() 四舍五入取整 21 | current = Math.round(parseFloat(getStyle(obj, attr))*100); 22 | } else { 23 | // 用 parseInt 去掉后面 px ,从左至右提取数字,遇到不是数字跳出 24 | current = parseInt(getStyle(obj, attr)); 25 | } 26 | var speed = (json[attr] - current)/4; 27 | if (speed < 0) { 28 | speed = Math.floor(speed); 29 | } else { 30 | speed = Math.ceil(speed); 31 | } 32 | if (json[attr] === current) { 33 | stop = true; 34 | } else { 35 | stop = false; 36 | if (attr === 'opacity') { 37 | obj.style[attr] = (current + speed)/100; 38 | obj.style.filter = "alpha("+[attr]+ "=" + (current + speed) + ")"; 39 | } else { 40 | obj.style[attr] = current + speed + 'px'; 41 | } 42 | } 43 | // console.log('json[attr]:',json[attr],'attr:', attr,'current:',current,'getStyle:',getStyle(obj, attr),'speed:',speed); 44 | } 45 | if (stop === true) { 46 | clearInterval(obj.timer); 47 | if (fnEnd) { 48 | fnEnd() 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /JavaScript_code/10.数码时钟.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 数码时钟 5 | 23 | 57 | 58 |
    59 |
  • 60 |
  • 61 | : 62 |
  • 63 |
  • 64 | : 65 |
  • 66 |
  • 67 |
68 | 69 | -------------------------------------------------------------------------------- /JavaScript_code/22.3.鼠标滚轮滚动.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 事件绑定与鼠标滚轮 7 | 8 | 16 | 48 | 49 | 50 | 51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /JavaScript_code/21.0.阻止默认事件自定义右键菜单限定输入框.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 默认事件 7 | 8 | 17 | 52 | 53 | 54 | 55 | 56 |
57 |
  • 123
  • 58 |
  • 456
  • 59 |
  • 789
  • 60 |
  • 123
  • 61 |
  • 456
  • 62 |
  • 789
  • 63 |
  • 123
  • 64 |
  • 456
  • 65 |
  • 789
  • 66 |
    67 | 68 | 69 | -------------------------------------------------------------------------------- /JavaScript_code/28.1.登陆后cookie读取用户名.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 28.1.登陆后cookie读取用户名 6 | 8 | 44 | 45 | 46 |
    47 | 48 | 49 | 50 |
    51 | 52 | -------------------------------------------------------------------------------- /fast-interview-code/css/05-圣杯布局.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 圣杯布局 8 | 54 | 55 | 56 | 57 |
    58 |
    this is center
    59 |
    this is left
    60 | 61 |
    62 | 63 | 64 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-5.js: -------------------------------------------------------------------------------- 1 | // let x = 1 2 | // let y = 2 3 | // let z = 8 4 | // let obj = { 5 | // x: x, 6 | // y: y, 7 | // hello: function () { 8 | // console.log('hello ES5') 9 | // } 10 | // } 11 | // obj[z] = 3 12 | // obj.hello() 13 | // console.log(obj) 14 | 15 | // let obj2 = { 16 | // x, 17 | // y, 18 | // [z + y]: 6, 19 | // hello () { 20 | // 只能用常规函数 21 | // 异步函数名称前加 * 22 | // console.log('hello ES6') 23 | // } 24 | // } 25 | // obj2.hello() 26 | // console.log(obj2) 27 | 28 | // let s = new Set([1, '2', 4]) 29 | // s.add('hellos').add('hellos').add('hellos2') 30 | // s.delete('hellos') 31 | // s.clear() 32 | // console.log(s.has('hellos2'), s.size) 33 | // console.log(s.values()) 34 | // console.log(s.keys()) 35 | // console.log(s.entries()) 36 | // s.forEach(item => { 37 | // console.log(item) 38 | // }) 39 | // for (let item of s) { 40 | // console.log(item) 41 | // } 42 | 43 | // map 44 | // let map = new Map([[1, 2], [2, 3]]) 45 | // // 添加 46 | // map.set(3, 4) 47 | // // 修改 48 | // map.set(1, 5) 49 | // // 删除 50 | // map.delete(3) 51 | // // console.log(map.size) 52 | // // console.log(map.has(3)) 53 | // // console.log(map.get(2)) 54 | // // console.log(map.keys(), map.values(), map.entries()) 55 | // // map.forEach((value, key) => { 56 | // // console.log(value, key) 57 | // // }) 58 | // for (let [key, value] of map) { 59 | // console.log(key, value) 60 | // } 61 | // let o = function () { 62 | // console.log('o') 63 | // } 64 | // map.set(o, 9) 65 | // console.log(map.get(o)) 66 | 67 | // object copy 68 | const target = { 69 | a: { 70 | b: { 71 | c: { 72 | d: 4 73 | } 74 | }, 75 | e: 7 76 | }, 77 | undefined: null 78 | } 79 | const source = { 80 | a: { 81 | b: { 82 | c: { 83 | null: null 84 | } 85 | } 86 | }, 87 | f: 2 88 | } 89 | Object.assign(target, source) 90 | console.log(target, 'source') 91 | -------------------------------------------------------------------------------- /JavaScript_code/23.ajax.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 58 | 59 | 60 | 61 |

    62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-14-mod.js: -------------------------------------------------------------------------------- 1 | // export const name = 'hello' 2 | // export let addr = 'beijing' 3 | // export let arr = [1, 2, 3] 4 | 5 | // const name = 'hello3' 6 | // let addr = 'Beijing' 7 | // let arr = [1, 2, 3] 8 | 9 | // export default name 10 | // export { 11 | // addr, 12 | // arr 13 | // } 14 | 15 | // 导出函数 16 | export function say(content) { 17 | console.log(content) 18 | } 19 | 20 | export function run() { 21 | console.log('I am running') 22 | } 23 | 24 | // const say = (content) => { 25 | // console.log(content) 26 | // } 27 | // const run = () => { 28 | // console.log('I am running') 29 | // } 30 | // export default say 31 | // export { 32 | // run 33 | // } 34 | 35 | // 导出对象 36 | // export default { 37 | // code: 0, 38 | // message: 'success' 39 | // } 40 | 41 | // const data = { 42 | // code: 1, 43 | // message: 'success' 44 | // } 45 | // const des = { 46 | // age: 20, 47 | // addr: 'Beijing' 48 | // } 49 | 50 | // export default { 51 | // data, 52 | // des 53 | // } 54 | 55 | // 导出类 56 | // class Test { 57 | // constructor () { 58 | // this.id = 2 59 | // } 60 | // } 61 | // export default Test 62 | // export { 63 | // Test 64 | // } 65 | 66 | // export default class Test { 67 | // constructor () { 68 | // this.id = 2 69 | // } 70 | // } 71 | 72 | // export default class { 73 | // constructor () { 74 | // this.id = 5 75 | // } 76 | // } 77 | 78 | // export class Test { 79 | // constructor () { 80 | // this.id = 2 81 | // } 82 | // } 83 | 84 | // 导出多个类,批量导入 85 | // export class Test { 86 | // constructor () { 87 | // this.id = 6 88 | // } 89 | // } 90 | // export class Animal { 91 | // constructor () { 92 | // this.name = 'dog' 93 | // } 94 | // } 95 | 96 | // export default class Peiple { 97 | // constructor () { 98 | // this.id = 123 99 | // } 100 | // } -------------------------------------------------------------------------------- /fast-interview-code/js-异步进阶/05-微任务和宏任务.md: -------------------------------------------------------------------------------- 1 | # 宏任务和微任务 2 | 3 | ## 介绍 4 | 5 | - 宏任务:setTimeout setInterval DOM 事件 6 | - 微任务:Promise(对于前端来说) 7 | - 微任务比宏任务执行的更早 8 | 9 | ```js 10 | console.log(100) 11 | setTimeout(() => { 12 | console.log(200) 13 | }) 14 | Promise.resolve().then(() => { 15 | console.log(300) 16 | }) 17 | console.log(400) 18 | // 100 400 300 200 19 | ``` 20 | 21 | ## event loop 和 DOM 渲染 22 | 23 | 再次回顾 event loop 的过程 24 | 25 | - 每一次 call stack 结束,都会触发 DOM 渲染(不一定非得渲染,就是给一次 DOM 渲染的机会!!!) 26 | - 然后再进行 event loop 27 | 28 | ```js 29 | const $p1 = $('

    一段文字

    ') 30 | const $p2 = $('

    一段文字

    ') 31 | const $p3 = $('

    一段文字

    ') 32 | $('#container') 33 | .append($p1) 34 | .append($p2) 35 | .append($p3) 36 | 37 | console.log('length', $('#container').children().length ) 38 | alert('本次 call stack 结束,DOM 结构已更新,但尚未触发渲染') 39 | // (alert 会阻断 js 执行,也会阻断 DOM 渲染,便于查看效果) 40 | // 到此,即本次 call stack 结束后(同步任务都执行完了),浏览器会自动触发渲染,不用代码干预 41 | 42 | // 另外,按照 event loop 触发 DOM 渲染时机,setTimeout 时 alert ,就能看到 DOM 渲染后的结果了 43 | setTimeout(function () { 44 | alert('setTimeout 是在下一次 Call Stack ,就能看到 DOM 渲染出来的结果了') 45 | }) 46 | ``` 47 | 48 | ## 宏任务和微任务的区别 49 | 50 | - 宏任务:DOM 渲染后再触发 51 | - 微任务:DOM 渲染前会触发 52 | 53 | ```js 54 | // 修改 DOM 55 | const $p1 = $('

    一段文字

    ') 56 | const $p2 = $('

    一段文字

    ') 57 | const $p3 = $('

    一段文字

    ') 58 | $('#container') 59 | .append($p1) 60 | .append($p2) 61 | .append($p3) 62 | 63 | // // 微任务:渲染之前执行(DOM 结构已更新) 64 | // Promise.resolve().then(() => { 65 | // const length = $('#container').children().length 66 | // alert(`micro task ${length}`) 67 | // }) 68 | 69 | // 宏任务:渲染之后执行(DOM 结构已更新) 70 | setTimeout(() => { 71 | const length = $('#container').children().length 72 | alert(`macro task ${length}`) 73 | }) 74 | ``` 75 | 76 | 再深入思考一下:为何两者会有以上区别,一个在渲染前,一个在渲染后? 77 | 78 | - 微任务:ES 语法标准之内,JS 引擎来统一处理。即,不用浏览器有任何关于,即可一次性处理完,更快更及时。 79 | - 宏任务:ES 语法没有,JS 引擎不处理,浏览器(或 nodejs)干预处理。 80 | -------------------------------------------------------------------------------- /JavaScript_code/7.变量类型转换.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 变量类型转换 6 | 7 | 45 | 46 | 47 | 48 | 49 | 50 |
    51 | 52 |
    53 |
    54 | 55 |
    56 | 57 | -------------------------------------------------------------------------------- /ES6-10/ES2019/static/index.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | a, 6 | abbr, 7 | acronym, 8 | address, 9 | applet, 10 | article, 11 | aside, 12 | audio, 13 | b, 14 | big, 15 | blockquote, 16 | body, 17 | canvas, 18 | caption, 19 | center, 20 | cite, 21 | code, 22 | dd, 23 | del, 24 | details, 25 | dfn, 26 | div, 27 | dl, 28 | dt, 29 | em, 30 | embed, 31 | fieldset, 32 | figcaption, 33 | figure, 34 | footer, 35 | form, 36 | h1, 37 | h2, 38 | h3, 39 | h4, 40 | h5, 41 | h6, 42 | header, 43 | hgroup, 44 | html, 45 | i, 46 | iframe, 47 | img, 48 | ins, 49 | kbd, 50 | label, 51 | legend, 52 | li, 53 | mark, 54 | menu, 55 | nav, 56 | object, 57 | ol, 58 | output, 59 | p, 60 | pre, 61 | q, 62 | ruby, 63 | s, 64 | samp, 65 | section, 66 | small, 67 | span, 68 | strike, 69 | strong, 70 | sub, 71 | summary, 72 | sup, 73 | table, 74 | tbody, 75 | td, 76 | tfoot, 77 | th, 78 | thead, 79 | time, 80 | tr, 81 | tt, 82 | u, 83 | ul, 84 | var, 85 | video { 86 | margin: 0; 87 | padding: 0; 88 | border: 0; 89 | font-size: 100%; 90 | font: inherit; 91 | vertical-align: baseline; 92 | } 93 | /* HTML5 display-role reset for older browsers */ 94 | article, 95 | aside, 96 | details, 97 | figcaption, 98 | figure, 99 | footer, 100 | header, 101 | hgroup, 102 | menu, 103 | nav, 104 | section { 105 | display: block; 106 | } 107 | 108 | body { 109 | line-height: 1; 110 | } 111 | 112 | ol, 113 | ul { 114 | list-style: none; 115 | } 116 | 117 | blockquote, 118 | q { 119 | quotes: none; 120 | } 121 | 122 | blockquote:after, 123 | blockquote:before, 124 | q:after, 125 | q:before { 126 | content: ''; 127 | content: none; 128 | } 129 | 130 | table { 131 | border-collapse: collapse; 132 | border-spacing: 0; 133 | } 134 | 135 | body, 136 | html { 137 | display: flex; 138 | flex-direction: column; 139 | align-items: center; 140 | justify-content: center; 141 | } 142 | 143 | .inner { 144 | text-align: center; 145 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.tabSize": 2, 3 | "editor.wordWrap": "on", 4 | "javascript.format.insertSpaceBeforeFunctionParenthesis": true, 5 | "eslint.validate": ["javascript", "html", "vue", "typescript"], 6 | "eslint.format.enable": true, 7 | "eslint.options": { 8 | "overrideConfig": { 9 | "env": { 10 | "browser": true, 11 | "node": true, 12 | "es2021": true 13 | }, 14 | "parserOptions": { 15 | "ecmaFeatures": { 16 | "jsx": true 17 | }, 18 | "ecmaVersion": "latest", 19 | "sourceType": "module" 20 | }, 21 | "rules": { 22 | "no-debugger": "off" 23 | } 24 | } 25 | }, 26 | "editor.formatOnSave": true, 27 | "html.format.indentHandlebars": true, 28 | "html.format.preserveNewLines": true, 29 | "editor.codeActionsOnSave": { 30 | "source.organizeImports": true, 31 | "source.fixAll": true, 32 | "source.fixAll.eslint": false 33 | }, 34 | "emmet.includeLanguages": { 35 | "vue": "html", 36 | "javascript": "html" 37 | }, 38 | "[vue]": { 39 | "editor.defaultFormatter": "octref.vetur" 40 | }, 41 | "[html]": { 42 | "editor.defaultFormatter": "esbenp.prettier-vscode" 43 | }, 44 | "editor.defaultFormatter": "esbenp.prettier-vscode", 45 | "[javascript]": { 46 | "editor.defaultFormatter": "esbenp.prettier-vscode" 47 | }, 48 | "[jsonc]": { 49 | "editor.defaultFormatter": "esbenp.prettier-vscode" 50 | }, 51 | "[css]": { 52 | "editor.defaultFormatter": "esbenp.prettier-vscode" 53 | }, 54 | "[typescript]": { 55 | "editor.defaultFormatter": "esbenp.prettier-vscode" 56 | }, 57 | "[json]": { 58 | "editor.defaultFormatter": "esbenp.prettier-vscode" 59 | }, 60 | // vue backup 61 | "vetur.format.defaultFormatterOptions": { 62 | "prettier": { 63 | "semi": true, 64 | "printWidth": 120, 65 | "singleQuote": false, 66 | "trailingComma": "aways", 67 | "arrowParens": "aways" 68 | } 69 | }, 70 | "vetur.format.defaultFormatter.js": "prettier-eslint", 71 | "vetur.format.defaultFormatter.html": "js-beautify-html" 72 | } 73 | -------------------------------------------------------------------------------- /JavaScript_code/css/reset.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | /* 3 | Document : CSS样式初始化 4 | Created on : 2016. 8. 7,09:41:00 5 | Author : 6 | Description: 7 | CSS样式表的初始化,全局样式设置。部分样式属性请根据具体页面重置其属性 8 | 导入方式: */ 9 | 10 | /* reset */ 11 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,textarea,p,blockquote,th,td,input,select,textarea,button {margin:0;padding:0} /* 初始化标签在所有浏览器中的margin、padding值 */ 12 | fieldset,img {border:0 none} /* 重置fieldset(表单分组)、图片的边框为0*/ 13 | dl,ul,ol,menu,li {list-style:none} /* 重置类表前导符号为onne,menu在HTML5中有效 */ 14 | blockquote, q {quotes: none} /* 重置嵌套引用的引号类型 */ 15 | blockquote:before, blockquote:after,q:before, q:after {content:'';content:none} /* 重置嵌套引用*/ 16 | input,select,textarea,button {vertical-align:middle;} /* 重置表单控件垂直居中*/ 17 | button {border:0 none;background-color:transparent;cursor:pointer} /* 重置表单button按钮效果 */ 18 | body {background:#fff} /* 重置body 页面背景为白色 */ 19 | body,th,td,input,select,textarea,button {font-size:14px;line-height:1 ;font-family:"微软雅黑", "黑体","宋体";color:#000} /* 重置页面文字属性 */ 20 | a {color:#ccc;text-decoration:none} /* 重置链接a标签 */ 21 | a:active, a:hover {text-decoration:none} /* 重置链接a标签的鼠标滑动效果 */ 22 | address,caption,cite,code,dfn,em,var {font-style:normal;font-weight:normal} /* 重置样式标签的样式 */ 23 | caption {display:none;} /* 重置表格标题为隐藏 */ 24 | table {width:100%;border-collapse:collapse;border-spacing:0;table-layout:fixed;} /* 重置table属性 */ 25 | img{vertical-align:top} /* 图片在当前行内的垂直位置 */ 26 | 27 | /* 页面设置 */ 28 | 29 | /* 取消a标签点击后的虚线框 */ 30 | a {outline: none;} 31 | a:active {star:expression(this.onFocus=this.blur());} 32 | 33 | /* 设置页面文字等在拖动鼠标选中情况下的背景色与文字颜色 */ 34 | /* 35 | ::selection {color: #fff;background-color: #4C6E78;} 36 | ::-moz-selection {color: #fff;background-color: #4C6E78;} 37 | */ 38 | 39 | /*清除浮动*/ 40 | .clear{clear: both;} 41 | 42 | /*清除浮动--推荐使用*/ 43 | .clearfix:before,.clearfix:after{content: '';display: table;} 44 | .clearfix:after{clear: both;} -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-4.js: -------------------------------------------------------------------------------- 1 | // function fn(x, y, z) { 2 | // if (y === undefined) { 3 | // y = 3 4 | // } 5 | // if (z === undefined) { 6 | // z = 4 7 | // } 8 | // return x + y + z 9 | // } 10 | // console.log(fn(2, 10, 30)) 11 | 12 | // 没有参数的往前写,否则默认没参数的为字符串类型 13 | // function fn(x, y, z = x + y) { 14 | // // ES6中废弃arguments 15 | // // console.log(Array.from(arguments)) 16 | // // fn.length 可以获取到定义过的没有默认值的参数个数 17 | // console.log(fn.length) 18 | 19 | // return x + y + z 20 | // } 21 | // console.log(fn(10, 10, 10)) 22 | // console.log(fn(10, 10, undefined), 4, 12) 23 | 24 | // 怎么处理不确定参数? 25 | // ES5 26 | // function sum() { 27 | // let num = 0 28 | // Array.prototype.forEach.call(arguments, function (item) { 29 | // num += item * 1 30 | // }) 31 | // return num 32 | // } 33 | // console.log(sum(1, 2, 3, 4)) 34 | 35 | // ES6 36 | // function sum(base, ...nums) { 37 | // // "...nums" Rest parameter 用来获取所有参数:函数执行时的参数,是数组,参数可以分别使用 38 | // let num = 0 39 | // nums.forEach(function (item) { 40 | // num += item * 1 41 | // }) 42 | // return num + base * 2 43 | // } 44 | // console.log(sum(1, 2, 3, 4)) 45 | 46 | // rest参数的逆运算 47 | // ES5 48 | // function sum (x = 1, y = 2, z = 3) { 49 | // return x + y + z 50 | // } 51 | // let data = [1, 2, 3] 52 | // console.log(sum.apply(this, data)) 53 | // ES6 54 | // spread 55 | // console.log(sum(...data)) 56 | 57 | // let hello = (name, city) => { 58 | // console.log(name, 'hello', city) 59 | // } 60 | // hello('zhangsan', 'imooc') 61 | // // 只有一个参数省略括号 62 | // let hi = name => { 63 | // console.log(name) 64 | // } 65 | // hi('zhangsan') 66 | // // 后面是表达式,省略花括号 67 | // let sum = (x, y, z) => x + y + z 68 | // console.log(sum(1, 2, 3)) 69 | // // 以对象返回数据,小括号相当于表达式,花括号是对象的 70 | // let sum2 = (x, y, z) => ({ 71 | // x: x, 72 | // y: y, 73 | // z: z 74 | // }) 75 | // console.log(sum2(1, 2, 3)) 76 | // // webpack eval 让 this 指向了空对象 77 | // // ES6 中this 指向写函数时的对象 78 | // let test = { 79 | // name: 'test', 80 | // say: () => { 81 | // console.log(this.name) 82 | // } 83 | // } 84 | // test.say() 85 | 86 | let arr = Array.of(1, 2, 3, 4) 87 | arr.forEach((item) => { 88 | console.log(item) 89 | }) 90 | -------------------------------------------------------------------------------- /JavaScript_code/2.网页换肤.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 43 | 44 | 45 | 46 | 47 |
    1
    48 |
    2
    49 |
    3
    50 | 51 |
    52 | 53 | 54 | 55 |
    56 | 57 | javascript:; 58 | 59 | 60 |
    4
    61 | 62 | 63 | -------------------------------------------------------------------------------- /JavaScript_code/30.0.template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Document 9 | 10 | 11 | 12 | 13 |
    14 | 56 | 57 | 65 | 66 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /JavaScript_code/21.1.基本拖拽.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 拖拽 7 | 8 | 16 | 62 | 63 | 64 | 65 |
    66 | 67 | 68 | -------------------------------------------------------------------------------- /fast-interview-code/css/10-垂直对齐.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 垂直对齐 8 | 64 | 65 | 66 |
    67 | 一段文字 68 |
    69 | 70 |
    71 |
    72 | this is item 73 |
    74 |
    75 | 76 |
    77 |
    78 | this is item 79 |
    80 |
    81 | 82 |
    83 |
    84 | this is item 85 |
    86 |
    87 | 88 | -------------------------------------------------------------------------------- /JavaScript_code/1.第一个JS效果.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 第一个JS效果 6 | 7 | 23 | 24 | 82 | 83 | 84 | 85 | 86 | 87 |
    88 |
    89 | 90 | 91 |
    92 |

    文字
    文字2

    93 |
    94 | 95 | -------------------------------------------------------------------------------- /typescript/src/utilityType.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-unused-vars */ 2 | enum Direction { 3 | up = 'up', 4 | left = 'left', 5 | right = 'right', 6 | down = 'down', 7 | } 8 | 9 | interface Facing { 10 | front: string 11 | back: string 12 | } 13 | 14 | type Dev = { 15 | html: string 16 | css: string 17 | } 18 | 19 | type DirectionType = keyof typeof Direction 20 | 21 | // Partial 22 | const directionPartial: Partial = 'down' 23 | 24 | // Readonly 25 | const directionReadonly: Readonly = { 26 | front: '1', 27 | back: '2', 28 | } 29 | // directionReadonly.back = 3 30 | 31 | // Record 32 | const directionRecord: Record = { 33 | right: '-90', 34 | left: '90', 35 | up: '180', 36 | down: '0', 37 | } 38 | 39 | const facingRecord: Partial> = { 40 | front: 'f', 41 | } 42 | 43 | // Pick 44 | // const directionPick: Pick = { 45 | // up: '180', 46 | // } 47 | enum KeysToBePickedFrom { 48 | KEY_ONE = 'Key One', 49 | KEY_TWO = 'Key Number Two', 50 | KEY_THREE = 'Another key n. 3', 51 | LAST_KEY = 'Here is the last Key', 52 | } 53 | 54 | type PickKey = Extract 55 | 56 | type Picked_KeysOfEnum = PickKey 57 | 58 | interface KeysPickedForType { 59 | keyone: Picked_KeysOfEnum 60 | } 61 | 62 | const picks: KeysPickedForType = { 63 | keyone: 'KEY_ONE', // KEY_ONE | LAST_KEY 64 | } 65 | 66 | // Omit 67 | const directionOmit: Omit = 'up' // 无效 68 | const directionOmit2: Omit = 'down' // 无效 69 | const facingOmit: Omit = { 70 | back: 'b', 71 | } 72 | const devOmit: Omit = { css: 'css' } 73 | 74 | // Exclude 75 | type UnionType = DirectionType | Facing | Dev 76 | const directionExclude: Exclude = 'down' 77 | const unionTypeExclude: Exclude = { 78 | html: 'html', 79 | css: 'css', 80 | } 81 | // const facingExclude: Exclude = { 82 | // back: 'b', 83 | // } 84 | // const devExclude: Exclude = { css: 'css' } 85 | 86 | // Extract 87 | type DirectionExtract = Extract 88 | const directionExtract: DirectionExtract = 'up' 89 | const unionTypeExtract: Extract = { 90 | html: 'html', 91 | css: 'css', 92 | } 93 | -------------------------------------------------------------------------------- /JavaScript_code/12.创建插入删除元素.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DOM创建插入删除元素 6 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
    67 |
      68 |
    69 |
    70 | 71 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson6-1.js: -------------------------------------------------------------------------------- 1 | // 0xD800-0xDFFF 字符无法编码成UTF-8, 而显示错误, 现在以非编码形式转义存在 2 | // console.log((JSON.stringify('\u{D800}'))) 3 | 4 | // let arr = [1, [2, 3], [4, 5, [6, 7, [8, 9]]]] 5 | 6 | // flat扁平化, 按照指定深度递归遍历数组, 合并成一个新数组 7 | // console.log(arr.flat(3)) 8 | 9 | // // map 对每个元素进行遍历 arr.map(item => item * 2) 10 | // arr.flatMap() 11 | // let arr = [[1], [2], [3]] 12 | // console.log(arr.map(item => item * 2).flat()) 13 | // console.log(arr.flatMap(item => item * 2)) 14 | 15 | // // string 字符串 16 | // let str = ' foo ' 17 | // // console.log(str.replace(/^\s+|\s+$/g, '_')) 18 | // console.log(str.trimStart()) 19 | // console.log(str.trimLeft()) 20 | // console.log(str.trimRight()) 21 | // console.log(str.trimEnd()) 22 | // console.log(str.trim()) 23 | 24 | // // matchAll 匹配 25 | // let str = `"foo" and "bar" and "baz"` 26 | 27 | // // ES5 28 | // function select (reg, str) { 29 | // const matches = [] 30 | // while (true) { 31 | // const match = reg.exec(str) 32 | // if (match === null) { 33 | // break 34 | // } 35 | // matches.push(match[1]) 36 | // } 37 | // return matches 38 | // } 39 | 40 | // console.log(select(/"([^"]*)"/g, str)) 41 | // console.log(str.match(/"([^"]*)"/g)) 42 | 43 | // // ES5 44 | // function select2 (reg, str) { 45 | // const matches = [] 46 | // // replace 传入函数 47 | // str.replace(reg, function (all, first) { 48 | // matches.push(first) 49 | // }) 50 | // return matches 51 | // } 52 | 53 | // console.log(select2(/"([^"]*)"/g, str)) 54 | 55 | // // ES10 56 | // function select3 (reg, str) { 57 | // const matches = [] 58 | // for (const match of str.matchAll(reg)) { 59 | // // console.log(match) 60 | // matches.push(match[1]) 61 | // } 62 | // return matches 63 | // } 64 | // console.log(select3(/"([^"]*)"/g, str)) 65 | 66 | // Object Array 转换 67 | const arr = [['foo', 1], ['bar', 2]] 68 | console.log(arr[1][1]) 69 | 70 | const obj = Object.fromEntries(arr) 71 | console.log(obj.bar) 72 | 73 | // 案例2 74 | const obj2 = { 75 | a: 1, 76 | b: 2, 77 | g: 3 78 | } 79 | // 对象使用数组方法: Object.entries转换成数组, 解构赋值并过滤, Object.fromEntries转换回对象 80 | let res = Object.fromEntries( 81 | Object.entries(obj).filter(([key, val]) => key.length === 3) 82 | ) 83 | console.log(res) 84 | 85 | // ES5 86 | try { 87 | 88 | } catch (e) { 89 | 90 | } 91 | 92 | // ES10 93 | try { 94 | 95 | } catch { 96 | 97 | } 98 | 99 | // BigInt 处理超过 2^53 的数字 100 | // const a=11n 101 | // console.log(typeof a) 102 | // "bigint" 103 | -------------------------------------------------------------------------------- /typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // "extends": "@tsconfig/node16/tsconfig.json", 3 | "compilerOptions": { 4 | /* 基本选项 */ 5 | "target": "ES6", // 指定 ECMAScript 目标版本: 'ES3' (default), 'ES5', 'ES6'/'ES2015', 'ES2016', 'ES2017', or 'ESNEXT' 6 | "module": "CommonJS", // 指定使用模块: 'commonjs', 'amd', 'system', 'umd' or 'es2015' 7 | "lib": [], // 指定要包含在编译中的库文件 8 | "allowJs": true, // 允许编译 javascript 文件 9 | "checkJs": true, // 报告 javascript 文件中的错误 10 | "jsx": "preserve", // 指定 jsx 代码的生成: 'preserve', 'react-native', or 'react' 11 | "declaration": true, // 生成相应的 '.d.ts' 文件 12 | // "sourceMap": true, // 生成相应的 '.map' 文件 13 | // "outFile": "./", // 将输出文件合并为一个文件 14 | "outDir": "./build", // 指定输出目录 15 | "rootDir": "./", // 用来控制输出目录结构 --outDir. 16 | "removeComments": true, // 删除编译后的所有的注释 17 | "noEmit": false, // 不生成输出文件 18 | "importHelpers": false, // 从 tslib 导入辅助工具函数 19 | "isolatedModules": false, // 将每个文件作为单独的模块 (与 'ts.transpileModule' 类似). 20 | 21 | /* 严格的类型检查选项 */ 22 | "strict": true, // 启用所有严格类型检查选项 23 | "noImplicitAny": true, // 在表达式和声明上有隐含的 any类型时报错 24 | "strictNullChecks": true, // 启用严格的 null 检查 25 | "noImplicitThis": true, // 当 this 表达式值为 any 类型的时候,生成一个错误 26 | "alwaysStrict": true, // 以严格模式检查每个模块,并在每个文件里加入 'use strict' 27 | 28 | /* 额外的检查 */ 29 | "noUnusedLocals": false, // 有未使用的变量时,抛出错误 30 | "noUnusedParameters": false, // 有未使用的参数时,抛出错误 31 | "noImplicitReturns": true, // 并不是所有函数里的代码都有返回值时,抛出错误 32 | "noFallthroughCasesInSwitch": true, // 报告 switch 语句的 fallthrough 错误。(即,不允许 switch 的 case 语句贯穿) 33 | 34 | /* 模块解析选项 */ 35 | "moduleResolution": "node", // 选择模块解析策略: 'node' (Node.js) or 'classic' (TypeScript pre-1.6) 36 | "baseUrl": "./", // 用于解析非相对模块名称的基目录 37 | "paths": {}, // 模块名到基于 baseUrl 的路径映射的列表 38 | "rootDirs": [], // 根文件夹列表,其组合内容表示项目运行时的结构内容 39 | // "typeRoots": [], // 包含类型声明的文件列表 40 | // "types": [], // 需要包含的类型声明文件名列表 41 | "allowSyntheticDefaultImports": true, // 允许从没有设置默认导出的模块中默认导入。 42 | 43 | /* Source Map Options */ 44 | // "sourceRoot": "./", // 指定调试器应该找到 TypeScript 文件而不是源文件的位置 45 | // "mapRoot": "./", // 指定调试器应该找到映射文件而不是生成文件的位置 46 | // "inlineSourceMap": true, // 生成单个 soucemaps 文件,而不是将 sourcemaps 生成不同的文件 47 | // "inlineSources": true, // 将代码与 sourcemaps 生成到一个文件中,要求同时设置了 --inlineSourceMap 或 --sourceMap 属性 48 | 49 | /* 其他选项 */ 50 | "experimentalDecorators": true, // 启用装饰器 51 | "emitDecoratorMetadata": true // 为装饰器提供元数据的支持 52 | }, 53 | "include": ["./src/**/*.ts"], 54 | "exclude": ["./node_modules", "**/*.js"] 55 | } 56 | -------------------------------------------------------------------------------- /JavaScript_code/3.函数传参.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 函数传参 6 | 7 | 23 | 24 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 |
    97 | 98 | 99 | -------------------------------------------------------------------------------- /ES6-10/vue-lesson/src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 54 | 55 | 56 | 72 | -------------------------------------------------------------------------------- /fast-interview-code/js-异步进阶/01-题目.md: -------------------------------------------------------------------------------- 1 | # 异步 题目 2 | 3 | - 描述 event loop 运行机制(可画图) 4 | - Promise 哪几种状态,如何变化? 5 | - 宏任务和微任务的区别 6 | - 场景题:Promise catch 连接 then 7 | - 场景题:Promise 和 setTimeout 顺序 8 | - 场景题:各类异步执行顺序问题 9 | 10 | ## Promise catch 连接 then 11 | 12 | ```js 13 | // 第一题 14 | Promise.resolve().then(() => { 15 | console.log(1) 16 | }).catch(() => { 17 | console.log(2) 18 | }).then(() => { 19 | console.log(3) 20 | }) 21 | // 1 3 22 | 23 | // 第二题 24 | Promise.resolve().then(() => { 25 | console.log(1) 26 | throw new Error('erro1') 27 | }).catch(() => { 28 | console.log(2) 29 | }).then(() => { 30 | console.log(3) 31 | }) 32 | // 1 2 3 33 | 34 | // 第三题 35 | Promise.resolve().then(() => { 36 | console.log(1) 37 | throw new Error('erro1') 38 | }).catch(() => { 39 | console.log(2) 40 | }).catch(() => { // 注意这里是 catch 41 | console.log(3) 42 | }) 43 | // 1 2 44 | ``` 45 | 46 | ## async/await 语法问题 47 | 48 | ```js 49 | async function fn() { 50 | return 100 51 | } 52 | (async function () { 53 | const a = fn() // ?? // promise 54 | const b = await fn() // ?? // 100 55 | })() 56 | ``` 57 | 58 | ```js 59 | (async function () { 60 | console.log('start') 61 | const a = await 100 62 | console.log('a', a) 63 | const b = await Promise.resolve(200) 64 | console.log('b', b) 65 | const c = await Promise.reject(300) 66 | console.log('c', c) 67 | console.log('end') 68 | })() // 执行完毕,打印出那些内容? 69 | ``` 70 | 71 | ## Promise 和 setTimeout 顺序 72 | 73 | ```js 74 | console.log(100) 75 | setTimeout(() => { 76 | console.log(200) 77 | }) 78 | Promise.resolve().then(() => { 79 | console.log(300) 80 | }) 81 | console.log(400) 82 | // 100 400 300 200 83 | ``` 84 | 85 | ## 执行顺序问题 86 | 87 | 网上很经典的面试题 88 | 89 | ```js 90 | async function async1 () { 91 | console.log('async1 start') 92 | await async2() // 这一句会同步执行,返回 Promise ,其中的 `console.log('async2')` 也会同步执行 93 | console.log('async1 end') // 上面有 await ,下面就变成了“异步”,类似 cakkback 的功能(微任务) 94 | } 95 | 96 | async function async2 () { 97 | console.log('async2') 98 | } 99 | 100 | console.log('script start') 101 | 102 | setTimeout(function () { // 异步,宏任务 103 | console.log('setTimeout') 104 | }, 0) 105 | 106 | async1() 107 | 108 | new Promise (function (resolve) { // 返回 Promise 之后,即同步执行完成,then 是异步代码 109 | console.log('promise1') // Promise 的函数体会立刻执行 110 | resolve() 111 | }).then (function () { // 异步,微任务 112 | console.log('promise2') 113 | }) 114 | 115 | console.log('script end') 116 | 117 | // 同步代码执行完之后,屡一下现有的异步未执行的,按照顺序 118 | // 1. async1 函数中 await 后面的内容 —— 微任务 119 | // 2. setTimeout —— 宏任务 120 | // 3. then —— 微任务 121 | ``` 122 | -------------------------------------------------------------------------------- /JavaScript_code/19.0.跟随鼠标一串div.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 跟随鼠标的一串div 7 | 8 | 16 | 44 | 45 | 46 | 47 |
    48 |
    49 |
    50 |
    51 |
    52 |
    53 |
    54 |
    55 |
    56 |
    57 |
    58 |
    59 |
    60 |
    61 |
    62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |
    69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 |
    76 |
    77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 |
    84 |
    85 |
    86 |
    87 |
    88 |
    89 |
    90 |
    91 |
    92 |
    93 |
    94 |
    95 |
    96 |
    97 |
    98 |
    99 |
    100 |
    101 |
    102 |
    103 |
    104 |
    105 |
    106 |
    107 | 108 | 109 | -------------------------------------------------------------------------------- /ES6-10/ES2019/js/lesson2-11.js: -------------------------------------------------------------------------------- 1 | // let o = { 2 | // name: 'xiaoming', 3 | // price: 190 4 | // } 5 | // let d = new Proxy(o, { 6 | // get (target, key) { 7 | // if (key === 'price') { 8 | // return target[key] + 20 9 | // } else { 10 | // return target[key] 11 | // } 12 | // } 13 | // }) 14 | // console.log(d.price, d.name) 15 | 16 | // let o = { 17 | // name: 'xiaoming', 18 | // price: 190 19 | // } 20 | // let d = new Proxy(o, { 21 | // get (target, key) { 22 | // return target[key] 23 | // }, 24 | // set (target, key, value) { 25 | // return false 26 | // } 27 | // }) 28 | // d.price = 700 29 | // console.log('拦截赋值操作:', d.price, d.name) 30 | 31 | // ES5 中完全禁止修改元素属性 32 | // for (let [key] of Object.entries(o)) { 33 | // Object.defineProperty(o, key, { 34 | // writable: false 35 | // }) 36 | // } 37 | // o.price = 300 38 | // console.log(o.name, o.price) 39 | 40 | // // 拦截 校验 41 | // let o = { 42 | // name: 'xiaoming', 43 | // price: 190 44 | // } 45 | // // 监听错误 46 | // window.addEventListener('error', (e) => { 47 | // console.log(e.message) 48 | // // report('./') 49 | // }, true) 50 | // // 按功能模块化 51 | // let validator = (target, key, value) => { 52 | // if (Reflect.has(target, key)) { 53 | // if (key === 'price') { 54 | // if (value > 300) { 55 | // // 不满足条件触发错误 56 | // throw new TypeError('price exceed 300') 57 | // } else { 58 | // target[key] = value 59 | // } 60 | // } else { 61 | // target[key] = value 62 | // } 63 | // } else { 64 | // return false 65 | // } 66 | // } 67 | // let d = new Proxy(o, { 68 | // get (target, key) { 69 | // return target[key] || '' 70 | // }, 71 | // set: validator 72 | // }) 73 | // d.price = 320 74 | // d.name = 'lisi' 75 | // d.age = 123 76 | // console.log(d.price, d.name, d.age) 77 | 78 | // // 代理生成ID, 随机\唯一\只读 79 | // class Component { 80 | // constructor () { 81 | // this.proxy = new Proxy({ 82 | // id: Math.random().toString(36).slice(-8) 83 | // }, {}) 84 | // } 85 | // get id () { 86 | // return this.proxy.id 87 | // } 88 | // } 89 | // let com = new Component() 90 | // let com2 = new Component() 91 | // for (let i = 0; i < 10; i++) { 92 | // console.log(com.id, com2.id) 93 | // } 94 | // com.id = 'abc' 95 | // console.log(com.id, com2.id) 96 | 97 | // 可撤销代理 98 | let o = { 99 | name: 'xiaoming', 100 | price: 190 101 | } 102 | let d = Proxy.revocable(o, { 103 | get (target, key) { 104 | if (key === 'price') { 105 | return target[key] + 20 106 | } else { 107 | return target[key] 108 | } 109 | } 110 | }) 111 | console.log(d) 112 | console.log(d.proxy.price) 113 | console.log(d.revoke) 114 | setTimeout(function () { 115 | d.revoke() 116 | setTimeout(function () { 117 | console.log(d.proxy.price) 118 | }, 100) 119 | }, 1000) 120 | -------------------------------------------------------------------------------- /JavaScript_code/5.导航选项卡.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 导航选项卡 6 | 50 | 77 | 78 | 79 |
    80 | 1 81 | 2 82 | 3 83 | 4 84 |
    85 |
    86 |
      87 |
    • 1
    • 88 |
    • 1
    • 89 |
    • 1
    • 90 |
    91 |
      92 |
    • 2
    • 93 |
    • 2
    • 94 |
    • 2
    • 95 |
    96 |
      97 |
    • 3
    • 98 |
    • 3
    • 99 |
    • 3
    • 100 |
    101 |
      102 |
    • 4
    • 103 |
    • 4
    • 104 |
    • 4
    • 105 |
    106 |
    107 | 108 | -------------------------------------------------------------------------------- /fast-interview-code/js-异步进阶/03-promise.md: -------------------------------------------------------------------------------- 1 | # Promise 2 | 3 | - 三种状态 4 | - 状态和 then catch 5 | - 常用 API 6 | 7 | 先回顾一下 Promise 的基本使用 8 | 9 | ```js 10 | // 加载图片 11 | function loadImg(src) { 12 | const p = new Promise( 13 | (resolve, reject) => { 14 | const img = document.createElement('img') 15 | img.onload = () => { 16 | resolve(img) 17 | } 18 | img.onerror = () => { 19 | const err = new Error(`图片加载失败 ${src}`) 20 | reject(err) 21 | } 22 | img.src = src 23 | } 24 | ) 25 | return p 26 | } 27 | const url = 'https://img.mukewang.com/5a9fc8070001a82402060220-140-140.jpg' 28 | loadImg(url).then(img => { 29 | console.log(img.width) 30 | return img 31 | }).then(img => { 32 | console.log(img.height) 33 | }).catch(ex => console.error(ex)) 34 | ``` 35 | 36 | ## 三种状态 37 | 38 | 三种状态 pending resolved rejected 39 | 40 | (画图表示转换关系,以及转换不可逆) 41 | 42 | ```js 43 | // 刚定义时,状态默认为 pending 44 | const p1 = new Promise((resolve, reject) => { 45 | 46 | }) 47 | 48 | // 执行 resolve() 后,状态变成 resolved 49 | const p2 = new Promise((resolve, reject) => { 50 | setTimeout(() => { 51 | resolve() 52 | }) 53 | }) 54 | 55 | // 执行 reject() 后,状态变成 rejected 56 | const p3 = new Promise((resolve, reject) => { 57 | setTimeout(() => { 58 | reject() 59 | }) 60 | }) 61 | 62 | ``` 63 | 64 | ```js 65 | // 直接返回一个 resolved 状态 66 | Promise.resolve(100) 67 | // 直接返回一个 rejected 状态 68 | Promise.reject('some error') 69 | ``` 70 | 71 | ## 状态和 then catch 72 | 73 | 状态变化会触发 then catch —— 这些比较好理解,就不再代码演示了 74 | 75 | - pending 不会触发任何 then catch 回调 76 | - 状态变为 resolved 会触发后续的 then 回调 77 | - 状态变为 rejected 会触发后续的 catch 回调 78 | 79 | ----- 80 | 81 | then catch 会继续返回 Promise ,**此时可能会发生状态变化!!!** 82 | 83 | ```js 84 | // then() 一般正常返回 resolved 状态的 promise 85 | Promise.resolve().then(() => { 86 | return 100 87 | }) 88 | 89 | // then() 里抛出错误,会返回 rejected 状态的 promise 90 | Promise.resolve().then(() => { 91 | throw new Error('err') 92 | }) 93 | 94 | // catch() 不抛出错误,会返回 resolved 状态的 promise 95 | Promise.reject().catch(() => { 96 | console.error('catch some error') 97 | }) 98 | 99 | // catch() 抛出错误,会返回 rejected 状态的 promise 100 | Promise.reject().catch(() => { 101 | console.error('catch some error') 102 | throw new Error('err') 103 | }) 104 | ``` 105 | 106 | 看一个综合的例子,即那几个面试题 107 | 108 | ```js 109 | // 第一题 110 | Promise.resolve().then(() => { 111 | console.log(1) 112 | }).catch(() => { 113 | console.log(2) 114 | }).then(() => { 115 | console.log(3) 116 | }) 117 | 118 | // 第二题 119 | Promise.resolve().then(() => { // 返回 rejected 状态的 promise 120 | console.log(1) 121 | throw new Error('erro1') 122 | }).catch(() => { // 返回 resolved 状态的 promise 123 | console.log(2) 124 | }).then(() => { 125 | console.log(3) 126 | }) 127 | 128 | // 第三题 129 | Promise.resolve().then(() => { // 返回 rejected 状态的 promise 130 | console.log(1) 131 | throw new Error('erro1') 132 | }).catch(() => { // 返回 resolved 状态的 promise 133 | console.log(2) 134 | }).catch(() => { 135 | console.log(3) 136 | }) 137 | ``` 138 | -------------------------------------------------------------------------------- /JavaScript_code/22.1.高级拖拽.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 高级拖拽 7 | 8 | 21 | 91 | 92 | 93 | 94 |
    95 | asdfasdfas/sad'234 96 |
    asdfasdfas/sad
    97 | asdfasdfas/sad'234 98 |
    99 | 100 | 101 | --------------------------------------------------------------------------------