Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?

Forums » Article Discussions

Discuss the articles posted on Dev.Opera.

Note: You need to login to post in the forums. if you don't have an account you first need to sign up.

By ChrisHeilmann anchor Tuesday, 3. February 2009, 06:38:55

39: Programming - the real basics!

This article marks the start of the Opera web standards curriculum JavaScript section! This part of the course is designed to give you a solid grounding in the real core basics of JavaScript, with more advanced followup courses to come later. We think you'll find this useful - let us know what you think, and what you'd like to see in followup courses. This article in particular looks at the basic principles of programming, in a language-neutral fashion, as a basic first step towards learning to program in JavaScript.

( Read the article )

By Andrew Gregory anchor Thursday, 5. February 2009, 06:25:53

avatarJust a style thing: Since JavaScript variables have function scope, as opposed to block scope (like C/C++, Java, etc do), I don't like for loops declaring their variable in the for statement. All your for loop examples look like:
for(var i = 0; i < 10; i++)
Instead, the "var i" should be with all the other variables at the top of the function. So:
function foo() {
  var i;
  // ...
  for (i = 0; i < 10; i++) {
    // ...
  }
  // ...
}
That most closely reflects how the language works, and might help stop bad habits forming.

By AndBre anchor Tuesday, 10. February 2009, 12:20:03

avatar1. "you are using form the context"
2. "if(b < 10 and b > 20)": did you mean "if(b < 10 && b > 20)"?

By stelt anchor Monday, 16. March 2009, 00:49:12

avatartypo: undertand

By chrismills O anchor Monday, 6. April 2009, 23:56:48

avatarAll typos fixed - cheers!

Moderators: pepelsbey | dstorey | mcx | operadev | chrismills | shwetankdixit | brucelawson | iheni | andreasbovens | zibin | mollydotcom