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 — Merge pull request #66 from CactaurMan36/master · klamzo/javascript@d0c4a60

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • SUMMARY.md
  • arrays
    • README.md
    • indicies.md
    • length.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎SUMMARY.md‎

Copy file name to clipboardExpand all lines: SUMMARY.md
+3Lines changed: 3 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
* [Else](conditional/else.md)
1919
* [Comparators](conditional/comparators.md)
2020
* [Concatenate](conditional/concatenate.md)
21+
* [Arrays](arrays/README.md)
22+
* [Indicies](indicies.md)
23+
* [Length](length.md)
2124
* [Loops](loops/README.md)
2225
* [For](loops/for.md)
2326
* [While](loops/while.md)
Collapse file

‎arrays/README.md‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Arrays
2+
3+
Arrays are a fundamental part of programming. An array is a list of data. We can store a lot of data in one variable, which makes our code more readable and easier to understand. It also makes it much easier to perform functions on related data.
4+
5+
The data in arrays are called **elements**.
6+
7+
Here is a simple array:
8+
```javascript
9+
// 1, 1, 2, 3, 5, and 8 are the elements in this array
10+
var numbers = [1, 1, 2, 3, 5, 8];
11+
```
Collapse file

‎arrays/indicies.md‎

Copy file name to clipboard
+41Lines changed: 41 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Indicies
2+
3+
So you have your array of data elements, but what if you want to access a specific element? That is where indicies come in. An **index** refers to a spot in the array. Indicies logically progress one by one, but it should be noted that the first index in an array is 0, as it is in most languages. Brackets [] are used to signify you are referring to an index of an array.
4+
5+
```javascript
6+
// This is an array of strings
7+
var fruits = ["apple", "banana", "pineapple", "strawberry"];
8+
9+
// We set the variable banana to the value of the second element of
10+
// the fruits array. Remember that indicies start at 0, so 1 is the
11+
// second element. Result: banana = "banana"
12+
var banana = fruits[1];
13+
```
14+
---
15+
16+
Define the variables using the indices of the array
17+
18+
```js
19+
var cars = ["Mazda", "Honda", "Chevy", "Ford"]
20+
var honda =
21+
var ford =
22+
var chevy =
23+
var mazda =
24+
```
25+
26+
```js
27+
var cars = ["Mazda", "Honda", "Chevy", "Ford"]
28+
var honda = cars[1];
29+
var ford = cars[3];
30+
var chevy = cars[2];
31+
var mazda = cars[0];
32+
```
33+
34+
```js
35+
assert(honda === "Honda");
36+
assert(ford === "Ford");
37+
assert(chevy === "Chevy");
38+
assert(mazda === "Mazda");
39+
```
40+
41+
---
Collapse file

‎arrays/length.md‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Length
2+
3+
Arrays have a property called length, and it's pretty much exactly as it sounds, it's the length of the array.
4+
5+
```javascript
6+
var array = [1 , 2, 3];
7+
8+
// Result: l = 3
9+
var l = array.length;
10+
```
11+
12+
---
13+
14+
Define the variable a to be the number value of the length of the array
15+
16+
```js
17+
var array = [1, 1, 2, 3, 5, 8];
18+
var l = array.length;
19+
var a =
20+
```
21+
22+
```js
23+
var array = [1, 1, 2, 3, 5, 8];
24+
var l = array.length;
25+
var a = 6;
26+
```
27+
28+
```js
29+
assert (a === 6)
30+
```
31+
---

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.