-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Example JavaScript file for minification testing | ||
|
||
// Function to add two numbers | ||
function addNumbers(a, b) { | ||
return a + b; | ||
} | ||
|
||
// Function to subtract two numbers | ||
function subtractNumbers(a, b) { | ||
return a - b; | ||
} | ||
|
||
// Using a template string and a variable | ||
const name = "GitHub Actions"; | ||
console.log(`Testing minification with ${name}!`); | ||
|
||
// An array of numbers | ||
const numbers = [1, 2, 3, 4, 5]; | ||
|
||
// Using map to create a new array | ||
const doubledNumbers = numbers.map((number) => number * 2); | ||
console.log(doubledNumbers); | ||
|
||
// Object with methods | ||
const calculator = { | ||
add: (x, y) => x + y, | ||
subtract: (x, y) => x - y, | ||
multiply: (x, y) => x * y, | ||
divide: (x, y) => x / y, | ||
}; | ||
|
||
// Using the calculator object | ||
console.log(calculator.add(5, 7)); | ||
console.log(calculator.subtract(10, 5)); | ||
|
||
// Testing async function | ||
async function fetchData(url) { | ||
try { | ||
const response = await fetch(url); | ||
const data = await response.json(); | ||
console.log(data); | ||
} catch (error) { | ||
console.error("Error fetching data:", error); | ||
} | ||
} | ||
|
||
// Invoking async function (this will fail without a valid URL or in a non-browser environment) | ||
fetchData("https://api.github.com/repos/nizarmah/auto-minify"); | ||
|
||
// End of file |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.