1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Javascript Tutorial

Discussion in 'JavaScript' started by Rian, Oct 18, 2008.

  1. #1
    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
     
    Rian, Oct 18, 2008 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    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.

    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
     
    dimitar christoff, Oct 18, 2008 IP
  3. coloriteman

    coloriteman Peon

    Messages:
    669
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks rian for the site ...really useful tools
     
    coloriteman, Oct 19, 2008 IP