/* JS DOCUMENTATION */ // Variable types // old var = dynamic in nature(values can change) // new let = dynamic in nature(values can change) const = constant values let mySky = "blue"; const myNumber = 1234567890; // DATA types Numbers: 1234; Text(string): "hello"; Boolean: true or false; Arrays: ["car", "house", "cat"]; let lightsOn = true; function makePizza() { // making pizza alert("Making Pizza..."); } // calls the function makePizza(); function displayWeather(weatherData) { console.log("the current weather is: " + weatherData) } displayWeather("sunny"); //Events let myShoe = document.getElementById("shoe"); myShoe.addEventListener("click", function () { myShoe.style.rotate = "3deg"; console.log("tilting the shoe..."); }) // Logging console.log("Hello Console - App is starting...") console.log(myNumber) // this will output 1234567890 console.log("my student number: " + myNumber) // + to concatenate in JS // this will output: my student number: 1234567890 /* For loops */ const myObjects = document.querySelectorAll(".box"); // square brackets on the myObjects variable (array) enable the targetting of the index number, starting at 0 // myObjects[2].addEventListener("click", myClickFunction) for (let i = 0; i > myObjects.length; i++) { // do stuff } myObjects.forEach(function (item, index, array) { // do stuff item.addEventListener("click", myClickFunction); })