Thanks a lot for the responses, i've finished reading the book and to my surprise i wasn't that far off from the 'correct' way to use javascript.
I tend to learn programming easier by thinking up something I want to achieve then attempting to code it (and asking questions about 'How to do...' along the way) rather than reading books and doing exercises. Thats how I learnt/am learning Javascript. But this may not be how you learn.
But if you do, I'd try to do something like 'Move a div from the left of the screen to the right' or 'Get some XML from a server'.
Indeed, i've used Javascript this way for a while now most of the time using jQuery.
The problem with Javascript is that it is a hackers language. If you look up several Javascript projects on Github and compare them some of hem will look like they have been written in completly different languages.
gretty is probably right. Just do a few projects in Javascript. The key to Javascript is that its a "getting things done" language and not a "making code look pretty" language.
Yeah, i think the most awfully written code i've seen was in JS (it worked like a charm but still, couldn't follow most of what was coded)
I think you'll be fine with the book you're reading and maybe a handy reference. JS is pretty straightforward once you understand the idea behind HTML, CSS, and DOM in general.
"To fully understand the beauty of LEGOs you need to think in LEGOs, many people build with art/science/efficiency in LEGOs and that doesn't cut it"
Thanks for the link Khatharr, and for the LEGO quote
I would recommend to just start coding as much as possible, then switch to some common framework(angular,backbone) and get a feel for how common javascript is written. Looking at the sourcecode for a couple of larger open-source projects might also be very helpful to get a feel for js-syntax.
I recently wrote a blogpost about learning javascript which might or might not be helpful,
http://pointnull.com/learn-javascript/
I've started looking into AngularJS and Nodejs a few days ago, that should keep me busy for a while, thanks for the blog link by the way!
The main problem of many programmers is, in my opinion, the desire to do everything just like they did it in other languages. Best example: object orientation.
In JavaScript, there are no classes. The only JavaScript thing which is close to be what a class in other languages is, are the constructors. (And constructors are regular functions which are used for object instanciation elsewhere.)
While working with JavaScript, keep in Mind: there are no private members. Every member is public. (Same goes for Python: "private" members will only be translated, e. g. from "__privateMember" to "_MyClass_privateMember". Knowing this, you can still access private members, but it's evil...)
In general: instead of relying on specific types you should just use objects as if they are what you expect them to be. For at least some type safety or "method overloading" you could do some type checking, but for objects of types other than the primitive types you should just check if they provide the features (methods and/or members) you need.
This also means: you have to use inheritance much less compared to other languages.
You should definitely take a look at what closures are and what you can do using them in JavaScript. Those are used frequntly to hide implementation specific functions to keep the global context clean. (-> Anonymous function containing all library setup calls, which is called immidately.)
Also Closures are used to have some kind of private "members", but due to what a closure is, those are no members ob the object. You will run into some troubles if you want to combine it with inheritance. ;)
Excellent, great advice. I've read and fiddled with closures in Python before but never applied them in any of my projects. With what you tell me it seems they have a niche in JS, will definitely look into it some more.
However, if you want to build games, then you want to know everything about HTML Canvas -- which is manipulated via JavaScript.
Since this is gamedev.net, I will assume that is what you want.
If that is what you want, then you definitely want the following book (not written by me, so this isn't spam):
HTML 5 Canvas (amazon link) by Steve Fulton & Jeff Fulton
That would be one of my goals, correct. Thanks for the heads up and the book recommendation, if you don't mind send me your books name via PM so i can check it out.
I'll check out some game dev resources on HTML5/JS and Python and probably will post on the Game Programming forum next time.
Thanks again!