Skip to content

Latest commit

 

History

History
71 lines (43 loc) · 1.44 KB

README.md

File metadata and controls

71 lines (43 loc) · 1.44 KB

Programming Foundations - Module 1

Lesson Task 2 Questions

Add all the answers to the script.js file.

Giving your variables meaningful names is very important. The names should indicate what type of information or data the variable holds.

Question 1

Create two number variables, one with an integer value and one with a decimal value.

Question 2

Declare and initialise a variable with all the working days of the week separated by hyphens -.

Question 3

Create four variables that demonstrate the following operations:

  • addition
  • subtraction
  • multiplication
  • division

Question 4

Declare a boolean variable with an initial value of false.

Question 5

Console log the number of characters in this string: "The frogs are angry."

Question 6

Convet the following variable names to camelCase:

var time_elapsed;
var totalprice;

Question 7

Convert the following string values to number values:

var number1 = "53";
var number2 = "44.6";

Question 8

Check the type of the following variables and log the results:

var pet = "donkey";
var age = 89;
var discountApplied = true;
var timeLeft;

Question 9

Declare and initialise a variable with the value "Updating heading".

Select the h1 element on the page and set it's inner HTML value to be the variable created above.

Question 10

Select the body element on the page and change its background colour to lightskyblue.