SlideShare a Scribd company logo
Build a Virtual Pet with JavaScript
November 2017
bit.ly/jspet-phx
1
Welcome to "Build a Virtual Pet with Javascript". The Wi-Fi network is X and the password is Y The website for this class is Z.
Speaker notes
Instructor
Dave Hoel
Full-stack Web Developer
Thinkful Graduate
TA's
Joe Previte
Digital Marketing Manager/Web Developer
2
Let me start with a little about me. My name is X and my background is Y
I am working with Thinkful to teach this class because Z
Speaker notes
About you
What's your name?
What's your goal?
What is your coding background?
3
I'd love to learn a little more about you guys. So can we go around the room and can everyone give us your name, what your goal is for attending
the class and your programming background?
Speaker notes
This is what we're making
4
Today we're building a simple virtual pet. We can click three different buttons to feed our pet, play with our bet, and have our pet do some exercise.
When we click on these buttons, we'll increase or decrease the weight or happiness of our pet.
Speaker notes
Agenda
Starter code review (5 min)
Learn key JavaScript concepts (20 min)
Build your app! (40 min)
Go over solutions (10 min)
Next steps (10 min)
5
I’ll start by walking you through the HTML/CSS starter code so you have a reference of what you’ll be working with. Then I’ll go over important
Javascript concepts that you’ll need to complete the app. You’ll then build the app during which time the TA’s and myself will be walking around to
help you guys out. At the end we’ll go over solutions and then cover next steps for continuing your learning.
Speaker notes
Starter code
http://bit.ly/virtual-pet-starter-code
6
Go ahead and go to this url to get the starter code. We’re using a online code editor called Glitch which will let us see the result of our code really
quickly.
On the README.MD file you should see an overview of the project and the challenges you'll need to complete. The files we’ll be using today on the
left are client.js and index.html. You can ignore style.css, server.js, package.json and .env. At the bottom of the Readme file we've added some
helpful links for further help on particular concepts.
Lets look at the index.html file to see how our app is structured. We have an image which includes a picture of our pet. We're displaying the pet's
name, weight, and level of happiness. Below that are three buttons. One to give the pet a treat, increasing it's weight and happiness. One is to play
with our pet, decreasing it's weight and increasing it's happiness. The third is exercise which decreases it's weight and happiness.
All of the code you’ll be writing will be in client.js but you may need to refer to the html and css file to solve some of the problems. Once you’ve
written some code, click the “Show Live” button at the top to open a new tab that will automatically update as you edit your code.
Speaker notes
Defining a variable with JavaScript
var firstVariable = 20
Initialize variable
Name of variable
Value of variable
7
Let's start with reviewing variables in Javascript. Variables let us assign some value to a a string. We use variables to store information that we'll use
when our app is running.
To define a variable in Javascript, we start with the keyword "var". We then give our variable a name. The name should start with a letter. Try to
make sure your variable names are descriptive. It's ok if they are long.
Then we set that variable name equal to some value. That value can be any data structure in JS including numbers and strings.
Speaker notes
More about variables
8
Alright lets try writing this out. Add var firstVariable = 20. If we type firstVariable now, what is going to happen?
The number 20 is stored in the variable so every time we use that variable, we're referring to the 20.
With a number, we can also increment or decrement that number. Once we define the variable, we can re-define it as either more or less. So we
could do firstVariable = firstVariable + 1 to change our variable from 20 to 21. In this way, an equal sign in JS is different than in math. A single equal
sign means we're assigning a value, not saying two things are equal.
What other things can we store in a variable? In Javascript we can store pretty much everything in a variable. We can store booleans and strings as
well. Lets see examples of each of those.
Instead of a number, set firstVariable equal to a string. In JS, when we put a value in quotes, it assumes its a string. Let's console.log the string. We
can do the same with booleans.
Speaker notes
Introducing our pet "object"
Name
"Thinkpup"
Weight
6
Happiness
0
9
Lets say we want to store a bunch of different information in one variable, we can do that with a Javascript object. We'll be using a JS object
remember all the aspects of our virtual pet.
An object will basically have a list of "keys" and "values". So we can store all the information about our pet in one place. In this case, we'll have three
items in our "list". The name of our pet, which would be a string. The weight which would be a number. And how happy they are, which will also be a
number.
We can "get" and "set" our values by grabbing them from the object with the "key" which is always a string. In this case, our key for "Thinkpup" is
"name".
Speaker notes
Working with objects
10
Creating an object
Define an object with curly brackets. The "key" is always a string. The value can be whatever value we like. A Javascript object can hold all sorts of
values in one variable.
Retrieving a value
We can retrieve a value by saying pet_info.name or pet_info['name']
Changing a value
We can change a value by saying pet_inf['name'] = "Nala"
Speaker notes
Basic functions
11
A function lets you separate your code into bite-sized pieces which you can use over again.
When you write a function to use later, you are “declaring” it. When you use (or run) that function you are “calling” it.
To call a function, we simply write doSomething() and then the function is run.
Speaker notes
If, then, else
pet is hungry feed it
go to park
if true
if false
12
In all programming languages there exist a way to tell the computer that if X happens, do this, if y happens, do that. In Javascript we use if, then,
else statement. So we tell the computer, if this condition is true, say the pet is hungry, feed it. If it's not hungry (or that condition is false), go to the
park. After this, continue running the program.
Speaker notes
Conditionals example
13
This is how we'd write that concept in Javascript. We have an "if" keyword and then some condition that could either be True or False in
parentheses. If it's true, it would run the code in the first bracket. If it's not true, we'd run the code in the else block.
Speaker notes
Real developers use Google... a lot
14
With that you should be ready to start the challenges. One last note before we do the first challenge together.
Google is an everyday part of being a developer. A key part of becoming a developer is getting comfortable using Google to learn and look up things.
The more you code, the more you will use Google, not the other way around.
Speaker notes
Let's work on the first step together
http://bit.ly/tf-virtual-pet
15
Alright, with that let's start building our app.
On the left, you can see the files you'll be working on. The Readme will give you instructions. You'll be writing your code in client.js. You shouldn't
need to touch any of the other files.
After you write your code, it will automatically be saved. At any point you can hit "Show Live" to see a live version of your app.
Let's start the first step together. So in this first step, we want to create our pet_info object with three keys. How would we do that? Feel free to
name your pet whatever you like and set it's starting happiness and weight to whatever you like.
(Assign TA's to different sections of class)
Speaker notes
Solution
16
Alright. Let's go over the solutions to the main challenges.
For each of the functions, we're going to do a version of the same thing. We're going to first grab the value from our object and then assign it to that
value plus or minus some number.
For our third step, we want to make sure weight can't go below zero. To do this, we add a function that checks weight before we update it in the
HTML. If weight is below one, it should equal one.
Speaker notes
17
In addition to these free workshops which you should definitely continue coming to, there are a number of resources available online, we've already
mentioned a few. Google, google, google for general information, w3schools.com is a resource for all HTML and CSS tags along with JavaScript
documentation. And Code Academy and FreeCodeCamp will give you a bit of structure.
Speaker notes
18
But if you’re interested in an even more structured approach, and you're at the point where you are ready to become and actual employed web
developer, then bootcamps are your best options.
This graph is showing us that by 2020, that's just over 2yrs!, there will be 1.4 million computing jobs, but only 400,000 CS degree graduates to fill
those positions. This means that by 2020 there will be a need for 1 million computer science professionals, of which web developers are a very large
number.
Because traditional 4-year colleges and universities are not enough, bootcamps were created as a way of filling the talent gap. Bootcamps are
immersive programs specifically designed to make you employable as a web developer. Like a trade school, if you put the work in, you will gain the
skills needed to fill these positions.
On average bootcamps have a job-placement rate of 70%.
Speaker notes
19
Thinkful goes beyond the average bootcamp. We actually guarantee job placement within six months of graduation. Let me say that another way -
if you complete our bootcamp, and do you part in career services, you will land a job as a web developer within six months of graduating from your
bootcamp.
Currently, 80% or our grads are placed as full-time devs, and 92% are placed in other tech roles, with graduates landing tech jobs at both startups
and larger more established companies like Boeing, Google, IBM. 80% of our grads work as developer and engineers, while other grads break into
high-growth roles such as product + project management, QA engineering, and more.
All of these numbers are updated monthly by a third-party auditor and can be found on the first page on our website.
Speaker notes
20
And this is why we are able to give you a guarantee...the unprecedented level of support you get as a Thinkful student.
Each student, whether full-time or flex, is matched with a personal mentor, to work through the program with. Our mentors have a minimum of 10
years of experience in their field, you meet with them for 1hr sessions three times per week, and they are your best friend throughout your
bootcamp. Once you graduate, you move into Career Services and are matched with a Career Services Coach, your after-graduation mentor, so to
speak. They will help you with your resume, do mock interviews with you, portfolio reviews, and guide you through the job seeking process. Then
you have a Program Manager, who's entire job is to make sure your relationship with these two other people is successful.
Then you have your local community - we host dinners for our local students and mentors, we call them Family Dinners, where students can present
what they're working on and get feedback from the mentors, talk about their experience with their bootcamp, commiserate, all over food and drinks
on Thinkful.
And then! You have access to our Thinkful Slack community: staff, mentors, and students all over the world are on our Slack group at all times.
Additionally, there are Q&A sessions and workshops that happens all day, every day of the week. Whenever you need help or just have a question,
mentors are available to work with you.
Speaker notes
21
So if this all sounds interesting to you and you want to try it out, I think you should. We’re offering a two-week trial. After the two-week trial you’ll
have the option to continue on with the full bootcamp. We offer a wide range of options for financing, including discounts and scholarships. This offer
is valid for one week from tonight. You can email or see before you leave to sign up. We’ll be around for a bit to answer any questions. Thank you.
Speaker notes

More Related Content

Similar to Bavpwjs1113

Web app-la-jan-2
Web app-la-jan-2Web app-la-jan-2
Web app-la-jan-2
Thinkful
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review Guide
Benjamin Kissinger
 
Python breakdown-workbook
Python breakdown-workbookPython breakdown-workbook
Python breakdown-workbook
HARUN PEHLIVAN
 
ABCs of Programming_eBook Contents
ABCs of Programming_eBook ContentsABCs of Programming_eBook Contents
ABCs of Programming_eBook Contents
Ashley Menhennett
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
Vlad Kolesnyk
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introduction
Hock Leng PUAH
 
Lab a
Lab aLab a
Lab a
sam-pee
 
Spreadsheets for developers
Spreadsheets for developersSpreadsheets for developers
Spreadsheets for developers
Felienne Hermans
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
Bagzzz
 
Bavpwjs221
Bavpwjs221Bavpwjs221
Bavpwjs221
Shannon Gallagher
 
Bavpwjs110
Bavpwjs110Bavpwjs110
Bavpwjs110
Thinkful
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
An I
 
Introjs10.5.17SD
Introjs10.5.17SDIntrojs10.5.17SD
Introjs10.5.17SD
Thinkful
 
Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.
Questpond
 
Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica) Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Thinkful
 
