Okay, this all bugs me. For one, having two free-floating arrays is asking for a typo later on that causes these two to be mismatched and then we'll have random mystery crashes. Two, the functions are really really kludgey. What makes it worse is that a lot of this kludginess can be done away with +[isSubclassOfClass:] ( https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/doc/uid/20000050-CJBJIDAB ) where yes, a class is its own subclass.

All this boils down to you have FOUR method names and 50 lines to do the following 10 lines:

NSString * JavascriptNameForClass(Class c)
{
    if([c isSubClassOfClass:[NSString class]]) return @"String";
    if([c isSubClassOfClass:[NSNumber class]]) return @"Number";
    if([c isSubClassOfClass:[NSArray class]]) return @"Array";
    if([c isSubClassOfClass:[NSDictionary class]]) return @"Object";
    if([c isSubClassOfClass:[KrollCallback class]]) return @"Function";
    if([c isSubClassOfClass:[KrollWrapper class]]) return @"Function";
    return NSStringFromClass(c)
}