Extension of arrays

Extension operator

meaning

Extension operator (spread) Three points (...). It's like rest Inverse operation of parameter , Convert an array to a comma separated sequence of parameters .

console.log(...[1, 2, 3])
// 1 2 3 console.log(1, ...[2, 3, 4], 5)
// 1 2 3 4 5 [...document.querySelectorAll('div')]
// [<div>, <div>, <div>]

This operator is mainly used for function calls .

function push(array, ...items) {
array.push(...items);
} function add(x, y) {
return x + y;
} const numbers = [4, 38];
add(...numbers) //

In the above code ,array.push(...items) and add(...numbers) These two lines , All are function calls , They all use extension operators . This operator takes an array , Change to parameter sequence .

Extension operators can be used in combination with normal function parameters , Very flexible .

function f(v, w, x, y, z) { }
const args = [0, 1];
f(-1, ...args, 2, ...[3]);

You can also place expressions after extension operators .

const arr = [
...(x > 0 ? ['a'] : []),
'b',
];

If the extension operator is followed by an empty array , It doesn't have any effect .

[...[], 1]
// [1]

Substitution function apply Method

Because extension operators can expand arrays , So you don't need it anymore apply Method , Turn the array into a function parameter .

// ES5 Writing 
function f(x, y, z) {
// ...
}
var args = [0, 1, 2];
f.apply(null, args); // ES6 Writing
function f(x, y, z) {
// ...
}
let args = [0, 1, 2];
f(...args);

Here's the extension operator replacement apply A practical example of the method , application Math.max Method , Simplify the way to find the largest element of an array .

// ES5 Writing 
Math.max.apply(null, [14, 3, 77]) // ES6 Writing
Math.max(...[14, 3, 77]) // Equate to
Math.max(14, 3, 77);

In the above code , because JavaScript Not to mention the function of the largest element of an array , So we can only apply Math.max function , Turn the array into a sequence of parameters , Then find the maximum . With the extension operator , You can use it directly Math.max 了 .

Another example is through push function , Add one array to the end of another .

// ES5 Of How to write it 
var arr1 = [0, 1, 2];
var arr2 = [3, 4, 5];
Array.prototype.push.apply(arr1, arr2); // ES6 Writing
let arr1 = [0, 1, 2];
let arr2 = [3, 4, 5];
arr1.push(...arr2);

Code above ES5 In writing ,push The argument to a method cannot be an array , So we have to go through apply The method can be used flexibly push Method . With extension operators , You can pass the array directly into push Method .

Here's another example .

// ES5
new (Date.bind.apply(Date, [null, 2015, 1, 1]))
// ES6
new Date(...[2015, 1, 1]);

Application of extension operators

(1) Copy the array

Arrays are composite data types , If you copy directly , Just copied the pointer to the underlying data structure , Instead of cloning a whole new array .

const a1 = [1, 2];
const a2 = a1; a2[0] = 2;
a1 // [2, 2]

In the above code ,a2 Not at all a1 The clone , It's another pointer to the same data . modify a2, Will lead directly to a1 The change of .

ES5 You can only copy arrays in a flexible way .

const a1 = [1, 2];
const a2 = a1.concat(); a2[0] = 2;
a1 // [1, 2]

In the above code ,a1 Will return a clone of the original array , Revise a2 It won't be right a1 An impact .

Extended operators provide a simple way to copy arrays .

const a1 = [1, 2];
// Writing a
const a2 = [...a1];
// Write two
const [...a2] = a1;

The above two ways of writing ,a2 All are a1 The clone .

(2) Merge array

The extension operator provides a new way to write array merging .

const arr1 = ['a', 'b'];
const arr2 = ['c'];
const arr3 = ['d', 'e']; // ES5 The merge array of
arr1.concat(arr2, arr3);
// [ 'a', 'b', 'c', 'd', 'e' ] // ES6 The merge array of
[...arr1, ...arr2, ...arr3]
// [ 'a', 'b', 'c', 'd', 'e' ]

