演算子を使用してネイティブ オブジェクトを拡張してみました。できます。考えられる副作用はありますか?
Number.prototype['+++'] = function(n){
return this + (2*n);
};
String.prototype['+'] = function(){
return this += [].slice.call(arguments).join('');
}
alert( 10['+++'](10) ); //=> 30
alert( 'hello '['+']('world ','and ','see you later!') );
//=> hello world and see you later!
このjsfiddleも参照してください