You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**repository**: The central location where your files are stored. You can think of it as a folder.
6
+
-**source code editor**: A text editor program designed specifically for editing source code of computer programs. (Think MS Word for code)
7
+
8
+
## Lecture Slides + Directions
9
+
10
+
[Slides are here](https://docs.google.com/presentation/d/e/2PACX-1vQWCRKZqhKU_B7-f72DZ5Aq34yxXys7yHed51cOeLEqTyBsIoay9a8LKyOXJMaM1grw8DVhqrSYSiV0/embed?start=false&loop=false&delayms=3000)
11
+
12
+
## Basic Requirements
13
+
14
+
1. Download [this zip file](https://bit.ly/ccjfoundations)
15
+
1. Extract the files to your desktop
16
+
1. Open the repository in Visual Studio Code
17
+
1. Edit a JavaScript file, save it, and refresh the html page in the browser to see the change
18
+
1. Create a second `console.log` and have it show up in the browser
- Understand why JavaScript is a useful programming language for beginners to learn
7
-
- Describe and use JavaScript _expressions_
8
-
- Describe and use arithmetic _operators_
9
-
- Describe and use `number` and `string` data _types_
10
-
11
3
## Lecture Slides
12
4
13
-
[Slides are here](https://docs.google.com/presentation/d/e/2PACX-1vQR9MVY1wprMhweN278XrP587sizLmdR1qxVmW2RDoArrz2Exxwy4wi1fZXgD0_-eGxRzMo6-2dzvLk/pub?start=false&loop=false&delayms=3000)
5
+
[Slides are here](https://docs.google.com/presentation/d/e/2PACX-1vSMm-b3hSJwjgc4TQe7YnXfVjpdgklt4Ma30sfWULU4jDxt0XplMXLX0vMem6cVBj8LDlbhtLSNpb4s/embed?start=false&loop=false&delayms=3000)
14
6
15
7
## Exercises
16
8
@@ -26,57 +18,99 @@ Can you try to define the following in your own words?
26
18
-_operator_
27
19
-_type_
28
20
29
-
#### `number`s & `string`s
21
+
#### numbers & strings
30
22
31
-
##### `number`s
23
+
##### numbers
32
24
33
-
1.Enter the below expressions, line by line, into your Chrome console. What happens for each?
25
+
1. Enter the following expressions, line by line, into your Chrome console. What happens for each?
34
26
35
-
```js
36
-
4+10;
37
-
1*3;
38
-
12*4;
39
-
4%2;
40
-
5%2;
41
-
5/1-99;
42
-
5000*-100* (1+2) * (5*6);
43
-
1241/9+99;
44
-
```
27
+
```js
28
+
4+10;
29
+
1*3;
30
+
12*4;
31
+
4%2;
32
+
5%2;
33
+
5/1-99;
34
+
5000*-100* (1+2) * (5*6);
35
+
1241/9+99;
36
+
```
45
37
46
-
1. Based on your work above, what does `%`do?
38
+
**Notice how we want to end all of our expressions with semi-colons.**
47
39
48
-
1. Calculate your age in minutes using the console.
40
+
1.Based on your work above, what does `%` do?
49
41
50
-
##### Bonus Section
42
+
1. Calculate your age in minutes using the console.
51
43
52
-
1.The console is getting a little full. Use`clear()` to clean things up a little.
44
+
1. The console is getting a little full. Use `clear()` or `⌘ K` to clean things up a little.
53
45
54
46
##### `string`s
55
47
56
-
1. In your console, put your name in a `string`!
48
+
1. In your console, write your name as a `string`!
49
+
50
+
1. Use the `+` operator to _concatenate_ (join together) two or more
51
+
`string`s, _e.g._:
52
+
53
+
```js
54
+
// Your first and last names as an example
55
+
"Lady "+"Gaga";
56
+
```
57
+
58
+
- Your first and last names (as shown above in the example code snippet)
59
+
- Your favourite singer's full name
60
+
- Code Chrysalis
61
+
62
+
1. Try the following in your console, line by line. What happens? Fix the errors:
63
+
64
+
```js
65
+
Where are the quotes?
66
+
'hmm something is not right"
67
+
'Do other ' * 'operators work with string concatenation?'
68
+
```
69
+
70
+
#### Exploration
57
71
58
-
1. Use the `+` operator to _concatenate_ (join together) two or more
59
-
`string`s, _e.g._:
72
+
We want you to get comfortable with actively exploring through code. This often can mean using code that you don't know very much about yet. But don't worry! This is part of the process and you'll learn them in no time.
60
73
61
-
```js
62
-
// Your first and last names as an example
63
-
"Yan " + "Fan";
64
-
```
74
+
1. Answer the following questions by coding to test the questions:
65
75
66
-
- Your first and last names (as shown above in the example code snippet)
67
-
- Your favourite singer's full name
68
-
- Code Chrysalis
76
+
1. What happens when I add a string and a number together?
77
+
1. What ifI reverse the order (e.g. number+ string)?
78
+
1. What happens ifI multiply a number of`5`with a string `5`?
69
79
70
-
1. Try the following in your console, line by line. What happens? Fix the errors:
80
+
1. Try the following line by line in your console. Whatdo you think adding `.length` does? Try finding the length of other strings.
71
81
72
-
```js
73
-
Where are the quotes?
74
-
'hmm something is not right"
75
-
'Do other ' * 'operators work with string concatenation?
76
-
```
82
+
```js
83
+
"hello".length;
84
+
"hello world".length;
85
+
"123".length;
86
+
```
77
87
78
-
1. We want you to get comfortable with actively exploring through code. Answer the following questions by coding to test the questions:
79
-
1. What happens when I add a `string` and a `number` together?
80
-
1. What if I reverse the order (e.g. `number` + `string`)?
81
-
1. What happens if I multiply a `number` 5 with a `string` "5"?
88
+
1. How about the below?
89
+
```js
90
+
"hello".toUpperCase();
91
+
"HELLO".toLowerCase();
92
+
"hello".endsWith("o");
93
+
"hello".endsWith("e");
94
+
"hello".endsWith("llo");
95
+
"hello".endsWith();
96
+
```
82
97
98
+
Can you think of more ways to test it?
99
+
100
+
`.toUpperCase()`, `.toLowerCase()`, and `.endsWith()` are what we call native methods. They are built-in to the JavaScript language and are available only forstrings. We'll learn more about them later on.
101
+
102
+
1. Bonus question: Where can you find information about the methods used above?
103
+
104
+
## Homework
105
+
106
+
- Complete the exercises for this lesson.
107
+
108
+
# Foundations of Programming
109
+
110
+
## Objectives
111
+
112
+
- Understand what a program is
113
+
- Understand why JavaScript is a useful programming language for beginners to learn
114
+
- Describe and use JavaScript _expressions_
115
+
- Describe and use arithmetic _operators_
116
+
- Describe and use `number` and `string` data _types_
0 commit comments