Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 15 2015 06:47

    RyanBalfanz on master

    Added Gitter badge Merge pull request #1 from gitt… (compare)

  • Mar 15 2015 06:47
    RyanBalfanz closed #1
  • Mar 15 2015 06:44
    gitter-badger opened #1
Ryan Balfanz
@RyanBalfanz
@katerynaz15 @TKEvMkt you guys are both on the loops exercises just FYI
You two might be able to help each other though some of the exercises.
Kateryna Zabashta
@katerynaz15
cool
i'll update my results soon
Ryan Balfanz
@RyanBalfanz
This new Gitter.im is pretty neat, it's a way to set up a chat room for individual repos on github
Kateryna Zabashta
@katerynaz15
looks good!
Ryan Balfanz
@RyanBalfanz
We should really have it on the main Bloc/frontend-javascript-exercises repo (as opposed to my fork) but I don't have access to it to make the room
TKEvMkt
@TKEvMkt
@katerynaz15 Hi Kateryna! I just told Ryan I have gotten through the 00 and 01, about to start working on 02. If I can help on the first two, let me know, you may already be ahead. Talk soon
Ryan Balfanz
@RyanBalfanz
sharing jsfiddle links here will make it easy to collaborate too!
Jean-Denis Vauguet
@chikamichi
Hey! I am another mentor @bloc :) I'll just lurk around, see how it goes. @RyanBalfanz is experimenting with gitter as a platform, you're at the forefront!
Ryan Balfanz
@RyanBalfanz
Hi @chikamichi, glad to have you here!
TKEvMkt
@TKEvMkt
Definitely great to have another resource. Ryan next time we talk can we walk through JSFiddle, in terms of how to use/share? Chrome inspector is a huge help but it would be much easier to collab with JSF. Thanks!
Ryan Balfanz
@RyanBalfanz
@TKEvMkt Absolutely, we can work through an exercise together using JSFiddle so you can get the hang of it.
Kateryna Zabashta
@katerynaz15
I am stuck on this task:

Complete the hasElems function. This function should:

take two arguments. The first is an object and the second is an array of elements
return true when all of the elements in the array are keys in the object, false otherwise

My code is this:
var hasElems = function(obj, arr) {
for (var prop in obj) {
if (arr[prop] = obj[prop]) {
return true;
} else {
return false;
}
};
};
It passes all but the last requirement
✓ should be defined
✓ returns true for an empty array
✓ returns true if it has all the keys
1) returns false if one or more of the keys isn't in the hash
TKEvMkt
@TKEvMkt
@katerynaz15 Hi Kateryna, I will be attempting this one a little later this morning, I'll post code if I find something different
TKEvMkt
@TKEvMkt
@katerynaz15 Ok, I took my first shot at this, code completely different.
// Here is my first run at hasElems
module.exports.hasElems = function hasElems (argObject, argArray) 
{
  var tempArray = Object.keys(argObject);
  if (tempArray.length != argArray.length)
  {
    return false;
  }
    else
    {
      for (var i=0; i < argArray.length; i++)
        {
          if (tempArray[i] != argArray[i])
          {
            return false;
          }
            else 
              {
                return true;
              };
        }
    };
};
// here are my results
copy
    ✓ should be defined
    ✓ should create a new object with a copy of all the data

  extend
    ✓ should be defined
    ✓ should correctly extends two hashes that are unique
    ✓ should correctly extend two hashes that are have keys in common

  hasElems
    ✓ should be defined
    1) returns true for an empty array
    ✓ returns true if it has all the keys
    ✓ returns false if one or more of the keys isn't in the hash


  8 passing (14ms)
  1 failing

  1) hasElems returns true for an empty array:
     AssertionError: expected false to be true
TKEvMkt
@TKEvMkt
@RyanBalfanz @katerynaz15 My question now is does this failing requirement match the request? I am probably misreading something, but I thought the keys in both arguments had to be equal. It seems that an empty array would be "false" as it would not contain keys equal to those in the object argument.
TKEvMkt
@TKEvMkt
nm..I reread it. The way it is worded, an empty array would satisfy true because technically the object argument would contain all the keys in the array arg, even if null.
TKEvMkt
@TKEvMkt
@RyanBalfanz @katerynaz15
//Here is my modified code that 'passed' (although I feel it could be way more efficient)
module.exports.hasElems = function hasElems (argObject, argArray) 
{
  var tempArray = Object.keys(argObject);
  if (tempArray.length < argArray.length)
  {
    return false;
  }
    else
    {
      for (var i=0; i < tempArray.length; i++)
        {
          if ((argArray !=0) && (tempArray[i] != argArray[i]))
          {
            return false;
          }
            else 
              {
                return true;
              };
        }
    };
};


vagrant@precise32:/vagrant/frontend-javascript-exercises/10-loops/02-object-operations$ mocha spec.js


  copy
    ✓ should be defined
    ✓ should create a new object with a copy of all the data

  extend
    ✓ should be defined
    ✓ should correctly extends two hashes that are unique
    ✓ should correctly extend two hashes that are have keys in common

  hasElems
    ✓ should be defined
    ✓ returns true for an empty array
    ✓ returns true if it has all the keys
    ✓ returns false if one or more of the keys isn't in the hash


  9 passing (13ms)

vagrant@precise32:/vagrant/frontend-javascript-exercises/10-loops/02-object-operations$
Ryan Balfanz
@RyanBalfanz
@TKEvMkt Hi, didn't see your messages until now. I'll have a look in a bit.
Lex
@arazzon
Hi all.... I'm Lex & I'm from Tasmania in Australia. I've just joined the group so wanted to say hello. I'm not that far through the frontend course yet - am only just working on the Github checkpoint now. I believe most of you are further through than I am, so if I ever get stuck perhaps you'll be able to help me.... :-)
TKEvMkt
@TKEvMkt
@arazzon hello Lex! (Tasmania, home of my favorite shoes in the world -Blundies!). I am in Texas, and we are in opposite time zones, but I will be happy to help where I can. Good luck on the course!
Ryan Balfanz
@RyanBalfanz
@TKEvMkt I made a quick fiddle from your submission: http://jsfiddle.net/crLo30qq/
Ryan Balfanz
@RyanBalfanz
Hi @/all I just learned of JS Bin -- here's a quick example: http://jsbin.com/gunifonawe/1/edit?html,js,output
TKEvMkt
@TKEvMkt
@RyanBalfanz Seems like a good bridge product between jsfiddle and Chrome inspector console?
Ryan Balfanz
@RyanBalfanz
@TKEvMkt, yeah maybe. Not yet sure if I like it much better than JSFiddle though.