Why is this taught?


#1

I finally figured out how to code the "Great to see you, Jonathan" part but had a question. What is the point in coding this if it's not even asking for that person's name? Not everyone's name is mine and I'm just confused as to how I can get everyone's name greeted if I wanted too. Thanks!


#2

Hey @jonnyboythan You can do it like this:

var value = prompt("name?");
console.log("Great to see you " + value);

or the hard function way:

var value = prompt("name?");
var func = function(name){
 console.log("Great to see you " + name);
}

func(value);

Hope this helped!