How to register scripts in wordpress

I am new to wordpress, I have a toggle nav that’s working just fine in html with this code.

however I don’t know the correct way to register it on wordpress functions.php to make my toggle nav work. and should I put it in a js folder, please help.

You will need to post your html code first and explain in detail exactly what you are wanting to do.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.