, , 201 jquery ( 2.0.1).
, ajax. 2. - {} "".
for ( ; i < length; i++ ) {
if ( (options = arguments[ i ]) != null ) {
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
loop on property (name in options), String, , ajax. first for loop , 2 , , capize.
:
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};
String.prototype.capitalize2 = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};
String.prototype.trim = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};
Object.defineProperty(String.prototype, 'test',
{
value: function(){ return "test" },
enumerable: false
});
Object.defineProperty(String.prototype, 'test2',
{
value: function(){ return "test" },
enumerable: true
});
for (var key in "") {
console.log(key);
}
:
capitalize2
test2
, , .
jsfiddle : http://jsfiddle.net/w9kdp96a/1/
mozilla:
for..in , . .
, capize
Object.defineProperty(String.prototype, 'capitalize',
{
value: function(){ return this.charAt(0).toUpperCase() + this.slice(1); },
enumerable: false
});
ajax.