Only Execute jQuery on Homepage

Only Execute jQuery on Homepage

Hello all!

First, just want to say thanks in advance for your help with my question!

I'm and VERY new to jQuery.. I have a WordPress theme I'm using, and it there is a piece of jQuery that I only want to be executed on the homepage.

Here's the code I'm wanting to execute: 
  1. $('.collapse').collapse({

  2.  toggle: true

  3. })
In other words, if it's the homepage, I want to execute what's above, "else" I want to make toggle: false

How do I go about doing that?

Thanks so much in advance for your help!

Please let me know if you have any questions or need additional information!

Regards,
-Alex