SlideShare a Scribd company logo
1 of 32
LEARN TO CODE
WITH JAVASCRIPT
BY CHOOSING YOUR OWN ADVENTURES
By Tessa Mero
Follow me on Twitter: @tessamero
Developer Relations
Instructor / Mentor
Community Leader
Mother of Two
Review
◦Basic Syntax of JavaScript
◦ Variables and Functions
◦Conditional Statements (if, else if, else)
◦Build a “Choose Your Own Adventure”
application
Thanks to Lee Ngo
◦github.com/lee-ngo
◦medium.com/@leepngo
Setting Up Your Computer
◦Text Editor: atom.io
◦Updated Web Browser : Google
Chrome
What is JavaScript?
◦First appearance 1995
◦Created by Netscape engineer
◦Most core language available
◦Can do more than just a static page – Animate,
calculate, any actions! Think of it as a BEHAVIOR
◦Bridges ”design” and “development”
◦JavaScript != Java
First Step? Variables
Variables and Data Types
• Strings – “Hello! My name is Tessa.”
• Numbers – 40, 0.15, 150, 15000000
• Boolean – True or False
• Null – nothing
• “ “ – undefined value
• Functions – hmmm show me!
=, ==, and === What?
= is the assignment operator. Sets variables
equal to a specific value.
== is the abstract equality comparison
=== is the strict equality comparison
Examples:
=
==
===
Var foo = 1
“1” == 1 => True
Null = undefined => True
“1” === 1 => False
Null === undefined => False
Functions
◦Blocks of Code
◦Syntax: Declare, Define, and Call
Syntax of Functions
◦Parameters – (a, b, c) – passes through functions
◦Arguments – real values of the parameters the function
affects
◦Block - { … } the function’s operational code
◦return command – the output of the function
Conditional Statements - if
◦ Remember Choose Your Own Adventure books?
◦ Format: if, else, else if
◦ If - If what is in the parameter is True, then a block of code will run. If
False, will not run
Conditional Statements – if, else
If you want it to do something else besides nothing if False…. Add else!
Conditional Statements – if, else if, else
Have more scenarios? Add ”else if” to it
if (name == “Tessa”)
{name = “My name is Tessa.”;)
else if (name ==“John”;)
{name = “My name is John.”;)
else {name = “This person does not
have a name.”;}
Can you figure out the error below?
TIME TO MAKE OUR
“CHOOSE YOUR OWN
ADVENTURES” APP!
Clone the GitHub Repo
◦https://github.com/GalvanizeOpenSource/l
earn-to-code-javascript-2
◦Short URL: http://bit.ly/choose-adventure
Open index.html in web browser
4 Steps to Building This App:
◦Start with an initial prompt
◦Create two possibilities for responding to that prompt
◦Connect everything to your HTML & CSS!
◦Test it out and see if it works
Player Selects an Option
Player must choose ‘TAKE GOLD’ or ’DRINK
POTION’ to move on to the next phase
Time to create a Function to make things
happen!
Create function goldOrPotion()
Open the custom.js file and add code starting at line 2
Add a response variable
Create Conditional Statement
Break down of the condition:
What if you type something else?
custom.js File results
Type in ‘TAKE GOLD’ - Results
Twitter: @tessamero
slides:
http://bit.ly/choose-
adventure-preso

More Related Content

Viewers also liked

Web app development_php_04
Web app development_php_04Web app development_php_04
Web app development_php_04Hassen Poreya
 
Web app development_php_06
Web app development_php_06Web app development_php_06
Web app development_php_06Hassen Poreya
 
Web app development_crud_13
Web app development_crud_13Web app development_crud_13
Web app development_crud_13Hassen Poreya
 
Web app development_database_design_11
Web app development_database_design_11Web app development_database_design_11
Web app development_database_design_11Hassen Poreya
 
Web app development_html_css_03
Web app development_html_css_03Web app development_html_css_03
Web app development_html_css_03Hassen Poreya
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07Hassen Poreya
 
Web app development_my_sql_08
Web app development_my_sql_08Web app development_my_sql_08
Web app development_my_sql_08Hassen Poreya
 
Web app development_database_design_10
Web app development_database_design_10Web app development_database_design_10
Web app development_database_design_10Hassen Poreya
 
