推荐关注
› Meteor
› JSLint - a JavaScript code quality tool
› jsFiddle
› D3.js
› WebStorm
推荐书目
› JavaScript 权威指南第 5 版
› Closure: The Definitive Guide
duhastmich

2吗?

  •  
  •   duhastmich · Jan 25, 2013 · 3784 views
    This topic created in 5040 days ago, the information mentioned may be changed or developed.
    fn = function(){
    console.log(1)
    return function(){
    console.log(3)
    }
    }

    (function(){
    console.log('2')
    })()
    7 replies  •  1970-01-01 08:00:00 +08:00
    0x0001
    0x0001
    Jan 25, 2013
    1
    233
    markmx
    markmx
    Jan 25, 2013
    2
    没看懂的路过 !

    @0x0001 能解释一下吗?
    undeflife
    undeflife
    Jan 25, 2013
    3
    @markmx
    这代码等于
    fn = function(){
    console.log(1)
    return function(){
    console.log(3)
    }
    }()()
    luin
    luin
    Jan 25, 2013
    4
    我曾经写过一篇文章,和这个很类似。代码中没加分号...
    http://zihua.li/2012/03/javascript-three-questions/
    第3题。
    duhastmich
    duhastmich
    OP
    Jan 25, 2013
    5
    @undeflife
    @luin 少了个分号,搞了个中午...
    luin
    luin
    Jan 25, 2013
    6
    @duhastmich 弄个jslint...
    duhastmich
    duhastmich
    OP
    Jan 25, 2013
    7
    @luin 哈哈,一般写coffeescript
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2107 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 12:19 · PVG 20:19 · LAX 04:19 · JFK 07:19
    ♥ Do have faith in what you're doing.