JavaScript
文章平均质量分 63
a540366413
这个作者很懒,什么都没留下…
展开
-
vue运行时报import不是关键字等解决办法
vue运行时报import不是关键字等解决办法 You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore the next line. Use /* eslint-disable */ to ignore all warnings in a file. … npm...原创 2019-12-05 10:46:28 · 505 阅读 · 0 评论 -
js 原型链
原型链在JS中扮演了很重要的一种角色,类似继承 每个Object都会有一个__proto__, function 会有prototype属性,同样function也是对象也有__proto__属性。 例如: function Person(){} var p = new Person(); 会产生类似如下操作 var p = {}; p.__proto__ = Person.prototype;...原创 2019-11-29 11:46:34 · 106 阅读 · 0 评论 -
js this问题
This是在运行时确定的,一下所有的情况都是在函数执行时确定this function this问题 如果函数有明确的归属对象,则this指向对象。 function Person(){ this.hi = function(){ console.log(this); } } Var p = new Person(); p.hi是p的成员函数,hi中的this指向p。 如果说var b ...原创 2019-11-28 18:00:47 · 111 阅读 · 0 评论 -
变量声明关键字var、let、const
变量声明关键字var、let、const举例 var a = 10;直接声明赋值 var a; a=10;先声明后使用 b = 10; var b;//先试用后定义,声明会提升到作用于最前面 c = 10;//直接赋值,直接变为顶层对象的属性,在node中顶层对象为global let a = 10;//有块作用域限制,不能重复声明,声明不会自动提升。 const a = 10;//可以用来声明原创 2017-02-22 20:24:25 · 1766 阅读 · 0 评论