Web app development_php_05
Web app development_php_05Web app development_php_05
Web app development_php_05Hassen Poreya
 
Web app development_html_01
Web app development_html_01Web app development_html_01
Web app development_html_01Hassen Poreya
 
Web app development_cookies_sessions_14
Web app development_cookies_sessions_14Web app development_cookies_sessions_14
Web app development_cookies_sessions_14Hassen Poreya
 
Web app development_html_02
Web app development_html_02Web app development_html_02
Web app development_html_02Hassen Poreya
 

Viewers also liked (13)

Web app development_php_04
Web app development_php_04Web app development_php_04
Web app development_php_04
 
Web app development_php_06
Web app development_php_06Web app development_php_06
Web app development_php_06
 
Web app development_crud_13
Web app development_crud_13Web app development_crud_13
Web app development_crud_13
 
Web app development_database_design_11
Web app development_database_design_11Web app development_database_design_11
Web app development_database_design_11
 
Web app development_html_css_03
Web app development_html_css_03Web app development_html_css_03
Web app development_html_css_03
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
 
Web app development_my_sql_08
Web app development_my_sql_08Web app development_my_sql_08
Web app development_my_sql_08
 
CodeIgniter Practice
CodeIgniter PracticeCodeIgniter Practice
CodeIgniter Practice
 
Web app development_database_design_10
Web app development_database_design_10Web app development_database_design_10
Web app development_database_design_10
 
Web app development_php_05
Web app development_php_05Web app development_php_05
Web app development_php_05
 
Web app development_html_01
Web app development_html_01Web app development_html_01
Web app development_html_01
 
Web app development_cookies_sessions_14
Web app development_cookies_sessions_14Web app development_cookies_sessions_14
Web app development_cookies_sessions_14
 
Web app development_html_02
Web app development_html_02Web app development_html_02
Web app development_html_02
 

Similar to Learn to Code with JavaScript - Choose Your Own Adventures

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
 
Build a virtual pet with javascript (may 2017)
Build a virtual pet with javascript (may 2017)Build a virtual pet with javascript (may 2017)
Build a virtual pet with javascript (may 2017)Thinkful
 
Reinvent yourself - How to become a native iOS developer in nine steps
Reinvent yourself - How to become a native iOS developer in nine stepsReinvent yourself - How to become a native iOS developer in nine steps
Reinvent yourself - How to become a native iOS developer in nine stepsJason Hanson
 
Hotfixing iOS apps with Javascript
Hotfixing iOS apps with JavascriptHotfixing iOS apps with Javascript
Hotfixing iOS apps with JavascriptSergio Padrino Recio
 
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
 
Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014Barry Kooij
 
Vpet sd-1.25.18
Vpet sd-1.25.18Vpet sd-1.25.18
Vpet sd-1.25.18Thinkful
 
Virtues of platform development
Virtues of platform developmentVirtues of platform development
Virtues of platform developmentPhillip Jackson
 
Keeping lab notes as a software developer
Keeping lab notes as a software developerKeeping lab notes as a software developer
Keeping lab notes as a software developerJames McKay
 
A Presentation on Presenting
A Presentation on PresentingA Presentation on Presenting
A Presentation on PresentingJason Lotito
 
Empathy: The Secret Ingredient in WordPress Development, Work, and Success
Empathy: The Secret Ingredient in WordPress Development, Work, and SuccessEmpathy: The Secret Ingredient in WordPress Development, Work, and Success
Empathy: The Secret Ingredient in WordPress Development, Work, and SuccessJason Clarke
 
Responsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJSResponsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJSChristian Heilmann
 
Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experimentslacyrhoades
 
Leveling Up at JavaScript
Leveling Up at JavaScriptLeveling Up at JavaScript
Leveling Up at JavaScriptRaymond Camden
 
Programming in as3 the basics
Programming in as3 the basicsProgramming in as3 the basics
Programming in as3 the basicsJoseph Burchett
 
Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...Duckademy IT courses
 
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,..."Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...Yandex
 

Similar to Learn to Code with JavaScript - Choose Your Own Adventures (20)

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)
 
Build a virtual pet with javascript (may 2017)
Build a virtual pet with javascript (may 2017)Build a virtual pet with javascript (may 2017)
Build a virtual pet with javascript (may 2017)
 
