New course! Every coder should learn Generative AI!
Try a free lesson0
help or explain please!!
Write a simple function that takes no parameters called sayHello. When called this function should print āHello, ____!ā to the console, where the blank is equal to the first index value in the splitName array from the previous question. Call the function. This is the previous question underneath!! splitName should equal[āFirst nameā, ālast nameā] when printed to the console
1 Answer
+ 3
let splitName = "John Doe".split(" ");
function sayHello() {
console.log("Hello, " + splitName[0]);
}
sayHello();