Javascript

Task 1
Complete this online [|CodeAvengers Javascript] tutorial (complete JavaScript lesson 1, level 1)

Task 2
Update the HTML web page which you created in the previous section, by adding some JavaScript to d isplay a simple "Welcome message". You do this by adding the following code underneath the and then saving your work

alert('Welcome to my web page')

Task 3
Replace the previous script with the following JavaScript code:

var currentTime = new Date alert("The date is: " + currentTime)

Write down what this code does.

Task 4
Replace the previous script with the following JavaScript code:

Click the button to demonstrate the prompt box. Press me

function myFunction { var x; var person=prompt("Please enter your name","Harry Potter"); if (person!=null) { x="Hello " + person + "! How are you today?"; document.getElementById("demo").innerHTML=x; } }

Write down what this code does, and try to explain how it works