From 41f14181b7fe9447feef2943d7b532a4d11d3d44 Mon Sep 17 00:00:00 2001 From: huangqiaobo Date: Sat, 6 Sep 2014 22:15:42 +0800 Subject: [PATCH] =?UTF-8?q?2.7=E9=97=AD=E5=8C=85sorted=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E7=BF=BB=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原文This gives a reverse alphabetical sort, with "Barry" being placed before "Alex", and so on. --- source/chapter2/07_Closures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/07_Closures.md b/source/chapter2/07_Closures.md index 9699ed45..07a943ee 100755 --- a/source/chapter2/07_Closures.md +++ b/source/chapter2/07_Closures.md @@ -76,7 +76,7 @@ var reversed = sorted(names, backwards) 如果第一个字符串 (`s1`) 大于第二个字符串 (`s2`),`backwards`函数返回`true`,表示在新的数组中`s1`应该出现在`s2`前。 对于字符串中的字符来说,“大于” 表示 “按照字母顺序较晚出现”。 这意味着字母`"B"`大于字母`"A"`,字符串`"Tom"`大于字符串`"Tim"`。 -其将进行字母逆序排序,`"Barry"`将会排在`"Alex"`之后。 +其将进行字母逆序排序,`"Barry"`将会排在`"Alex"`之前。 然而,这是一个相当冗长的方式,本质上只是写了一个单表达式函数 (a > b)。 在下面的例子中,利用闭合表达式语法可以更好的构造一个内联排序闭包。