Browse Source

Listing 5.14: string building with array.join().

Frederic G. MARAND 8 năm trước cách đây
mục cha
commit
d5bbd0c346
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      Chapter 5/05.js

+ 5 - 1
Chapter 5/05.js

@@ -21,7 +21,11 @@ $(document).ready(function () {
   var $notes = $('<ol id="notes"></ol>').insertBefore('#footer');
   $('span.footnote').each (function (index) {
     $(this)
-      .before('<sup>' + (index + 1) + '</sup>')
+      .before([
+        '<sup>',
+        index + 1,
+        '</sup>'
+      ].join(''))
       .appendTo($notes)
       .wrap('<li></li>');
   });