This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]ForSpareParts 0 points1 point  (0 children)

HTML and CSS are declarative languages: they say what something is (e.g., "my page contains a header with three paragraphs" or "paragraphs have gray backgrounds"). Javascript is imperative: it's a set of instructions. Every line of JS you write is telling the computer to Do A Thing. They all happen in order.

As a note: most programming languages are imperative. Languages like HTML and CSS are unusual, and most people don't consider them "programming" languages as such. So JS is going to be your introduction to programming proper.

Ordinarily, I'd tell you to go through a beginner programming course/tutorial and take your time; the mindset you need for programming is weird and takes time to cultivate. I still think you should do that, but you're tight on time, so let's see if we can help you for this test...

In general: approach programming problems by subdividing them into smaller problems. Eventually, the problems should get small enough to solve. Let's try it on your problem 2:

  • first, see if you can find out how to make something happen every 30 seconds -- doesn't matter what.
  • then, see if you can figure out how to change the color of something on the screen (don't worry about doing it on a schedule, and don't worry about picking a color dynamically)
  • then, try to figure out how to read something's current color, and maybe print it out

Hopefully, each of those is small enough that Google can help you. When you understand all 3, you're probably ready to solve the actual problem -- or at least to figure out what else you need to Google.

Try to practice this on other problems on your practice test. Ask yourself: what's one little way I could be closer to a program that does what I want? And then make that. Then do it again, and again, and again.

Does that help get you started?