Skip to content

Commit

Permalink
Updates to values and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
joemull committed Feb 1, 2025
1 parent 5ce8b8c commit 666d021
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lectures/javascript-values-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Yuankai Xue, Hanlin Chen, Gina R. Bai, Robert Tairas, and Yu Huang. 2024. [Does
- c. `'False'`
- d. `"on"`

7. How can we calculate the money left over?
7. Are there any problems with this program?

<<< @/public/sandbox/js-variables/variable-script.js#check1{js}

Expand Down
13 changes: 5 additions & 8 deletions public/sandbox/js-variables/variable-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,21 @@ let pizza = 9;
let numPizzas = 2;
let drinks = 8;
let cash = 40;
let moneyLeftOver = '?';
let moneyLeftOver = cash - pizza + numPizzas + drinks;
console.log(moneyLeftOver);
// #endregion check1

// #region check2
First episode name == 'Pilot ; EpisodesWatched = 8;
episodeCount = 5;
console.log(episodesWatched);
First episode name == 'Pilot';
episodeCount = 8
console.log(episodeCount);
// #endregion check2

// #region check3
const mostCommonOrder = 'juice ';
let order1 = mostCommonOrder;
order1 = 'tea ';
let order2 = 'tea ';
let jonsOrder = order2;
order2 = 'coffee ';
let samsOrder = mostCommonOrder + order2;
let table5Order = samsOrder + order1;
let table5Order = order1 + order2;
console.log(table5Order);
// #endregion check3
4 changes: 4 additions & 0 deletions workshops/values-variables/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ For this workshop, practice working with JS values and variables by
writing a story about a character of your choosing--a pet, a person or thing from
a movie or a book, etc.

::: tip Aesop’s Fables
You can use one of Aesop’s fables if you like! There is a nice [edition for children at read.gov](https://www.read.gov/aesop/).
:::

::: info Advanced option
Are you already pretty good at JS values and variables? Then do this workshop by defining an
object with properties and methods as appropriate, rather than raw variables in the global namespace.
Expand Down

0 comments on commit 666d021

Please sign in to comment.