`range` of files with `where`

I have a short question about where. How can I rewrite the code

  {{ $files := readDir $part }}

  {{ range $files }}
    {{ if eq (substr .Name -1 3) ".js" }}
      {{ .Name }}
    {{ end }}
  {{ end }}

to

{{ range where $files (substr .Name -1 3) ".js" }}

?

I can’t understand the correct where syntax.