v8.run/go/exp@v0.0.26-0.20230226010534-afcdbd3f782d/util/slice/reverse.go (about)

     1  package slice
     2  
     3  func Reverse[T any](array []T) {
     4  	for i := 0; i < len(array)/2; i++ {
     5  		array[i], array[len(array)-i-1] = array[len(array)-i-1], array[i]
     6  	}
     7  }