Giter Site home page Giter Site logo

js-object-oriented-bind-call-apply-this-lab-online-web-sp-000's Introduction

Bind, Call, Apply Lab

Objectives

  • Use JavaScript's bind, call, and apply methods to change function's scope and properly pass arguments

Instructions

In this lab, our tests define functions that are then passed through to functions we ask you to write. Your functions should not only invoke the functions passed as arguments, but also modify the this value of the functions passed through while ensuring arguments are properly passed.

We ask you to write the following functions:

  • justInvoke(fn): The function simply invokes the function passed through to it. It also returns the return value of the passed through function.
  • setThisWithCall(fn, thisValue, arg): The function again invokes the function passed to it, but uses the call method to return the function's this value. (Make sure to correctly pass the third argument!)
  • setThisWithApply(fn, thisValue, args): Again, invoke the function passed to it, change the this value of that function passed to it. In addition, we ask you to invoked the passed function with arguments. You should accomplish all of the above by using apply.
  • returnNewFunctionOf(functionToBeCopied, thisValue): Here, we ask you to write a function that returns a copy of the function passed through, but sets the this value of the function's copy.

View Javascript Bind, Call and Apply Lab on Learn.co and start learning to code for free.

Don't forget to make use of MDN's call and apply documentation!

MDN Call

MDN Apply

js-object-oriented-bind-call-apply-this-lab-online-web-sp-000's People

Contributors

danielseehausen avatar gj avatar j-shilling avatar jeffkatzy avatar maxwellbenton avatar sammarcus avatar

Watchers

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