updated array function to take a number and array as arg