// HTML content as a JavaScript string
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quiz Questions</title>
<!-- Include your CSS or additional head elements here -->
</head>
<body>
`;
const apiKey = 'CtJG5HSMq7i1ggbhqnvc6n0x0iFnx9oWwZ6VFmcd';
const apiUrl = 'https://quizapi.io/api/v1/questions';
async function getQuizQuestions(category, difficulty, limit) {
const url = new URL(apiUrl);
url.searchParams.append('apiKey', apiKey);
url.searchParams.append('category', category);
url.searchParams.append('difficulty', difficulty);
url.searchParams.append('limit', limit);
try {
const response = await fetch(url.toString());
const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching quiz questions:', error);
return null;
}
}
// Example usage
const category = 'Linux';
const difficulty = 'Easy';
const limit = 5;
getQuizQuestions(category, difficulty, limit)
.then(questions => {
if (questions) {
console.log('Quiz Questions:', questions);
}
});