This method is alias of script().

echo Asset::js('your-js-path');
echo Asset::js('your-js-path', ['required' => 'yes']);

@return mixed
500228
public function js()
    {
        $args = [];
        $args = func_get_args();

        if (isset($args[1])) {
            $args[1] = array_merge($args[1], ['type' => 'static']);
        } else {
            $args[1] = ['type' => 'static'];
        }

        return call_user_func_array([new static($this->container), 'script'], $args);
    }
421795
public function minifyJS() {
      $js_dir = './js';
      if (is_dir($js_dir)) {
         foreach (glob("$js_dir/*.js") as $js_file) {
            if (!$this->endsWith($js_file, 'min.js')) {
               $this->taskMinify($js_file)
                  ->to(str_replace('.js', '.min.js', $js_file))
                  ->type('js')
                  ->run();
            }
         }
      }
      return $this;
   }
1109595
public function asJavascript()
    {
        return implode("\n    ", array_map(function ($push) {
            return '_paq.push([' . implode(', ', array_map(function ($item) {
                    if ($item instanceof RawExpression) {
                        return $item->value;
                    }

                    // JSON encoding is used to escape data injected into javascript
                    return json_encode($item);
                }, $push)) . ']);';
        }, $this->pushs));
    }
1042663
public function generateAndIncludeJavaScript()
    {
        $filePath = $this->assetHandlerConnectorManager->getFormzGeneratedFilePath() . '.js';

        $this->assetHandlerConnectorManager->createFileInTemporaryDirectory(
            $filePath,
            function () {
                return
                    // Form initialization code.
                    $this->getFormInitializationJavaScriptAssetHandler()
                        ->getFormInitializationJavaScriptCode() .
                    LF .
                    // Fields validation code.
                    $this->getFieldsValidationJavaScriptAssetHandler()
                        ->getJavaScriptCode() .
                    LF .
                    // Fields activation conditions code.
                    $this->getFieldsActivationJavaScriptAssetHandler()
                        ->getFieldsActivationJavaScriptCode() .
                    LF .
                    // Fields validation activation conditions code.
                    $this->getFieldsValidationActivationJavaScriptAssetHandler()
                        ->getFieldsValidationActivationJavaScriptCode();
            }
        );

        $this->includeJsFile(StringService::get()->getResourceRelativePath($filePath));

        return $this;
    }
535347
protected function setScript()
    {
        $name = $this->getViewName();
        if (! $this->hasView($name)) {
            return $this->viewNotFound();
        }
        $this->view->setView($name);
    }
937457
public function getScript()
    {
        if(count($this->aScripts) == 0)
        {
            return '';
        }
        if(($this->sContext))
        {
            $js = "$('" . $this->sSelector . "', $('" . $this->sContext . "'))";
        }
        else
        {
            $js = "$('" . $this->sSelector . "')";
        }
        return $js . '.' . implode('.', $this->aScripts);
    }
1082944
public function scriptsAction()
    {
        $locator = $this->get('file_locator');

        $content =
            file_get_contents($locator->locate('@PhlexibleUserBundle/Resources/scripts/ChangePasswordWindow.js')).
            file_get_contents($locator->locate('@PhlexibleUserBundle/Resources/scripts/ValidateWindow.js')).
            file_get_contents($locator->locate('@PhlexibleUserBundle/Resources/scripts/SetPasswordWindow.js'));

        return new Response($content, 200, ['Content-Type' => 'text/javascript']);
    }
1199048
public function scriptFile($path) {
        if ($this->skipOtherScriptFiles)
            return "";
        
        if ('http' != substr($path, 0, 4)) {
            $path = \mpf\WebApp::get()->request()->getWebRoot() . $path;
        }

        $md5 = md5($path);
        if (in_array($md5, self::$cssScriptHistory))
            return '';
        self::$cssScriptHistory[] = $md5;
        return '<script type="text/javascript" src="' . self::encode($path) . '"></script>';
    }
