Beginner15 minutesJavaScriptDOM

Hello World App

Project Overview

Create a simple interactive greeting application that demonstrates these JavaScript concepts:

  • Getting user input with prompt()
  • Storing values in variables
  • Manipulating the DOM to display messages
  • Handling button clicks with event listeners

What You'll Build

A simple web app that:

  • Asks for the user's name
  • Displays a personalized greeting
  • Changes the greeting when a button is clicked
  • Updates text colors dynamically

Step-by-Step Instructions

1. Create Your HTML Structure

Create a new file called index.html with this structure:

2. Add Your JavaScript

Create a file called script.js and add this code:

3. Style Your App

Create a file called styles.css and add these styles:

Challenge Yourself!

Once you have the basic app working, try these enhancements:

  • Add a button to change the background color
  • Add an input field instead of using prompt()
  • Display the current time with the greeting
  • Add different greetings for different times of day

Pro Tips:

  • Use console.log() to debug your code
  • Try different string concatenation methods
  • Experiment with different DOM methods like querySelector
  • Practice using template literals for strings