however , Both methods are shallow copies , You need to pay attention to .

const a1 = [{ foo: 1 }];
const a2 = [{ bar: 2 }]; const a3 = a1.concat(a2);
const a4 = [...a1, ...a2]; a3[0] === a1[0] // true
a4[0] === a1[0] // true

In the above code ,a3 and a4 It's a new array formed by combining two different methods , But their members are all references to the original array members , This is a shallow copy . If you modify the members of the original array , It will be synchronized to the new array .

(3) Combined with deconstruction assignment

Extension operators can be combined with deconstruction assignments , Used to generate arrays .

// ES5
a = list[0], rest = list.slice(1)
// ES6
[a, ...rest] = list

Here are some other examples .

const [first, ...rest] = [1, 2, 3, 4, 5];
first //
rest // [2, 3, 4, 5] const [first, ...rest] = [];
first // undefined
rest // [] const [first, ...rest] = ["foo"];
first // "foo"
rest // []

If the extended operator is used for array assignment , It can only be placed in the last bit of the parameter , Otherwise, an error will be reported .

const [...butLast, last] = [1, 2, 3, 4, 5];
// Report errors const [first, ...middle, last] = [1, 2, 3, 4, 5];
// Report errors

(4) character string

Extension operators can also turn strings into real arrays .

[...'hello']
// [ "h", "e", "l", "l", "o" ]

The way it's written is , There is an important benefit , That is to be able to correctly identify four bytes Unicode character .

'x\uD83D\uDE80y'.length //
[...'x\uD83D\uDE80y'].length //

The first way to write the above code ,JavaScript Four bytes of Unicode character , Identified as 2 Characters , There is no such problem with extension operators . therefore , Functions that correctly return the length of a string , You can write like this .

function length(str) {
return [...str].length;
} length('x\uD83D\uDE80y') //

Anything that involves manipulating four bytes Unicode Character functions , All have this problem . therefore , It's best to rewrite them all with extension operators .

let str = 'x\uD83D\uDE80y';
str.split('').reverse().join('')
// 'y\uDE80\uD83Dx' [...str].reverse().join('')
// 'y\uD83D\uDE80x'

In the above code , If you don't use extension operators , A string of reverse The operation is not correct .

(5) Realized Iterator Object of the interface

whatever Iterator Object of the interface ( Refer to the Iterator chapter ), Can be converted to a real array with the extension operator .

let nodeList = document.querySelectorAll('div');
let array = [...nodeList];

In the above code ,querySelectorAll Method returns a nodeList object . It's not an array , It's an array like object . At this time , Extension operators can turn it into a real array , And the reason is that NodeList Object implementation Iterator .

For those who are not deployed Iterator Interface is an array like object , The extension operator can't turn it into a real array .

let arrayLike = {
'0': 'a',
'1': 'b',
'2': 'c',
length: 3
}; // TypeError: Cannot spread non-iterable object.
let arr = [...arrayLike];

In the above code ,arrayLike Is an array-like object , But there's no deployment Iterator Interface , The extension operator will report an error . At this time , You can use Array.from Methods will arrayLike Turns into a real array .

(6)Map and Set structure ,Generator function

The extension operator internally calls the data structure Iterator Interface , So as long as you have Iterator Object of the interface , You can use extension operators , such as Map structure .

let map = new Map([
[1, 'one'],
[2, 'two'],
[3, 'three'],
]); let arr = [...map.keys()]; // [1, 2, 3]

Generator After the function runs , Returns a traverser object , So you can also use extension operators .

const go = function*(){
yield 1;
yield 2;
yield 3;
}; [...go()] // [1, 2, 3]

In the above code , Variable go It's a Generator function , After execution, a traverser object is returned , Execute the extension operator on this traverser object , The value obtained by internal traversal will be , Into an array .

If not Iterator Object of the interface , Use the extension operator , Will be an error .

const obj = {a: 1, b: 2};
let arr = [...obj]; // TypeError: Cannot spread non-iterable object

Array.from()

Array.from Method to convert two types of objects into real arrays : Array like objects (array-like object) Ergodic (iterable) The object of ( Include ES6 New data structure Set and Map).

Here is an array like object ,Array.from Turn it into a real array .

let arrayLike = {
'0': 'a',
'1': 'b',
'2': 'c',
length: 3
}; // ES5 Writing
var arr1 = [].slice.call(arrayLike); // ['a', 'b', 'c'] // ES6 Writing
let arr2 = Array.from(arrayLike); // ['a', 'b', 'c']

Practical application , Common array like objects are DOM Operation returned NodeList aggregate , And inside the function arguments object .Array.from You can turn them into real arrays .

// NodeList object 
let ps = document.querySelectorAll('p');
Array.from(ps).filter(p => {
return p.textContent.length > 100;
}); // arguments object
function foo() {
var args = Array.from(arguments);
// ...
}

In the above code ,querySelectorAll Method returns an array like object , You can turn this object into a real array , Reuse filter Method .

As long as it's deployed Iterator Data structure of the interface ,Array.from Can be converted to an array .

Array.from('hello')
// ['h', 'e', 'l', 'l', 'o'] let namesSet = new Set(['a', 'b'])
Array.from(namesSet) // ['a', 'b']

In the above code , String and Set Structure has Iterator Interface , So it can be Array.from Turns into a real array .

If the parameter is a real array ,Array.from A new array as like as two peas .

Array.from([1, 2, 3])
// [1, 2, 3]

It's worth reminding , Extension operator (...) You can also convert some data structures to arrays .

// arguments object 
function foo() {
const args = [...arguments];
} // NodeList object
[...document.querySelectorAll('div')]

The traversal interface is invoked behind the extension operator (Symbol.iterator), If an object does not deploy this interface , Can't convert .Array.from Method also supports array like objects . So called array like objects , There is only one essential feature , That is, there must be length attribute . therefore , Any length Object of property , Both can pass Array.from Method to array , At this point, extension operators cannot be converted .

Array.from({ length: 3 });
// [ undefined, undefined, undefined ]

In the above code ,Array.from Returns an array with three members , The value of each position is undefined. Extension operators can't convert this object .

For browsers that have not yet deployed this method , It can be used Array.prototype.slice Method substitution .

const toArray = (() =>
Array.from ? Array.from : obj => [].slice.call(obj)
)();

Array.from You can also accept the second parameter , Act like an array map Method , Used to process each element , Put the processed value into the returned array .

Array.from(arrayLike, x => x * x);
// Equate to
Array.from(arrayLike).map(x => x * x); Array.from([1, 2, 3], (x) => x * x)
// [1, 4, 9]

Here's an example of taking out a set of DOM The text content of the node .

let spans = document.querySelectorAll('span.name');
// map()
let names1 = Array.prototype.map.call(spans, s => s.textContent); // Array.from()
let names2 = Array.from(spans, s => s.textContent)

In the following example, the Boolean value in the array is false Members of 0.

Array.from([1, , 2, , 3], (n) => n || 0)
// [1, 0, 2, 0, 3]

Another example is to return various types of data .

function typesOf () {
return Array.from(arguments, value => typeof value)
}
typesOf(null, [], NaN)
// ['object', 'object', 'number']

If map The function uses this keyword , You can also pass in Array.from The third parameter of , Used to bind this.

Array.from() You can turn various values into real arrays , And it also provides map function . This actually means , As long as there is an original data structure , You can process its value first , Then it's converted to a canonical array structure , Then you can use a large number of array methods .

Array.from({ length: 2 }, () => 'jack')
// ['jack', 'jack']

In the above code ,Array.from The first parameter of specifies the number of times the second parameter runs . This feature can make the usage of this method very flexible .

Array.from() Another application of , Convert string to array , Then return the length of the string . Because it can handle all kinds of Unicode character , You can avoid JavaScript Will be bigger than the \uFFFF Of Unicode character , Count as two characters bug.

