1 The `reverse()` function returns the input argument in reverse order. 2 3 Returns a reversed copy of the input string if the given input value 4 argument is a string. 5 6 Returns a reversed copy of the input array if the given input value 7 argument is an array. 8 9 Returns `null` if the input argument is neither a string nor an array. 10 11 -- Testcase -- 12 {% 13 printf("%.J\n", [ 14 reverse("abc"), 15 reverse([1, 2, 3]), 16 reverse(true) 17 ]); 18 %} 19 -- End -- 20 21 -- Expect stdout -- 22 [ 23 "cba", 24 [ 25 3, 26 2, 27 1 28 ], 29 null 30 ] 31 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt