Giter Site home page Giter Site logo

javascript-ii-mini's Introduction

JavaScript II Mini

Topics we will cover

  • Recursion
  • the this keyword
  • constructor functions
  • classes

Instructions

  • This repository is provided as more of a follow along structure.

  • In class we will be going over the principles listed above and you will be expected to follow along when the instructor asks you to do so.

Recursion

What it is

  • recursion is another way to represent a looping program.
  • Simliar to a for loop or a while loop a recursive function will loop until you tell it to stop.
  • when solving complex algorithms recursion comes in handy. It is not that great for smaller, less complex algorithms.
  • For every recursive function, you'll need to establish what is called a base case. A base case is a condition that when triggered, will discontinue the call to your function.

The this keyword

  • Because JavaScript is both an Object Oriented and Functional Programming language, it has some very interesting concepts built into it.
  • The 'this' keyword is one of those querky concepts that tend to trip up a lot of people coming into JavaScript.
  • You can think of this, as a Pointer to an object. For example, you can use the this keyword to reference an object without having to refer to that object's name.
  • example
  const myObj = { 
    name: 'Freddy' 
    greet: function() {
      console.log(`hello my name is ${this.name}`);
    }
  };
  myObj.greet();
  • In the above example the "this" keyword becomes active when a person's name is called.
  • Tyler McGinnis' four rules to the 'this' keyword. found here
    1. Window Binding
    2. Implicit Binding
    3. New Binding
    4. Explicit Binding

javascript-ii-mini's People

Contributors

jcuffe avatar ryan-hamblin avatar sunjieming avatar

Watchers

James Cloos avatar  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.