I'm trying to write a recursive function to count the number of items in a array using Javascript.

I can do it in Python:

```
def count(list):
 if list == []:
  return 0
 return 1 + count(list[1:]) 

```

How can I do it in ES5 and ES6?