currentArticle and nextArticle formatting question


#1


https://www.codecademy.com/courses/web-beginner-en-4hxyb/0/9?content_from=make-an-interactive-website%3Ajquery-events#

Hi there isn't any error with my codes, however, I'm wondering why there is no need to write $('.currentArticle') instead of 'currentArticle' , is the reason cause of the fact that currentArticle is a variable?


var main= function() {
    $('.article').click(function() {
    $('.article').removeClass('current');
    $('.description').hide();   
    $(this).addClass('current');
    $(this).children('.description').show();
    
  });

  $(document).keypress(function(event) {
    if(event.which === 111) {
    $('.current').children('.description').toggle()
    }
    
  else if(event.which === 110) {
  var currentArticle = '.current';
  var nextArticle = '.currentArticle.next()';
  
  $('.currentArticle').removeClass('current');
  $('.nextArticle').addClass('current')


#2

The correct format of writing currentArticle was supposed to be currentArticle.removeClass('current'). I wrote the wrong one in my first post to show what I thought was correct.


#3

Hey @seanhoon,

I think I've answered a similar question before. Does this post answer your question:

?