work
This commit is contained in:
parent
1bffa43db4
commit
057783d216
373 changed files with 203 additions and 190 deletions
10
1-js/3-object-basics/7-array/2-create-array/solution.md
Normal file
10
1-js/3-object-basics/7-array/2-create-array/solution.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
|
||||
```js run
|
||||
let styles = ["Jazz", "Blues"];
|
||||
styles.push("Rock-n-Roll");
|
||||
styles[(styles.length + 1) / 2] = "Classics";
|
||||
alert( styles.shift() );
|
||||
styles.unshift("Rap", "Reggie");
|
||||
```
|
||||
|
24
1-js/3-object-basics/7-array/2-create-array/task.md
Normal file
24
1-js/3-object-basics/7-array/2-create-array/task.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
importance: 5
|
||||
|
||||
---
|
||||
|
||||
# Array operations.
|
||||
|
||||
Let's try 5 array operations.
|
||||
|
||||
1. Create an array `styles` with items "Jazz" and "Blues".
|
||||
2. Append "Rock-n-Roll" to the end.
|
||||
3. Replace the value in the middle by "Classics". Your code for finding the middle value should work for any arrays with odd length.
|
||||
4. Strip off the first value of the array and show it.
|
||||
5. Prepend `Rap` and `Reggie` to the array.
|
||||
|
||||
The array in the process:
|
||||
|
||||
```js no-beautify
|
||||
Jazz, Blues
|
||||
Jazz, Bues, Rock-n-Roll
|
||||
Jazz, Classics, Rock-n-Roll
|
||||
Classics, Rock-n-Roll
|
||||
Rap, Reggie, Classics, Rock-n-Roll
|
||||
```
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue