Module 1 — Introduction to JavaScript
MODULE 1 — INTRODUCTION TO JAVASCRIPT
Welcome to Module 1
Welcome to JavaScript for Cybersecurity at Cyberpedia Coding Academy.
JavaScript is one of the most widely used programming languages, especially for websites and web applications. For cybersecurity professionals, understanding JavaScript is valuable because many modern applications rely on it.
In this module, you’ll learn the basics of JavaScript and write your first programs.
Section 1 — What Is JavaScript?
JavaScript is a programming language used to make websites and applications interactive and dynamic.
- HTML: Structures a webpage.
- CSS: Controls appearance.
- JavaScript: Controls behavior and interaction.
JavaScript can also be used outside the browser with environments such as Node.js, which we’ll explore later.
Section 2 — JavaScript & Cybersecurity
Cybersecurity professionals encounter JavaScript when working with:
- Websites
- Web applications
- Login systems
- Forms
- APIs
- Browser-based applications
Learning JavaScript helps security professionals understand how web applications process information and how security controls are implemented.
Section 3 — Your First JavaScript Program
One of the simplest JavaScript commands is:
console.log("Hello Cyberpedia!");Output:
Hello Cyberpedia!console.log() is commonly used to display information while developing and testing programs.
Section 4 — Using console.log()
Displaying text:
console.log("Welcome to Cyberpedia");Displaying numbers:
console.log(100);Displaying multiple messages:
console.log("Cybersecurity");
console.log("JavaScript");
console.log("Cyberpedia");Section 5 — Comments
Comments allow programmers to leave notes inside their code. JavaScript ignores comments when running the program.
Single-line comment:
// This is a comment
console.log("Hello");Multi-line comment:
/*
This is a
multi-line comment
*/
console.log("Hello");Comments are useful for explaining code and making programs easier to understand.
Section 6 — Basic JavaScript Syntax
JavaScript has rules for how code is written.
console.log("Hello");Here:
consolerefers to the console object..log()calls the logging method."Hello"is the text being displayed.
Strings: Text is written inside quotation marks.
"Cyberpedia"Numbers: Numbers can be written without quotation marks.
25Section 7 — Common Beginner Errors
1. Missing quotation marks
Incorrect:
console.log(Hello);Correct:
console.log("Hello");2. Misspelling console.log
Incorrect:
console.lo("Hello");Correct:
console.log("Hello");3. Missing parentheses
Incorrect:
console.log "Hello";Correct:
console.log("Hello");Small syntax errors can prevent your program from running correctly.
Module 1 Summary
In this module, you learned:
- What JavaScript is
- Where JavaScript is used
- Why JavaScript matters in cybersecurity
- How to use console.log()
- How to write comments
- Basic JavaScript syntax
- Common beginner errors
You’ll use these fundamentals throughout the rest of the course.
Project — Your First Javascript Program
Objective
Create a JavaScript program that displays the following three lines:
Requirements
Welcome to Cyberpedia Coding Academy!
JavaScript for Cybersecurity
Your journey starts here.Requirements
- Use
console.log()for each line. - Write each message as a separate statement.
Answer KeyClick to view the step-by-step solution.
Solution Code
console.log("Welcome to Cyberpedia Coding Academy!");
console.log("JavaScript for Cybersecurity");
console.log("Your journey starts here.");Output
Welcome to Cyberpedia Coding Academy! JavaScript for Cybersecurity Your journey starts here.
MODULE 1 COMPLETE
Congratulations! You’ve completed Module 1 — Introduction to JavaScript.
Next Module: Module 2 — Variables & Data Types
You’ll learn how JavaScript stores and works with information using let, const, strings, numbers, booleans, null, undefined, and typeof.