Question regarding when to use period


#1



On the n shortcut 2


I have a question about when to use a period (".") So when creating a new variable and replacing them, we use a period before current ('.current') but when using to remove and add class of ('current'), we don't add a period. What's the difference that makes this the case?

Thanks in advance!


else if(event.which === 110) {
            var currentArticle = $('.current');
            var nextArticle = currentArticle.next();
            
            currentArticle.removeClass('current');
            nextArticle.addClass('current');
            }


#2

as you see addClass you can only add a class and not anything else thus you don't need to specify it as a class by adding . - same with removeClass

^ Here you can choose anything, an id, class, any element thus you specify it as a class by using a .