982118
private function localizeAsset()
    {
        if ($this->getArgument('localize')) {
            wp_localize_script(
                $this->getSlug(),
                $this->getArgument('localize')['var'],
                $this->getArgument('localize')['callback']
            );
        }

        return $this;
    }
303081
public function generateAndIncludeFormzConfigurationJavaScript()
    {
        $formzConfigurationJavaScriptAssetHandler = $this->getFormzConfigurationJavaScriptAssetHandler();
        $fileName = $formzConfigurationJavaScriptAssetHandler->getJavaScriptFileName();

        $this->assetHandlerConnectorManager->createFileInTemporaryDirectory(
            $fileName,
            function () use ($formzConfigurationJavaScriptAssetHandler) {
                return $formzConfigurationJavaScriptAssetHandler->getJavaScriptCode();
            }
        );

        $this->includeJsFile(StringService::get()->getResourceRelativePath($fileName));

        return $this;
    }
444034
public static function js()
    {
        $jsPath = dirname(__FILE__) . "/clients/core/KoolReport.js";
        if (is_file($jsPath)) {
            return "<script type='text/javascript'>"
                .preg_replace('/\s+/S', " ", file_get_contents($jsPath)) 
                ."</script>";
        } else {
            throw new \Exception("Could not find KoolReport.js");
        }
    }
1335199
protected function getScript()
    {
        if (null === $this->getScriptName()) {
            $request = $this->frontController->getRequest();
            $this->setScriptName($request->getControllerName() . DIRECTORY_SEPARATOR . $request->getActionName());
        }

        return $this->getScriptName() . '.' . $this->getViewSuffix();
    }
39727
public static function getAssets(){

    // first call? include styles and javascript
    if(static::$didAssets)
      return '';

    ob_start();

    if(ref::config('stylePath') !== false){
      ?>
      <style scoped>
        <?php readfile(str_replace('{:dir}', __DIR__, ref::config('stylePath'))); ?>
      </style>
      <?php
    }

    if(ref::config('scriptPath') !== false){
      ?>
      <script>
        <?php readfile(str_replace('{:dir}', __DIR__, ref::config('scriptPath'))); ?>
      </script>
      <?php
    }

    // normalize space and remove comments
    $output = preg_replace('/\s+/', ' ', trim(ob_get_clean()));
    $output = preg_replace('!/\*.*?\*/!s', '', $output);
    $output = preg_replace('/\n\s*\n/', "\n", $output);

    static::$didAssets = true;
    return $output;
  }
575143
function RenderScript()
    {
        $templateFile = Path::RemoveExtension($this->TemplateFile());
        $scriptFile = Path::AddExtension($templateFile, 'Script');
        ob_start();
        require Path::AddExtension($scriptFile, 'phtml');
        return ob_get_clean();
    }
1167761
public static function getCurrentScriptPath()
    {
        $queryString = self::getCurrentScriptName();

        //add a fake letter case /test/test2/ returns /test which is not expected
        $urlDir = dirname($queryString . 'x');
        $urlDir = str_replace('\\', '/', $urlDir);
        // if we are in a subpath we add a trailing slash
        if (strlen($urlDir) > 1) {
            $urlDir .= '/';
        }
        return $urlDir;
    }
357921
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $dismissable_messages =
            '[' . implode(', ', $this->dismissable_messages) . ']';

        $javascript .= sprintf(
            "var %s_obj = new %s('%s', %s);",
            $this->id,
            $this->getJavaScriptClass(),
            $this->id,
            $dismissable_messages
        );

        return $javascript;
    }
426476
public function run(): string
    {
        $out = '';
        $this->_dependencies = array_unique($this->_dependencies);

        $out .= $this->getNamespaceDefinitions();
        $this->addCurrentController();

        foreach ($this->_dependencies as $dependency) {
            if (strpos($dependency, DS) !== false) {
                $dependency = str_replace(DS, '/', $dependency);
            }
            $jsFile = $this->Html->script($dependency);
            $out .= $jsFile . "\n";
        }
        $out .= $this->getAppDataJs($this->_frontendData);
        $out .= $this->Html->script('/frontend_bridge/js/bootstrap.js');

        return $out;
    }