Array question making array based on selected index or element

How can i make new array selecting an index :
let say i have an array like this:

var myarray: Array = [“a”, “b”,“c”, “d”,“e”, “f”, “g” ,“h”, “i”, “j” , “k” , “l”];

and let say i selected myarray[4] or **“e” ** so when i point it to “e” then the 3 elements before that will get selected and also the 3 elements after that …so it will form something like this …

newarray = [“b” , “c” ,“d” ,“e” , “f” ,“g” , “h”];

or let say i selected myarray[7] which is the “h” then
the newarray = [“e”, “f”, “g”, “h” , “i”, “j”, “k”];

and so on … hopes this is clear. …

basicly just make new array according to the selected or current index …

another example if myarray[0] is selected

then the newarray = [“a”, “b”,“c” , “d” ] the 3 before that will not be created since there is none same goes at the end of an array …

thanks in advanced…