JS常见基础知识回顾

2017-03-29  本文已影响0人  韩_小文

变量,作用域和内存问题

引用类型(存在于堆内存中)

可以为其添加属性和方法

Paste_Image.png Paste_Image.png

基本类型(存在于栈内存中)

不可以为其添加属性和方法

Paste_Image.png

但是?


Paste_Image.png

原因:


Paste_Image.png

基本包装类型:Boolean,Number,String

Paste_Image.png

tip:ES中所有函数的参数都是按值传递的,意味着向函数中传入引用类型的话传递的是对应的指针

Paste_Image.png

垃圾收集机制

Paste_Image.png Paste_Image.png

数组

模拟栈(后进先出,最新添加的项最早被移除)方法:

Paste_Image.png

模拟队列(先进先出,末端添加项,前端移除)方法:

Paste_Image.png

重排序方法:

reverse():反转数组顺序
sort():升序排列

连接数组:concat()

截取数组:slice()

插入,替换新项到指定位置:splice()

寻找元素索引: indexOf() lastIndexOf()

迭代方法:

Paste_Image.png Paste_Image.png

RegExp

Paste_Image.png

测试匹配方法:test()

Function

arguments:保存函数参数。

Paste_Image.png

tip:严格模式下会报错

改变函数内this指向,扩充函数作用域:call(),apply(),bind().

(1)Math.min.apply(null,array);
(2)


Paste_Image.png

Number

toString():返回字符串形式的值。

Paste_Image.png

toFixed():返回指定小数位字符串。

Paste_Image.png

String

charAt()/charCodeAt():返回指定单个字符位置

字符串拼接:concat(),join()

字符串截取:slice(),substr(),subsring()

返回指定子字符串位置:indexOf(),lastIndexOf()

删除字符串多余空格:trim()

模式匹配方法,跟正则的exec()一样:match()

字符串替换:replace()

大小写转换:toLowerCase(),toUpperCase()

字符串分割:split()

Global对象

URI编码方法:

Paste_Image.png

相对应的解码方法:decodeURI(),decodeURIComponent()

Math对象

Paste_Image.png Paste_Image.png Paste_Image.png Paste_Image.png Paste_Image.png

原型链与继承

Paste_Image.png Paste_Image.png Paste_Image.png

检测属性存在实例中还是原型中:hasOwnProperty()

取得对象所有可枚举实例属性方法:Object.keys()

闭包

闭包:有权访问另一个函数作用域中的变量的函数。

Paste_Image.png

DOM

自定义数据属性:

滚动方法

返回当前元素所有计算样式方法:getComputedStyle(),IE中为currentStyle属性

事件

DOM事件流

Paste_Image.png

DOM事件对象

Paste_Image.png Paste_Image.png Paste_Image.png Paste_Image.png

UI事件

Paste_Image.png

鼠标事件

Paste_Image.png Paste_Image.png Paste_Image.png Paste_Image.png Paste_Image.png

触摸与手势事件

Paste_Image.png Paste_Image.png Paste_Image.png

FILE API

fileReader 类型

Paste_Image.png Paste_Image.png Paste_Image.png

blob URL

Paste_Image.png Paste_Image.png Paste_Image.png

文件拖拽

Paste_Image.png

上传

Paste_Image.png

WEINRE 工具

Paste_Image.png Paste_Image.png
上一篇 下一篇

猜你喜欢

热点阅读