Viewing 31 posts - 1 through 31 (of 31 total)
  • 12 hours to learn Java Script
  • WorldClassAccident
    Free Member

    Please can you tell me the basics about Java Script. I used to be a programmer so can understand old coding languages (Informix 4gl anyone?).

    what’s new in Java Script? What are the key things I should understand.

    General hints to get me through a simple interview sounding like I know Java Script. I am iunlikely to be sat at a keyboard and be forced to prove my knowledge.

    trickydisco
    Free Member

    I don’t know a huge amount of javascript but i work with a lot of developers and understand the concepts

    I’d probably read up on unobtrusive methods, DOM manipulation and javascript frameworks such as jquery.

    geoffj
    Full Member

    1. Its in no way related to Java although some of the syntax is similar
    2. Its used primarily on the client-side of web applications
    3. It can be used for implementing Ajax functionality
    4. Its best left to spotty geeks who also understand XHTML, DOM, CSS…..

    simonfbarnes
    Free Member

    Many programmers look down on Javascript, but it’s a powerful language with some object orientation (and admittedly many unshakable design faults). It does allow you to write very scrappy code, and the scoping is odd. You can embed JS anywhere in your HTML (XML too), or put it in a separate include files, and you can attach JS functions to HTML objects to act on user events and page/image loading. Your JS code can be used for writing parts of the HTML in a page (including ITS JS 🙂 [though this is increasingly frowned upon], and in event handlers JS code has full access to the DOM (Document Object Model) so that it can modify the page (and its CSS) dynamically. Also JS can use various methods to access the server to update the page without reloading the whole thing (often referred to as AJAX [Asynchronous Javascript A? XML) – though in this case the XML bit is just as much misdirection as the ‘Java’ in Javascript, as JS has NOTHING to do with Java, and AJAX only nominally involves XML.

    simonfbarnes
    Free Member

    1. Its in no way related to Java although some of the syntax is similar

    I would be careful about this – there really is almost NO connection whatever, and any resemblance is coincidental.

    WorldClassAccident
    Free Member

    Okay, I am guessing that they will be asking me about tweaking existing JS that is used in a standard web based application for demo/POC set ups. This means the code doesn;t have to be industrial strength and probably relates to the way data is processed or the main system is connected to other systems.

    Good advice so far. Anything specific about connecting between systems or data handling?

    simonfbarnes
    Free Member

    Anything specific about connecting between systems or data handling?

    JS can do general purpose programming, but is entirely concerned with the page DOM. It has NO access to the local machine except through embedded ActiveX or Java objects. There is no implicit data handling beyond what the programmer creates.

    JulianA
    Free Member

    Not that hard a language.

    Try:

    http://www.w3schools.com/JS/default.asp
    http://www.4guysfromrolla.com/webtech/111599-1.shtml
    http://www.webteacher.com/javascript/index.html

    It looks like C# (and therefore by extension C / C++?)

    Loops:

    for (i = 0; i < x; i ++)
    {
    // code loop here
    }

    ‘while’ and ‘do’ loops are similar.

    ‘if’ statements:

    if (i == x)
    {
    // code for i is equal to x
    }
    else
    {
    // code for i is not equal to x
    }

    Note the ‘==’, otherwise (with a single ‘=’) you are assigning a value to i

    So, if you have a form element (probably in this case a text box) named ‘txtFirstName’ your code to make sure it contains a value would be something like:

    if (document.getElementByID(‘txtFirstName’).text == ”)
    (
    alert(‘First name is required’); // note double slash for the comment
    return false; // ‘return false’ to exit code
    }

    ‘alert’ puts up the (annoying) message! Yes, I know this doesn’t validate ‘ ‘ entries (ie, those with spaces entered) but they’re not hard to code around…

    Hope this helps – email me at vdub1992[at]hotmail[dot]com if you want some examples. I’m sure I can dig some out.

    My programming ‘lightbulb’ moment was when I realised that all languages do the same thing, they just say it differently! (With, I guess, some exceptions: ADA maybe?).

    Shoot me down if you want, STW massif, I’m just trying to recall some stuff!

    geoffj
    Full Member

    Good advice so far. Anything specific about connecting between systems or data handling?

    See my Ajax point above.

    JulianA
    Free Member

    Sorry, several posts happened whilst I was typing!

    Gilesey
    Free Member

    I’ve always thought of Javascript as pretty much front-end only i.e. web form validation or processing at the client (browser). System integration & data handling stuff would be done by the appserver or whatever framework’s in place behind the webserver.

    But then I seldom stray beyond the db, that’s where all the real action is…

    geoffj
    Full Member

    It looks like C# (and therefore by extension C / C++?)
    Chronology
    C
    C++ (actually a subset of C)
    C# (Microshafts answer to Java – JScript was their answer to JavaScript)

    But lets not confuse the issues 🙂

    molgrips
    Free Member

    http://www.w3schools.com is a good place to start.

    It really is a basic C++/Java style language – but the main thing is that in a browser it has access to everthing on the web page as an object. So you can give objects ie <div> elements an id and then access its attributes from your Javascript. That’s how you make say menus that drop down when you mouse over them – make the menus invisible, put an event handler on the menu title – onclick or whatever, i.e. < img src=”button.gif” /> and then in the dropMenu() function you make the menu appear.

    It’s pretty simple – however the code people write in it often isn’t.

    andywhit
    Free Member

    Extended chronology
    BCPL
    B
    C
    C++
    C#

    Sorry, what was that about not confusing things 😀

    JulianA
    Free Member

    Thanks for the chronology lesson guys! (particularly geoffj). Was aware of that, just doing it in reverse I guess!

    JulianA
    Free Member

    Good points, molgrips.

    MrNutt
    Free Member

    tell them Javascript is for chumps and that you work exclusively in binary and self compile!

    stratobiker
    Free Member

    What geoffj said, but especially point 2.

    SB

    IHN
    Full Member

    10 PRINT “Si is Cool”
    20 GOTO 10

    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool
    Si is Cool

    barrykellett
    Free Member

    One thing you need to know – ITS BLOODY CASE SENSITIVE

    RooleyMoor
    Free Member

    case sensitivity….. I’m discovering that at the moment with Perl.. grrrrr

    simonfbarnes
    Free Member

    ITS BLOODY CASE SENSITIVE

    yeah, so it’s document.getElementById() 🙂

    JulianA
    Free Member

    Sorry, typo there (getElementById)!

    SandyThePig
    Free Member

    With javascript you can include code that doesn’t originate from the url in the address bar.

    This can be considered a good and bad thing (Imagine a login screen with the login form loaded from http://allyourpasswordsarebelongtome.com).

    For accessibility purposes, the core functionality of any exotic javascript you write should still be available if you have javascript turned off.

    SandyThePig
    Free Member

    Oh yeah, it also can be pretty horrific. Best to write any JS code in a clear, easy to understand manner internally, and use some form of JS compresser for your production code.

    I have had to fix so much fxxxing JS written by idiots.

    feenster
    Free Member

    It has NO access to the local machine except through embedded ActiveX or Java objects

    Terminology: Sandbox. Javascript runs in the browser (the sandbox) and has limited access to the host machine.

    JulianA
    Free Member

    So how did the interview go, WCA? Well, I hope…

    Drac
    Full Member

    IHN you forgot one very crucial line.

    WorldClassAccident
    Free Member

    Interview bumped to tomorrow. Thanks for the advice though, I now speakk fluent JavaScript

    JulianA
    Free Member

    Drac: Which is?

    Loop?

Viewing 31 posts - 1 through 31 (of 31 total)

The topic ‘12 hours to learn Java Script’ is closed to new replies.