The first argument is the actual JS code we want to insert into the page. The second argument
determines where script should be inserted into the page. Possible values are:
-[[yii\web\View::POS_HEAD|View::POS_HEAD]] for head section.
-[[yii\web\View::POS_BEGIN|View::POS_BEGIN]] for right after opening `<body>`.
-[[yii\web\View::POS_END|View::POS_END]] for right before closing `</body>`.
-[[yii\web\View::POS_READY|View::POS_READY]] for executing code on document `ready` event. This will register [[yii\web\JqueryAsset|jQuery]] automatically.
-[[yii\web\View::POS_LOAD|View::POS_LOAD]] for executing code on document `load` event. This will register [[yii\web\JqueryAsset|jQuery]] automatically.
The last argument is a unique script ID that is used to identify code block and replace existing one with the same ID
instead of adding a new one. If you don't provide it, the JS code itself will be used as the ID.
An external script can be added like the following: