this repo has no description
at main 100 lines 2.4 kB view raw
1function my_function() { 2 let firstName = prompt("What is your first name?"); 3 let lastName = prompt("What is your last name?"); 4 let fullName = firstName + " " + lastName; 5 console.log(firstName, lastName); 6 7 let userConfirmed = confirm( 8 "Hello! " + fullName + " Welcome to CSCI4410/5410! Click OK to continue.", 9 ); 10 11 if (userConfirmed) { 12 alert("You clicked OK! Enjoy the course."); 13 console.log(fullName + " has joined the course."); 14 } else { 15 alert("You clicked Cancel. Let us know if you need help."); 16 console.log(fullName + " declined to continue."); 17 } 18} 19 20function scream() { 21 alert("HELP ME HAADHKDJAFHSDKFJHSDKJF"); 22} 23 24function showAlert() { 25 alert("hello?"); 26} 27 28document.getElementById("text").addEventListener("click", showAlert); 29 30let title = document.querySelector("#mytitle"); 31console.log(title.innerHTML); 32 33let box = document.querySelector(".box"); 34console.log(box.innerHTML); 35 36let firstParagraph = document.querySelector("p"); 37console.log(firstParagraph.innerHTML); 38 39let firstItem = document.querySelector("ul li"); 40console.log(firstItem.innerHTML); 41 42document.getElementById("title1").innerHTML = "asdfwow"; 43 44function changeText() { 45 let elements = document.querySelectorAll("#title1, #title2, #title3"); 46 47 elements.forEach((element) => { 48 element.innerHTML = "xd"; 49 element.style.color = "blue"; 50 }); 51} 52 53document.getElementById("btn").addEventListener("click", changeText); 54 55let cars = ["Nissan", "BMW"]; 56document.getElementById("demo").innerText = cars; 57console.log(cars); 58 59cars.push("Toyota"); 60document.getElementById("demo").innerText = cars; 61console.log(cars); 62 63cars.shift(); 64document.getElementById("demo").innerText = cars; 65console.log(cars); 66 67cars.unshift("Nissan"); 68document.getElementById("demo").innerText = cars; 69console.log(cars); 70 71cars.forEach((car) => { 72 console.log(car); 73}); 74 75for (const car of cars) { 76 console.log(car); 77} 78 79let text = "<ul>"; 80for (const car of cars) { 81 text += `<li>${car}</li>`; 82} 83text += "</ul>"; 84 85document.getElementById("demo").innerHTML = text; 86 87const person = { 88 firstName: "matt", 89 lastName: "morris", 90 age: "20", 91 isStudent: true, 92 93 printInfo: function() { 94 return `hello ${this.firstName} ${this.lastName} who is ${this.age} years old wow!` 95 } 96} 97 98console.log(person.printInfo()) 99 100document.getElementById("demo3").innerText = person.printInfo();