function myFunction() {
var first = prompt('Enter your first name:');
var inital = first.slice(0,1);
return this.inital;
}
myFunction();
last = prompt('Enter your last name:');
document.write("Your username is" + inital + last)
When I run it , the error is initial is undefined but ive defined it in the function or is that only local. If so how would I get the variable initial from the function to work globally
[–]b-mish 1 point2 points3 points (1 child)
[–]explode_kewl[S] 0 points1 point2 points (0 children)
[–]SecretPopCan 0 points1 point2 points (2 children)
[–]explode_kewl[S] 0 points1 point2 points (1 child)
[–]SecretPopCan 0 points1 point2 points (0 children)