Skip to content

Commit 6ac3098

Browse files
committed
Initial commit
0 parents  commit 6ac3098

7 files changed

Lines changed: 89 additions & 0 deletions

File tree

‎.gitignore‎

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

‎00_template/index.html‎

Lines 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>

‎00_template/main.js‎

Whitespace-only changes.

‎01_scope/main.js‎

Lines 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();

‎02_objects_arrays/main.js‎

Lines 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)

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# JavaScript Lessons

‎challenge.js‎

Lines 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)