Getting started:
Related tutorials:
Getting started:
Related tutorials:
/* | |
REVISED VERSION | |
Note: This is the revised version of my readiness assessment. For the original gist, see: | |
https://gist.github.com/ScottRudiger/1e5e6327050c4f315aa1d0a8f95e804f | |
After dinner, I came back to the RA and spent 15 minutes debugging my mistake in Part 4 and coding Parts 5 & 6. | |
Although I did not finish the RA in time (got stuck trying to find my syntax mistake in Part 4), | |
in deciding whether I'm ready to join the May cohort, I hope you consider that I was able to complete the problems in | |
a short amount of time afterwards. |
//Readiness Assessment - Ben Cooley - Monday, May 1, 2017 | |
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'}, | |
{name: {first: 'douglas', last: 'denney'}, age: 53, sales: '$5058'}, | |
{name: {first: 'earline', last: 'erickson'}, age: 19, sales: '$18876'}, | |
{name: {first: 'herman', last: 'hazell'}, age: 25, sales: '$2746'}, | |
{name: {first: 'homer', last: 'hirth'}, age: 26, sales: '$474'}, | |
{name: {first: 'hwa', last: 'heidt'}, age: 53, sales: '$9607'}, | |
{name: {first: 'hyon', last: 'hampshire'}, age: 46, sales: '$13598'}, |
// javascript | |
/*1Debug each: You are given this function each, but it doesn't work exactly as expected. | |
It should call callback on value, key, and collection respectively for each element of collection, | |
and accept both arrays and objects. Identify everything incorrect with each as it is provided, | |
and modify the function so that it works as expected. Be sure to list all that was incorrect about the original function. | |
*/ | |
var each = function(collection, callback) { | |
if (Array.isArray(collection)){ | |
for (var i = 0; i < collection.length; i++) { | |
collection[i] = callback(collection[i], i, collection); |
//so, Scrimba had uneccessary "unexpected token" errors that do not exist on replit. Lots of time spent debugging things that don't need debugging | |
console.log('dog'); | |
var each = function(collection, callback) { | |
if (Array.isArray(collection)) { | |
for (var i = 0; i < collection.length; i++) { | |
callback(collection[i], i, collection); | |
} | |
} else { | |
for (var key in collection) { |
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'}, | |
{name: {first: 'douglas', last: 'denney'}, age: 53, sales: '$5058'}, | |
{name: {first: 'earline', last: 'erickson'}, age: 19, sales: '$18876'}, | |
{name: {first: 'herman', last: 'hazell'}, age: 25, sales: '$2746'}, | |
{name: {first: 'homer', last: 'hirth'}, age: 26, sales: '$474'}, | |
{name: {first: 'hwa', last: 'heidt'}, age: 53, sales: '$9607'}, | |
{name: {first: 'hyon', last: 'hampshire'}, age: 46, sales: '$13598'}, | |
{name: {first: 'issac', last: 'ingerson'}, age: 45, sales: '$5225'}, |
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'}, | |
{name: {first: 'douglas', last: 'denney'}, age: 53, sales: '$5058'}, | |
{name: {first: 'earline', last: 'erickson'}, age: 19, sales: '$18876'}, | |
{name: {first: 'herman', last: 'hazell'}, age: 25, sales: '$2746'}, | |
{name: {first: 'homer', last: 'hirth'}, age: 26, sales: '$474'}, | |
{name: {first: 'hwa', last: 'heidt'}, age: 53, sales: '$9607'}, | |
{name: {first: 'hyon', last: 'hampshire'}, age: 46, sales: '$13598'}, |
// Write a function that takes 3 words and returns a single count of all their letters. | |
function combinedCharacterCount(word1, word2, word3){ | |
var together = word1 + word2 + word3; | |
return together.length; | |
} | |
// Below is a simple assert function and its invocation. Add this to your code and make sure that the test passes. |