function countSymbols(string) {
return Array.from(string).length;
}

Array.of()

Array.of Method to use a set of values , Convert to array .

Array.of(3, 11, 8) // [3,11,8]
Array.of(3) // [3]
Array.of(3).length //

The main purpose of this method , Is a complement to array constructors Array() Deficiency . Because the number of parameters is different , It can lead to Array() Different behaviors .

Array() // []
Array(3) // [, , ,]
Array(3, 11, 8) // [3, 11, 8]

In the above code ,Array Method has no parameters 、 One parameter 、 When there are three parameters , The results are not the same . Only when the number of parameters is not less than 2 Time ,Array() Will return a new array of parameters . When there is only one parameter , It's actually specifying the length of the array .

Array.of Basically, it can be used as an alternative Array() or new Array(), And there is no overload due to different parameters . Its behavior is very uniform .

Array.of() // []
Array.of(undefined) // [undefined]
Array.of(1) // [1]
Array.of(1, 2) // [1, 2]

Array.of Always return an array of parameter values . If there are no parameters , It returns an empty array .

Array.of Method can be simulated with the following code .

function ArrayOf(){
return [].slice.call(arguments);
}

Of the array instance copyWithin()

Of the array instance copyWithin Method , Inside the current array , Copies a member of the specified location to another location ( Will overwrite the original members ), Then return the current array . in other words , Using this method , The current array will be modified .

Array.prototype.copyWithin(target, start = 0, end = this.length)

It takes three parameters .

  • target( It's necessary ): Replace data from this location . If it's negative , Said the bottom .
  • start( Optional ): The data is read from this location , The default is 0. If it's negative , Said the bottom .
  • end( Optional ): Stop reading data before reaching this location , The default is equal to the array length . If it's negative , Said the bottom .

All three parameters should be numerical , If not , It will automatically convert to a value .

[1, 2, 3, 4, 5].copyWithin(0, 3)
// [4, 5, 3, 4, 5]

The above code indicates that it will be from 3 A member that is signed until the end of an array (4 and 5), Copy to from 0 The starting position of the sign , The result covers the original 1 and 2.

Here are more examples .

// take 3 The number is copied to 0 No. A 
[1, 2, 3, 4, 5].copyWithin(0, 3, 4)
// [4, 2, 3, 4, 5] // -2 amount to 3 No. A ,-1 amount to 4 No. A
[1, 2, 3, 4, 5].copyWithin(0, -2, -1)
// [4, 2, 3, 4, 5] // take 3 The number is copied to 0 No. A
[].copyWithin.call({length: 5, 3: 1}, 0, 3)
// {0: 1, 3: 1, length: 5} // take 2 The number goes to the end of the array , Copied to the 0 No. A
let i32a = new Int32Array([1, 2, 3, 4, 5]);
i32a.copyWithin(0, 2);
// Int32Array [3, 4, 5, 4, 5] // For no deployment TypedArray Of copyWithin The platform of the method
// It needs to be written in the following way
[].copyWithin.call(new Int32Array([1, 2, 3, 4, 5]), 0, 3, 4);
// Int32Array [4, 2, 3, 4, 5]

Of the array instance find() and findIndex()

Of the array instance find Method , To find the first qualified member of the array . Its argument is a callback function , All array members execute the callback function in turn , Until you find out that the first return value is true Members of , Then return to the member . If there are no eligible members , Then return to undefined.

[1, 4, -5, 10].find((n) => n < 0)
// -5

The above code finds the first one in the array that is less than 0 Members of .

Copy to clipboardErrorCopied

In the above code ,find The callback function of method can take three parameters , In order is the current value 、 Current position and original array .

Of the array instance findIndex Method usage and find The method is very similar , Returns the location of the first qualified array member , If all the members are not eligible , Then return to -1.

[1, 5, 10, 15].findIndex(function(value, index, arr) {
return value > 9;
}) //

Both methods can take the second parameter , Used to bind callback functions this object .

function f(v){
return v > this.age;
}
let person = {name: 'John', age: 20};
[10, 12, 26, 15].find(f, person); //

In the above code ,find Function takes the second parameter person object , In callback function this The object points to person object .

in addition , Both of these methods can be found NaN, Make up for the indexOf The inadequacy of the method .

[NaN].indexOf(NaN)
// -1 [NaN].findIndex(y => Object.is(NaN, y))
//

In the above code ,indexOf Method does not recognize the NaN member , however findIndex We can use Object.is Method to achieve .

Of the array instance fill()

fill Method uses the given value , Fill an array .

['a', 'b', 'c'].fill(7)
// [7, 7, 7] new Array(3).fill(7)
// [7, 7, 7]

The above code indicates ,fill Method is very convenient for initialization of empty arrays . Elements already in the array , It'll be erased .

fill Methods can also take second and third arguments , Used to specify the start and end positions of the fill .

['a', 'b', 'c'].fill(7, 1, 2)
// ['a', 7, 'c']

The code above indicates ,fill Methods from 1 The number position starts , Fill the original array with 7, To 2 It's over before the number .

Be careful , If the type of fill is object , Then the assigned object is the object with the same memory address , Instead of deep copying objects .

let arr = new Array(3).fill({name: "Mike"});
arr[0].name = "Ben";
arr
// [{name: "Ben"}, {name: "Ben"}, {name: "Ben"}] let arr = new Array(3).fill([]);
arr[0].push(5);
arr
// [[5], [5], [5]]

Of the array instance entries(),keys() and values()

ES6 There are three new ways ——entries(),keys() and values()—— For traversing arrays . They all return a traverser object ( See 《Iterator》 chapter ), It can be used for...of Loop through , The only difference is keys() Is the traversal of key names 、values() Is the traversal of the key value ,entries() Is the traversal of key value pairs .

for (let index of ['a', 'b'].keys()) {
console.log(index);
}
//
// for (let elem of ['a', 'b'].values()) {
console.log(elem);
}
// 'a'
// 'b' for (let [index, elem] of ['a', 'b'].entries()) {
console.log(index, elem);
}
// 0 "a"
// 1 "b"

If not used for...of loop , The traverser object can be called manually next Method , Traversal .

let letter = ['a', 'b', 'c'];
let entries = letter.entries();
console.log(entries.next().value); // [0, 'a']
console.log(entries.next().value); // [1, 'b']
console.log(entries.next().value); // [2, 'c']

Of the array instance includes()

Array.prototype.includes Method returns a Boolean value , Indicates whether an array contains a given value , With string includes The method is similar to .ES2016 This method is introduced .

[1, 2, 3].includes(2) // true
[1, 2, 3].includes(4) // false
[1, 2, NaN].includes(NaN) // true

The second parameter of the method represents the starting position of the search , The default is 0. If the second parameter is negative , It means the position of the reciprocal , If it is greater than the array length at this time ( For example, the second parameter is -4, But the length of the array is 3), Will be reset to from 0 Start .

[1, 2, 3].includes(3, 3); // false
[1, 2, 3].includes(3, -1); // true

Without this method , We usually use arrays of indexOf Method , Check to see if there is a value .

if (arr.indexOf(el) !== -1) {
// ...
}

indexOf There are two drawbacks to this approach , One is not semantic enough , It means to find the first occurrence of the parameter value , So to compare is not equal to -1, It's not intuitive enough . Two is , It uses strict equality operators inside (===) Judge , This will lead to the right NaN Miscarriage of Justice .

[NaN].indexOf(NaN)
// -1

includes Using a different algorithm , There is no such problem .

[NaN].includes(NaN)
// true

The following code is used to check whether the current environment supports this method , If not , Deploy a simple alternative version .

const contains = (() =>
Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
)();
contains(['foo', 'bar'], 'baz'); // => false

in addition ,Map and Set The data structure has a has Method , We need to pay attention to includes distinguish .

  • Map Structural has Method , It's used to find the key name , such as Map.prototype.has(key)WeakMap.prototype.has(key)Reflect.has(target, propertyKey).
  • Set Structural has Method , Is used to find values , such as Set.prototype.has(value)WeakSet.prototype.has(value).

Array vacancy

Empty bits in an array refer to , There is no value in one position of the array . such as ,Array The array returned by the constructor is empty .

Array(3) // [, , ,]

In the above code ,Array(3) Return a with 3 An array of empty bits .

Be careful , No vacancy undefined, The value of a position is equal to undefined, It's still worth it . The vacancy has no value ,in Operators illustrate this .

0 in [undefined, undefined, undefined] // true
0 in [, , ,] // false

The above code shows , The first array of 0 The number position is valuable , Of the second array 0 There is no value for position number .

ES5 Handling of vacancies , It's very inconsistent , Empty spaces are ignored in most cases .

  • forEach()filter()reduce()every()  and some() Will skip the empty space .
  • map() Will skip empty space , But this value will be retained
  • join() and toString() Will treat empty spaces as undefined, and undefined and null Will be processed to an empty string .
// forEach Method 
[,'a'].forEach((x,i) => console.log(i)); // // filter Method
['a',,'b'].filter(x => true) // ['a','b'] // every Method
[,'a'].every(x => x==='a') // true // reduce Method
[1,,2].reduce((x,y) => return x+y) // // some Method
[,'a'].some(x => x !== 'a') // false // map Method
[,'a'].map(x => 1) // [,1] // join Method
[,'a',undefined,null].join('#') // "#a##" // toString Method
[,'a',undefined,null].toString() // ",a,,"

ES6 It is clear that the vacancy will be changed to undefined.

Array.from Method will empty the array , To undefined, in other words , This method doesn't ignore vacancies .

Array.from(['a',,'b'])
// [ "a", undefined, "b" ]

Extension operator (...) It will also change the vacancy to undefined.

[...['a',,'b']]
// [ "a", undefined, "b" ]

copyWithin() It will be copied together with the empty space .

[,'a','b',,].copyWithin(2,0) // [,"a",,"a"]

fill() Treat empty bits as normal array positions .

new Array(3).fill('a') // ["a","a","a"]

for...of The loop will also traverse the vacancy .

let arr = [, ,];
for (let i of arr) {
console.log(1);
}
//
//

In the above code , Array arr There are two vacancies ,for...of They are not ignored . If change to map Methods through , Empty seats will be skipped .

entries()keys()values()find() and findIndex() The empty space will be treated as undefined.

// entries()
[...[,'a'].entries()] // [[0,undefined], [1,"a"]] // keys()
[...[,'a'].keys()] // [0,1] // values()
[...[,'a'].values()] // [undefined,"a"] // find()
[,'a'].find(x => true) // undefined // findIndex()
[,'a'].findIndex(x => true) //

Because the processing rules of empty space are very inconsistent , Therefore, it is recommended to avoid empty space .

ES6 New features (8)—— Array expansion of more related articles

  1. ES6 Common new features

    https://segmentfault.com/a/1190000011976770?share_user=1030000010776722 This article is a reprinted article ! I only like collecting articles ! 1. Preface the other day ...

  2. ES6 &amp;&amp; ECMAScript2015 New characteristics

      ECMAScript 6( hereinafter referred to as ES6) yes JavaScript The next generation standard of language . Because the current version of ES6 Is in 2015 Published in , So it's also called ECMAScript 2015. in other words ,ES6 Namely ES201 ...

  3. ES6 New features (9)—— Object extension

    Object extension A concise representation of an attribute ES6 Allow direct writing of variables and functions , Properties and methods as objects . This kind of writing is more concise . const foo = 'bar'; const baz = {foo}; baz // {f ...

  4. ES6 Introduction to related new features

    You may have heard of  ECMAScript 6 ( abbreviation ES6) 了 .ES6 yes Javascript Next version of , It has a lot of great new features . These features vary in complexity , But it's useful for simple scripts and complex applications . stay ...

  5. ES6 Practical new features

    Compatibility http://kangax.github.io/compat-table/es5/ http://kangax.github.io/compat-table/es6/ ES6(ES2015) and ...

  6. JS - ECMAScript2015(ES6) New characteristics

    Friendship tips : This article only mark Several common new features , For details, see :ES6 introduction - ryf: debris var VS let VS const var: Declare global variables , let: Declare block level variables , Local variable const: Statement ...

  7. About ES6 New features

    1  let Declare variables 01    let Declared variables , Not to repeat , such as let   a=1  : let   a=2 : This statement will report an error 02    let Declared variables , There are block-level scopes , such as   if( ){ ...

  8. ES6:JavaScript New characteristics

    I Believe , stay ECMAScript.next When it comes , What we write every day now JavaScript The code is going to change a lot . The next year will be JavaScript An exciting year for developers , More and more feature proposals will be the most popular ...

  9. es6 New features -- Template string

    I've had a simple look these days es6 This book , It feels very practical , Learned a new feature --- Template Strings in project development , Splicing strings is indispensable , Dynamically create dom Elements and js All operation data should be spliced into strings , stay es6 before , We all usually ...

Random recommendation

  1. Website development commonly used jQuery Plug in summary ( Nine ) Sidebar plug in pageslide

    One .pageslide Plug in features Realize the function of hiding sidebar in reality . The plug-in can read another html, It can also be an element in the current page . Two .pageslide Official address http://srobbin.com/jquery-p ...

  2. eclipse Use maven establish springmvc + mybatis

    next eclipse Use maven Create pure spring mvc project After all, all projects have to access the database , So add mybatis That's what the Internet says most of the time SSM Construction of framework (Spring + Spring M ...

  3. android Message push (Jpush)

    One . I use Aurora push Jpush Push messages , Finish sending messages to the application in a certain time Two . Development steps 1. download Jpush Of SDK 2. Registered users and apps , obtain APPKey and Master Secret 3-1. take SDK Of l ...

  4. temp and tmp file

    TMP and TEMP Files are temporary files produced by various software or systems , That's what we call junk files .Windows Generated temporary documents , It's essentially the same as virtual memory , It's just that temporary files are more targeted than virtual memory , It's just for a program . And its ...

  5. To make Java

    After work , Start studying Java 了 . Think about it since I started reading books in March ,Spring+Mybatis+ The use of company framework , It's basically a crash course , There are still some fears . Spring It's so cool ,annotion It's very comfortable to use , But I still want to ...

  6. 【 turn 】【 machine learning 】R Regularization function scale

    Source :http://blog.163.com/shen_960124/blog/static/60730984201582594011277/ 1. Centralization of data The so-called data centralization refers to the data in the data set ...

  7. Asynchronous core interface IAsyncResult The implementation of the

    To implement asynchronous programming , It needs to be implemented correctly IAsyncResult Interface .IAsyncResult There are four attributes : public interface IAsyncResult { object AsyncState ...

  8. [No0000115] open Excel2016 Prompt the solution of insufficient memory or disk space

    symptoms : Law 1 : Right click file , and Unlock : Law two : View... In the service of the system Windows Firewall service and Windows Update Whether the service is on , If it doesn't turn on, turn them on . 1. On the table [ Computer ...

  9. obtain div, The contents of the form

    Get content - text().html() as well as val() Three simple and practical methods for DOM Operation of the jQuery Method : text() - Sets or returns the text content of the selected element html() - Sets or returns the selected element ...

  10. SVG Study &lt; 7、 ... and &gt; SVG The path of ——path(1) Straight line command 、 Arc command

    Catalog SVG Study < One > Basic graphics and line segments SVG Study < Two > Advanced SVG The world , View , window stroke attribute svg grouping SVG Study < 3、 ... and > The gradient SVG Study < Four ...