update README for JavaScript
This commit is contained in:
17
code/JavaScript/Arrays/arrays.js
Normal file
17
code/JavaScript/Arrays/arrays.js
Normal file
@ -0,0 +1,17 @@
|
||||
let cats = ['Bob', 'Willy', 'Mini'];
|
||||
|
||||
// pop(): Remove an item from the end of an array
|
||||
// pop() returns the removed item
|
||||
cats.pop(); // ['Bob', 'Willy']
|
||||
|
||||
// push(): Add items to the end of an array
|
||||
// push() returns the new array length
|
||||
cats.push('Mini'); // ['Bob', 'Willy', 'Mini']
|
||||
|
||||
// shift(): Remove an item from the beginning of an array
|
||||
// shift() returns the removed item
|
||||
cats.shift(); // ['Willy', 'Mini']
|
||||
|
||||
// unshift(): Add items to the beginning of an array
|
||||
// unshift() returns the new array length.
|
||||
cats.unshift('Puff', 'George'); // ['Puff', 'George', 'Willy', 'Mini']
|
9
code/JavaScript/Arrays/forEach.js
Normal file
9
code/JavaScript/Arrays/forEach.js
Normal file
@ -0,0 +1,9 @@
|
||||
// arr.forEach(function callback(currentValue, index, array) {
|
||||
// your iterator
|
||||
// }[, thisArg]);
|
||||
|
||||
Синтаксис
|
||||
|
||||
arr.forEach(function callback(currentValue, index, array) {
|
||||
//your iterator
|
||||
}[, thisArg]);
|
Reference in New Issue
Block a user