Array: Js array is a consecutive group of memory locations with the same name. the memory locations in an array…