• in
InterCourses
CoursesBlogs
0
← Introduction to JavaScript
●What is JavaScript?○Your First JavaScript Code○Data Types○Type Checking○Inspect Values in the Console○Inspect the Queue Report○Trace a Faulty Calculation○Repair the Score Calculation✦Module Quiz
○Declaring Variables○let and const in Practice○Operators○Type Conversion○Group and Convert Expense Inputs○Calculate the Event Expense Total○Track a Changing Points Tally○Adjust a Ticket Price✦Module Quiz
○Conditionals○Demo: Combined Conditions Before FizzBuzz○Challenge: FizzBuzz Announcer○Switch Statement○Demo: Switch a Venue Sign○Challenge: Power Loadout○For Loops○While Loop○Break and Continue○Demo: Stop a Ticket Scan○Challenge: Number Guess Referee○Demo: Rainfall Routing Walkthrough○Exercise: Score Batch Report✦Module Quiz
○Defining Functions○Arrow Functions○Scope○Closures○Project - Calculator○Function Expressions○Demo: Ticket Pricing Walkthrough○Exercise: Shipping Labels with Defaults○Demo: Seat Ledger Closure Walkthrough○Exercise: Private Budget Ledger✦Module Quiz
○Arrays○Demo: Student Scoreboard○Challenge: Student Course Scoreboard○Array Mutation Methods○Array Slice and Concat○Array Iteration Methods○Multidimensional Arrays○Destructuring○Array Reverse and Sort○Array Fill○Array Find and Includes○Array Flat and FlatMap○Array Reduce, Some, and Every○Demo: Charging Rack Restock Report○Exercise: Pantry Restock Plan✦Module Quiz
○Object Key-Value Pairs○Student Course Record○Object Methods and Destructuring○Map and Set Collections○Playlist Lookup○Number and BigInt Boundaries○Ticket Ledger○JSON○Math and Date○Date Basics○Demo: Supply Bin Audit○Exercise: Volunteer Shift Audit○Demo: Workshop Attendance Feed○Exercise: Parcel Scan Feed✦Module Quiz
○String Methods○Template Literals○Regular Expressions○Demo: Build a Reminder with Template Literals○Exercise: Format Pantry Pickup Messages○Demo: Validate a Time Slot with Regex○Exercise: Validate Storage Shelf Labels✦Module Quiz
○Higher-Order Functions○Callbacks○map, filter, and reduce○Demo: Student Register with map○Challenge: Student Register○Recursion○Project - Data Transform Pipeline○Demo: Handle an Error-First Callback○Exercise: Report Seat Reservation Results○Demo: Summarize Completed Bike Rides○Exercise: Summarize Delivered Parcels✦Module Quiz
○Demo: A notebook object○OOP Introduction○Demo: Independent workshop passes○Classes○Demo: An inherited notice○Inheritance○Demo: A private seat counter○Encapsulation○Demo: Equipment desk checkout○Project: Library Checkout✦Module Quiz
○Demo: Callback Timing○Exercise: Asynchronous JavaScript○Demo: Promise Rehearsal○Exercise: Promises and Async Await○Demo: Offline API Coordination○Exercise: Async API Simulation○Demo: Partial Results Bulletin○Project: Resilient Awards Feed○Demo: Retry a Local Delivery○Project: Reliable Score Delivery✦Module Quiz

What is JavaScript?

Mission: Signal Launch

The Starline Awards scoreboard starts as a static page. In this one bridge lesson, connect index.html to script.js and show a calculated result in the page. The remaining lessons in these sections use only script.js and the Console.

Run the starter and watch the paragraph in the preview. It is empty until your script writes the message and number into #output.

JavaScript runs in the browser and powers the interactive parts of the web. This first coding lesson keeps the idea simple: store a message, calculate a number, and show both on the page.

HTML, CSS, and JavaScript have different jobs

  • HTML gives the page its structure and content.
  • CSS controls the visual presentation.
  • JavaScript calculates, decides, and responds to input. This first lesson writes a result into the page only so you can see how the two files connect.

Include JavaScript from HTML

index.html contains the page shell and includes this line near the end of <body>:

html
<script src="script.js"></script>

That src value is the filename. The browser reads index.html, reaches the script tag, and then runs script.js. Both tabs are visible in this one lesson because the connection is the topic. From the next lesson onward, the missions use script.js and the Console only.

Example

const gives a value a name. In the last line, ${...} inserts a value into the backtick-delimited message. The Console displays the result; the starter's document.getElementById("output").textContent displays it on the page instead. You will study these tools in more detail later.

javascript
const notice = "Exhibit open";
const visitors = 4 * 6 - 1;
console.log(`${notice}: ${visitors}`);

Your Task

  1. Set introMessage to "JavaScript rocks!"; the provided probe will log message: JavaScript rocks!.
  2. Calculate introNumber as (5 * 3) + 2; the provided probe will log number: 17.
  3. Show JavaScript rocks! | 17 in #output using both values.
Hint 1
1 / 2
HINT 1

Store text in introMessage and the calculation result in introNumber.

HINT 2

Use document.getElementById('output') to show the final summary.

Loading editor…
Press Run to execute your code.
READY
intercourses
javascript