Skip to content

wdi-red-coral/week_01-day_02-javascript-intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

Pseudocode Intro

images/js-6 images/js-7 images/js-8 images/js-9 images/js-10 images/js-10a

Javascript Intro

JS Background & History

images/js_0 images/js_1 images/js_2 images/js_3 images/js_4 images/js_5 images/js-6 images/js_7 images/js-1

Variables

images/js-11 images/js-11a images/js-11b images/js-11c images/js-var1 images/js-var2 JavaScript Reserved Words: https://www.w3schools.com/js/js_reserved.asp images/js-var3 images/js-var4 images/js-var4a Note that I don't use let after the first line. This is because the variable has already been declared. images/js-var5

images/js-type1 images/js-type2 images/js-12 images/js-type4 images/js-type5 images/js-type6 images/js-type7 images/js-type8

images/js-13 images/js-14 images/js-15

String Methods and Properties

let name = "mike";
let capitalName = name.toUpperCase(); // ?

name.length // ?

String Concatenation

let firstName = "Mike";
let lastName = "Finneran";

let fullName = firstName + " " + lastName;

Class activity

My Future Cat

  • Write a variable called age.
  • Write a variable called name.
  • Write a variable called color.
  • Then write a variable called cat and assign all the previous variables along with a sting concatenation.
  • Then call the the variable cat with console.log(cat).
  • Result will be: My future cat's name is Strawberry, he is 86 years old, and his color is Orange.

Calculate the area

To find the area of a rectangle multiply its height by its width. A = H * W Result will be : The area of rectangle is '40.20'

Comparison Operator

images/js-20 images/js-21

Logical operators

images/js-26

Conditions

images/js-18 images/js-19

images/js-con1 images/js-con2 images/js-con3 images/js-con4 images/js-con5 images/js-con6 images/js-con7

images/js-27 images/js-27a

Exercises: if/else if/else statements

What number's bigger?

Write an if statement that tests two number (numOne and numTwo), and prints the biggest number

Driving Age

  • Store the user age
  • If age is less than 18, print "Sorry, you can't drive yet"
  • If the age is equal to or over 18, print "Drive away!"
  • Bonus: If the user can't drive yet, tell them how many years they will have to wait. E.g. "Sorry, you have 4 years to wait until you can drive"

images/js-28 images/js-28a images/js-28b images/js-28c images/js-28e images/js-29

Fizzbuzz

  • Write a program that declares a variable equal to a number 0 - 100

  • If it is a multiple of 3, print “Fizz” instead of the number.

  • If it is a multiple of 5, print “Buzz” instead of the number.

  • If it is a multiple of both 3 and 5, print “FizzBuzz” instead of the number.

  • Otherwise, print the number

Additional Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published