codex-lv2-may-2025

Level Navigation: 1 2 3 4 5 6 7 8 9 10 11 12 13 Current Level: 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32


đź§Ş Level 14: Create Function

What You’ll Do

Create the function that will call the AI model.

Instructions

Create a function (e.g., sendToModel()). Inside, log "sendToModel called" to confirm it runs.

đź’ˇ Code Hints

Creating functions? You’ll need to define a function that you can call later. Check out the Functions section in SNIPPETS.md for function creation examples.

âś… Check

  1. Open your webpage in a browser
  2. Open Chrome DevTools (F12) and go to the Console tab
  3. Type sendToModel() and press Enter
  4. You should see “sendToModel called” appear in the Console
  5. If you get an error like “sendToModel is not defined”, check that you created the function in your chatbot.js file
  6. Make sure the function is properly defined with function sendToModel() { ... }

Next: Level 15 - Add Hugging Face API



Level Navigation: 1 2 3 4 5 6 7 8 9 10 11 12 13 Current Level: 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32