“JavaScript Advanced Program Design” Reading Note (1) ECMAScript Basic Basis

ecmascript foundation, mainly including grammar, variables, keywords, reserved words, original values and reference values
2.1 grammar
Differential writing, weak variable type, tail score number may be optional, annotated as dual -inclined lines, parentheses indicate code blocks

2.2 variable
Variables are declared in VAR. The naming rules of variables: The first character must be a letter, an lower line or a US dollar symbol; the remaining characters can be the lower line, the US dollar symbol or any letter or digital character.

variable naming specifications:

Camel mark: The first letter is lowercase, and the next word starts with a capital letter. For example: Var mytestvalue = 0, mySecondTVALUE = “Hi”;

PASCAL mark: The first letters are capitalized, and the next word starts with uppercase letters. For example: Var mytestvalue = 0, mySecondTVALUE = “Hi”;

Hungary Type Method: Add a lowercase letter (or lowercase letter sequence) in front of the variable named after the Pascal mark, indicating the type of the variable. For example, I represent an integer, s represents the string, as shown below:

  var iMyTestValue=0,sMySecondTestValue=”hi”;

The prefix used by the Hungarian type marking method defines the ECMAScript variables as follows:

Type: Array prefix: A Example: Avalues

Type: Boolean prefix: example B: BFOUND

Type: Floating -point prefix: F Example: Fvalue

Type: Function prefix: Fn Example: FnMethod

Type: Surgery prefix: I Example: IVALUE

type: Object prefix: O Example: OTYPE

type: regular prefix: Repatten

Type: String prefix: s example: SVALUE

Type: Variable Prefix: V Example: VVALUE

2.3 Keywords

The keywords defined by
ECMA-262 are::

  break  case  catch  continue  default  delete  do  else  finally  for  function  if  in  instanceof  new  return  switch  this  throw  try  typeof  var  void  while  with

2.4 Reserved Word
ECMA-262 In the 3rd edition, the reserved words are::

  abstract  boolean  byte  char  class  const  debugger  double  enum  export  extends  final  float  goto  implements  import  int  interface  long  native  package  private  protected  public  short  static  super  synchronized  throws  transient  volatile

2.5 Original value and reference value
Primitive value is a simple data segment stored in stacks, that is, their values are directly stored in the position of variable access.

Reference value is an object stored in the heap, that is, the value stored at the variable is a pointer, pointing to the memory of the storage object.

Author: Tian Xingjian, self -improvement

Leave a Reply

Your email address will not be published. Required fields are marked *