Strana 1 z 1

script help

Napísané: Ut 05. Nov, 2019, 12:15
od užívateľa JurajSlovakID
caute chlapi, preco mi to nejde?


var age = 31;
if(age < 18);
{
document.write("You just are a pup!");
} else if(age >= 18 && age <= 29)
{
document.write("Welcome to young adulthood! Enjoy while you can!");
} else if(age >= 30 && age <= 39)
{
document.write("It's time to get serious about career and family!");
} else if(age >= 40 && <= 49)
{
document.write("It's time about to make a retirement! Make sure you're saving!");
} else if(age >= 50 && <= 59)
{
document.write("Enjoy your life now! You don't well!");
} else if(age >= 60)
{
document.write("60 is the new 40! Do something exciting");
}

Re: script help

Napísané: Ut 05. Nov, 2019, 12:19
od užívateľa LordKJ

var age = 31;
if(age < 18); <- tu nema byt
{
document.write("You just are a pup!");
} else if(age >= 18 && age <= 29)
{
document.write("Welcome to young adulthood! Enjoy while you can!");
} else if(age >= 30 && age <= 39)
{
document.write("It's time to get serious about career and family!");
} else if(age >= 40 && <tu-nieco-chyba> <= 49)
{
document.write("It's time about to make a retirement! Make sure you're saving!");
} else if(age >= 50 && <tu-nieco-chyba> <= 59)
{
document.write("Enjoy your life now! You don't well!");
} else if(age >= 60)
{
document.write("60 is the new 40! Do something exciting");
}
nabuduce napis co presne ti nejde, aky je to jazyk... nikto tu nema vestecku gulu

Re: script help

Napísané: Ut 05. Nov, 2019, 12:27
od užívateľa LeaR
Taketo temy by som bez zavahania lockoval.

Ziadny popis, co si skusal, nic.

Re: script help

Napísané: Ut 05. Nov, 2019, 12:37
od užívateľa PROMETHEUS
aky IDE pouzivas? ja mam visual studio a to by ti hned napisalo kde mas chyby a je kopec light programov co maju tiez slusny debug a toto by ti hned vyskocilo.

Re: script help

Napísané: Ut 05. Nov, 2019, 12:57
od užívateľa JurajSlovakID
je ocividne o co ide, skor ma to napadne z kodu nez hladat temu
pouzivam sublime text
v skratke zaradujem vystupy tipy na obdobie v ktorom clovek zije, je to len priklad
podla hodnoty var age=xx bude stanoveny textovy vystup
edit: je to javascript

Re: script help

Napísané: Ut 05. Nov, 2019, 13:22
od užívateľa LordKJ
no ved som ti to vyriesil. (cerveny text)

Len o pomoc sa neziada tak, ze tu mate kod a povedzte mi preco to nejde pricom ani nepovies co nejde

Re: script help

Napísané: Ut 05. Nov, 2019, 13:53
od užívateľa JurajSlovakID
var age = 31;

if(age < 18);
{
document.write("You just are a pup!");
} else if(age >= 18 && age <= 29)
{
document.write("Welcome to young adulthood! Enjoy while you can!");
} else if(age >= 30 && age <= 39)
{
document.write("It's time to get serious about career and family!");
} else if(age >= 40 && age <= 49)
{
document.write("It's time about to make a retirement! Make sure you're saving!");
} else if(age >= 50 && age <= 59)
{
document.write("Enjoy your life now! You don't well!");
} else if(age >= 60)
{
document.write("60 is the new 40! Do something exciting");
}


Ok ospravednte ma prosim.
Dakujem za tio, no mam to teraz takto a nepise nic ani v chrome ani vo ff.

Re: script help

Napísané: Ut 05. Nov, 2019, 13:59
od užívateľa bepetko
1337180a napísal:
Ut 05. Nov, 2019, 13:53

if(age < 18);

Re: script help

Napísané: Ut 05. Nov, 2019, 14:08
od užívateľa JurajSlovakID
let age = 31;
switch(true) {
case (age < 18):
document.write("You just are a pup!");
break;
case (age <= 29):
document.write("Welcome to young adulthood! Enjoy while you can!");
break;
case (age <= 39):
document.write("It's time to get serious about career and family!");
break;
case (age <= 49):
document.write("It's time about to make a retirement! Make sure you're saving!");
break;
case (age <= 59):
document.write("Enjoy your life now! You don't well!");
break;
case (age >= 60):
document.write("60 is the new 40! Do something exciting");
break;
}

takto to ide ale musim vediet preco minule riesenie nefungovalo tak pls help.

Re: script help

Napísané: Ut 05. Nov, 2019, 14:10
od užívateľa bepetko
bodkočiarka za if

Re: script help

Napísané: Ut 05. Nov, 2019, 14:24
od užívateľa LordKJ
ta cervena bodkociarka tam nema byt lebo ukoncuje ten if a tym padom else if za tym nedavaju zmysel

Re: script help

Napísané: Ut 05. Nov, 2019, 14:40
od užívateľa JurajSlovakID
uz to ide, toto som potreboval, dakujem vsetkym.