# \`range\` of files with \`where\`

**URL:** https://discourse.gohugo.io/t/range-of-files-with-where/21407
**Category:** support
**Created:** [October 23, 2019, 6:43pm UTC](https://discourse.gohugo.io/t/range-of-files-with-where/21407 "2019-10-23T18:43:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![oshliaer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/oshliaer/32/1641_2.png) [@oshliaer](https://discourse.gohugo.io/u/oshliaer)
#### Post date: [October 23, 2019, 6:43pm UTC](https://discourse.gohugo.io/t/range-of-files-with-where/21407/1 "2019-10-23T18:43:53Z")

</div>

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.
