Skip to content

Latest commit

 

History

History
117 lines (80 loc) · 1.79 KB

READMe.md

File metadata and controls

117 lines (80 loc) · 1.79 KB

JavaScript 1 - Module 1

Lesson Task 1 Questions

Question 1

Write code that logs the following variable to the console.

const instrument = "guitar";

Question 2

Log the following variable to the console.

const button = document.querySelector("button.login");

Question 3

Log the following variable to the console in table format.

const instruments = [
    {
        type: "guitar",
        colour: "red",
    },
    {
        type: "piano",
        colour: "black",
    },
];

Question 4

Convert the following code to use either a const or let variables.

var name = "Percival";
var age = 13;

Question 5

Convert the following code to use either a const or let variable.

var total = 0;
total = total + 10;

Question 6

Convert the following code to use either a const or let variable.

for (var i = 0; i <= 5; i++) {
    console.log(i);
}

Question 7

Convert the following to use backticks:

const firstName = "Florence";

const introduction = "Hello, my name is " + firstName + ".";

console.log(introduction);

Question 8

Convert the following to use backticks:

const title = "Big Technical Event";

const whatToHave = "good time";

const welcome = "Welcome! \n\n" +
                "This " + title + " is starting today.\n\n" +
                "Have a " + whatToHave + "!";

console.log(welcome);

Question 9

Log each property in the object below.

const car = {
    "paint-colour": "red",
    "number of wheels": 3
};

Question 10

Add a function (method) called getExpired to the object below that logs the expired status of the object.

Call the function after adding it.

const product = {
    name: "Chicken Lips",
    price: 35,
    expired: false
}