google_forms/assets/js/dummy.js

45 lines
955 B
JavaScript
Raw Normal View History

2024-08-12 08:52:09 +00:00
// Importing React (necessary if using JSX)
import React from "react";
2024-08-09 12:04:48 +00:00
2024-08-12 08:52:09 +00:00
// Example function using a regular function declaration
function multiply(x, y) {
return x * y;
2024-08-09 12:04:48 +00:00
}
2024-08-12 08:52:09 +00:00
// Example usage of a function
let result = multiply(4, 5);
console.log("The product is:", result); // Output: The product is: 20
2024-08-09 12:04:48 +00:00
2024-08-12 08:52:09 +00:00
// Example of a variable declared with let
let count = 0;
for (let i = 0; i < 5; i++) {
count += i;
2024-08-09 12:04:48 +00:00
}
2024-08-12 08:52:09 +00:00
console.log("The count is:", count); // Output: The count is: 10
2024-08-09 12:04:48 +00:00
2024-08-12 08:52:09 +00:00
// Example of a variable declared with let (instead of const)
let message = "This is a message";
console.log(message);
2024-08-09 12:04:48 +00:00
2024-08-12 08:52:09 +00:00
// Example of a React functional component
function Greeting({ name }) {
return (
<div>
<h1>Hello, {name}!</h1>
</div>
);
2024-08-09 12:04:48 +00:00
}
2024-08-12 08:52:09 +00:00
// Usage of the Greeting component
function App() {
return (
<div>
<Greeting name="Alice" />
</div>
);
2024-08-09 12:04:48 +00:00
}
2024-08-12 08:52:09 +00:00
// Export the App component for usage in other parts of the application
export default App;