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