Hide element based on items in a collection list

Hi!
I’m trying to hide the .book-reviews_main-heading based on if the collection list (.book-reviews_list) has less than two items. What is wrong with this code snippet? It won’t work.

if ($('.book-reviews_grid').length) < 2 {
  $('.book-reviews_main-heading').hide();
  }

hi @Patrik_Norell I do not work with jQuery but what I see in this short snippet is that you have your comparison out of if statement.

you should put your < 2 comparison condition into if condition wrapper. Hope that make sense.

if ($('.book-reviews_grid').length  <  2) {
 $('.book-reviews_main-heading').hide();
 }

now it will return true or false when condition is checked