nightwind
V2EX  ›  Node.js

死活看不懂这句代码啊,帮分析下

  •  
  •   nightwind · Oct 18, 2016 · 3372 views
    This topic created in 3670 days ago, the information mentioned may be changed or developed.
    <% site.tags.sort('name').each(function(item){ %>

    .each(function(item))啥意思啊
    8 replies  •  2016-12-15 12:47:42 +08:00
    fszaer
    fszaer
    Oct 18, 2016
    1
    遍历,下一
    zhangqinmiao
    zhangqinmiao
    Oct 21, 2016
    2
    第一行是遍历数组,第二行再遍历一次?
    不是很看得懂...............
    oscaryc
    oscaryc
    Oct 21, 2016
    3
    执行一下啥都清楚了?!
    wanganjun
    wanganjun
    Oct 24, 2016
    4
    可能楼主看不懂 <% 和 %>, 这个是 ejs 的语法
    http://ejs.co
    wanganjun
    wanganjun
    Oct 24, 2016
    5
    没注意看正文第二行...
    nightwind
    nightwind
    OP
    Oct 26, 2016
    6
    @oscaryc
    @fszaer item 如果换成别的单词行吗?
    SilentDepth
    SilentDepth
    Oct 26, 2016
    7
    @nightwind 换成别的单词行啊,只是一个变量而已,跟花括号里引用的变量名一致就行
    rekey
    rekey
    Dec 15, 2016
    8
    会报错吧。还是说扩展了一个 each 方法?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1886 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 16:41 · PVG 00:41 · LAX 08:41 · JFK 11:41
    ♥ Do have faith in what you're doing.