Need help with my first code


#1

I am new to Javascript and after finishing lesson 26 i tried this for fun.
Why wont it run?

confirm("Hello I am here to know many things about you");
var hisname = prompt("Just tell me your name");
var hisage = prompt("And your age");
var hisheight = prompt ("And your height");
var hisweight = prompt ("And your weight");
var itsgender = prompt ("And your gender");
var all = hisname.length + hisage.length + hisheight.length + hisweight.length + itsgender.length;
if itsgender.length > 0
{
confirm("Are you ready to be amazed?")
}
console.log("I know that your name is " + hisname");
console.log("It has a length of " + hisname.length + " (the name)");
console.log("I also know that your grandfather's name was propably " + hisname);
if all > 25
{
console.log("you are also bullshiting me");
}
if all < 10
{
console.log("you are also bullshiting me");
}
if all > 15 && < 24
{
console.log("TA-DAAAAA");
}


#2

if statements should be written like this :

if(condition){
do-something
}

else if ( condition)
{
do-somehintg
}

else {
do something
}


#3

yeah but confirm wont work at the start nor will the prompts


#4

confirm("Hello I am here to know many things about you");
var hisname = prompt("Just tell me your name");
var hisage = prompt("And your age");
var hisheight = prompt ("And your height");
var hisweight = prompt ("And your weight");
var itsgender = prompt ("And your gender");
var all = hisname.length + hisage.length + hisheight.length + hisweight.length + itsgender.length;
if (itsgender.length > 0)
{
confirm("Are you ready to be amazed?")
}
console.log("I know that your name is " + "hisname");
console.log("It has a length of " + hisname.length + " (the name)");
console.log("I also know that your grandfather's name was propably " + hisname);
if (all > 25)
{
console.log("you are also bullshiting me");
}
else if (all < 10)
{
console.log("you are also bullshiting me");
}
else
{
console.log("TA-DAAAAA");
}


#5

notice the changes on line 8, line 12, 15,19 and 23 when you paste it


#6

nice, the prompts worked but it wont log the results


#7

confirm("Hello I am here to know many things about you");
var hisname = prompt("Just tell me your name");
var hisage = prompt("And your age");
var hisheight = prompt ("And your height");
var hisweight = prompt ("And your weight");
var itsgender = prompt ("And your gender");
var all = hisname.length + hisage.length + hisheight.length + hisweight.length + itsgender.length;
if (itsgender.length > 0)
{
confirm("Are you ready to be amazed?")
}
console.log("I know that your name is " + hisname);
console.log("It has a length of " + hisname.length + " (the name)");
console.log("I also know that your grandfather's name was propably " + hisname);
if (all > 25)
{
console.log("you are also bullshiting me");
}
else if (all < 10)
{
console.log("you are also bullshiting me");
}
else
{
console.log("TA-DAAAAA");
}

removed quotes from hisname in line 12 and i got the console to display