LOGBOOK

HELP

1 / 333
time's up — finish this card
Other keys: showSpace: good1-4: rate0: skip5: flag
Topic User Sessions

Question

What is the difference between authentication and authorization?

Answer

Authentication verifies who you are, while authorization decides what you are allowed to access.

Authentication Authorization
"Are you who you claim to be?" "Are you allowed to do this?"
Verify identity (password) Check permissions
Happens at login Happens on each request
Sets session.user Checks session.user permissions

Example: Logging in authenticates you. Accessing your own profile (but not others') is authorization.

or press any other key
Topic Introduction to JavaScript

Question

How do you debug JavaScript using the browser console?

Answer

You print values with console.log(...), which appear in the Console tab of the browser's developer tools (opened with F12).

The simplest way to see what your code is doing is to make it tell you. console.log() writes whatever you pass it to the browser's developer console — an invisible-by-default panel where script output and errors show up:

console.log("Das Ergebnis: " + "Hello" + " " + "World");
// Output: Das Ergebnis: Hello World

To see this output:

  • Press F12 to open the browser's developer tools.
  • Click the Console tab.

console.log isn't the only method. Others make output stand out or display data nicely:

  • console.error() — prints an error message (usually red)
  • console.warn() — prints a warning (usually yellow)
  • console.table() — shows an array or object as a readable table

Sprinkling console.log calls through your code to check variable values and trace the flow of execution is the everyday, no-setup-required way to debug — and the console doubles as a scratchpad where you can type and test snippets live.

or press any other key