Write a function that calculates the sum of all integers in a nested list. A nested list is an array (or list) that may contain integers as well as other nested lists. The function should use recursion to traverse and accumulate the sum of all numbers in the structure.
For the nested list:
[1, [2, 3], [4, [5]], 6]
The sum is: 1 + 2 + 3 + 4 + 5 + 6 = 21.
// Input: a nested list which can contain integers and nested lists
// Output: integer representing the sum of all numbers
function nestedListSum(nestedList) {}