- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript Programming Basics</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
JavaScript Programming Basics
JavaScript is a programming language for web pages. Here's an example of a simple function to add two numbers:
function sum(a, b) {
return a + b;
}
Let's use this function:
let result = sum(3, 5);
console.log(result);
The result will be 8. You can use arrays to store data, for example:
let numbers = [10, 20, 30];
Arrays make it easy to store and manipulate collections of data. For example, you can loop through the array elements:
for (let i = 0; i < numbers.length; i++) {
console.log(numbers[i]);
}
This will print all the numbers in the array.
</body>
</html>
CSS
body {
width: 500px;
margin: 0;
padding: 10px;
font-family: "Arial", sans-serif;
font-size: 16px;
line-height: 1.2;
}
- Goal
- Result
- Overlay
- Differences
- ?
Press Compare to send your code for review.