There's a full example on the Help page "Map/Reduc...
# suitescript
e
There's a full example on the Help page "Map/Reduce Script Type"