Task Instructions
In this activity, you will define a variable within a JavaScript function. You'll learn more about functions later. For now, we'll focus on variables.To accomplish this task, you need to do the following:
- Open the
Variables-01folder and add code to thevariables01.jsfile to do the following:- Create a variable called
myFriendusing one of the variable declarations described above.- Set the variable you created to contain your friend's name.
- Inside the
greetingsfunction, return the string: "Greetings [your-friend's-name]."
I have no idea what I am missing in this code but it still comes up as wrong.
/*Instructions
- Greet your friend by printing a message to the console.
*/
function greetings(greetings ,{myFriend}) {
var myFriend = 'Mike';
`greetings ${myFriend}`;
console.log(myFriend);
}
//leave this line unchanged to console log the results
console.log('results: ', greetings());
//don't change this line
if (typeof module !== 'undefined') {
module.exports = greetings;
}
returnin front of`greetings?function greetings(){as you are not using the arguments.