Question: This is supposed to be in jQuery!!! Can you make sure you've declared the temporary variable inside your for loop? I thought I did this

This is supposed to be in jQuery!!!

Can you make sure you've declared the temporary variable inside your for loop?

I thought I did this already but apparently, I haven't. Suggestions?

var toPigLatin = function(str) { if (!str.replace) { return 'ERROR: Expected a string!'; } return str.replace(/\b(\w)(\w+)\b/g, '$2-$1ay').toLowerCase(); }; // Iterate through each paragraph, call the toPigLatin function on it var $paragraphs = $('p'); for (var i = 0; i < $paragraphs.length; i++) { var element = $paragraphs[i]; // DOM node var $paragraph = $(element); $paragraph.html( $paragraph.html()); } $paragraphs.each(function(index, element) { var $paragraph = $(this); console.log(element === this); $paragraph.html( $paragraph.html()); });

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!