What is the Objective-C equivalent of the JavaScript concat() function?
Assuming that both objects are arrays, how would you combine them?
NSArray's arrayByAddingObjectsFromArray: is more-or-less equivalent to JavaScript's .concat() method:
NSArray *newArray=[firstArray arrayByAddingObjectsFromArray:secondArray];
Note: If firstArray is nil, newArray will be nil. This can be fixed by using the following:
NSArray *newArray=firstArray?[firstArray arrayByAddingObjectsFromArray:secondArray]:[[NSArray alloc] initWithArray:secondArray];
If you want to strip-out duplicates:
NSArray *uniqueEntries = (NSArray *)[[NSSet setWithArray:newArray] allObjects];
firstArray to be an NSMutableArray?if (!firstArray) firstArray = @[ ];
NSCalendarandNSDateComponentsand friends to do them for you. They are not a trivial subject. Are you taking leap months into account? How about daylight savings time? What about leap seconds? etc.