This is an old revision of the document!
Introduction to JavaScript Workshop
hello world
https://www.memecreator.org/static/images/memes/4349871.jpg
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; }); }