Skip to main content
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

As @Hosch250@Hosch250 pointed out, this is hard to read because the indentation is off in many places.

A minor thing about this loop:

      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $(".inner").append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

The $(".inner") dom lookup will be performed in every iteration of the loop, which is inefficient. It would be better to cache this lookup in a variable before the loop:

      var $inner = $(".inner");
      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $inner.append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

As @Hosch250 pointed out, this is hard to read because the indentation is off in many places.

A minor thing about this loop:

      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $(".inner").append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

The $(".inner") dom lookup will be performed in every iteration of the loop, which is inefficient. It would be better to cache this lookup in a variable before the loop:

      var $inner = $(".inner");
      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $inner.append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

As @Hosch250 pointed out, this is hard to read because the indentation is off in many places.

A minor thing about this loop:

      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $(".inner").append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

The $(".inner") dom lookup will be performed in every iteration of the loop, which is inefficient. It would be better to cache this lookup in a variable before the loop:

      var $inner = $(".inner");
      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $inner.append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }
added 74 characters in body
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391

As @Hosch250@Hosch250 pointed out, this is hard to read because the indentation is off in many places.

A minor thing about this loop:

      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $(".inner").append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

The $(".inner") dom lookup will be performed in every iteration of the loop, which is inefficient. It would be better to cache this lookup in a variable before the loop:

      var $inner = $(".inner");
      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $inner.append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

As @Hosch250 pointed out, this is hard to read because the indentation is off in many places.

A minor thing about this loop:

      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $(".inner").append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

The $(".inner") dom lookup will be performed in every iteration of the loop, which is inefficient. It would be better to cache this lookup in a variable before the loop:

      var $inner = $(".inner");
      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $inner.append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

As @Hosch250 pointed out, this is hard to read because the indentation is off in many places.

A minor thing about this loop:

      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $(".inner").append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

The $(".inner") dom lookup will be performed in every iteration of the loop, which is inefficient. It would be better to cache this lookup in a variable before the loop:

      var $inner = $(".inner");
      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $inner.append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391

As @Hosch250 pointed out, this is hard to read because the indentation is off in many places.

A minor thing about this loop:

      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $(".inner").append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }

The $(".inner") dom lookup will be performed in every iteration of the loop, which is inefficient. It would be better to cache this lookup in a variable before the loop:

      var $inner = $(".inner");
      for (var i = 0; i < result.feed.entries.length; i++) {
          var entry = result.feed.entries[i];
          var link = '<a target=_blank; href="' + entry.link + '">' + 'View on Ted.com' + '</a>';
          var image = result.feed.entries[i].mediaGroups[0].contents[0].thumbnails[0].url;
          $inner.append('<div class="innerdetail viewmore" data-num="' + i + '"> <img class="thumbnail" title="Click to view more" src="' + image + '"/> <p class="title">' + entry.title + ' </p> <p class="snippet">' + entry.contentSnippet + '</p>' + link + ' </div>');
      }