08 2020 档案

摘要:class jQuery { constructor(selector) { const result = document.querySelectorAll(selector) console.log(result) const length = result.length for (let i 阅读全文
posted @ 2020-08-09 10:59 火星_PGY 阅读(166) 评论(0) 推荐(0) 编辑
摘要:Class的使用: // 父类 class People { constructor(name) { this.name = name } eat() { console.log(`${this.name} eat`) } } // 子类 class Student extends People { 阅读全文
posted @ 2020-08-09 10:57 火星_PGY 阅读(606) 评论(0) 推荐(0) 编辑
摘要:const obj = { a: 100, b: { b1: [1, 2, 3], b2: 'string' }, c: ['a', 'b', 'c'] } /* * 没做深拷贝的效果 const obj2 = obj obj2.a = 200 obj2.b.b2 = 'abc123' obj2.c 阅读全文
posted @ 2020-08-09 10:50 火星_PGY 阅读(302) 评论(0) 推荐(0) 编辑
摘要:var arr = [1,2,3,4,5] console.log(arr.slice(1,4)) console.log(arr) Function.prototype.bind1 = function(){ // arguments是个列表不是数组,将参数拆解为数组 const args = A 阅读全文
posted @ 2020-08-09 10:42 火星_PGY 阅读(271) 评论(0) 推荐(0) 编辑
摘要:什么是闭包,闭包的表现形式: // 作用域应用的特殊情况,有两种表现: // 函数作为参数被传递 // 函数作为返回值被返回 // 函数作为返回值 function create() { let a = 100 return function () { console.log(a) } } let 阅读全文
posted @ 2020-08-09 10:41 火星_PGY 阅读(358) 评论(0) 推荐(0) 编辑
摘要:// 一个对象里面,属性名不能重复,属性名一般是字符串,数字属性名==字符串属性名 /* let a={},b='0',c=0; a[b]='abc'; a[c]='123' console.log(a[b]) */ //考点进一步深入提问:对象和数组的区别 /* let a={},b=Symbol 阅读全文
posted @ 2020-08-08 20:12 火星_PGY 阅读(304) 评论(0) 推荐(0) 编辑
摘要:下列代码的输出值: function A() { console.log(1) } function fn() { A = function () { console.log(2) } return this } fn.A=A fn.prototype = { A: () => { console. 阅读全文
posted @ 2020-08-08 20:03 火星_PGY 阅读(162) 评论(0) 推荐(0) 编辑
摘要://拆分字符串形式 function queryToObj() { const res = {} const search = location.search.substr(1);//去掉前面的“?” search.split('&').forEach(paramStr => { const arr 阅读全文
posted @ 2020-08-08 19:59 火星_PGY 阅读(563) 评论(0) 推荐(0) 编辑
摘要:// flatern 是摊平数组 function flat(arr) { const isDeep = arr.some(item => item instanceof Array) if(!isDeep){ return arr } const result = Array.prototype. 阅读全文
posted @ 2020-08-08 19:55 火星_PGY 阅读(207) 评论(0) 推荐(0) 编辑
摘要:下面代码输出打印值顺序: async function async1(){ console.log('async1 start'); await async2(); console.log('async1 end'); } async function async2(){ console.log(' 阅读全文
posted @ 2020-08-08 19:45 火星_PGY 阅读(233) 评论(0) 推荐(0) 编辑
摘要:下列代码输出打印值: function Foo() { getName = function () { console.log(1); } return this; } Foo.getName = function () { console.log(2) } Foo.prototype.getNam 阅读全文
posted @ 2020-08-08 19:42 火星_PGY 阅读(218) 评论(0) 推荐(0) 编辑
摘要:// 传统方式,遍历元素比较 function unique(arr) { const res = [] arr.forEach(item => { if (res.indexOf(item) < 0) { res.push(item) } }) return res } console.log(u 阅读全文
posted @ 2020-08-08 19:39 火星_PGY 阅读(130) 评论(0) 推荐(0) 编辑
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>手写ajax</title> </head> <body> <script> const xhr = new XMLHttpRequest(); xhr.ope 阅读全文
posted @ 2020-08-08 19:35 火星_PGY 阅读(428) 评论(0) 推荐(0) 编辑
摘要:VUE2.0和3.0数据双向绑定的原理,并说出其区别。 代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>vue2.0/3.0双向数据绑定原理</title> </head> <body> 姓名:<sp 阅读全文
posted @ 2020-08-08 18:34 火星_PGY 阅读(1408) 评论(0) 推荐(0) 编辑
摘要:常见值类型: let a; //undefined let s = 'abc'; let n = 100; let b = true; let sb = Symbol('s'); let nn = NaN 常见引用类型: const obj = {x: 100}; const arr = [1, 2 阅读全文
posted @ 2020-08-08 18:25 火星_PGY 阅读(181) 评论(0) 推荐(0) 编辑
摘要:如何理解语义化: 对应的内容是用相应意思的标签,增加开发者和机器爬虫对代码的可读性。 块状元素和内联元素: 块状元素有:display:block/table;有div h1 h2 table ul ol p等,这些元素特点是独占一行。 内联元素:display:inline/inline-bloc 阅读全文
posted @ 2020-08-08 17:57 火星_PGY 阅读(175) 评论(0) 推荐(0) 编辑
摘要:前言 最近公司向员工搜集公司杂志的文章,刚好最近学习了机器学习相关课程。为了赚取购买课程的费用,所以写了如下文章投稿赚取稿费。 如下文章可能涉及一些我所购买课程的内容,所以不便将所有资源进行展示。 当初写这篇文章的目的除了赚取公司的稿费外,还有就是给现有web开发的同事提供一些新的开发方向,认识新的 阅读全文
posted @ 2020-08-08 17:05 火星_PGY 阅读(895) 评论(2) 推荐(0) 编辑

点击右上角即可分享
微信分享提示