Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Support
  • Code University
  • First steps of Javascript
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
First steps of Javascript
Tweet Topic Started: Feb 5 2009, 06:14 AM (528 Views)
Vitality May 19 2009, 02:22 PM Post #11
Member Avatar
Tabula Rasa

Posts:
784
Group:
Former Staff
Member
#320
Joined:
Jul 26, 2008
Nice Reid :)

Honestly Everafter, just take a step back and try not to over think it. I think that's a huge problem with those trying to learn; it looks scary so you tend to make it more difficult than it should be.

Try to think straight to what code will cause this, but more along the lines of actualizing your situation. Think through what you're trying to do before you start writing any code. What I mean by that is break it down.

Think to yourself; okay, here is my page. It's filled with arrays, elements, objects and so on. Then first, locate where you need to apply the code; for example, on all <a> tags, rather all links. That right there just prevented us from searching every single thing on the page you're on and narrowly reduced it to only links.

Now you would say; okay, I have all of the links on this page, but I want to change the text of this specific one. You would see that with what you have you can't change only one (because you currently have all of them =P), you need to do some searching. No problem, but how can I pinpoint that one link? Get specific. Look at what is unique about that link. Is it it's text, or maybe to be even isolate the search matches even more, it's address. Look at that. You now have your link and you can do what you want with it.

Try to think sort of like that and then once you've figured out what you want to do, then figure out and remember which code will help you do that. Sometimes analogizing helps. For exmaple:
An array can be an aisle in a store, your methods/functions can be you with a cart and so on.

Try visualizing the process of what you're trying to achieve.
Offline Profile Goto Top
 
Reid May 19 2009, 02:48 PM Post #12
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
I have almost every step/way of doing something planned out before I even open up notepad++ to start the code. It isn't very specific, but a general idea of how you're going to do something is immensely useful.

After all, you don't start building a house without knowing the size, shape, and location, do you..?
The Resource Board
Offline Profile Goto Top
 
slayer766 May 19 2009, 05:11 PM Post #13
Member Avatar
Hello all

Posts:
1,653
Group:
Distinguished Coder
Member
#12
Joined:
Jul 9, 2008
Coding language
PHP
Well that's a house, totally different perspective. Hahaha, but yeah I see your point though Reid. I tend to usually jump right in the code and think of stuff on the way but with RPG projects and such that are quite large, I then try to think of stuff in my head(because I don't write anything down <_<) and then go from there.
Offline Profile Goto Top
 
Everafter May 20 2009, 12:01 PM Post #14
Member Avatar


Posts:
101
Group:
Member
Member
#3,012
Joined:
May 18, 2009
* nods * okay. Im reading over the tutorials right now. Getting my feet wet. One day I will get it. Even if there is something similiar on here I will still at least know that I did my own version. * snickers * the last program I ever used was basic.
Offline Profile Goto Top
 
Viral May 20 2009, 06:44 PM Post #15


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
condition ? true : false is called a tertiary statement iirc :) . As for the triple === and stuff, they're mainly used when comparing with a boolean (true or false).

var this_is_me = true; // the variable this_is_me will be equal to true
var this_is_you = false; // the variable this_is_you is equal to false

Now, to test it, using an if statement:

if(this_is_me === true){
// execute
}


That's how you'll normally see it. Or if you like the tertiary way (shorthand):

var definitely_me = this_is_me === true ? "yes" : "no";
That defines the variable definitely_me. It checks whether this_is_me is equal to true, which it is, so definitely_me is now equal to yes. If this_is_me was equal to false, then definitely_me would be equal to no.

I have no idea how much you know, but I'm pretty sure this is a bit too complicated (I've repeated myself too much). It might help though.

Posted Image
Offline Profile Goto Top
 
Reid May 20 2009, 07:11 PM Post #16
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
Tertiary eh? I'll keep that in mind.. lol
The Resource Board
Offline Profile Goto Top
 
Viral May 25 2009, 09:46 AM Post #17


Posts:
342
Group:
Dedicated
Member
#48
Joined:
Jul 17, 2008
Coding language
PHP
Ternary*

Posted Image
Offline Profile Goto Top
 
Reid May 25 2009, 01:26 PM Post #18
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
Indeed. The triple equal signs are used to check for type as well as actual equality, apparently.

For example, if I did this:
Code:
 
y = 0;
z = new Boolean(); // will be 'false';
if (y == z) alert('AHA!') //this would be true
if (y === z) alert('nope'); //this would be false;
Apparently. Or something like that. :P
The Resource Board
Offline Profile Goto Top
 
iBlake Jun 12 2009, 06:35 AM Post #19


Posts:
8
Group:
Member
Member
#559
Joined:
Aug 12, 2008
Coding language
ASP.Net
Thanks. I understand those tags better.
Posted Image
Offline Profile Goto Top
 
Choco Jul 2 2009, 09:14 AM Post #20
Member Avatar
¡ʎɹoʇɔɐɟ ʎʇıʌɐɹƃ ɐ uı pǝddɐɹʇ ɯ,ı 'dןǝɥ

Posts:
589
Group:
Admins
Member
#3,272
Joined:
Jun 30, 2009
Coding language
Everything
Reid
May 25 2009, 01:26 PM
Indeed. The triple equal signs are used to check for type as well as actual equality, apparently.

For example, if I did this:
Code:
 
y = 0;
z = new Boolean(); // will be 'false';
if (y == z) alert('AHA!') //this would be true
if (y === z) alert('nope'); //this would be false;
Apparently. Or something like that. :P
Easier way to put it is that it checks type as well as value instead of just value. :P
Code:
 
zeroString = "0";
zeroInt = 0;
alert(zeroString==zeroInt); //Alerts true, because both are equal to a form of 0
alert(zeroString===zeroInt); //Alerts false, because one is a string and one is an integer
Posted ImageIt's a magical world, Hobbes, ol'd buddy... ...let's go exploring!
In progress: Something Special ;)
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Code University · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2

Track Topic · E-mail Topic Time: 7:46 PM Jul 10
Hosted for free by ZetaBoards · Privacy Policy