Java script basics
Java script basicsJava script basics
Java script basics
John Smith
 
Build a virtual pet with javascript (april 2017)
Build a virtual pet with javascript (april 2017)Build a virtual pet with javascript (april 2017)
Build a virtual pet with javascript (april 2017)
Thinkful
 
Cat scratch
Cat scratchCat scratch
Cat scratch
hassan hafez
 
Mobile Warsaw - Efficient Localization for iOS Apps
Mobile Warsaw - Efficient Localization for iOS AppsMobile Warsaw - Efficient Localization for iOS Apps
Mobile Warsaw - Efficient Localization for iOS Apps
Edgar Figueiredo
 
Baawjsajq109
Baawjsajq109Baawjsajq109
Baawjsajq109
Thinkful
 

Similar to Bavpwjs1113 (20)

Web app-la-jan-2
Web app-la-jan-2Web app-la-jan-2
Web app-la-jan-2
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review Guide
 
Python breakdown-workbook
Python breakdown-workbookPython breakdown-workbook
Python breakdown-workbook
 
ABCs of Programming_eBook Contents
ABCs of Programming_eBook ContentsABCs of Programming_eBook Contents
ABCs of Programming_eBook Contents
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introduction
 
Lab a
Lab aLab a
Lab a
 
Spreadsheets for developers
Spreadsheets for developersSpreadsheets for developers
Spreadsheets for developers
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Bavpwjs221
Bavpwjs221Bavpwjs221
Bavpwjs221
 
