js文档MDN doc

简介

JavaScript是一种属于网络的脚本语言,已经被广泛用于Web应用开发,常用来为网页添加各式各样的动态功能,为用户提供更流畅美观的浏览效果。本节主要带大家熟悉JavaScript语句,巩固JavaScript基础,应对JavaScript相关面试提问。

程序的三种基本结构
顺序结构:从上到下执行的代码就是顺序结构,程序默认就是由上到下顺序执行的;
分支结构:根据不同的情况及判断,执行对应代码;
循环结构:重复执行一段代码。

JS 由三部分组成,分别是:DOM BOM ES(5 6 ….)


前端框架

类库:

  • JQuery
  • Lodash

JS 框架:

  • React
  • Vue
  • Angular
  • Ext JS
  • Backbone

工具:

  • webpack(Build)
  • jest(Test)
  • ESlint(Lint)
  • Template(EJS)
  • 应用方面的(Echarts/D3/three)

区别:

框架—包含—>库
框架—调用—>运行代码(如:生命周期函数)—调用—>库


数据及类型判断

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// undefined(未定义)
typeof undefined // "undefined"

// 字符串
typeof "" // "string"

// 布尔值
typeof true // "boolean"

// number
typeof 0 // "number"
isNaN(+"a") // true

// function
typeof Function; // "function"

// object(Array 和 null 也是 object 类型,所以不能用 typeof 判断类型了)
Object.prototype.toString.call([]) // "[object Array]"
Array.isArray([]) // true
[] instanceof Array // true
Object.prototype.toString.call({}) // "[object Object]"
({}) instanceof Object // true
Object.prototype.toString.call(null) // "[object Null]"
Function('console.log(Object.prototype.toString.call(arguments))')() // "[object Arguments]"

var v={};v!==undefined&&v!==null&&(v).constructor==={}.constructor // true