Hello everybody! i’m currently extra confused about something, so i have this code let userName = ‘’;
userName ? console.log(‘Hello’) : console.log(‘Hello!’);
const userQuestion = ‘Am i becoming a vampire?’;
console.log(The user asked: ${userQuestion}
);
const randomNumber = Math.floor(Math.random() * 8);
let eightBall = ‘’;
switch (randomNumber){
case 0:
eightBall = ‘It is certain’;
break;
case 1:
eightBall = ‘It is decidedly so’;
break;
case 2:
eightBall = ‘Reply hazy try again’;
break;
case 3:
eightBall = ‘Cannot predict now’;
break;
case 4:
eightBall = ‘Do not count on it’;
break;
case 5:
eightBall = ‘My sources say no’;
break;
case 6:
eightBall = ‘Outlook not so good’;
break;
case 7:
eightBall = ‘Signs point to yes’;
break;
}
console.log(The eight ball answered: ${eightBall}
);
sorry it might seem spammy but i’m not sure if i can upload .js files and actually get people to read it… so anyways, i have a question regarding the use of the let userName = ’ '; so i have that string blank, i want that element doing exactly what the supposed headline says i want that to return that if somebody inputs a name it gets autofilled to my operary ternator : for example if the blank of userName get’s filled i want that to reflect in userName ? console.log(“true”) : console.log(“false”);
I’m not sure if i’m explaining myself correctly but i guess ill try it this way, i know this problem is probably something really easy to solve but right now i feel like i don’t really get it, i mean it works right now but i want that additional perk, it’s like some kind of user input that get’s autofilled with an automated answer using the “input” part