Bavpwjs110
Bavpwjs110Bavpwjs110
Bavpwjs110
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
 
Introjs10.5.17SD
Introjs10.5.17SDIntrojs10.5.17SD
Introjs10.5.17SD
 
Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.
 
Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica) Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
 
Java script basics
Java script basicsJava script basics
Java script basics
 
Build a virtual pet with javascript (april 2017)
Build a virtual pet with javascript (april 2017)Build a virtual pet with javascript (april 2017)
Build a virtual pet with javascript (april 2017)
 
Cat scratch
Cat scratchCat scratch
Cat scratch
 
Mobile Warsaw - Efficient Localization for iOS Apps
Mobile Warsaw - Efficient Localization for iOS AppsMobile Warsaw - Efficient Localization for iOS Apps
Mobile Warsaw - Efficient Localization for iOS Apps
 
Baawjsajq109
Baawjsajq109Baawjsajq109
Baawjsajq109
 

More from Thinkful

893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
Thinkful
 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: Fundamentals
Thinkful
 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: Fundamentals
Thinkful
 
Itjsf129
Itjsf129Itjsf129
Itjsf129
Thinkful
 
Twit botsd1.30.18
Twit botsd1.30.18Twit botsd1.30.18
Twit botsd1.30.18
Thinkful
 
Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)
Thinkful
 
