how to use javaScript - Yii2
<p>I registered a JavaScript file in AppAsset like this:</p>

<pre><code>public $js = ['Index/top_menu.js']
</code></pre>

<p>Is it necessary to use <code>registerJs</code> and <code>registerJsFile</code>?<br>
If yes where should I use them?</p>