Git Product home page Git Product logo

js-function-context-this-diagnostic's Introduction

General Assembly Logo

JavaScript Scope and Context Diagnostic

The purpose of this diagnostic is to determine whether you can identify the value of this when invoked in differenct contexts.

Prerequisites

Instructions

  1. Fork and clone this repository.
  2. Change into the new directory.
  3. Install dependencies.
  4. Create and checkout a new branch, named response.
  5. Follow the directions given in lib/diagnostic.js.
  6. Before the alotted time is up, push to your fork and issue a pull request.

Your pull request description should contain a "fist to five" for comfort and clarity. Additionally, you should mention the resources you used to help you complete this assessment. For example:

Comfort: 3
Clarity: 3

I used Google and my class notes to help with this assessment.

You may wish to refer to "How do I submit diagnostics?" and other FAQs related to forking, cloning, and pull requests.

You may use any resource other than each other to complete this diagnostic. This includes referencing talk materials, appropriate documentation, and searching for help online.

You should be running grunt nag before diagnosing any bugs, since it finds some of the most common sources of errors. After grunt nag passes, you should run grunt test to run the included tests. Tests will tell you whether of not your responses are correct.

Note: For this diagnostic, grunt nag will complain about example code we have provided for the questions. You are not required to fix this warnings. Only fix warnings that occur on lines you have written for your response.

  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

js-function-context-this-diagnostic's People

Contributors

bengitscode avatar micfin avatar realweeks avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

js-function-context-this-diagnostic's Issues

Instructions unclear

Insert a line between 7 and 8 that invokes fire.

Is this asking students to create a property on deathStar to hold the result of deathStar.fire?
i.e.

/*1*/ var alderaan = { name: 'Alderaan' };
/*2*/ var deathStar = {
/*3*/   laserQuantity: 1,
/*4*/   laserSize: "huge",
/*5*/   fire: function fire(){
/*6*/     conosole.log(this);
/*7*/   },
          iife: (this.fire)()
/*8*/ };

Descope and clarify

This assessment is too long. Instead of having students refactor code, ask few questions and provide them with the code necessary to complete.

Diagnostic not in line with lesson.

This diagnostic seems to be about scope, whereas the lesson was about this. (Which also has to do with scope, but isn't tested here.) I think it needs reworking.

Tests are too easily tricked into passing

The questions should have better answers or tests so that they are less easily solved or give developers a passing test too broadly.

Question 1: Too easy to just run the code in the console and get the answer
Question 2: Too easy to just run the code in the console and get the answer
Question 3: Developer can enter the resulting string and not the method call to trick test
Question 4: Developer can just write a function that returns the string and trick test

Question 4 is ambigious

The question asks which variables are defined within the scope of the method. Some students interpreted this question as asking which variables were created, while other interpreted this as which were available

Add LICENSE

Are there any other missing boilerplate files?

uncaught typo in question

// Suppose we had declared another function between line 7 and 8. Would that
// new function have access to the value stored in the variable `laseQuantity`
// on line 3?

laserQuanity

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.