Giter VIP home page Giter VIP logo

admissions-challenge-2's Introduction

Admissions Challenge 2 of 2 - Making Cookies

For this project you will be incorporating your JavaScript skills along with jQuery in order to build out a cookie baking app. Start by cloning this repository and reading through the pre-existing code - we've built out the HTML for you.

If you're not comfortable with jQuery just yet, check out CodeCademy or Code school.

When You're Finished

Submit your solution here. Upon submission, you'll automatically be taken to schedule your Technical Interview.

Note: Please do not schedule a Technical Interview before conducting your "Admissions Q&A Interview". E-mail [email protected] for any further clarification.


Step 1

All of your code will go inside of the document ready function. Here's the functionality you need to build out:

  1. When someone clicks on Use 1 Sugar, decrement 1 from the sugar in ingredients, and increment 1 from the sugar count in the pot
  2. Replicate the same for flour
  3. When someone clicks Cook a Cookie, deplete 6 units of flour and 3 units of sugar. Add 1 cookie as well.
  4. When you click on buy Sugar, add 1 unit of sugar for $10.
  5. 1 unit of flour costs $20
  6. Make sure you spend time cleaning up your code. Keeping your code flexible and DRY is very important. This is your chance to showcase your ability to write excellent code.

Step 2

Right now, anyone can just jump into the developer console for the HTML page and change how many cookies are available. This is unacceptable! We cannot have people counterfeiting cookies! Instead of keeping track of cookies inside of the HTML, we want to keep track of cookies inside of our JavaScript code - the HTML code will simply reflect what the JavaScript says.

For example you can keep track of an object called inventory which keeps track of how much money you have, how many cookies you have, etc:

var inventory = {
  product: {
    money: 1000,
    cookies: 0
  },
  ingredients: {
    sugar: 10,
    flour: 10
  },
  pot: {
    sugar: 0,
    flour: 0
  }
};

This object will hold the "truth" about what you actually have, and anytime you update this object, you will want to also update the HTML page regarding how much you have.


Algorithms Challenge

Along with this challenge, submit a solution to the following challenge:

Given an array of integers, find the smallest positive difference between any two elements of the array. For example:

var findSmallestDifference = function(arr) {
  // Your code goes here
};
var result = findSmallestDifference([100, 500, 300, 1000, -200, 990]);
console.log(result); // The answer is 10 for this example because the difference between 1000 and 990 is 10

This code should print out 10 because the different between 1000 and 990 is 10 and there are no pairs that have a smaller difference.

admissions-challenge-2's People

Contributors

gilbert avatar icbat avatar sdevani avatar

Watchers

 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.