前言:好的代码风格可以让你写起来事半功倍,而混乱或者没有代码风格会让你事倍功办,起写越乱

1. Javascript代码应符合Douban-JSLint检验标准

2. Javascript命名规则

  <td class="c5">
    <p class="c0">
      Element
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      Example
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      n
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      integer
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      nVariableName
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      i,j,k,m,n, etc. *
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      integer as counter/iterator
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      (for i=0; i<=oArray.length; i++)
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      s
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      string
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      sVariableName
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      o
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      object
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      oObjectName
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      is, can, has
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      boolean
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      [Boolean name]ConditionName
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      event method
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      event attachment
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      [event type]_MethodName
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      get
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      accessor method
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      getMethodName
    </p>
  </td>
</tr>

<tr>
  <td class="c6">
    <p class="c0">
      set
    </p>
  </td>
  
  <td class="c5">
    <p class="c0">
      accessor method
    </p>
  </td>
  
  <td class="c4">
    <p class="c0">
      setMethodName
    </p>
  </td>
</tr>