A linked list node is represented as a plain object `{ val, next }`. Implement `arrayToList(arr)` that converts an array into a linked list and returns the head node. Example: `arrayToList([1,2,3])` → `{ val:1, next:{ val:2, next:{ val:3, next:null } } }`.
Run your code to see results.