3

Below I have the simplest code. In my name function its all good, it works but in the User_age function I get the following error:

User_age is not a function.

What am I doing wrong?

User_age();

function User_age()
{
    var age = promt("what is your age");
    var printAge = "your age is" + age;
    console.log(printAge);
}
name();

function name(){

    var username = prompt("what is your name");
    var greed = "hello" + username;
    console.log(greed);
}
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
davidLaid
  • 33
  • 2

1 Answers1

1

you have a small issue in your first function you are typing promt not prompt

 User_age();

function User_age()
{
var age = prompt("what is your age");
var printAge = "your age is" + age;
console.log(printAge);
}

name();

function name(){

var username = prompt("what is your name");
var greed = "hello" + username;
console.log(greed);
}
Wassim Ben Hssen
  • 519
  • 6
  • 23