Code Monkey home page Code Monkey logo

week_01-day_02-javascript-intro's Introduction

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

week_01-day_02-javascript-intro's People

Contributors

samidahlawi 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.