V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
nightwind
V2EX  ›  Node.js

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

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