Skip to content

Instantly share code, notes, and snippets.

@jshawl
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save jshawl/89b4d7f757fff078267c to your computer and use it in GitHub Desktop.

Select an option

Save jshawl/89b4d7f757fff078267c to your computer and use it in GitHub Desktop.

Programming && JavaScript

What can JS do?

The Basics of programming && Pseudocode

The Thermostat Problem

  • what does it need to know?
  • what can it do?
  • when does it do it?
    get target_temprature
    target_temperature = 72
    repeat forever,
      current_temperature = get_sensor_reading
      if target_temperature > (current_temperature+5),
          turn_on_heater
      if target_temperature <= current_temperature,
          turn_off_heater

The Vending Machine Problem

  • A vending machine offers a finite number of products.
  • A customer may insert cash at any time to add credit.
  • A customer may enter a product code at any time to request a purchase.
  • A requested product requires N credit to purchase.
  • A requested product may be out of stock.
  • A purchase is triggered when a valid product code and sufficient credit has been entered.
  • A purchase yeilds the requested product, and appropriate change.
  • Full change may be requested at any time.

JS Basics

Code Along

Try it yourself

Color Scheme Switcher Redux

Choose your own Lab!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment