Credit Cards - Credit Report - Find jobs - Debt Consolidation - Credit Cards

PDA

View Full Version : Javascript Tutorial


Rian
Oct 18th 2008, 4:26 am
Hi Guys

I am busy compiling a tutorial on my website for newbies - learning how to code in Javascript.

I would like to have some comments from experts and newbies on what you think of the sections this far.

Is it easy to read and understand? Is it helpful?

I will appreciate any comments.

http://www.javascripts.co.za/javascript_tutorials.html

dimitar christoff
Oct 18th 2008, 12:33 pm
it's quite rudimentary - i suppose it makes sense for beginners...

however, even for illustration purposes, using document.write may teach them a bad habit - scripts that rely on this rather than writing via DOM are really not acceptable anymore.


Var arrayNumberone = new array (The number of elements);

i also learnt it from a tutorial like that a while back... careful with the V there...

but you should really declare an array like so:
var arrayName = []; // especially since you may not know how many elements it will have.

not sure on memory allocation here, though.

whereas:
var SecondArray = new Array (“Value One” , “Value Two” , “Value Three” , “Value Four” , “Value Five”);

...will work, you can just do:
var SecondArray = [“Value One” , “Value Two” , “Value Three” , “Value Four” , “Value Five”];

functions... its great that you've covered various ways of defining functions in javascript but the tutorial where you cover creating your own function, you have chosen to use:

function blah(params) {
}

it would have been so much better if when i started I had gotten my head around the fact that all a function has to be is variable definition. this way it can be a method of a class or whatever i need it to be...

i'd change to:
var blah = function(params) {
- and create a good habit for somebody from the start :)

anyway, don't have time for this in more depth now but it looks awesome--good work.

might i suggest you get some syntax highlighting script for the js blocks. Try CodeHighlighter (I use it on my blog and its pretty awesome) - you just do <pre><code class="javascript">blah</code></pre>

good luck

coloriteman
Oct 19th 2008, 11:57 am
Thanks rian for the site ...really useful tools