In the printFullName() function:
1.Create a local variable also named fullName.
2.Assign the local variable the value, “Bill Smith”.
3.Add a list item to the HTML ordered list with the id of "outputList" with the local fullName variable as the data.
In the main function lab02localGlobal():
1.Assign the name “Judy Green” to the global variable version of fullName.
2.Add a list item to the HTML ordered list with the id of "outputList" with the global fullName variable as the data.
3.Call the printFullName() function.
Should display like this: 1. Judy Green 2. Bill Smith
However it keeps display this: Bill Smith 1. Bill Smith
// global variables var fullName; fullName = "Judy Green"; function printFullName() { "use strict"; // declare variable var fullName; var output; // assign value to variable fullName = "Bill Smith"; output = document.getElementById("outputList"); fullName += "<li>" + fullName + "</li>"; output.innerHTML = fullName; } function lab02localGlobal() { "use strict"; var output; output = document.getElementById("outputList"); fullName = "<li>" + fullName + "</li>"; output.innerHTML = fullName; printFullName(); }
fullNameinprintFullNameinstead of appending to theoutput. You should probably calloutput.innerHTML += ....fullName += "<li>" + fullName + "</li>";, It should befullName = "<li>" + fullName + "</li>";