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

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...

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