Learning JavaScript - what should you know beforehand?

My wife is looking into learning JavaScript for her job, so she can start doing web development, and so that she’s generally more valuable a commodity. Some questions:

  • First of all, what’s JavaScript like? I’ve heard people compare it to HTML (which my wife knows), but I’ve looked at some of the code, and it looks a lot like more traditional programming languages to me. Is it closer to HTML, or closer to, say, C?

  • My wife has the options of either taking a few short 2- and 3-day courses, or possibly looking into a more rigorous curriculum that offers certification. Is certification important if she’s looking to beef up her value as an employee (and, by extension, her resume), or is it more important that she just know what she’s doing? Would going the route of the few short courses give her a large enough knowledge base to make her an effective JavaScript coder, or would it be pretty paltry?

  • Anything else somebody should know before they tackle JavaScript?
    Jeff

Jscript and C are nearly indistiguishable syntactically. Jscript bears no resemblance at all to HTML. In fact, the hardest part is getting to two to work together, usually as a call to a function in an onClick() or onLoad() event.

Much closer to C. If she can get used to the Java naming convention (thisIsTheOneThatIMean), it should be smooth sailing. It’s not a hard language and all the docs are online and searchable.

I’d go with the short courses. JavaScript isn’t very complicated, she should be fine with a short intro and a good reference book.

I’ve had recruiters set up online testing for me a number of times ( almost always through Brain Bench ) so this is the only JavaScript certification I’m aware of. Your wife can take these on her own if she wants and just point people to her scores if they ask.

Heh, I always liked that naming convention. The other artists I work with don’t seem to get it, but the programmers all do, and I seem to get more respect from them. :slight_smile:
Jeff

Oh, don’t get me wrong, I prefer it too…but then Java was my first procedural language so I’ve never had to relearn anything. It gives all my C hacker friends fits; seems it’s been years since they’ve needed capital letters :wink:

One annoying thing about JavaScript is trying to debug it.
Also, it took some getting used to (at least for me) that JavaScript has no “go to” command.
Sources, I’ve used include the book “JavaScript - a Definitive Guide” by David Flanagan - (part of the O’Reilly series). The book seems excessively wordy and uses expressions that are 100% authentic computer bulls**t. (JavaScript is an object-oriented language, etc. That’s supposed to help you learn how to program?)
There are many online tutorials that I’ve also found helpful.
I know this posting may seem a little bitter but I’ve been contending with JavaScript for as long as I’ve had my website. www.1728.com
Please excuse the “shameless plug” but thought I’d just show that I do know JavaScript. However, I find that as a programming language, it is something less than spectacular.

I have done a fair amount of JavaScript development. The main problem I had was supporting multiple browsers and multiple versions of browsers. Seems like IE is the browser of choice these days, but even IE varies from version to version on what JavaScript features are supported and how you interface with those features. See, the JavaScript interpreter is “inside” the browser. So if you are lucky enough to need to only support one version of one browser, then your JavaScript experience may not be too bad. Also, whenever I set out on a new JavaScript development, I would always take a day or so looking through the achieves online for a free copy of something close to what I needed. Good luck.

Know how HTML pages work. Know the DOM well. Know what properties each object on a web page has. A lot of this stuff you pick up along the way.

Saying ‘Javascript is easy’ is like saying learning to write well is easy because there are only 26 letters in the alphabet.

JavaScript (not to be confused with Java, a totally different language) is a full-fledged language that allows you to write code as simple or as complex as you want.

I vote for her taking a comprehensive course. It’s one thing to learn enough Javascript to be able to write a four-line onclick() event handler to launch a url. That’s easy. But if she wants to be a full-fledged web developer, she needs to learn to program. That means learning how to design maintainable, readable code. An introduction to object oriented design would be useful, even though it takes some work to write objects in Javascript. There is a LOT of really, really bad Javascript out there.

A lot depends on what kinds of web development she’s doing. I build HTML/Javascript GUIs for applications, which means a lot of event driven stuff, large dynamic tables, multi-page forms handling, client/server parameter passing in hidden frames, etc. Doing it right is not easy, especially if you want it to perform well.

What IS easy about Javascript is the ‘plumbing’. Writing ‘hello world’ in ‘C’ under windows requires a lot of boilerplate code, an understanding of the OS, a compiler, .mak files, etc. ad nauseum. Writing the same thing in Javascript requires notepad and a browser.

This gives the illusion that Javascript is ‘easy’, but you can write bad code in Javascript just as easily as you can write bad code in ‘C’ or Java.

Java and JavaScript are not at all the same language. They are both object oriented languages and the both have Java in the name, but the similarity ends there. JavaScript code can be imbedded in an HTML document and your browser has an interpreter. Java has to be translated in to some sort of binary code and stored in a separate file. Java applets can be called from HTML, but require a separate file.

It is Java that is similar to C++, not JavaScript.

Ha! EXACTLY, great point. JavaScript is a tough language to learn and VERY tough to be great with it. It is riddled with crap like:
if (browser == NS){
then do this idiotic thing;
} else if (browser == IE) {
do this even more idiotic thing;
}

I gave up on this sh!t a LONG time ago. Server side scripting (PHP, ASP, etc) is FAR more useful in the long run.

I knew a handful of languages before i tried to learn javascript and spent more time in frustration camp than anywhere else. I can not recommend anyone learn this language–i wish it would disappear. :sour:

BTW, DrMatrix, Javascript is only weakly OO, relative to C++ and Java.

Heh. My friend is using CSS with PHP, and has found out that font sizes in style sheets mean totally different things to different browsers.

I think that pretty much any procedural programming language course would help someone pick up JavaScript.

Sure, but imagine this situation:

Write/test/debug two or more forms of a script to get it to work with NS and IE in numerous environments…

…or write ONE script to do everything along with a simple:

[PRE]
<HTML><HEAD>
<? if (browser == NS){ ?>
<link rel=“stylesheet” type=“text/css” href=" <? echo $NS_css ?> “>
<? else if (browser == IE){ ?>
<link rel=“stylesheet” type=“text/css” href=”<? echo $IE_css ?>">
</HEAD>…
[/PRE]

That is, if font size is crucial. Which it NEVER is because the user can change font size whenever s/he wants. So, i guess this follow up is pointless…

LOL Homercles, I can sure sympathize with your sentiments in that first posting.
Let’s suppose you have a routine that has a mis-matched number of braces - {} - you’ll get an error message “Object Expected”.

Fine. But let’s say in that same routine you have the correct number of braces, but you misspell a math function such as Math.pw (instead of Math.pow) you will get an error message “Object Expected”.

Okay that’s just dandy. Now in that same routine you forget to use the ‘eval’ or forget the proper syntax for ‘documnet…etc’ you get the error message “Object Expected”.

Wow those error messages are just a bottomless box of help aren’t they ?

Ah yes, Wolf, that bond that grows so strong from having spent so much time at camp together…frustration camp that is. :wink: :smiley:

If you want to debug Javascript, I recommend getting a script debugger. I use Visual Studio, which has a very good script debugger interface.

Mind you, I wouldn’t recommend buying Visual Studio for that. I already have to use it for C++ stuff. But I seem to recall that you can download Microsoft’s script debugger from their web site.

homercles: I sympathise with your dislike for Javascript - I spent an hour the other day trying to find a bug caused by wrong capitalization in an object name. Boy, was that annoying when I found it.

But sometimes you can’t get away with client-side scripting if you want to have a snappy, high performance user interface. The environment I program in allows the use of as many .jsp pages and servlets as I want, and it still seems that every HTML UI I write has hundreds of lines of Javascript.

Sam Stone
I did try using a JavaScript debugger some time ago but decided to say the Hell with it and just went back to the Notepad and browser method.
Incidentally, if you took 1 hour to find a bug in JavaScript didn’t your debugger tell you what the problem was? OR did it offer the ever-helpful “object expected” ?

Whenever I have to debug my JavaScript, I’ve found Mozilla’s debugger (open the page, get an error, go to “javascript:” via the address bar) to be infinitely more useful than IE’s omnipresent “Object expected on line 1, character 1.”

As for the OP: ElJeffe, does your wife already know another language, how to take advantage of object-oriented ideas, etc., etc.? If she does, a couple of short courses in JS should be plenty. If she’s never done any real programming before, though, a longer study is probably in order.

LOL!!!

I remember working with a Pascal compiler many moons ago that would only say - Semicolon expected. No matter what type of compiler error you had actually caused by your source - Semicolon expected. For kicks we would try to compile random text files - Semicolon expected. LOL!!!

But anyways … about JavaScript debugging …

When all else fails, there is always the Java console display - alert().