Reinvent yourself - How to become a native iOS developer in nine steps
Reinvent yourself - How to become a native iOS developer in nine stepsReinvent yourself - How to become a native iOS developer in nine steps
Reinvent yourself - How to become a native iOS developer in nine steps
 
Hotfixing iOS apps with Javascript
Hotfixing iOS apps with JavascriptHotfixing iOS apps with Javascript
Hotfixing iOS apps with Javascript
 
Js basics
Js basicsJs basics
Js basics
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
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)
 
Isotope
IsotopeIsotope
Isotope
 
Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014
 
Vpet sd-1.25.18
Vpet sd-1.25.18Vpet sd-1.25.18
Vpet sd-1.25.18
 
Virtues of platform development
Virtues of platform developmentVirtues of platform development
Virtues of platform development
 
Keeping lab notes as a software developer
Keeping lab notes as a software developerKeeping lab notes as a software developer
Keeping lab notes as a software developer
 
A Presentation on Presenting
A Presentation on PresentingA Presentation on Presenting
A Presentation on Presenting
 
Empathy: The Secret Ingredient in WordPress Development, Work, and Success
Empathy: The Secret Ingredient in WordPress Development, Work, and SuccessEmpathy: The Secret Ingredient in WordPress Development, Work, and Success
Empathy: The Secret Ingredient in WordPress Development, Work, and Success
 
Responsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJSResponsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJS
 
Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experiments
 
Leveling Up at JavaScript
Leveling Up at JavaScriptLeveling Up at JavaScript
Leveling Up at JavaScript
 
Programming in as3 the basics
Programming in as3 the basicsProgramming in as3 the basics
Programming in as3 the basics
 
Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...
 
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,..."Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
 

More from Tessa Mero

Developer relations KPIs
Developer relations KPIsDeveloper relations KPIs
Developer relations KPIsTessa Mero
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
5 ways to simply add media accessibility (m16y) to your jamstack app
5 ways to simply add media accessibility (m16y) to your jamstack app5 ways to simply add media accessibility (m16y) to your jamstack app
5 ways to simply add media accessibility (m16y) to your jamstack appTessa Mero
 
I'm Graduating Soon. Help! How Do I Get into the Tech Field?
I'm Graduating Soon. Help! How Do I Get into the Tech Field?I'm Graduating Soon. Help! How Do I Get into the Tech Field?
I'm Graduating Soon. Help! How Do I Get into the Tech Field?Tessa Mero
 
Optimize media performance in wordpress with cloudinary
Optimize media performance in wordpress with cloudinaryOptimize media performance in wordpress with cloudinary
Optimize media performance in wordpress with cloudinaryTessa Mero
 
Joining a developer experts program to leverage your career
Joining a developer experts program to leverage your careerJoining a developer experts program to leverage your career
Joining a developer experts program to leverage your careerTessa Mero
 
Finding the Jelly in the JAMstack
Finding the Jelly in the JAMstackFinding the Jelly in the JAMstack
Finding the Jelly in the JAMstackTessa Mero
 
Building APIs the serverless way
Building APIs the serverless wayBuilding APIs the serverless way
Building APIs the serverless wayTessa Mero
 
Don't let FaaS do a BaaS job
Don't let FaaS do a BaaS jobDon't let FaaS do a BaaS job
Don't let FaaS do a BaaS jobTessa Mero
 
Finding the jelly in the jam stack
Finding the jelly in the jam stackFinding the jelly in the jam stack
Finding the jelly in the jam stackTessa Mero
 
Chatbots Workshop SF JS Meetup May 2018
Chatbots Workshop SF JS Meetup May 2018Chatbots Workshop SF JS Meetup May 2018
Chatbots Workshop SF JS Meetup May 2018Tessa Mero
 
ChatOps Workshop
ChatOps WorkshopChatOps Workshop
ChatOps WorkshopTessa Mero
 
Cisco CMX Location Services
Cisco CMX Location ServicesCisco CMX Location Services
Cisco CMX Location ServicesTessa Mero
 
DeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a ChatbotDeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a ChatbotTessa Mero
 
Revolutionize Your Workflow with ChatOps
Revolutionize Your Workflow with ChatOpsRevolutionize Your Workflow with ChatOps
Revolutionize Your Workflow with ChatOpsTessa Mero
 
