Apply for the next session

Lesson Intro

Forms are a bit easier to build in JS than in PHP… but they still require more working knowledge than you have. Until then, we can use these browser-based dialog box things.

It’s probably the fastest way to get user input – out of all of the programming languages.

The Goals

  1. Master alert, confirm, and prompt

    A few solid sittings should burn these into your brain.

  2. Start thinking more about functions

    What are they. What are they good for? When can you use them?

  3. Get a little more practice with control flow

    You should have this if/else stuff down pretty good by now, but – these dialogs will reveal many uses for control flow.

Key
concept

Dialog box

https://en.wikipedia.org/wiki/Dialog_box


In our case, this is a browser-specific dialog box. But surely you’ve seen your MacOS dialogs that prompt you for passwords and tell you to brush your teeth and do your homework.

It’s a very general term. It’s a “conversation.” You are having a dialog / in a box!

Recap

Can you explain everything that is happening here in detail? If not – then work it out: today!

Top down

These directions are just floating out there in the global space. They will be read top-down – just like PHP (for the most part).

An encapsulated program

Functions can be defined (designed) – and then used whenever and wherever – and as many times as you want / at any time – while the page is loaded.

Sometimes you use them to just run some code. They can almost be used like a partial. Just a set of instructions.

Return values

Dialogs

Does this make sense? If not — you haven’t practiced enough.

Browser dialogs

They look a little different in each browser.

Alert

Just has the “OK.”

What does it return?

Confirm

Basically a “yes” and “no.”

What does it return?

Prompt

Now you have the “OK” and “Cancel” – but also a text input.

What does it return?

What can you put in there?

Today's Exercises:

  1. Watch/follow along with the video

    This will be enough to get your feet wet, but of course, you’ll need lots more practice.

    60 minutes suggested
  2. Write out the pseudo code for each of the first 10 exercises for programmers

    If you’ve already done this, then – do it again. Start over. Write out the human-readable steps. (just do the basic exercise – and not the challenges)

    ? minutes suggested
  3. Write the code for the first 10 exercises for programmers

    Set the timer. Stick to the most basic exercise requirements. You either accomplish them or you don’t. Get as many done as time allows. Post the code for all of them.

    60 minutes suggested

Optional reading


No!

Keep practicing today’s lesson.

Do it AGAIN!!!

and then again… until you are so bored – and fast / that you come up with an idea.

Apply for the next session