Skip to content

SPStover/js-and-pseudocode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Pseudocoding, Javascript, and Programatic Thinking

Prerequisite Lessons:

  • Javascript Foundations
  • Boolean Logic
  • Introduction to the Chrome Developer Tools

Notes: In this lab, we are going to practice fundamental programming skills. As programmers, we will be performing numerous calculations that we want to save. We'll practice using variables to save these values so that we can reuse them later on.

There will also be instances where we won't write our own code from scratch. Instead, we will use code that other people have created and tested heavily. To do this, we'll have to be comfortable reading documentation to learn how to use other people's existing code, as well as how to incorporate it into our own code.

When tackling a new programming challenge, it is tempting to dive right into the code. For simpler problems that the developer has seen before, this might not be an issue. But for larger problems that they haven't seen before, developers will usually plan out their solution in plain English to make sure their logic is correct. We'll practice pseudocode so we can be comfortable tackling new problems that come our way.

Exercise

Requirements

  • Follow the instructions provided in the main.js file in the starter-code folder.
  • Open the index.html file and examine the console in the Developer Tools. Look here to see if your code is producing the correct results.

Directions

Part 1:

  • Create three variables: name, age, and address.
    • Create a fourth variable, greeting, that combines these three variables to form a greeting.
    • For example, "Hello, I'm Anthony, I'm 20 years old and live at 100 Main St."
    • Log this fourth variable to the console. Check the console to make sure you're getting the desired result.

Part 2:

  • Create another variable called greeting2.
  • This time, use the new ES6 Syntax, string interpolation, to create the same greeting.
    • Hint: String interpolation uses backticks instead of quotation marks.
    • Log the greeting2 variable to the console. Check the console to make sure you're getting the desired result.

Part 3:

  • "Code Testing." Let's check and see if we did everything correctly and that greeting returns the same value as greeting2.
  • Create a variable problemSolved whose value is the boolean value of if greeting and greeting2 are equivalent. Log this variable to the console to check the values result.
  • If the return is false, correct your bugs above until greeting and greeting2 are equivalent.

Part 4: (No coding is needed for this part).

  • We are given a list of 20 numbers. We have to go through the list and find the largest number.
  • What would the pseudocode for this problem look like? What variables would we need?
    • Hint: How would we solve this problem if we had to do this with pencil and paper?
  • What number would we write down in order to remember? Anything that you write down probably belongs in a variable.
  • Extra Bonus Question: What would the pseudocode look like if you also had to find the smallest number?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 89.7%
  • HTML 10.3%