جواب «Step 1: Five Checked Questions» چالش 1 از جلسهی 12
سؤال
آرایهی questions خالی است. پنج سؤال دربارهی هوش مصنوعی امن در آن بگذار؛ هر سؤال یک شیء با q، options (دقیقاً سه گزینه) و answer (شمارهی گزینهی درست از صفر). بعد کاری کن که کلیک روی #start در #score بنویسد 5 questions (با questions.length).
راهنما
{ q: "Can AI make up facts?", options: ["Yes", "No", "Only on Fridays"], answer: 0 }, و پنج تا از اینها. بعد document.getElementById("start").onclick = function () { ... }.
یک جواب درست
<h1>Know Your AI</h1>
<p id="question">Press Start!</p>
<div id="answers"></div>
<p id="score"></p>
<button id="start">Start</button>
<script>
const questions = [
{ q: "Can an AI chat bot make up facts?", options: ["Yes", "No", "Only on Fridays"], answer: 0 },
{ q: "Should you tell a chat bot your password?", options: ["Yes", "Only if it asks nicely", "Never"], answer: 2 },
{ q: "What is a deepfake?", options: ["A fake photo or voice made by AI", "A deep pool", "A kind of fish"], answer: 0 },
{ q: "Who should check what an AI says?", options: ["Nobody", "You, with a book or a teacher", "Another AI only"], answer: 1 },
{ q: "Using AI for homework is honest when...", options: ["You hide it", "It teaches you and you say so", "It writes everything"], answer: 1 },
];
document.getElementById("start").onclick = function () {
document.getElementById("score").textContent = questions.length + " questions";
};
</script>
<style>
body { font-family: sans-serif; padding: 16px; }
#answers { display: flex; flex-wrap: wrap; gap: 8px; }
button { min-height: 40px; padding: 8px 14px; font-size: 16px; }
</style>
اول خودت امتحان کن؛ جوابهای دیگر هم قبول است. برگرد و خودت حلش کن