Moshe
Moshe

Reputation: 58097

Objective-C methods that correspond to these JS methods?

What NSMutableArray methods correspond to these Javascript Array methods?

Upvotes: 2

Views: 751

Answers (1)

Dave DeLong
Dave DeLong

Reputation: 243156

  • shift is a combination of -objectAtIndex:0 and removeObjectAtIndex:0.
  • unshift is insertObject:obj atIndex:0. It does not return the new length, however.
  • slice is -[NSString substringWithRange:]
  • splice has no equivalent, though you can approximate it with insertObjects:atIndexes:.

Upvotes: 8

Related Questions