Task
Create a program that stores information about yourself in variables
TIP:
This example uses the ‘concatenation’ method.
Solution
name
age
location
interests


Show Code
Code
| window.onload = function() { | |
| // declare variables | |
| let myName = “Neil”; | |
| let myAge = 101; | |
| let myLocation = “Aberdeen”; | |
| let myInterests = | |
| `Writing computer code for websites, | |
| and designing interactive systems.`; | |
| //display output | |
| document.getElementById(“my-name”).innerHTML = “My name is: ” + myName; | |
| document.getElementById(“my-age”).innerHTML = “My age is: ” + myAge; | |
| document.getElementById(“my-location”).innerHTML = “My location is: ” + myLocation; | |
| document.getElementById(“my-interests”).innerHTML = “My interests are: ” + myInterests; | |
| } |
