What denotes such a function?

Tag.wrapImagesInLinks = function() {
 $('.img').each(function() {
 if (!$(this).parent().is('a')) {
 $(this).wrap('<a href="' + $(this).attr('src') + '" target="_blank" class="tag__link-img">');
}
});
 };</a>


What this function differs from the following:

function Tag.wrapImagesInLinks () {
 $('.img').each(function() {
 if (!$(this).parent().is('a')) {
 $(this).wrap('<a href="' + $(this).attr('src') + '" target="_blank" class="tag__link-img">');
}
});
 };</a>
July 9th 19 at 10:39
2 answers
July 9th 19 at 10:41
Solution
1) Function checks all the pictures and those that are not wrapped in anchor (a), wrapped in a link that points to the image, so the user could click on the picture and open it in a separate tab.
2) In the first case, the function is assigned to the object element. That is becoming a method of the module or don't know what you have there. In the 2nd case, the js should error, because the dot in the function name should not be.
July 9th 19 at 10:43
Solution

Find more questions by tags JavaScript