Giter Site home page Giter Site logo

Comments (2)

zhangjun620 avatar zhangjun620 commented on September 14, 2024

Switch语句

  1. "case" 分组 共享同一段代码的几个case分支可以被分为一组。(其实是 switch 语句没有 break 时的副作用)

  2. 类型 case的相等是严格相等,所以说 字符串的‘0‘ 和 数字 0 是不会匹配的

from font-end-tips.

zhangjun620 avatar zhangjun620 commented on September 14, 2024

For..in For..of

首先 forof是es6新增的,对于ie是不兼容的。

For in

  1. forin 遍历可枚举属性对象用的,数组还是foreach吧,或者for of
  2. 如果有可枚举的属性都会打印出来属性名,所以慎用(enumerable为true 的)

For of

  1. 迭代的是值,数组返回所有数组元素的值,而字符串则是所有的字符

参考

from font-end-tips.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.