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
This curriculum is meant to introduce the javascript programming language. It builds on the [Front End RailsBridge Curriculum](http://curriculum.railsbridge.org/frontend). Anyone familiar with HTML, will be able to work through this curriculum.
6
+
7
+
In the workshop, we will:
8
+
9
+
* Learn about and use the primitive types of javascript,
10
+
* Learn about and use functions and callbacks,
11
+
* Understand scope, and the changing value of the keyword 'this'
12
+
* Use javascript to create a simple single page application.
13
+
* Use git to version control our application.
14
+
15
+
This is just a rough guideline, not a mandate. Some steps you'll go over and some you'll go under. It'll all work out by the end of the day. :D
16
+
17
+
### Requirements
18
+
19
+
We're going to be working with:
20
+
21
+
* [Chrome](https://www.google.com/chrome)
22
+
(If you're experienced with the developer tools in another browser, that may work too.)
23
+
* The code editor of your choice.
24
+
[Sublime Text 2](http://www.sublimetext.com/2) is popular and free to download, but you should buy a license if you keep using it after the workshop.
25
+
[Komodo Edit](http://www.activestate.com/komodo-edit) is a good open source option, if you don't have one yet.
26
+
27
+
Optional tools if you're checking in to GitHub:
28
+
29
+
* Git
30
+
* Your [GitHub](http://github.com) account
31
+
32
+
### Working Effectively and Efficiently
33
+
34
+
We highly recommend you do the following:
35
+
36
+
* Open your browser fresh or hide any windows you already have open.
37
+
* Bring up one window with two tabs
38
+
* One for this content
39
+
* One for interacting with your app.
40
+
* Open your text editor and _do not ever close it_. We're not quitters.
41
+
* Hide all extra applications. Turn off twitter, IM, and all other distractions.
42
+
43
+
By minimizing the number of things you interact with, you reduce the
44
+
amount of time spent switching between them and the context lost as
45
+
you work through the lessons. Having 50 tabs open in your web
goal "Understand the primitive types of numbers, strings and booleans"
4
+
end
5
+
6
+
overview do
7
+
message <<-MARKDOWN
8
+
9
+
## Using the Browser's Console
10
+
11
+
We'll experiment with javascript using the console of our browser. We recommend everyone use Chrome, for consistency through the class.
12
+
13
+
To open the console on a Mac, use the shortcut `Command` + `Option` + `J`. To open the console in Windows or Linux, use the keyboard shortcut `Control` + `Shift` + `J`. Alternatively, right click, select 'Inspect Element' from the right-click menu, and click the 'Console' tab.
14
+
15
+
The console is where we can experiment with javascript, by typing after the `>` prompt. The console will also show us the return value of an expression we type and will display any errors we get.
16
+
17
+
## Numbers
18
+
MARKDOWN
19
+
20
+
steps do
21
+
22
+
step { message "In the console, type `5` and press enter. Notice that it will display the value `5` in response. Thus, our return value for the expression `5` is `5`." }
23
+
step { message "Try `typeof(5)` and note what kind of object `5` is."}
24
+
step { message "Try creating decimal numbers."}
25
+
step { message "Try creating irrational numbers (a number that can only be fully expressed as the ratio of two numbers, like 2/3). Notice that it will convert it to a decimal."}
26
+
step { message "Try adding or subtracting numbers in the console by typing `6 + 12` or `15 - 32`."}
27
+
step { message "Try an edge case with numbers, like `12 / 0`." }
28
+
step { message "To assign a number to a variable, type `favoriteNumber = 5` into the console prompt. Then use favoriteNumber in the next expression, like `favoriteNumber + 7`. Variables in Javascript are traditionally 'camel-cased' with capital letters separating words in a variable name." }
29
+
step { message "More complex math, like exponents, will require us to use the Math object, as in `Math.pow(12, 2)`, but that shouldn't stop us from trying it out!"}
30
+
step { message "Bonus Points: Check out [Mozilla Developer Network Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math) for the Math object, and try using some of the other methods they describe in your console!"}
31
+
end
32
+
33
+
34
+
message <<-MARKDOWN
35
+
## Strings
36
+
Strings are units of text, and we encapsulate them in `'single quotes'` or `"double quotes"`.
37
+
MARKDOWN
38
+
steps do
39
+
step { message "Try creating a string by typing `'this is a string'` into the console prompt."}
40
+
step { message "You can grab a string's individual characters with `'this is a string'[6]`, where the number 6 is the index of the character you want, starting at 0."}
41
+
step { message "Concatenate strings with `'my name is' + 'Michelle' + '.'`."}
42
+
step { message "Assign a string to a variable by writing `myName = 'Michelle'`."}
43
+
step { message "Use the variable as you would a literal string: `'Is your name ' + myName + '?'`"}
44
+
step { message "If you're ahead of others, check out the [MDN docs on strings](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)."}
45
+
end
46
+
47
+
48
+
message <<-MARKDOWN
49
+
## Booleans (True/False)
50
+
Booleans are a type of object used to indicate true or false values in Javascript.
0 commit comments