These are chat archives for FreeCodeCamp/Help

20th
Feb 2015
Ken
@kaiservonarctic
Feb 20 2015 00:09
Looking for a pair programming partner if anyone is free
Got a taker, thanks!
Alex Dixon
@alex-dixon
Feb 20 2015 02:47
setOpenSpaces: function ( game.openSpaces, marks) {
Not understanding why this breaks everything. Appears to have something to do with the dot notation in the first parameter
david
@dalvarado
Feb 20 2015 02:53
are you declaring the function and setting it to setOpenSpaces?
Alex Dixon
@alex-dixon
Feb 20 2015 02:58
I'm trying to declare setOpenSpaces right there
openSpaces is an array. Both are part of an object called game
If I take "game." away from open spaces everything is fine
Problem is I'm calling it with game.openSpaces
david
@dalvarado
Feb 20 2015 03:13
since you're declaring the function at that point, then those two are variables and not actual arguments
Cristián Berríos
@crisberrios
Feb 20 2015 03:15
@alex-dixon game.openSpaces is an invalid function argument
names in function parameters are just aliases, and should be like any other variable name
if you want to pass game.openSpaces to the function
call it from inside
like var = something = this.openSpaces or something like that.
Jonathan
@jonathantimm
Feb 20 2015 04:07
Hey all, I have a quick hangup on a basic javascript thing if anyone feels up for it
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:07
Shoot and I'll see if I'm of any help (no promises though I'm still learning too).
Jonathan
@jonathantimm
Feb 20 2015 04:08
hehe okay cool, i bet you can do it
i'm just doing code academy's javascript course and i have to do an if/else statement with a prompt
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:08
Ok.
(I probably can ;) ).
Jonathan
@jonathantimm
Feb 20 2015 04:09
except in the previous example, the prompt was answered with <= 13
but in this one, the answer just has to be yes or no
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:09
Ok.
Jonathan
@jonathantimm
Feb 20 2015 04:10
but can I write if userAnswer === yes
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:10
it would need to be a string "yes" or 'yes', not just yes
the condition could be
Jonathan
@jonathantimm
Feb 20 2015 04:11
yeah
that's totally it!
thank you! hehe so basic
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:11
if (userAnswer === 'yes') {
     //code to execute here
}
else {
     //more code 
}
LOL
It's ALWAYS something basic.
Jonathan
@jonathantimm
Feb 20 2015 04:11
heheh
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:11
OMG the few times it tripped me up...
When I realized my errors... I was always like OMG WTF.
Jonathan
@jonathantimm
Feb 20 2015 04:12
so i'm assuming later i can figure out how to make the options more than just "ok" and "cancel"
haha totally
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:12
Yea.
Jonathan
@jonathantimm
Feb 20 2015 04:13
thank you so much!
Angelica Ferdinand
@ESOComputing
Feb 20 2015 04:16
You're welcome. :) Any time you need help or if you'd like to pair up for bonfires later. HMU.
Jonathan
@jonathantimm
Feb 20 2015 04:17
Aw thanks, will do!
Vince
@Vince33
Feb 20 2015 05:41
Hey was just in a pair and once finished and passed the challenge the button to move on docent work the big green btn
Angelica Ferdinand
@ESOComputing
Feb 20 2015 05:41
Interesting.
It worked for me yesterday, but I haven't paired today.
Vince
@Vince33
Feb 20 2015 05:42
He has done some challenges and they seem not to have changed
Angelica Ferdinand
@ESOComputing
Feb 20 2015 05:42
Hmmm.... Let me check.
Vince
@Vince33
Feb 20 2015 05:43
saved*
the challenges didn't save
seems ok now
Angelica Ferdinand
@ESOComputing
Feb 20 2015 05:57
There was some kind of issue on the server temporarily it seems.
Glad to know it is back to normal.
Vince
@Vince33
Feb 20 2015 06:26
@ESOComputing cool thanks for checking
lotbs
@LookOnTheBrightSide
Feb 20 2015 09:00
hey guys
having trouble here
how can I make a function that accepts 2 params, id, and color and then changes the background color of that div?
lotbs
@LookOnTheBrightSide
Feb 20 2015 09:09
function changeColor(divId, color ){
      //    
}
  this.divId = document.querySelector() ;
???
Nathan
@terakilobyte
Feb 20 2015 09:16
why not something like $('#' + divID + ') to start with?
if using jquery
lotbs
@LookOnTheBrightSide
Feb 20 2015 09:23
I'm using pure javascript. just working through some exercises and failing to get it
this.document.querySelector(divId) = divId ;
does that even make any sense haha
Nathan
@terakilobyte
Feb 20 2015 09:28
well you can grab onto the element by id with document.getElementById()
if I remember right
you could then probably alter its color pretty easily after that
lotbs
@LookOnTheBrightSide
Feb 20 2015 09:30
yes that's right but I want it to be able to accept any given id
Nathan
@terakilobyte
Feb 20 2015 09:32
so why wouldn't you?
var something = document.getElementById(divId);
something.classList.add(color);
lotbs
@LookOnTheBrightSide
Feb 20 2015 09:34
thanks tera, let me try that
Alex Dixon
@alex-dixon
Feb 20 2015 12:34
checkWin: function checkWin (moves) {
        var check = function (testNum) {
            moves.some(function (elem) { return elem === testNum });
        };
I’m under the impression this should work as a closure…but it’s not. Any advice?
Alex Dixon
@alex-dixon
Feb 20 2015 12:40
problem seems to be with parameters...
when invoked as a whole it returns undefined
the moves.some part works as desired when run from the console with input
Gregory Scheerlinck
@greg-js
Feb 20 2015 12:49
What exactly are you trying to do there?
Alex Dixon
@alex-dixon
Feb 20 2015 12:51
I’m trying to check if a number is present in an array
cerissa
@cerissa
Feb 20 2015 12:52
have you ran the inspect element and checked the console?
Gregory Scheerlinck
@greg-js
Feb 20 2015 12:53
@alex-dixon what about the native indexOf method?
cerissa
@cerissa
Feb 20 2015 12:53
also i think you are missing one } at the end if im counting right
Alex Dixon
@alex-dixon
Feb 20 2015 12:53
@wdgreg Good call. Thank you
I checked the console. returns undefined. not sure how to inspect the element
the checkWin function continues for a bit so didn’t copy the last bracket but good eye
cerissa
@cerissa
Feb 20 2015 12:54
if your in console log thats good, inspect element was just a way to open up the console.
Gregory Scheerlinck
@greg-js
Feb 20 2015 12:55
you could also use the some method
Alex Dixon
@alex-dixon
Feb 20 2015 12:55
yeah. some method is in there. kinda hard to see
honestly if anyone has time to tell me what’s wrong with that i’d be curious to know just from a learning standpoint but I think indexOf will work so I’ll try that just to get things running
Gregory Scheerlinck
@greg-js
Feb 20 2015 12:57
So what you're trying to do is make it easy to check whether a certain element exists in an array?
Alex Dixon
@alex-dixon
Feb 20 2015 12:57
@wdgreg reason i’m trying to write “check” is because I have to use some a bunch
Gregory Scheerlinck
@greg-js
Feb 20 2015 12:57
If you're going to use it a lot, I'd add it to the Array prototype
something like this: `Array.prototype.exists = function9e) { return this.some(function(a){ return a === e; }); };
Alex Dixon
@alex-dixon
Feb 20 2015 12:58
Oh very cool. I’ve yet to do that
Gregory Scheerlinck
@greg-js
Feb 20 2015 12:58
oops, the 9 is supposed to be a ( :)
Alex Dixon
@alex-dixon
Feb 20 2015 12:58
Nice! I’ll try that. Assuming it goes in global scope?
Gregory Scheerlinck
@greg-js
Feb 20 2015 12:58
that way, you can do `arr = [1,2,3,4]; arr.exists(5) // false arr.exists(4) // true
sorry I keep forgetting the closing `
Hm this would be added to the Array prototype, it's not quite the global scope because you're not adding global variables but it would be available throughout your program, not sure what to call it
Alex Dixon
@alex-dixon
Feb 20 2015 13:01
Oh ok. So if I put that code in an object I’ve defined…all is well?
Array.prototype etc.
or a function inside that object? guess I can just try it
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:03
Oh i see what you mean, you're asking where to put that line of code?
Umm, I'd put it near the top of my project, or I'd put it in a separate js file called util.js or something and then source it
Alex Dixon
@alex-dixon
Feb 20 2015 13:04
ok. cool
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:04
but in practice, you could just use lodash or underscore or something and use the methods that come with them
Alex Dixon
@alex-dixon
Feb 20 2015 13:05
so the way I had invoked it previously was check(4)
Is there any way to write something like this without having to specify the array every time?
if it’s the same array
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:06
if you write check(4), how would the code know which array to check for 4?
Alex Dixon
@alex-dixon
Feb 20 2015 13:07
Could i make it part of the definition for check somehow?
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:07
you could write something like check(arr, 4) or arr.check(4)
Sorry I don't understand what you mean by making it part of the definition for check
can you give an example of how you want the code to work?
Alex Dixon
@alex-dixon
Feb 20 2015 13:08
No problem
Probably not lol
uhm so in the definition for what check does
I want part of what it does to use an array
and that array is being passed to its parent function
then close on that and accept a number as input
er.
crap
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:11
so not something like [1,3,5].check(4) ? How would you pass the array?
Alex Dixon
@alex-dixon
Feb 20 2015 13:12
could you store the value of the array with a closure?
inside check
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:13
Hmm, wait, let me get on the web chat so I can use markdown
Alex Dixon
@alex-dixon
Feb 20 2015 13:13
yayy. Thank you
function outerFunction (array) {
        //var check = function (input) {
        //    array.some(function (elem) { return elem === input });
        //};
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:15
Alright
so is this about what you're looking for:
Alex Dixon
@alex-dixon
Feb 20 2015 13:15
That’s a generic version of what I had
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:16
var check = function(checkValue){
  var arr = [1,3,5];
  return arr.some(function(e){ return e === a; });
};
oops, obviously a is supposed to be checkValue there :)
Alex Dixon
@alex-dixon
Feb 20 2015 13:17
Yes
only difference is that array is a parameter being passed to an outer function
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:19
right I think I understand what you're getting at, give me a minute
Alex Dixon
@alex-dixon
Feb 20 2015 13:19
thank you
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:26
sorry, can't figure it out myself right now, I'll take another look at it when I get back in about fifteen minutes if no one else has done it for you by then, okay? :)
Alex Dixon
@alex-dixon
Feb 20 2015 13:27
Of course. Thanks man :D
just glad to hear I might have a good problem
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:28
heh, well, talk to you soon, I'm off to buy a sandwich :D
Alex Dixon
@alex-dixon
Feb 20 2015 13:29
Sounds good. Thanks again
Really appreciate it
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:40
aaaand I'm back with a cheese sandwich :) but I thought about your issue while standing in line, lemme type it up
var arrayStuff = function(arr) {
  return {
    check: function(checkValue){ return arr.some(function(ele){ return ele === checkValue; }); }
  };
};
is that what you were looking for?
that way you can do arrayStuff([1,3,5]).check(4); // false ; arrayStuff([1,3,5]).check(3); // true
I think.. I didn't actually try the code
Nathan
@terakilobyte
Feb 20 2015 13:43
to me it looks like check is an overcomplicated filter
reduce the problem to the most simple operation you can
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:44
Yes, I'd just add it to the prototype myself, but I'm assuming this is just to try stuff to see how it works
or.. well, indexOf is probably the most obvious solution to this problem
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:50
So did you finish that hardcore functional programming course, @terakilobyte ? I'll finally have more time to myself in two weeks and i'm aching to sign up and start currying
Nathan
@terakilobyte
Feb 20 2015 13:51
yes I did
it was good
Gregory Scheerlinck
@greg-js
Feb 20 2015 13:52
Nice :) looking forward to it
Jonathan
@jonathantimm
Feb 20 2015 15:36
Hey guys, I have a question you might be able to help with. I have a JS chart I edited in JSFiddle and it works fine on the results frame, but then when I take the code from "view source" on the results frame and save it as a document, I get errors and it doesn't work. Any ideas why that could be?
Cristián Berríos
@crisberrios
Feb 20 2015 15:42
sure, you shouldn't use the code from the result window, but use the code from each of the other windows and link it together
using proper stylesheets and script files
Jonathan
@jonathantimm
Feb 20 2015 15:44
Okay I'll try that. Thanks!
Suzanne Atkinson
@AdventureBear
Feb 20 2015 16:35
hey guys I'm headed off on vacation for the next week. one thing I am oddly looking forward to is clearing my mind and working on a few programming projects! Oh, I'll be enjoying the beach and the sun as well. :)
Does anyone know off the top of their head any libraries that could help with calendar layout? Differet formats like 1 colum represents 1 week over a year?
Danny Fritz
@dannyfritz
Feb 20 2015 16:49
not sure if this meets what you are requiring, but i've used this to great affect http://kylestetz.github.io/CLNDR/
Christopher Nguyen
@crosscris
Feb 20 2015 20:23
@AdventureBear coding in the sun with good food......oh man, that sounds nice
lotbs
@LookOnTheBrightSide
Feb 20 2015 21:50
hey guys could I please get some help with my fiddle?
Danny Fritz
@dannyfritz
Feb 20 2015 21:52
sure, what is it supposed to do
lotbs
@LookOnTheBrightSide
Feb 20 2015 21:52
so I want it to work when I when I take the color and div id from a user via prompt
Danny Fritz
@dannyfritz
Feb 20 2015 21:53
i'm not seeing a prompt in there
lotbs
@LookOnTheBrightSide
Feb 20 2015 21:53
when I add prompt it returns null
Danny Fritz
@dannyfritz
Feb 20 2015 21:53
oh, you have some <script> tags that don't point to anything
lotbs
@LookOnTheBrightSide
Feb 20 2015 21:54
the code is on js bit now
all of it
Danny Fritz
@dannyfritz
Feb 20 2015 21:57
i'm going to add a button that prompts the user
lotbs
@LookOnTheBrightSide
Feb 20 2015 21:59
I did it!!!!
Danny Fritz
@dannyfritz
Feb 20 2015 21:59
nice!
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:00
@dannyfritz thanks for helping! I really appreciate that!
Danny Fritz
@dannyfritz
Feb 20 2015 22:01
haha, rubber duck helping?
@LookOnTheBrightSide here was what i was going to suggest: http://jsfiddle.net/hm7fuwnf/3/
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:04
second time you tried to help ;)
wow
that's some nice code!
ok how can I make my code fail
I have the background set to green already. so if that does not change, I want it to say failed
Danny Fritz
@dannyfritz
Feb 20 2015 22:08
@LookOnTheBrightSide this one has a really interesting CSS property! look how i don't have any text in the div's http://jsfiddle.net/hm7fuwnf/4/
@LookOnTheBrightSide here it is with error checking http://jsfiddle.net/hm7fuwnf/5/
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:11
that content attribute
nice!
Danny Fritz
@dannyfritz
Feb 20 2015 22:12
yeah, i don't recommend doing the attr function in CSS. it was just fun to see if it worked.
Evan Davis
@davisec52
Feb 20 2015 22:13
I'm doing the truncacat Bonfire challenge. The code sample below appears to do what the challenge is asking for, yet it throws the error below the code sample. I don't understand what the error is telling me. It may also be that I don't understand the instructions for this particular Bonfire.

function truncate(str, num) {
    var trunc = "";
      if(str.length <= num) {
          for(var i = 0; i < str.length; i++) {
              return str;
          }
      }
      else if(str.length > num) {
          for(var j = 0; j < str.length - num; j++) {
              trunc += str[j];
          }

  }

  return trunc + "...";
}

truncate('A-tisket a-tasket A green and yellow basket', 11);



ERROR ==> expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');AssertionError:expected 'A-tisket a-tasket A green and ye...' to deeply equal 'A-tisket...'
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:13
@dannyfritz the error is not working
Danny Fritz
@dannyfritz
Feb 20 2015 22:13
how so? it seems to work for me
Angelica Ferdinand
@ESOComputing
Feb 20 2015 22:14
@davisec52 Not there yet, sorry I'm unable to help. :(
Danny Fritz
@dannyfritz
Feb 20 2015 22:15
@davisec52 somehow i don't think truncate('A-tisket a-tasket A green and yellow basket', 11).length should return 35 :P
Evan Davis
@davisec52
Feb 20 2015 22:15
@dannyfritz When I run it through the Bonfire interface it gives me the error.
Is it a bug with the interface or my code?
Danny Fritz
@dannyfritz
Feb 20 2015 22:16
yeah, it is saying it didn't truncate it enough
no, your result isn't correct
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:16
@dannyfritz when the color does not change it wont give an error
Evan Davis
@davisec52
Feb 20 2015 22:16
?
Danny Fritz
@dannyfritz
Feb 20 2015 22:16
look at the result you get for truncate('A-tisket a-tasket A green and yellow basket', 11) it is 35 characters long
Evan Davis
@davisec52
Feb 20 2015 22:17
I don't understand what you are getting at. The code seems to work properly in repl.it.
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:17
You can't break the words.
Evan Davis
@davisec52
Feb 20 2015 22:18
So the challenge does not want us to reduce the string by character but by words?
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:18
You need to truncate it to the previous white space.
Yes.
Danny Fritz
@dannyfritz
Feb 20 2015 22:18
what i'm getting at, is that the code you provided doesn't give the correct answer for truncate('A-tisket a-tasket A green and yellow basket', 11); http://i.imgur.com/Cusltnn.png
no, it is by characters
Evan Davis
@davisec52
Feb 20 2015 22:19
Ok. I totally fail to make any sense out of the instructions for that particular challenge.
Danny Fritz
@dannyfritz
Feb 20 2015 22:20
it expected the result to be 'A-tisket...'
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:20
Also, take a look at the substring method: http://www.w3schools.com/jsref/jsref_substring.asp
Danny Fritz
@dannyfritz
Feb 20 2015 22:20
'A-tisket...' is 11 characters long
Evan Davis
@davisec52
Feb 20 2015 22:20
Could you translate the instructions into meaningful English:)
Danny Fritz
@dannyfritz
Feb 20 2015 22:20
truncate('A-tisket a-tasket A green and yellow basket', 11) says to truncate it to 11 characters
your function returns "A-tisket a-tasket A green and ye..." which is 35 characters, not the 11 characters it asked for
Evan Davis
@davisec52
Feb 20 2015 22:21
Ok, so it wants me to return a string equal to the second argument.
?
Danny Fritz
@dannyfritz
Feb 20 2015 22:21
equal in length yes
Evan Davis
@davisec52
Feb 20 2015 22:21
Thank you!
Danny Fritz
@dannyfritz
Feb 20 2015 22:22
and if any characters are removed, make sure the last 3 chars are ...
Evan Davis
@davisec52
Feb 20 2015 22:22
also understood.
Ok, yes, now the substr method would make much more sense . ..
Danny Fritz
@dannyfritz
Feb 20 2015 22:23
@LookOnTheBrightSide if I type green for box3 twice I get this http://i.imgur.com/Dst2zv3.png
Cristián Berríos
@crisberrios
Feb 20 2015 22:26
lol at me for clicking that image
Danny Fritz
@dannyfritz
Feb 20 2015 22:26
lol
Cristián Berríos
@crisberrios
Feb 20 2015 22:26
I read fiddle and thought it was a pop-up :chicken:
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:28
mmm
haha
Can anyone see what I can't see?
Danny Fritz
@dannyfritz
Feb 20 2015 22:35
what can't you see?
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:36
Gimme a sec, I can't find my code LOL
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:43
@dannyfritz sorry to bother you again but if you enter anything other than a color it does not fail
try and enter n or any other value
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:43
function where(arr, num) {
  // Find my place in this sorted array.
  for(i = 0; i < arr.length; i++){
    if(num < arr[i]){
      return i;
    }
    if(num >= arr[i]){
      if(num < arr[i+1] || arr[i+1] === undefined){
        return i+1;
      }
      if(num >= arr[i+1]){
        return i+2;
      }
    }
  }      
  return num;
}

where([40, 50], 50);
Danny Fritz
@dannyfritz
Feb 20 2015 22:43
oh, how would you detect a non color?
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:44
I know haha
Danny Fritz
@dannyfritz
Feb 20 2015 22:44
@piecedigital that outputs 2 on my console
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:44
so it's impossible then
Danny Fritz
@dannyfritz
Feb 20 2015 22:45
i don't know about that. i'm just not aware of a good way to do it
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:45
@dannyfritz Yes, it's supposed to be placed an index ahead of the number if it's equal to or greater than the number
lotbs
@LookOnTheBrightSide
Feb 20 2015 22:45
yer true
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:45
Wait, I stopped the loop too soon
I think I got it...
I'll get back to it after I shower
(i woke up late.. as usual)
Danny Fritz
@dannyfritz
Feb 20 2015 22:47
@piecedigital these are the 2 test cases by the way
where([10, 20, 30, 40, 50], 35);
where([10, 20, 30, 40, 50], 30);
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:49
Got it.
``
function where(arr, num) {
  // Find my place in this sorted array.
  for(i = 0; i < arr.length; i++){
    if(num <= arr[i]){
      return i;
    }
    if(num > arr[i]){
      if(num < arr[i+1] || arr[i+1] === undefined){
        return i+1;
      }
    }
  }      
  return num;
}

where([40, 50], 50);
Danny Fritz
@dannyfritz
Feb 20 2015 22:50
nice, cleaner too
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:50
I was putting them ahead of the number if they were equal to or greater than the number, but it should only be ahead if it IS greater
but if equal to or less than the number it gets placed in that position.
Thanks for the help. How did you get the test cases/
?
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:51
Truuuue.
Danny Fritz
@dannyfritz
Feb 20 2015 22:52
you want to see my solution?
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:52
sure.
Danny Fritz
@dannyfritz
Feb 20 2015 22:53
function where(arr, num) {
  return arr.map(function (value) {
      return value >= num;
    })
    .indexOf(true);
}
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:54
Oh ok
Danny Fritz
@dannyfritz
Feb 20 2015 22:54
my solution breaks if it is greater than all elements. :P
Darryl Dixon - Piece Digital
@piecedigital
Feb 20 2015 22:55
because it doesn't check for undefined?
Danny Fritz
@dannyfritz
Feb 20 2015 22:55
well, -1
but yeah, same idea