//
function(data, statusText, xhr, $form){ // 有个逗号是中文
The hasOwnProperty() method returns a boolean indicating whether the object has the specified property as its own property(as opposed to inheriting it).
Function.prototype.bind
The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
var module = {
x: 42,
getX: function() {
return this.x;
}
}
var retrieveX = module.getX;
console.log(retrieveX()); // The function gets invoked at the global scope
// expected output: undefined
var boundGetX = retrieveX.bind(module);
console.log(boundGetX());
// expected output: 42
fun.bind(thisArg[, arg1[, arg2[, ...]]])
arg1, arg2, ...
Arguments to prepend to arguments provided to the bound function when invoking the target function.
array.prototype.splice()
The splice()
method changes the contents of an array by removing existing elements and/or adding new elements.
var months = ['Jan', 'March', 'April', 'June'];
months.splice(1, 0, 'Feb');
// inserts at 1st index position
console.log(months);
// expected output: Array ['Jan', 'Feb', 'March', 'April', 'June']
months.splice(4, 1, 'May');
// replaces 1 element at 4th index
console.log(months);
// expected output: Array ['Jan', 'Feb', 'March', 'April', 'May']
array.prototype.slice()
The slice()
method returns a shallow copy of a portion of an array into a new array object selected from begin
to end
(end
not included). The original array will not be modified.
var animals = ['ant', 'bison', 'camel', 'duck', 'elephant'];
console.log(animals.slice(2));
// expected output: Array ["camel", "duck", "elephant"]
console.log(animals.slice(2, 4));
// expected output: Array ["camel", "duck"]
console.log(animals.slice(1, 5));
// expected output: Array ["bison", "camel", "duck", "elephant"]
var regex1 = RegExp('foo*');
var regex2 = RegExp('foo*','g');
var str1 = 'table football';
console.log(regex1.test(str1));
// expected output: true
console.log(regex1.test(str1));
// expected output: true
console.log(regex2.test(str1));
// expected output: true
// the regex.prototype.exec() method, the returned array has the matched text as the first item, and then one item for
// each capturing parenthesis that matched containing the text that was captured. when "g" is absent,lastIndex will remain as 0
// the string.prototype.search() method return the index of the first match.
// the string.prototype.match() method if "g" is absent, return the same result as regex.prototype.exec(), else return an array
// containing all matched substrings rather than match objects. captured groups are not returned.
console.log(regex2.test(str1)); //if the regex has the global flag set, test() will advance the lastIndex of the regex.
// expected output: false
function.prototype.length // arguments length
function.prototype.toString() // 可以打印函数定义