3. Coding Challenge Flashcards

1
Q

LECTURE: Values and Variables

  1. Declare variables called ‘country’, ‘continent’ and ‘population’ and
    assign their values according to your own country (population in millions)
  2. Log their values to the console
A
let country = 'India';
let continent = 'Asia';
let population = 135;
console.log(country);
console.log(continent);
console.log(population);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

LECTURE: Data Types

  1. Declare a variable called ‘isIsland’ and set its value according to your
    country. The variable should hold a Boolean value. Also declare a variable.
    ‘language’, but don’t assign it any value yet
  2. Log the types(TYPEOF) of ‘isIsland’, ‘population’, ‘country’ and ‘language’
    to the console
A
let isIsland = false;
let language;
console.log(typeof isIsland);
console.log(typeof population);
console.log(typeof country);
console.log(typeof language);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

LECTURE: let, const and var

  1. Set the value of ‘language’ to the language spoken where you live (some
    countries have multiple languages, but just choose one)
  2. Think about which variables should be const variables (which values will never change, and which might change?). Then, change these variables to const.
  3. Try to change one of the changed variables now, and observe what happens
A
language = 'portuguese';
const country = 'Portugal';
const continent = 'Europe';
const isIsland = false;
isIsland = true;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

LECTURE: Basic Operators

If your country split in half, and each half would contain half the population,
then how many people would live in each half?
2. Increase the population of your country by 1 and log the result to the console
3. Finland has a population of 6 million. Does your country have more people than Finland?
4. The average population of a country is 33 million people. Does your country
have less people than the average country?
5. Based on the variables you created, create a new variable ‘description’
which contains a string with this format: ‘Portugal is in Europe, and its 11 million
people speak portuguese’

A
console.log(population / 2);
population++;
console.log(population);
console.log(population > 6);
console.log(population < 33);
const description1 =
country +
' is in ' +
continent +
', and its ' +
population +
' million people speak ' +
language;
console.log(description1);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly