0 william appiah-dankwah · June 13, 2014
just wrote this code funny thing is bucky has a tutorial on it does anyone know why my browser displays the code and undefined inside the code

var Candy = new Array(2);

for(var i=0;i<2;i++)

Candy = prompt("DETAILS", "");
document.write(Candy[0] + Candy[1]);
can someone check and let me know if they get that

Post a Reply


- page 2
Oldest  Newest  Rating
0 Kumi Festus · June 14, 2014
Oh sorry, my mistake
0 william appiah-dankwah · June 14, 2014
Your functions don't work kumi is it so posed to be like that
0 Ethan Fraser · June 15, 2014
Stop taking codes from places and copying them, you need to learn it. You can't just read something from a book, realise you can't make it work then just ask us for help. You must learn it your way, books don't seem to work for you, I can't stress enough how much I advise the use of CodeCademy. Apart from that, his code was written wrong.

function people(name,age){
this.name = name;
this.age = age;
this.yearsUntilRetire = yearsLeft();

I assume that will work. Again, LEARN IT. Don't just ask for the answers.
0 william appiah-dankwah · June 15, 2014
Err Ethan what I know from learning from a book is that the function should work as a no click event correct me if I'm wrong that's why I have copied and asked
0 william appiah-dankwah · June 15, 2014
Any way that's not a loop @Ethan
0 Ethan Fraser · June 16, 2014
I know it's not a loop... It was just said it was broken so I helped to fix it. 
  • 1
  • 2



A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.