Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

JavaScript sucks...

Name: Anonymous 2006-06-23 3:18

No, really! I tried to program a bit with it, but it does really strange things and I don't think that this is my fault!

menu = new Array();

function menuobject (one, two)
{
  this.id = one;
  this.stuff = two;
}

menu_db = "1|foo;2|bar;"

for (i=0; i < menu_db.length; i++)
{
  temp = menu_db.split(";");
  menu[i] = new menuobject(temp[0], temp[1]);
}

Name: Anonymous 2006-06-23 3:21

oops... copy-pasta is very hard...

This is different:

menu_db = menu_db.split(";");
for (i=0; i < menu_db.length; i++)
{
  temp = menu_db.split("|");
  menu[i] = new menuobject(temp[0], temp[1]);
}

Name: Anonymous 2006-06-23 7:25

Ok, I know what the problem was...
The problem was that JAVASCRIPT THINKS THAT I INITIALIZED A GLOBAL VAR WHICH WAS INSIDE A DAMN FUNCTION!!!!!
WHY THE FUCKING HELL DO YOU THINK I WROTE IT _INTO_ THE FUNCTION, YOU ASSWIPE?

So, the value of the var got wrong and changed stuff.
I'm happy, that this is over...

Name: Anonymous 2006-06-23 9:02

>>1-3

WHY AREN'T YOU USING VAR TO DEFINE VARIABLES YOU LITTLE FAGGOT?

Name: Anonymous 2006-06-23 13:35

>>4
BECAUSE I DONT'T NEED TO!

Name: Anonymous 2006-06-23 14:01

>>5 BUT YOU REALLY SHOULD

Name: Anonymous 2006-06-23 15:50

it looks like you are coming from java. did you know that instead of

menu = new Array();

Name: Anonymous 2006-06-23 15:56

>>7

Name: Anonymous 2006-06-23 16:15 (sage)


>>6
Thread over.

Name: Anonymous 2006-06-23 16:27

>>7
Because he's fucking stupid.

Name: Anonymous 2006-06-24 22:27

menu_db = menu_db.split(";");
for (i=0; i < menu_db.length; i++)
{
  temp = menu_db.split("|");
  menu[i] = new menuobject(temp[0], temp[1]);
}
look at 'temp = menu_db.split("|");'. do you want this to do the same exact thing on every iteration of the loop? because it doesn't seem to include 'i' anywhere in the expression :)

you probably mean temp = menu_db[i].split("|")

Name: Anonymous 2006-06-25 9:03

>>7
no, c++, but I wouldn't consider me a mastar hacker :P
I used examples from selfhtml.org and the did it this way. Thanks for the info.

>>11
oops... I actually did. If I didn't I'd get errors.

Name: Anonymous 2006-11-14 21:25

java...SCRIPT!

Name: Anonymous 2009-01-14 5:26

Learn arrays and use the proper index. Arrays begin with 0

Name: Anonymous 2009-03-06 7:28

The fetal position cover   in my own   from scratch fuck   you all cocksuckers.

Name: Anonymous 2010-10-09 8:48

test

Name: Anonymous 2010-10-09 15:33

Name: Anonymous 2010-10-09 18:37

>>17
Go away.

Name: Anonymous 2010-10-10 0:42

>>18
Fuck you, I actually enjoyed his link.

Name: Anonymous 2010-10-10 4:34

>>19
And he'd be welcome to post it in a non-retarded manner, but I don't hold much hope for that.

Name: Anonymous 2010-11-26 13:27

Name: Sgt.Kabu昳찒kiman╦ 2012-05-28 19:19

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List