This is an old revision of the document!
Introduction to JavaScript Workshop
hello world
Are you feeling like this about programming?
We'll do this today.
At the end of this hour, you;ll feel like this!
This webpage can be found at this QR code, or go to my website and search javascript-workshop.
console.log('hello world!')
calculator
mess with images on a webpage
function replaceImagesWithUrl(url) { // Get all img elements in the document var images = document.getElementsByTagName('img'); // Convert images NodeList to an array and iterate using forEach Array.from(images).forEach(function(img) { // Replace the src attribute with the provided URL img.src = url; }); }
mess with text on a webpage
function replaceSpanText(newText) { // Get all span elements in the document var spans = document.getElementsByTagName('span'); // Convert NodeList to an array and iterate using forEach Array.from(spans).forEach(function(span) { // Replace the text content of the span with the provided new text (string span.textContent = newText; }); }
p5js
term dump
( ) parentheses, brackets { } curly brackets, curly braces ' ' single quotes " " double quotes , comma . period, dot - dash, hyphen _ underscore / slash \ backslash argument = the input to a function call a function = use a function, make it do what it's intended to do put the argument between the parentheses when you call a function declare a function return = the value that a function returns or gives back when it is called string = text data which is determined by a pair of quotes, single or double variable = a box with a name in which we can store things