JavaScript 语句 Statement

  • Atom
  • Expression
  • Statement #这里讲的主要是这个 看 ECMA-262 里面就能够很清晰的看到这些JS 的statement
  • Structure
  • Program/Module

Grammar

简单语句
  • Expression Statement 表达式语句
    • a = 1 + 2;
  • Empty Statement 空语句
    • ;
  • Debugger Statement debugger语句,运行时不产生作用
    • debugger;
  • ThrowStatement
    • throw a;
  • Continue Statement(与循环相互匹配)
    • continue label1;
  • Break Statement(与循环匹配)
    • break label2;
  • Return Statement
    • return; / return 1;
组合语句
  • Block Statement
{
...
...
}
  • Iteration
while()
do...while
for
for...in...
for...of...
声明
  • FunctionDeclaration
  • GeneratorDeclaration
  • AsyncFunctionDeclaration
  • AsyncGeneratorDeclaration
  • VariableStatemeny
  • ClassDeclaration
  • LexicalDeclaration
标签、循环、break、continue
  • LabelledStatement
  • IterationStatement
  • ContinueStatement
  • BreakStatement
  • SwitchStatement

Runtime:

  • Complection Record
    • [[type]]: normal, break, continue, return, throw
    • [[value]]: Types
    • [[target]]: label
  • Lexical Enviorment(推荐使用前三种)
    • {} . [] Object.defineProperty
    • Object.create Object.setPrototypeOf Object.getPrototypeOf
    • new class extends
    • new function prototype(用这种会被打死)
posted @ 2020-06-11 15:30  jaiodfjiaodf  阅读(473)  评论(0编辑  收藏  举报