Coder Social home page Coder Social logo

week2_secondpass's Introduction

Week 2 Second Pass

Functions

Whiteboarding time! On a scale of 1 to 5, how confident are you feeling about functions? Form groups of 3 with numbers similar to yours, then try to attack the following problem on a whiteboard:

The dev team is looking for a function that takes two numbers, a and b, and returns the following value: add a to b, then multiply that value by (b plus 4)

  1. Define this function
  2. Call this function twice with different a and b values
  3. Write out the result for these two calls

Those who are on the 4 or 5 side, try the following challenge:

Do the same three steps as above with the following function description: grab an element with the id "math-result" and add the value to this element.

Callbacks

First, let's look at a simple example of callback use.

Now, team up in your squads. On a scale of 1 to 5, how confident are each of you about callbacks? The lowest number in the squad should type out a solution for the following, and the rest of the team should help out or research:

The dev team is looking for a new function. We want to print out "first part is ready" immediately. We want to print out "second part is ready" 3 seconds later.

  1. Define this function
  2. Call this function in dev tools
  3. Verify the time difference is about three seconds

Those who are looking for a challenge, add the following feature: print out "page is refreshed" every 4 seconds (we update our databse every 4 seconds).

jQuery

A good resource for jQuery commands is the intermediate-jquery. Feel free to utilize this for the upcoming activity and for Project 1 if you are using jQuery.

jQuery Practice

There is some very simple starter code in this repo. Please complete the following steps to reinforce your jQuery skills.

  1. Fork and clone this repo.
  2. Include a jQuery script tag from a CDN.
  3. Do a "hello world" test in app.js.
  4. Open the page and verify you have a blue square.
  5. Change the color of the square to red on page load.
  6. Add a button with a click handler (console.log fine for now).
  7. Make the button's click handler remove the red square from the page.
  8. Finally, make the red square fade out as it gets removed from the page.

OOP and Prototypal Inheritance

OOP is hard.

Looking for a good example to explain prototypal inheritance with JS? This article is a good one.

Looking for a full re-coverage of all the things we covered in the first couple weeks, with a different approach? Check this one out, at least the first section.

Want to dive deeper into constructor functions? This article goes into more specifics than our earlier lesson.

week2_secondpass's People

Contributors

zebgirouard avatar

Watchers

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