namespace app\components;
This tutorial presents a way of separating JS code from views and passing to it values from PHP.