Build a Guessing GameBuild a Guessing Game
with JavaScriptwith JavaScript
April 2018
  
codepen.iocodepen.io
1
About us
Kati Long
Thinkful Event Host
Thinkful Student
Sean Jun
Web Developer, Intel
Thinkful Grad
Shu Sia
Web Developer, Carvana
Thinkful TA
2
About you
What's your name? 
What brought you here today?
What is your programming experience?
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
3
About Thinkful
We train developers and data scientists through
1x1 mentorship and project-based learning.
 
Guaranteed.
4
This is what we're making
View example here
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
5
De ning a variable with JavaScript
var numberOfSheep = 20var numberOfSheep = 20
Initialize variable
Name of variable
Value of variable
http://bit.ly/tf-js-game-atlhttp://bit.ly/js-game-dc
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
6
Variable examples
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
7
Declaring a function with JavaScript
function greet() {function greet() {
   return "Hello world!";   return "Hello world!";
}}
Initialize function Name of function
What the function does
Wi-Fi: IgniteHQ
Password: igniteHQ
http://bit.ly/tf-js-game-atlWi : MakeOf ces 5Ghz
Password: Internet!23 8
http://bit.ly/js-game-dc
Function examples
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
9
If/else statements
go to gas stationkeep driving
if false if true
need gas?
family roadtrip
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
10
If/else statements
function familyRoadtrip() {
    if (needGas == true) {
        getGas();
    }
    else {
        keepDriving();
    }
}
http://bit.ly/tf-js-game-atlhttp://bit.ly/js-game-dc
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
11
Comparing values
==    (equal to)
 
         5 == 5  --> true
         5 == 6  --> false
 
!=     (not equal to)
 
         5 != 5  --> false
         5 != 6  --> true
 
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
12
If/else statements and comparing values
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
13
Parameters within functions
function adder(a, b) {function adder(a, b) {
   return a + b;   return a + b;
}}
adder(1,2);adder(1,2);
Parameters in declaration
Parameters used
within the function
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
14
Examples of parameters within functions
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
15
Real developers use Google... a lot
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
16
Glitch setup & rst steps!
Wi : MakeOf ces 5Ghz
Password: Internet!23
http://bit.ly/js-game-dc
http://bit.ly/tf-guessing-game
17
Answers!
18
Ways to keep learning
19
Thinkful's Free Course
Access to four weeks of curriculum for
two weeks
HTML, CSS and JavaScript
Unlimited mentor-led Q&A sessions
Personal Program Manager
Option to continue on to the full
program at a prorated rate!
bit.ly/web-dev-freebit.ly/web-dev-free
20

itjsbagg410

  • 1.
    Build a GuessingGameBuild a Guessing Game with JavaScriptwith JavaScript April 2018    codepen.iocodepen.io 1
  • 2.
    About us Kati Long ThinkfulEvent Host Thinkful Student Sean Jun Web Developer, Intel Thinkful Grad Shu Sia Web Developer, Carvana Thinkful TA 2
  • 3.
    About you What's yourname?  What brought you here today? What is your programming experience? Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 3
  • 4.
    About Thinkful We traindevelopers and data scientists through 1x1 mentorship and project-based learning.   Guaranteed. 4
  • 5.
    This is whatwe're making View example here Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 5
  • 6.
    De ning avariable with JavaScript var numberOfSheep = 20var numberOfSheep = 20 Initialize variable Name of variable Value of variable http://bit.ly/tf-js-game-atlhttp://bit.ly/js-game-dc Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 6
  • 7.
    Variable examples Wi :MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 7
  • 8.
    Declaring a functionwith JavaScript function greet() {function greet() {    return "Hello world!";   return "Hello world!"; }} Initialize function Name of function What the function does Wi-Fi: IgniteHQ Password: igniteHQ http://bit.ly/tf-js-game-atlWi : MakeOf ces 5Ghz Password: Internet!23 8 http://bit.ly/js-game-dc
  • 9.
    Function examples Wi :MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 9
  • 10.
    If/else statements go togas stationkeep driving if false if true need gas? family roadtrip Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 10
  • 11.
    If/else statements function familyRoadtrip(){     if (needGas == true) {         getGas();     }     else {         keepDriving();     } } http://bit.ly/tf-js-game-atlhttp://bit.ly/js-game-dc Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 11
  • 12.
    Comparing values ==   (equal to)            5 == 5  --> true          5 == 6  --> false   !=     (not equal to)            5 != 5  --> false          5 != 6  --> true   Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 12
  • 13.
    If/else statements andcomparing values Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 13
  • 14.
    Parameters within functions functionadder(a, b) {function adder(a, b) {    return a + b;   return a + b; }} adder(1,2);adder(1,2); Parameters in declaration Parameters used within the function Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 14
  • 15.
    Examples of parameterswithin functions Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 15
  • 16.
    Real developers useGoogle... a lot Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc 16
  • 17.
    Glitch setup &rst steps! Wi : MakeOf ces 5Ghz Password: Internet!23 http://bit.ly/js-game-dc http://bit.ly/tf-guessing-game 17
  • 18.
  • 19.
    Ways to keeplearning 19
  • 20.
    Thinkful's Free Course Accessto four weeks of curriculum for two weeks HTML, CSS and JavaScript Unlimited mentor-led Q&A sessions Personal Program Manager Option to continue on to the full program at a prorated rate! bit.ly/web-dev-freebit.ly/web-dev-free 20