Skip to content

Instantly share code, notes, and snippets.

View san-sekhon's full-sized avatar

Sandeep Singh Sekhon san-sekhon

View GitHub Profile

Set C

Prompt

//1. Write a function that checks if the given input is an object.

After prompt number 1, you are given this :

function assert(expectedBehavior, descriptionOfCorrectBehavior) {
  if (!expectedBehavior) {
    console.log(descriptionOfCorrectBehavior);

Set D

Prompt

//1. Write a function that takes in a number, and returns a string with that many number of stars ("*").

After prompt number 1, you are given this :

function assert(expectedBehavior, descriptionOfCorrectBehavior) {
  if (!expectedBehavior) {
    console.log(descriptionOfCorrectBehavior);
/*
Last time
* Conditionals (rps mini game)
This time
* Functions
* Iteration (for and while loop)
// Super basic assertion
// console.log(square(2) === 4);
// Now, let's try writing an assertion that gives us a little more information about what's going on.
/* Write a function, assertEqual, that takes in 3 arguments:
- An invocation of the function you're testing
- The expected output of the function you're testing

Module 2 Assessment

Sales Team

You are managing a sales team and you are interested is analyzing some data related to their age and total sales. Take a moment to review the following data structure you will be analyzing:

var salesTeam = [{name: {first: 'Aleen', last: 'Atkins'}, age: 26, sales: '$2314'},
 		{name: {first: 'Alvaro', last: 'Angelos'}, age: 55, sales: '$1668'},
 		{name: {first: 'Denese', last: 'Dossett'}, age: 29, sales: '$9248'},
@san-sekhon
san-sekhon / nativeJavaScript.js
Created July 14, 2017 01:32 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests

Introduction to Higher-Order Functions

Lessons

Slides 1

Slides 2

Two Forms of Functions