Skip to content

Instantly share code, notes, and snippets.

@ryanbsherrill
Created February 27, 2017 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanbsherrill/09a8418e0f6e5a8e2b026d5ee137381d to your computer and use it in GitHub Desktop.
Save ryanbsherrill/09a8418e0f6e5a8e2b026d5ee137381d to your computer and use it in GitHub Desktop.
object drills 2
.map:
https://jsbin.com/yowisob/edit?js
for loop:
https://jsbin.com/yowisob/edit?js
for loop:
https://jsbin.com/gekane/edit?js
.find:
https://jsbin.com/gekane/edit?js
for loop:
https://jsbin.com/xafejol/edit?html,js,console,output
.map:
https://jsbin.com/xafejol/edit?js
this one was also a bit of a pain in the neck. actually, it mostly had to do with
the whole html method. i'm not quite sure how I was supposed to know how to figure that
wihtout having done any exercise like it, or even learning how to put together the various methods like
that. but that's fine. the 1st part of the exercise I got just fine. the html
method i did not. I just copied what you guys had there.
https://jsbin.com/notunaw/edit?js,console
couldn't get this one. wen't over it a few times and ended up taking a look at the answer.
I get why the answer works, but I don't understand why my answer didn't really work.
I did something like:
function validateKeys(obj, expectedKeys) {
return Object.keys(object) == expectedKeys;
}
since the Object.keys(object) returns the exact same style array of keys
as is held in expected keys, I really don't understand why this doesn't work.
shouldn't 2 identical arrays of strings == each other? i thought the problem there
was only if I were to use the strict equality operator ===. anyhow, I get why your solution works
seems a bit convoluted to me, but it got all of the tests to pass so I guess I can't really say anything.
anyhow, here is the code I di once I had looked at the solution and worked through how it was working:
https://jsbin.com/kuneyug/edit?js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment