Last active
August 29, 2015 14:06
-
-
Save niusounds/1bfa584da69fb35ac069 to your computer and use it in GitHub Desktop.
JavaScriptの配列操作
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var a = [1, 2, 3, 4, 5]; | |
| // shift は先頭を取り出す | |
| a.shift(); // -> 1 | |
| console.log(a); // -> [2, 3, 4, 5] | |
| // push は末尾に入れる | |
| a.push(111); | |
| console.log(a); // -> [2, 3, 4, 5, 111] | |
| // pop は末尾を取り出す | |
| a.pop(); // -> 111 | |
| console.log(a); // -> [2, 3, 4, 5] | |
| // unshift は先頭に入れる | |
| a.unshift(88); | |
| console.log(a); // -> [88, 2, 3, 4, 5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment