Code Monkey home page Code Monkey logo

noop's Introduction

🇨🇳 张云龙

寻找现实世界中的"bug"并用技术手段来解决,让世界变得更加规则,更加美好,这就是我的道。

noop's People

Contributors

fouber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ashitak guoyu07

noop's Issues

JavaScript语句末尾到底该不该加 分号 ?加或不加又有什么区别?比如性能,可读性?

我觉得,应该写

这件事我在很多地方讲起过,写下来,方便以后再发给别人看。

曾经发生过一起这样的事件,有一段这样的代码:

var foo = function(str){
    console.log(str);
}

(function(){
    foo('123');
})()

怎么想也想不明白,为什么这段js会报错,而且输出了一段不符合预期的内容,后来发现是因为第三行var语句结束那里少加了一个分号,导致整段代码实际上以这种方式执行:

var foo = function(str){
    console.log(str);
}(function(){
    foo('123');
});

foo();

这个故事告诉我们,结尾不写分号可能会引起一些麻烦。。。

在知乎上看到了更加完整的答案,http://zhi.hu/EVhp ,讲的更生动

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.