Baggwjs124
Baggwjs124Baggwjs124
Baggwjs124
Thinkful
 
Become a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info SessionBecome a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info Session
Thinkful
 
LA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info SessionLA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info Session
Thinkful
 
How to Choose a Programming Language
How to Choose a Programming LanguageHow to Choose a Programming Language
How to Choose a Programming Language
Thinkful
 
Batbwjs117
Batbwjs117Batbwjs117
Batbwjs117
Thinkful
 
1/16/18 Intro to JS Workshop
1/16/18 Intro to JS Workshop1/16/18 Intro to JS Workshop
1/16/18 Intro to JS Workshop
Thinkful
 
LA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: FundamentalsLA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: Fundamentals
Thinkful
 
(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: Fundamentals(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: Fundamentals
Thinkful
 
Websitesd1.15.17.
Websitesd1.15.17.Websitesd1.15.17.
Websitesd1.15.17.
Thinkful
 
Byowwhc110
Byowwhc110Byowwhc110
Byowwhc110
Thinkful
 
Getting started-jan-9-2018
Getting started-jan-9-2018Getting started-jan-9-2018
Getting started-jan-9-2018
Thinkful
 
Introjs1.9.18tf
Introjs1.9.18tfIntrojs1.9.18tf
Introjs1.9.18tf
Thinkful
 
Proglangauage1.10.18
Proglangauage1.10.18Proglangauage1.10.18
Proglangauage1.10.18
Thinkful
 
Batbwjs14
Batbwjs14Batbwjs14
Batbwjs14
Thinkful
 

More from Thinkful (20)

893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: Fundamentals
 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: Fundamentals
 
Itjsf129
Itjsf129Itjsf129
Itjsf129
 
Twit botsd1.30.18
Twit botsd1.30.18Twit botsd1.30.18
Twit botsd1.30.18
 
Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)
 
Baggwjs124
Baggwjs124Baggwjs124
Baggwjs124
 
Become a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info SessionBecome a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info Session
 
LA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info SessionLA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info Session
 
How to Choose a Programming Language
How to Choose a Programming LanguageHow to Choose a Programming Language
How to Choose a Programming Language
 
Batbwjs117
Batbwjs117Batbwjs117
Batbwjs117
 
1/16/18 Intro to JS Workshop
1/16/18 Intro to JS Workshop1/16/18 Intro to JS Workshop
1/16/18 Intro to JS Workshop
 
LA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: FundamentalsLA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: Fundamentals
 
(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: Fundamentals(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: Fundamentals
 
Websitesd1.15.17.
Websitesd1.15.17.Websitesd1.15.17.
Websitesd1.15.17.
 
Byowwhc110
Byowwhc110Byowwhc110
Byowwhc110
 
Getting started-jan-9-2018
Getting started-jan-9-2018Getting started-jan-9-2018
Getting started-jan-9-2018
 
Introjs1.9.18tf
Introjs1.9.18tfIntrojs1.9.18tf
Introjs1.9.18tf
 
Proglangauage1.10.18
Proglangauage1.10.18Proglangauage1.10.18
Proglangauage1.10.18
 
Batbwjs14
Batbwjs14Batbwjs14
Batbwjs14
 

Recently uploaded

Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 

Bavpwjs1113

  • 1. Build a Virtual Pet with JavaScript November 2017 bit.ly/jspet-phx 1
  • 2. Welcome to "Build a Virtual Pet with Javascript". The Wi-Fi network is X and the password is Y The website for this class is Z. Speaker notes
  • 3. Instructor Dave Hoel Full-stack Web Developer Thinkful Graduate TA's Joe Previte Digital Marketing Manager/Web Developer 2
  • 4. Let me start with a little about me. My name is X and my background is Y I am working with Thinkful to teach this class because Z Speaker notes
  • 5. About you What's your name? What's your goal? What is your coding background? 3
  • 6. I'd love to learn a little more about you guys. So can we go around the room and can everyone give us your name, what your goal is for attending the class and your programming background? Speaker notes
  • 7. This is what we're making 4
  • 8. Today we're building a simple virtual pet. We can click three different buttons to feed our pet, play with our bet, and have our pet do some exercise. When we click on these buttons, we'll increase or decrease the weight or happiness of our pet. Speaker notes
  • 9. Agenda Starter code review (5 min) Learn key JavaScript concepts (20 min) Build your app! (40 min) Go over solutions (10 min) Next steps (10 min) 5
  • 10. I’ll start by walking you through the HTML/CSS starter code so you have a reference of what you’ll be working with. Then I’ll go over important Javascript concepts that you’ll need to complete the app. You’ll then build the app during which time the TA’s and myself will be walking around to help you guys out. At the end we’ll go over solutions and then cover next steps for continuing your learning. Speaker notes
  • 12. Go ahead and go to this url to get the starter code. We’re using a online code editor called Glitch which will let us see the result of our code really quickly. On the README.MD file you should see an overview of the project and the challenges you'll need to complete. The files we’ll be using today on the left are client.js and index.html. You can ignore style.css, server.js, package.json and .env. At the bottom of the Readme file we've added some helpful links for further help on particular concepts. Lets look at the index.html file to see how our app is structured. We have an image which includes a picture of our pet. We're displaying the pet's name, weight, and level of happiness. Below that are three buttons. One to give the pet a treat, increasing it's weight and happiness. One is to play with our pet, decreasing it's weight and increasing it's happiness. The third is exercise which decreases it's weight and happiness. All of the code you’ll be writing will be in client.js but you may need to refer to the html and css file to solve some of the problems. Once you’ve written some code, click the “Show Live” button at the top to open a new tab that will automatically update as you edit your code. Speaker notes
  • 13. Defining a variable with JavaScript var firstVariable = 20 Initialize variable Name of variable Value of variable 7
  • 14. Let's start with reviewing variables in Javascript. Variables let us assign some value to a a string. We use variables to store information that we'll use when our app is running. To define a variable in Javascript, we start with the keyword "var". We then give our variable a name. The name should start with a letter. Try to make sure your variable names are descriptive. It's ok if they are long. Then we set that variable name equal to some value. That value can be any data structure in JS including numbers and strings. Speaker notes
  • 16. Alright lets try writing this out. Add var firstVariable = 20. If we type firstVariable now, what is going to happen? The number 20 is stored in the variable so every time we use that variable, we're referring to the 20. With a number, we can also increment or decrement that number. Once we define the variable, we can re-define it as either more or less. So we could do firstVariable = firstVariable + 1 to change our variable from 20 to 21. In this way, an equal sign in JS is different than in math. A single equal sign means we're assigning a value, not saying two things are equal. What other things can we store in a variable? In Javascript we can store pretty much everything in a variable. We can store booleans and strings as well. Lets see examples of each of those. Instead of a number, set firstVariable equal to a string. In JS, when we put a value in quotes, it assumes its a string. Let's console.log the string. We can do the same with booleans. Speaker notes
  • 17. Introducing our pet "object" Name "Thinkpup" Weight 6 Happiness 0 9
  • 18. Lets say we want to store a bunch of different information in one variable, we can do that with a Javascript object. We'll be using a JS object remember all the aspects of our virtual pet. An object will basically have a list of "keys" and "values". So we can store all the information about our pet in one place. In this case, we'll have three items in our "list". The name of our pet, which would be a string. The weight which would be a number. And how happy they are, which will also be a number. We can "get" and "set" our values by grabbing them from the object with the "key" which is always a string. In this case, our key for "Thinkpup" is "name". Speaker notes
  • 20. Creating an object Define an object with curly brackets. The "key" is always a string. The value can be whatever value we like. A Javascript object can hold all sorts of values in one variable. Retrieving a value We can retrieve a value by saying pet_info.name or pet_info['name'] Changing a value We can change a value by saying pet_inf['name'] = "Nala" Speaker notes
  • 22. A function lets you separate your code into bite-sized pieces which you can use over again. When you write a function to use later, you are “declaring” it. When you use (or run) that function you are “calling” it. To call a function, we simply write doSomething() and then the function is run. Speaker notes
  • 23. If, then, else pet is hungry feed it go to park if true if false 12
  • 24. In all programming languages there exist a way to tell the computer that if X happens, do this, if y happens, do that. In Javascript we use if, then, else statement. So we tell the computer, if this condition is true, say the pet is hungry, feed it. If it's not hungry (or that condition is false), go to the park. After this, continue running the program. Speaker notes
  • 26. This is how we'd write that concept in Javascript. We have an "if" keyword and then some condition that could either be True or False in parentheses. If it's true, it would run the code in the first bracket. If it's not true, we'd run the code in the else block. Speaker notes
  • 27. Real developers use Google... a lot 14
  • 28. With that you should be ready to start the challenges. One last note before we do the first challenge together. Google is an everyday part of being a developer. A key part of becoming a developer is getting comfortable using Google to learn and look up things. The more you code, the more you will use Google, not the other way around. Speaker notes
  • 29. Let's work on the first step together http://bit.ly/tf-virtual-pet 15
  • 30. Alright, with that let's start building our app. On the left, you can see the files you'll be working on. The Readme will give you instructions. You'll be writing your code in client.js. You shouldn't need to touch any of the other files. After you write your code, it will automatically be saved. At any point you can hit "Show Live" to see a live version of your app. Let's start the first step together. So in this first step, we want to create our pet_info object with three keys. How would we do that? Feel free to name your pet whatever you like and set it's starting happiness and weight to whatever you like. (Assign TA's to different sections of class) Speaker notes
  • 32. Alright. Let's go over the solutions to the main challenges. For each of the functions, we're going to do a version of the same thing. We're going to first grab the value from our object and then assign it to that value plus or minus some number. For our third step, we want to make sure weight can't go below zero. To do this, we add a function that checks weight before we update it in the HTML. If weight is below one, it should equal one. Speaker notes
  • 33. 17
  • 34. In addition to these free workshops which you should definitely continue coming to, there are a number of resources available online, we've already mentioned a few. Google, google, google for general information, w3schools.com is a resource for all HTML and CSS tags along with JavaScript documentation. And Code Academy and FreeCodeCamp will give you a bit of structure. Speaker notes
  • 35. 18
  • 36. But if you’re interested in an even more structured approach, and you're at the point where you are ready to become and actual employed web developer, then bootcamps are your best options. This graph is showing us that by 2020, that's just over 2yrs!, there will be 1.4 million computing jobs, but only 400,000 CS degree graduates to fill those positions. This means that by 2020 there will be a need for 1 million computer science professionals, of which web developers are a very large number. Because traditional 4-year colleges and universities are not enough, bootcamps were created as a way of filling the talent gap. Bootcamps are immersive programs specifically designed to make you employable as a web developer. Like a trade school, if you put the work in, you will gain the skills needed to fill these positions. On average bootcamps have a job-placement rate of 70%. Speaker notes
  • 37. 19
  • 38. Thinkful goes beyond the average bootcamp. We actually guarantee job placement within six months of graduation. Let me say that another way - if you complete our bootcamp, and do you part in career services, you will land a job as a web developer within six months of graduating from your bootcamp. Currently, 80% or our grads are placed as full-time devs, and 92% are placed in other tech roles, with graduates landing tech jobs at both startups and larger more established companies like Boeing, Google, IBM. 80% of our grads work as developer and engineers, while other grads break into high-growth roles such as product + project management, QA engineering, and more. All of these numbers are updated monthly by a third-party auditor and can be found on the first page on our website. Speaker notes
  • 39. 20
  • 40. And this is why we are able to give you a guarantee...the unprecedented level of support you get as a Thinkful student. Each student, whether full-time or flex, is matched with a personal mentor, to work through the program with. Our mentors have a minimum of 10 years of experience in their field, you meet with them for 1hr sessions three times per week, and they are your best friend throughout your bootcamp. Once you graduate, you move into Career Services and are matched with a Career Services Coach, your after-graduation mentor, so to speak. They will help you with your resume, do mock interviews with you, portfolio reviews, and guide you through the job seeking process. Then you have a Program Manager, who's entire job is to make sure your relationship with these two other people is successful. Then you have your local community - we host dinners for our local students and mentors, we call them Family Dinners, where students can present what they're working on and get feedback from the mentors, talk about their experience with their bootcamp, commiserate, all over food and drinks on Thinkful. And then! You have access to our Thinkful Slack community: staff, mentors, and students all over the world are on our Slack group at all times. Additionally, there are Q&A sessions and workshops that happens all day, every day of the week. Whenever you need help or just have a question, mentors are available to work with you. Speaker notes
  • 41. 21
  • 42. So if this all sounds interesting to you and you want to try it out, I think you should. We’re offering a two-week trial. After the two-week trial you’ll have the option to continue on with the full bootcamp. We offer a wide range of options for financing, including discounts and scholarships. This offer is valid for one week from tonight. You can email or see before you leave to sign up. We’ll be around for a bit to answer any questions. Thank you. Speaker notes