Let's Build a Chatbot
Let's Build a ChatbotLet's Build a Chatbot
Let's Build a ChatbotTessa Mero
 
DevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot WorkshopDevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot WorkshopTessa Mero
 
Building Chatbots
Building ChatbotsBuilding Chatbots
Building ChatbotsTessa Mero
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsTessa Mero
 

More from Tessa Mero (20)

Developer relations KPIs
Developer relations KPIsDeveloper relations KPIs
Developer relations KPIs
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
5 ways to simply add media accessibility (m16y) to your jamstack app
5 ways to simply add media accessibility (m16y) to your jamstack app5 ways to simply add media accessibility (m16y) to your jamstack app
5 ways to simply add media accessibility (m16y) to your jamstack app
 
I'm Graduating Soon. Help! How Do I Get into the Tech Field?
I'm Graduating Soon. Help! How Do I Get into the Tech Field?I'm Graduating Soon. Help! How Do I Get into the Tech Field?
I'm Graduating Soon. Help! How Do I Get into the Tech Field?
 
Optimize media performance in wordpress with cloudinary
Optimize media performance in wordpress with cloudinaryOptimize media performance in wordpress with cloudinary
Optimize media performance in wordpress with cloudinary
 
Joining a developer experts program to leverage your career
Joining a developer experts program to leverage your careerJoining a developer experts program to leverage your career
Joining a developer experts program to leverage your career
 
Finding the Jelly in the JAMstack
Finding the Jelly in the JAMstackFinding the Jelly in the JAMstack
Finding the Jelly in the JAMstack
 
Building APIs the serverless way
Building APIs the serverless wayBuilding APIs the serverless way
Building APIs the serverless way
 
Don't let FaaS do a BaaS job
Don't let FaaS do a BaaS jobDon't let FaaS do a BaaS job
Don't let FaaS do a BaaS job
 
Finding the jelly in the jam stack
Finding the jelly in the jam stackFinding the jelly in the jam stack
Finding the jelly in the jam stack
 
Chatbots Workshop SF JS Meetup May 2018
Chatbots Workshop SF JS Meetup May 2018Chatbots Workshop SF JS Meetup May 2018
Chatbots Workshop SF JS Meetup May 2018
 
ChatOps Workshop
ChatOps WorkshopChatOps Workshop
ChatOps Workshop
 
Cisco CMX Location Services
Cisco CMX Location ServicesCisco CMX Location Services
Cisco CMX Location Services
 
DeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a ChatbotDeveloperWeek2018 - Let's Build a Chatbot
DeveloperWeek2018 - Let's Build a Chatbot
 
Revolutionize Your Workflow with ChatOps
Revolutionize Your Workflow with ChatOpsRevolutionize Your Workflow with ChatOps
Revolutionize Your Workflow with ChatOps
 
Let's Build a Chatbot
Let's Build a ChatbotLet's Build a Chatbot
Let's Build a Chatbot
 
DevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot WorkshopDevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot Workshop
 
Chatbots
ChatbotsChatbots
Chatbots
 
Building Chatbots
Building ChatbotsBuilding Chatbots
Building Chatbots
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Learn to Code with JavaScript - Choose Your Own Adventures

