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 — Initial commit · anikwai/JavaScript-Lessons@6ac3098

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .gitignore
  • 00_template
    • index.html
    • main.js
  • 01_scope
    • main.js
  • 02_objects_arrays
    • main.js
  • README.md
  • challenge.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.gitignore‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
node_modules
Collapse file

‎00_template/index.html‎

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>thenewboston</title>
6+
</head>
7+
<body>
8+
<script src="main.js"></script>
9+
</body>
10+
</html>
Collapse file

‎00_template/main.js‎

Copy file name to clipboardExpand all lines: 00_template/main.js
Whitespace-only changes.
Collapse file

‎01_scope/main.js‎

Copy file name to clipboard
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
/********** Scope **********/
3+
4+
// each function can only access its own scoped variables
5+
function one() {
6+
var a = 5;
7+
console.log(a);
8+
}
9+
10+
function two() {
11+
var a = 20;
12+
console.log(a);
13+
}
14+
15+
one(); // 5
16+
two(); // 20
17+
18+
19+
/********** Nested scope **********/
20+
21+
function outer() {
22+
var a = 10;
23+
24+
// inner() has access to a since it is nested inside (part of) outer()
25+
function inner() {
26+
var b = 27;
27+
console.log(a + b);
28+
}
29+
30+
inner();
31+
32+
// can only access a
33+
console.log(a);
34+
35+
}
36+
37+
outer();
Collapse file

‎02_objects_arrays/main.js‎

Copy file name to clipboard
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
/********** Objects **********/
3+
4+
// objects are composed of multiple names and values
5+
var person = {
6+
name: "Bucky",
7+
age: 87
8+
};
9+
console.log(person.name); // preferred
10+
console.log(person['age']); // also valid
11+
12+
13+
/********** Arrays **********/
14+
15+
// array values are retrieved by index, not name
16+
var food = ['bacon', 'tuna', 'corn'];
17+
console.log(food[2]);
18+
19+
20+
/********** Equality **********/
21+
22+
var a = '26';
23+
var b = 26;
24+
25+
console.log(a==b); // true (only checks value)
26+
console.log(a===b); // false (compares type as well)
Collapse file

‎README.md‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# JavaScript Lessons
Collapse file

‎challenge.js‎

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var isValid = false;
2+
3+
function validParentheses(arr){
4+
if (arr[0] == '(' && arr[arr.length - 1] == ')'){
5+
if (arr.length == 2)
6+
isValid = true;
7+
else
8+
validParentheses(arr.slice(1, arr.length - 1));
9+
}
10+
return isValid;
11+
}
12+
13+
console.log(validParentheses('((()))'.split('')));

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.