Web Cartography More JavaScript Learn the basics of JavaScript. Goals Exercise let sentence = “I’m a 1000 years old”; ● turn sentence into an array ● find the only numeric item (don’t use array indices) ● subtract any number you want from the item found ● turn the array back to a string Logical operators let age = 20; let isMale = true; let isAdultMale = age > 18 && isMale; let isAdultOrFemale = age > 18 || !isMale; BOM Collection of objects accessible inside any browser window Browser dependent Most important (to us): window, document (DOM) DOM https://devdocs.io/dom/document Interface representing any web page loaded in the browser Functionality global to the document Exercise Count all the
s in the web page you’ve made Find one element by its ID and try to change its color Choose a part of your web page and remove it from DOM Create a new DOM Element and append it to the Events https://devdocs.io/dom_events/ Notify code that something has happened Events const form = document.getElementById(“login”); form.addEventListener(“submit”, function(e) { alert(“The form was submitted!”); }); Exercise Try to console.log all the values submitted by your
Try to write something to an empty input/append to the Add interaction to your Tasks JavaScript Intro at https://javascript.info Tips anytime, anywhere, anyhow zimmicz@gmail.com 357484@mail.muni.cz @zimmicz Feel free to ask