Full-Stack Development

JavaScript ‐ Intro to JavaScript

Lesson 02.04.00

Essential Question:

  • How do we apply our knowledge of programming syntax to a new language?

Learning Objectives:

  • Differentiate between Python and JavaScript syntax
  • Integrate JavaScript into a HTML website
  • Adapt existing programming scripts to JavaScript

Standards:

Materials:

Opening Task (20 mins)

  • Scholars will complete opening task on Schoology covering topics learned from python foundations unit
  • Randomly selected scholar will facilitate review with peers

JavaScript Overview (20 Minutes)

  • Research: Facts about JavaScript
    • Scholars will find facts about JavaScript to share out to the class via a PollEverywhere Slide
  • Examples of what JavaScript is used for:
    • Popup Messages
    • Dropdowns
    • Show/Hide Content Based off buttons
    • Animations
    • Timers/Countdowns
  • External vs Internal JS
    • Relating to CSS external vs internal instructor will overview
      • What were the limitations of internal stylesheets with css?
      • What benefit would an external javascript file have?

New GitHub Repo (10 Minutes)

Scholars will create a new GitHub repository to hold this units code

Break (10 Minutes)

Using JavaScript Demo (30 Minutes)

Instructor Guided Demo of using JavaScript with HTML

  • Using console.log() + devtools console
console.log('Hello World')
console.info('Hello world')
console.warn('Hello World')
console.error('Hello world')
  • Variable creation
// Unlike python, we need to prefix variables with the let keyword to create them
let name = 'Mr. Forlenza'
// When changing values we do not need to use the let keyword again
name = 'Mr. F'
  • If statements
if (2 == 3) {
  // We use curly brackets to define the inside of our if statement
  console.log('i broke math')
}
else {
  console.log('math is good')
}
  • Functions & Buttons
<body>
  <button onclick="clickMe()">Click Me</button>

  <script>
    function clickMe() {
      console.log('Hello World')
    }
  </script>
</body>

JavaScript Exercise (40 Minutes)

Scholars will complete a JavaScript exercise combing their knowledge of JS variables, if statements and outputs.

Exit Ticket (10 Minutes)

Scholars will complete exit ticket reflecting on the days work

  • From your experience how would you compare Python and JavaScript?
  • What do you envision will be the difficult part of learning JavaScript?
  • What do you envision will be the easiest part of learning JavaScript?