GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add of exercises and some courses · youxiberlin/javascript@b47cf7b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • SUMMARY.md
  • arrays
    • array_methods.md
  • exercises
    • all_exercises.md
  • functions
    • higher_order.md
  • objects
    • delete.md
    • enumeration.md
    • global_footprint.md
    • mutable.md
    • prototype.md
    • reference.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎SUMMARY.md‎

Copy file name to clipboardExpand all lines: SUMMARY.md
+3-7Lines changed: 3 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,18 @@
2121
* [Arrays](arrays/README.md)
2222
* [Indices](arrays/indices.md)
2323
* [Length](arrays/length.md)
24+
* [Array Methods](arrays/array_methods.md)
2425
* [Loops](loops/README.md)
2526
* [For](loops/for.md)
2627
* [While](loops/while.md)
2728
* [Do...While](loops/dowhile.md)
2829
* [Functions](functions/README.md)
2930
* [Declare](functions/declare.md)
30-
* [Higher order](functions/higher_order.md)
31+
* [Higher order (Advanced)](functions/higher_order.md)
3132
* [Objects](objects/README.md)
3233
* [Creation](objects/creation.md)
3334
* [Properties](objects/properties.md)
34-
* [Mutable](objects/mutable.md)
35-
* [Reference](objects/reference.md)
36-
* [Prototype](objects/prototype.md)
37-
* [Delete](objects/delete.md)
38-
* [Enumeration](objects/enumeration.md)
39-
* [Global footprint](objects/global_footprint.md)
35+
* [Reference (Advanced)](objects/reference.md)
4036
* [Exercises](exercises/README.md)
4137
* [All Exercises](exercises/all_exercises.md)
4238

Collapse file

‎arrays/array_methods.md‎

Copy file name to clipboard
+32Lines changed: 32 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Push
2+
3+
You can insert elements inside an array with their method `push`. In fact, there is many other properties:
4+
- `push(n)`: Add the element `n` at the end
5+
- `pop()`: Remove the last element
6+
- `sort()`: Sort the array by lexicographical order
7+
8+
```javascript
9+
var array = [1, 2, 4];
10+
array.push(8);
11+
// Now array = [1, 2, 4, 8]
12+
```
13+
14+
{% exercise %}
15+
Add the city "Paris" to cities and sort it
16+
{% initial %}
17+
var cities = ["Madrid", "Barcelona", "Miami"];
18+
19+
20+
var a =
21+
{% solution %}
22+
var cities = ["Madrid", "Barcelona", "Miami"];
23+
cities.push("Paris");
24+
cities.sort();
25+
26+
{% validation %}
27+
assert (cities.length === 4);
28+
assert (cities[0] === "Barcelona");
29+
assert (cities[1] === "Madrid");
30+
assert (cities[2] === "Miami");
31+
assert (cities[3] === "Paris");
32+
{% endexercise %}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.