syntax errors; how to find

M

mk834tt

Beginner here.

Here is the function correctly written:

function countKids() {
var body = document.body;
var kids = body.childNodes;
var lengthis = kids.length;
alert("nodes in body = " + lengthis);
}

Here is the way I constructed it.

function countKids() {
var body = document.body;
var kids = body.childNodes var lengthis = kids.length;
alert("nodes in body = " + lengthis);
}

If I were using perl, for example, the parser would let me know
(usually)
what and where I did the damge. How do you find stuff like that in
an html file?

I tried the venkman debugger (Firefox/2.0.0.11, Venkman version
0.9.87.2) but it wouldn't
load the functions. The debugger always died in a internal debugger
script. How do you catch
these things. Isn't there a little parser that out there to check
syntax?

Thanks
 
M

Martin Honnen

Here is the way I constructed it.

function countKids() {
var body = document.body;
var kids = body.childNodes var lengthis = kids.length;
alert("nodes in body = " + lengthis);
}

If I were using perl, for example, the parser would let me know
(usually)
what and where I did the damge. How do you find stuff like that in
an html file?

I tried the venkman debugger (Firefox/2.0.0.11, Venkman version
0.9.87.2) but it wouldn't
load the functions.

Check the Firefox error console, it should display an error alike

Error: missing ; before statement
Source File: http://example.com/file.html
Source Code:
var kids = body.childNodes var lengthis = kids.length;

and indicate the position.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top