Course: BSCS/BSIS-Software Engineering/Programming Duration: 1 hour
Learning Objectives
- Declare and use JavaScript variables and functions.
- Manipulate HTML content using DOM APIs and events.
- Apply console-based debugging (console.log) to trace program flow.
- Deliver a working mini-app and submit clean, well-organized files.
Activity 1: Variables & Functions 15 minutes. Activity 2: DOM Manipulation-20 minutes Activity 3: Debugging & Enhancement - 15 minutes Submission & Reflection 5 minutes
Any modern browser (Chrome/Firefox/Edge). Text editor (VS Code recommended), Starter files or create from scratch (index.html, script.js). Stable internet (for documentation lookups if needed).
Work individually. Follow each activity and test your code in the browser console. Save your work frequently.
Create an HTML file and link a JS script. Declare variables name and age. Write a function greetUser(name, age) that returns a formatted string. Log the result.
index.html script.js
Hello, I am Ailen and I am 30 years old.
Add a button that changes the background color randomly when clicked. Alse display the chosen color in a paragraph element. index.html (add inside ) script.js (append): Expected behavior: Clicking the button changes the background and shows the hex code.
Use console.log to trace values before and after color change. Enhance logs to include a friendly message. script.js (append):
Expected console output example:
Push two files: lastname js lab.html and lastname_js_lab.js. Ensure Activity 1-3 code is present and runs in the browser without errors. Add a short note in the private comment: What did you learn or debug today? (1-2 sentences).