Developer
Intros
How it works
API reference
File types
sjs-4
sjs-4e
sjs-4et
app-1
buckets-1
contextmenu-1
css-1
css-2
css-2-wrapper
html-1
image-1
markdown-1
page-1
redirect-301
sh-1
static-1
svg-1
deprecated types
accept-1
accept-2
accept-3
sjs-3
Injected variables
Collection
add
attrInt32
attrStr
each
eq
filter
first
inline
last
length
query
reverse
select
slice
sort
sortBy
File
os
User
util
File links
App interface
Hotkeys & mouse controls
Nocode editor API
Filesystem Query Language
Reserved namespaces
Filesystem interface versions
URL endpoints
URL query parameters
Turbo CSS
Blog
Developer
Intros
How it works
API reference
Turbo CSS
Blog
sjs-4
sjs-4e
sjs-4et
app-1
buckets-1
contextmenu-1
css-1
css-2
css-2-wrapper
html-1
image-1
markdown-1
page-1
redirect-301
sh-1
static-1
svg-1
deprecated types
accept-1
accept-2
accept-3
sjs-3
Injected variables
Collection
add
attrInt32
attrStr
each
eq
filter
first
inline
last
length
query
reverse
select
slice
sort
sortBy
File
os
User
util
WARNING: The [sjs-3] engine was
deprecated
, use [
sjs-4
] instead.
Collection.prototype.reverse()
Return a new collection of files in reverse order.
Syntax
collection.reverse() Collection
Examples
Basic example.
f = new File() f.new(os.APPEND, "child-1", 0) f.new(os.APPEND, "child-2", 0) c = f.children() os.print("normal order:\n") c.each(function(file) { os.print(" " + file.name() + "\n") }) os.print("\n") os.print("reverse order:\n") c.reverse().each(function(file) { os.print(" " + file.name() + "\n") })
Run
Reversing empty collection is ok.
f = new File() c = f.children() os.print(c.reverse().length)
Run