Git Product home page Git Product logo

javascript-fundamentals-exercises-1's Introduction

Variables and Values exercise

  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
  3. Declare a variable called language and set the value to the language spoken in your country
  4. Declare a variable called onCoast and set the value to a boolean value indicating if your country has a coast or not

Basic operators exercise

  1. Half the population of your country
  2. Increase the population 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 avarage population of a country is 33 million using comparions operators is your countries population have less people than the average country
  5. Based on the varaibles you created create a variable description which contains a string with this format 'YOURCOUNTRY is in YOURCONTINENET and its YOURPOPULATION million people speak YOURLANGUAGE'

If & Else statements

  1. if your countries population is greater than 33 million, log a string like this to the console 'YOURCOUNTRY's population is above average' otherwise, log a string like 'YOURCOUNTRY's population is YOURPOPULATION, bellow average'

Logical Operators

  1. Lets saying Ahmed is looking for a new country to leave in. He wantes to live in a country with a population less than 50 million and is not on the coast. Write a if statement to help Ahmed see if your country fits the conditions
  2. If your country is the right country log a string like this: 'you should live in YOURCOUNTRY!' if not log 'YOURCOUNTRY does not meet your criteria :(' (NOTE: if your country doesnt meet the criteria change some variables to make sure the codition is working properly)

Switch Statements

  1. User a switch statement to log the followning string for the given 'language': chinese or mandarin: 'MOST number of native speakers' spanish: '2nd place in number of native speakers' english: '3rd place' hindi: 'Number 4' arabic: '5th most spoken language' for all other simply log 'Great languages too :)'

The conditional (Ternary) operator

  1. If your country's population is greater than 33 million, use the ternary operator to log a string like this to the console: 'YOURCOUNTRY's population is above average'. Otherwise, simply log 'YOURCOUNTRY's population is below average'

javascript-fundamentals-exercises-1's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.