In these exercises you will be given a small program and be asked to identify each piece of syntax with a comment, like this:
// prim SC
'use strict';
// kw id oper prim SC
#!/bin/bash | |
while true; do | |
read -p "Please input the word \"cat\": " input | |
if [ "$input" != "cat" ]; then | |
echo "Incorrect input. Please try again." | |
else | |
echo "Congratulations! You entered \"cat\"." | |
break | |
fi |
"""A simple recipe for baked squash, delicious.""" | |
# gather ingredients | |
squash = "🎃" | |
spices = ["coriander", "ginger", "black pepper", "allspice"] | |
veggies = ["much garlic", "onion"] | |
marinade_bases = ["olive oil", "maple syrup"] | |
# prepare the marinade |
// #todo | |
'use strict'; | |
// NaN is a strange thing in JavaScript | |
// if you are not careful about types in your programs ... | |
// ... NaN will come to get you! | |
console.log('--- Comparing with ==='); |
"use strict"; | |
/* | |
similar looking code with substantially different notional machines | |
a student will want to study the "cooler" one (DOM, API calls, ...) | |
without recognizing the extra orders of magnitude in complexity | |
they may be able to make the code work, but missed nuance below the surface | |
seen with a strong JS notional machine these programs are very different | |
*/ |
export const log = (thing) => (console.log(thing), thing); |
import { addNumberEvent } from './custom-event.js'; | |
/** | |
* Returns a number input with your initial value set. | |
* | |
* @param {number} initialValue - The initial value for this input. | |
* @returns {HTMLInputElement} - The rendered input element. | |
* @fires CustomEvent#addNumber | |
*/ | |
export const numberInputComponent = (initialValue = 0) => { |
'use strict';
let thing = 'dog';
console.log(thing);
thing = 'cat';
// - I disappear and leave you | |
// - you didn’t disappear | |
// - well, i did and than appeared again. the void does not accept me, sir | |
console.assert(void 'me', 'the void accepts me'); |