0
0
Javascriptprogramming~5 mins

Writing first JavaScript program - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Writing first JavaScript program
Start Program
Write code: console.log('Hello, world!')
Run code in browser or Node.js
JavaScript engine executes code
Output appears on console: Hello, world!
Program ends
The program starts, runs the console.log statement, prints the message, then ends.
Execution Sample
Javascript
console.log('Hello, world!');
Prints the text 'Hello, world!' to the console.
Execution Table
StepActionCode ExecutedOutput
1Start program
2Execute console.logconsole.log('Hello, world!');Hello, world!
3Program ends
💡 Program ends after printing the message.
Variable Tracker
VariableStartAfter Step 2Final
No variables---
Key Moments - 2 Insights
Why do we use console.log in this program?
console.log is used to show messages on the console. In the execution_table row 2, it prints 'Hello, world!' so we can see output.
Does this program change or store any data?
No, this program only prints a message. The variable_tracker shows no variables are created or changed.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is printed at step 2?
ANothing is printed
BGoodbye!
CHello, world!
DAn error message
💡 Hint
Check the Output column in execution_table row 2.
At which step does the program end?
AStep 3
BStep 1
CStep 2
DThere is no end
💡 Hint
Look at the Action column and exit_note in execution_table.
If we change the text inside console.log to 'Hi!', what changes in the execution_table?
AStep 2 action changes to something else
BOutput at step 2 changes to Hi!
CProgram ends earlier
DNo changes at all
💡 Hint
Focus on the Output column in execution_table row 2.
Concept Snapshot
JavaScript programs run code line by line.
Use console.log('text') to print messages.
The message appears in the console.
No variables needed for simple output.
Program ends after last line runs.
Full Transcript
This program shows how to write your first JavaScript code. It uses console.log to print 'Hello, world!' on the console. The execution flow starts the program, runs the console.log command, prints the message, then ends. No variables are created or changed. This is the simplest way to see output in JavaScript.