Write code that logs the following variable to the console.
const instrument = "guitar";
Log the following variable to the console.
const button = document.querySelector("button.login");
Log the following variable to the console in table format.
const instruments = [
{
type: "guitar",
colour: "red",
},
{
type: "piano",
colour: "black",
},
];
Convert the following code to use either a const
or let
variables.
var name = "Percival";
var age = 13;
Convert the following code to use either a const
or let
variable.
var total = 0;
total = total + 10;
Convert the following code to use either a const
or let
variable.
for (var i = 0; i <= 5; i++) {
console.log(i);
}
Convert the following to use backticks:
const firstName = "Florence";
const introduction = "Hello, my name is " + firstName + ".";
console.log(introduction);
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);
Log each property in the object below.
const car = {
"paint-colour": "red",
"number of wheels": 3
};
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
}