Editor's Notes

  1. * What is a Developer Evangelist or Developer Advocate? An advocate means to go out and tell others about your company or tools and teach others. We demo code and help developers improve their work flow by showing them the Dev tools we have. * I do not sell anything. I only teach and help developers. What is Cisco DevNet? Founded 3 years ago. Developer Community 450,000+ devs using our APIs. Over 200 APIs. Cisco is now a software applications company. I work specifically on the Cisco Spark team What is Cisco Spark? Chat/Calls/Video/ Chat bots which us to discussing ChatOps
  2. This photo was taken in Brazil in the summer of 2016. I was at the BrazilJS JavaScript conference in Porto Alegre, which is also the largest JavaScript conference in the world, holding 2000 attendees. I taught college before I got a job at Cisco. I was teaching web development including frontend and backend web. During this time I took on a volunteer role to mentor students and people who are new to the web development field. I assist others with resumes, cover letters, job interview processes, and job searches. I have helped countless people find jobs and get hired.
  3. Board of Director member of Joomla Production Leadership Team member Organizer of Meetup for Joomla Meetup and Conference for PHP in my city Meetup and Conference for APIs in my city My city is one of the major tech cities in the USA, Seattle, WA.
  4. In this course, we'll be going over the following! Basic syntax of JavaScript Variables and Functions Conditional statements (if, else if, else) Build a “Choose Your Own Adventure” application
  5. This is the what the website looks like. You can fork the repo here. You can follow along as this can also be designed like a workshop or you can watch and try it out later. The link to the slides will be on the last slide. You can also find the content of the slides on the github repo I will provide.
  6. Thank you to Lee Ngo
  7. Install a text editor! We recommend Atom.io Have an updated web browser! We recommend Google Chrome
  8. For those who are brand new to JavaScript: Making its first appearance in 1995, JavaScript was created by an engineer at Netscape to provide a user-friendly, lightweight programming language Now, with HTML and CSS, it is one of the core languages of the Internet and is growing quickly to accommodate beyond the client-side. JavaScript allows web pages to do more than just “sit there." You can animate, calculate, etc. - you can do it all! It is a great programming bridge between “design” and “development” that allows for endless creativity. Common confusion: JavaScript is NOT Java. They are largely different programming languages and should not be confused with one another. Twitter: Opening up a tweet in a bigger window. Any action below a tweet is using JavaScript. Reply, Favoriting JavaScript is not just for programming on browsers. Can be used for Servers, game programming, databases, and robots!
  9. So if you are brand new to JavaScript, the first step you’ll need to know is the very basics. Variables are created by using the word “var” and then putting a word or word and number afterwards and setting a value. What is the value of the variable total?
  10. With the ” = “ operator, you are assigning a value to a variable. With the “ == “ abstract equality comparison operator, it compares two items to see if they are of equal value, but ignores if they are the same exact type of data With the ” === “
  11. With the ” = “ operator, you are assigning a value to a variable.
  12. Functions are blocks of code that can perform a task. In JS, you follow the general syntax: 1) declare 2) define 3) call (invoke) Think about the value that is produced by this function.
  13. Parameters - (a,b,c) - hypothetically what passes through the function Arguments - real values of the parameters the function affects Block - {...} - the function’s operational code Return command - the output of the function
  14. If statements by themselves are to be true.
  15. What if you wanted the code to do something else besides nothing if it’s False? Make it an ”if else” statement
  16. Add an “else if” between the ”if” and the “else” Recap of Conditional Rules If statements perform an action if the statement is True Else statements perform an action if the statement is False Else if statements perform an action if the first is False but the second is True Is there any other way to do this?
  17. You can clone the GitHub repo so you can try it now or later. You can also just download the zip file if you are not familiar with using Git commands. Open the text editor Atom that you installed or whatever favorite text editor you have. Before we get started into looking at the code, we first need to go over JavaScript basics.
  18. The first thing we’ll do is create a function that runs everything on click.
  19. Create a variable called “response” that captures whatever the player types into the field. This function retrieves the value in the webpage that is submitted with is associated with the id of the field called “response”. That value is stored in JavaScript for the next move.
  20. There are 3 possible outcomes: 1) Player types TAKE GOLD 2) Player types DRINK POTION 3) if anything else is typed You would then create an if, else if, and else conditional to indicate to the player that the interactions worked.
  21. JavaScript finds element with ID ‘gold’ in the HTML and change current setting of class ‘hidden’. Same with ‘intro’ class. Creates the illusion you’re advancing in the story In the else if conditional scenario, the player typed 'DRINK POTION', then the 'intro' block would also disappear, but the 'potion' block would appear instead. ********* In other words, if the player typed 'TAKE GOLD', two things will happen: -JavaScript will find an element with the ID 'gold' in the HTML and change the current setting of class 'hidden' -JavaScript will find an element with the ID 'intro' in the HTML and channge the current setting of class 'hidden' The 'intro' block is by default not hidden from the player - you get to see that in the HTML The 'gold' block is by default hidden - the class 'hidden' and its attributes make it that way. This will make one block of HTML appear and another block disappear, creating the illusion that you're advancing in the story.
  22. If you do not type in ‘TAKE GOLD’ or ’DRINK POTION’, you have your else statement in the code. This adds a new value to the HTML page that says 'Sorry, I do not understand.' This last bit of code is helpful for knowing that the JavaScript does work, but it's looking for a particular answer.