求教:上面是underscore的一段源碼,讓我比較困惑的是switch的作用,我覺得完全不需要switch啊,直接如果判斷context==null,如果不是直接返回return function () { return func.apply(context, arguments)
}上面這個不就可以嗎?求各位大神指教???它的注釋中說是// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore // functions.請問是對于比較少參數的時候,用call這種方法會快不少嗎?感覺有別的深意啊,畢竟我不覺得這個速度會差很多,可是實在想不到區別了
underscore源碼
慕田峪7331174
2018-10-03 09:23:41