zoukankan      html  css  js  c++  java
  • JavaScript Good Parts学习笔记-语法篇

    1 保留字一览

     abstract
    boolean break byte
    case catch char class const continue
    debugger default delete do double

    else enum export extends
    false final finally float for function
    goto
    if implements import in instanceof int interface
    long
    native new null
    package private protected public
    return
    short static super switch synchronized
    this throw throws transient true try typeof
    var volatile void
    while with

    2

    字符串可以用单引号,也可以用双引号。所有的字符都是16位的。

    The switch, while, for, and do statements are allowed to have an optional label prefix
    that interacts with the break statement.

    JavaScript的代码块不像其他语言一样,创建新的作用域。 因此变量应该定义在函数的头部。

    4

    Here are the falsy values:
    • false
    • null

    • undefined
    • The empty string ''
    • The number 0
    • The number NaN
    All other values are truthy, including true, the string 'false', and all objects.

    5???原型链???(prototype chain)

    The other form (called for in) enumerates the property names (or keys) of an object.
    On each iteration, another property name string from the object is assigned to the
    variable.
    It is usually necessary to test object.hasOwnProperty(variable) to determine whether
    the property name is truly a member of the object or was found instead on the prototype
    chain.
    for (myvar in obj) {
    if (obj.hasOwnProperty(myvar)) {
    ...
    }
    }

    6

    不允许在return关键字和表达式之间换行。

    不允许在break关键字和表达式之间换行。

    7

    The values produced by typeof are 'number', 'string', 'boolean', 'undefined',
    'function', and 'object'. If the operand is an array or null, then the result is
    'object', which is wrong.

  • 相关阅读:
    IOCP六:UDP 客户端退出
    IOCP六:UDP 客户端退出
    IOCP五:UDP线程退出
    IOCP五:UDP线程退出
    IOCP四:己方closesocket
    IOCP四:己方closesocket
    深入剖析多态,什么是多态?多态有什么用?
    SSM框架jsp无法从webapp下跳转到WEB-INF下的jsp;偶尔进去了也无法加载jsp的静态资源
    一句话理解什么是“聚合”,什么是“组合”
    Jsp+Servlet+JDBC实现ATM机系统
  • 原文地址:https://www.cnblogs.com/sdfczyx/p/6396591.html
Copyright © 2011-2022 走看看