These are chat archives for FreeCodeCamp/Help

15th
Aug 2015
Cody Bouscaren
@codybousc
Aug 15 2015 00:01
@arturts it worked! thank you! i can't believe i wasted over an hour trying to do it the other way.
Artur de Oliveira Tsuda
@arturts
Aug 15 2015 00:02
@codybousc great!
@cjstewart13 What is mutation supposed to do?
Christopher Stewart
@cjstewart13
Aug 15 2015 00:03
it checks to see if all the string elements in arg 2 are within arg 1..... so this should be false since y is not in hellow
*hellow
*hello
Moisés Man
@moigithub
Aug 15 2015 00:04
return exit the function/break the loop
Christopher Stewart
@cjstewart13
Aug 15 2015 00:05
@moigithub what does that mean
Moisés Man
@moigithub
Aug 15 2015 00:05
so u ..
starting the loop
check if exists (index)
if -1 RETURN (exit)
if not.. RETURN (exit)
so.. ur loop.. will iterate only 1 time
Christopher Stewart
@cjstewart13
Aug 15 2015 00:06
ok. so how do I get one side of the condition to continue the loop?
Artur de Oliveira Tsuda
@arturts
Aug 15 2015 00:06
@cjstewart13 you should only return true if the iteration has ended, like @moigithub is saying
@cjstewart13 put the return true outside the loop. Also, you don't need that first assignment to search, since you'll iterate over i starting from 0
Omar
@oab00
Aug 15 2015 00:07
@cjstewart13 continue;
Christopher Stewart
@cjstewart13
Aug 15 2015 00:08
Thanks everybody!
Artur de Oliveira Tsuda
@arturts
Aug 15 2015 00:10
@oab00 continue terminates the current iteration and jumps to the next. That will work, but it is used when you have other stuff in the loop, that you want to execute if it doesn't pass through continue
Richard Viramontes
@rviramontes
Aug 15 2015 00:17
@SojournerOctocat @viznev thanks I appreciate the help if anyone has an invite to screen hero it would be appreciated I'll give it a try on Wine when I get off work and one last question would teamviewer work with screen hero if I were to pair with someone using the other?
Tyler St. Onge
@tylerstonge
Aug 15 2015 00:40
Adding methods of an object like Car.prototype.move = function() {...} doesn't put the methods in the Object.keys()? Or did I forget to do something?
Donavin Northrup
@dnorthrupva
Aug 15 2015 00:43
Anyone familiar with the Bonfire: Diff Two Arrays that wants to help me? I am just nootttt getting it.
Tyler St. Onge
@tylerstonge
Aug 15 2015 00:44
bf Diff Two Arrays
CamperBot
@camperbot
Aug 15 2015 00:44

:fire:Bonfire: Diff Two Arrays :link:

function diff(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);

Compare two arrays and return a new array with any items not found in both of the original arrays.

more info:  bf details | bf links | hint

Tyler St. Onge
@tylerstonge
Aug 15 2015 00:45
What do you have?
Donavin Northrup
@dnorthrupva
Aug 15 2015 00:46

So the closest I feel I've gotten is

function diff(arr1, arr2) {
  var newArr = [];
  for (i = 0; i <=arr1.length; i++){
arr1.index[i] === arr2.index[0..5] // This is Ruby, I'm not sure if this works in JS?
   return newArr.push(i);
}
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);

Which I know isn't even close I didn't use indexOf, and I don't think [0..5] would be accepted as a 'range' in JS. Plus it would limit it to 6 entries, not the entire thing.

I then tried making a second 'for' inside of the first 'for' to compare arr1, while comparing arr2.... That one turned out messy
Tyler St. Onge
@tylerstonge
Aug 15 2015 00:48
Yeah, using the Array.indexOf() method will make things a lot easier. What I did was iterate over one array, well calling indexOf on the array I wasn't iterating on and found any value that wasn't in both that way.
I do not believe that notation arr2.index[0..5] works in JavaScript.
Donavin Northrup
@dnorthrupva
Aug 15 2015 00:49
Yea, I didn't think so.
So did you end up making 2 new arrays to hold the temporary 'search'? I guess I'm trying to figure out how to compare them, on a grand scale. And not arr10 === arr20, etc.
Omar
@oab00
Aug 15 2015 00:50
you could combine the arrays into one then compare it to itself
Artur de Oliveira Tsuda
@arturts
Aug 15 2015 00:52
@dnorthrupva for every element in array 1, if it's not in array 2, add it to the new array. Do the same for array 2
Donavin Northrup
@dnorthrupva
Aug 15 2015 00:52
I'm right with newArr.push(i)? to push the one not found?
Or would it be newArr.push(arr1[i])?
Artur de Oliveira Tsuda
@arturts
Aug 15 2015 00:52
newArr.push(arr1[i])
Donavin Northrup
@dnorthrupva
Aug 15 2015 00:58
How would I make i compare to every piece of content within arr2? arr2.indexOf(i)?
Would i be a valid option?
Moisés Man
@moigithub
Aug 15 2015 01:05
WhereToCheck.indexOf(whatChecking)
"hello".indexOf ( "X" ) <--- can read like.. its "X" on "hello" string
if return -1 means not found..
if >=0 yes found
Artur de Oliveira Tsuda
@arturts
Aug 15 2015 01:07
@dnorthrupva yep. Just remember to do the for loops separately
@dnorthrupva oops, indexOf(arr1[i]), like @moigithub said
Sean
@seanr707
Aug 15 2015 01:08
anyone know why this isn't working in CodePen
@height: 100px;

.section {
  height: @height;
}
I have the LESS preprocessor enabled
Clayton
@cjg040103
Aug 15 2015 01:11
anybody know whats wrong here?
var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
};

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: "mary.johnson@example.com"
};

var contacts = [bob, mary];

function printPerson(person) {
    console.log(person.firstName + " " + person.lastName);
}

function list() {
    var contactsLength = contacts.length;
    for (var i = 0; i < contactsLength; i++) {
        printPerson(contacts[i]);
    }
}
function search(lastName) {
    var c = contacts.length;
    for(var i = 0; i < c; i++) {
        if(lastName == contacts[i].lastName) {
            console.log(contacts[i].firstName contacts[i].lastName);
        } else {
            console.log();
        }
    }
    }
    search('Jones');
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:11
Ugh, I hit delete on accident and my code got erased (Went back a page.) I don't think I was close, but I feel like I'm getting there.
jameswlytle
@jameswlytle
Aug 15 2015 01:12
'''
CamperBot
@camperbot
Aug 15 2015 01:12
:bulb: to format code use backticks! ``` more info
jameswlytle
@jameswlytle
Aug 15 2015 01:13
function chunk(arr, size) {
  // Break it up.
  var newArray = [[],[]];
  var index = 0;

  for (var i = 0; i < Math.floor(arr.length/2); i++) {
    for (var j = 0; j < size; j++) {
      newArray[i][j] = arr[index++];
    }
  }
  return newArray;
}
Danny Fritz
@dannyfritz
Aug 15 2015 01:13
can you link me to the bonfire too @jameswlytle ?
Luis Felipe López G.
@luishendrix92
Aug 15 2015 01:13
bf cunks
CamperBot
@camperbot
Aug 15 2015 01:13
Sorry, can't find a bonfire called cunks. [ Check the map? ]
Luis Felipe López G.
@luishendrix92
Aug 15 2015 01:14
bf chunk
CamperBot
@camperbot
Aug 15 2015 01:14

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Luis Felipe López G.
@luishendrix92
Aug 15 2015 01:14
There it is
Danny Fritz
@dannyfritz
Aug 15 2015 01:14
heh, thanks @luishendrix92 :)
jameswlytle
@jameswlytle
Aug 15 2015 01:14
still learning this chat interface. thanks @luishendrix92
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:15
function diff(arr1, arr2) {
  var newArr = [];
  for (i=0; i<= arr1.length; i++){
    for (j=0; j<=arr2.length; j++){
      if (indexOf(arr1[i]) === indexOf(arr2[j]));
        return;
        } else {
          newArr.push();
        }

    }
  }
  return newArr;


diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Am I even getting remotely close? I feel like I'm not. Haha
Sean
@seanr707
Aug 15 2015 01:15
@cjg040103 trying adding a comma b/t the two variables in that last console.log
Cristián Berríos
@crisberrios
Aug 15 2015 01:15
@dannyfritz we've become obsolete lol
xD
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:15
@crisberrios Yea, that's what I think the issue is also.
Not @crisberrios ! @cjg040103
Danny Fritz
@dannyfritz
Aug 15 2015 01:15
@crisberrios i know. T_T haha
Moisés Man
@moigithub
Aug 15 2015 01:15
@cjg040103 u have 2 data here
console.log(contacts[i].firstName contacts[i].lastName);
missing a separator OR.. join
console.log(contacts[i].firstName , contacts[i].lastName);
console.log(contacts[i].firstName + contacts[i].lastName);
but u already have a printPerson function.. so.. why repeat console.log?
u can use printPerson(contacts[X] )
Cristián Berríos
@crisberrios
Aug 15 2015 01:16
@dannyfritz no, seriously, the user base has grown 10x since you left
the active one of course
Danny Fritz
@dannyfritz
Aug 15 2015 01:16
oh my gosh. that is pretty nuts
@crisberrios can we no longer console.log in a bonfire?
oh, i'm not running it. ;)
@jameswlytle it looks like you are trying to access an array that doesn't exist. newArray is 2 arrays long, but i might be more than 0 or 1.
jameswlytle
@jameswlytle
Aug 15 2015 01:19
hmm. guess i need to study multi-dimensional arrays in javascript some more. C++ is much easier on those. thanks!
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:23
function diff(arr1, arr2) {
  var newArr = [];
  for (i=0; i<= arr1.length; i++){
    for (j=0; j<=arr2.length; j++){
      newArr = arr2.filter(arr1);
    }
  }
  }
  return newArr;


diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Tried my hand at .filter, did not work so well.
tinako97
@tinako97
Aug 15 2015 01:24
@dnorthrupva I was very very confused about those functions not very long ago. Your filter parenthesis need to have a function inside, e.g. .filter(function( ){ } )
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:25
So essentially -if- I wanted to do the filter method, it would have to start this 'for' chain? I'm reading documentation on .filter to see if it's even the route I want to go.
Tyler St. Onge
@tylerstonge
Aug 15 2015 01:26
I don't understand how to have 6 keys on the Make a Person bonfire, when you have to have 6 methods, and a way to store a first and last name.
tinako97
@tinako97
Aug 15 2015 01:26
The filter is its own loop. It will handle the whole array in one go.
Christopher Stewart
@cjstewart13
Aug 15 2015 01:26
I'm still working on the mutation bonfire. I've included comments to talk through my logic. I could use help identifying where my code is going wrong.
function mutation(arr) {

  //so search doesn't think 'a' and 'A' aren't the same
  var lowerCase2 = arr[1].toLowerCase();
  //creates the arrays to compare
  var split2 = arr[1].split("");
  //gives starting point for search
  var search = 0;

  //loops through second array item
  for (i = 0; i < split2.length; i++) {

    //set's search value to the index value of that iteration of split2: -1 if not there
    search = arr[0].indexOf(split2[i]);

    //if statement logic to deal with each iteration
    if (search != -1) {
      continue;

      //this else if says /in theory/ if there is an index value and you are at the end of the iteration, return true else return false
    }else if (search != -1 && (split2[i] === split2.length-1)) {
      return true;
    }else {
      return false;
    }
  }
  return search;
}

mutation(['hello', 'hey']);
Omar
@oab00
Aug 15 2015 01:27
@tylerstonge use var not this.
tinako97
@tinako97
Aug 15 2015 01:27
@dnorthrupva Like this: arr.filter( function (a) { code to do something with a, each element in the array } )
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:28
function diff(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  for (var i in arr1){
    if( arr2.indexOf(arr1[i]) === -1) newArr.push(arr1[i]);
  }
  for (var j in arr2){
    if( arr1.indexOf(arr2[j]) === -1) newArr.push(arr2[j]);
  }
  console.log(newArr);
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
I ended up using this, because the documentation told me I could make it equal to -1 .... But I feel like this is sloppy, like very sloppy. I have two 'if's, doing the same thing, but in reverse.
Any insight on how I could have done it via another method?
Tyler St. Onge
@tylerstonge
Aug 15 2015 01:28
@oab00 Oh duh, to make the "private"
tinako97
@tinako97
Aug 15 2015 01:28
In the case of filter, you return either true or false. True, a will be retained in the array. false, no. Now let me see what you have.
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:31
I think once I'm done for the night I will go check out StackOverflow for use of 'filter' to see how it's used (Though to be fair SO usually blows my mind with half the stuff they do with calls)
Omar
@oab00
Aug 15 2015 01:31
var arr = [1, 2, 3, 4];
arr = arr.filter(function(element) {
    return element > 2; // true if element is bigger than 2
}
arr becomes [3, 4]
Danny Fritz
@dannyfritz
Aug 15 2015 01:32
@dnorthrupva does an if/else not apply?
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:32
I figured out how to use filter in that method, but how could I have used it to compare two arrays? Assuming I didn't know what was inside of them?
tinako97
@tinako97
Aug 15 2015 01:32
Hah, that is almost exactly how I wrote it several weeks ago. @dnorthrupva . I could probably do better now.
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:33
@dannyfritz I tried if/else, but the issue was in the 'else', but the way I did it ended up 'elsif' and another "j=0; j<arr2.legnth" etc etc. And it kept erroring out.
Sadly that was the code that got deleted when I accidentally backed out. I thought of this code when trying to re-type it.
Danny Fritz
@dannyfritz
Aug 15 2015 01:34
bf diff
CamperBot
@camperbot
Aug 15 2015 01:34

:fire:Bonfire: Diff Two Arrays :link:

function diff(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);

Compare two arrays and return a new array with any items not found in both of the original arrays.

more info:  bf details | bf links | hint

tinako97
@tinako97
Aug 15 2015 01:34
I think I would use filter now.
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:34
Filter seems cleaner than what I did, but somehow I keep ending up with if/else, even inside of my filters. Lack of practice, I guess.
tinako97
@tinako97
Aug 15 2015 01:34
Actually, you need to retain both arrays until you have gone thru both, so I would still make another array, with .map.
Omar
@oab00
Aug 15 2015 01:35
@dnorthrupva use indexOf()
if it returns -1 means element inside bracket is not in the array
so filter out the ones that return anything but -1
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:36
I backed out of indexOf() earlier, I was trying it, but I couldn't figure out how to 'keep' the ones it didn't find.
function diff(arr1, arr2) {
  var newArr = [];
  for (i=0; i<= arr1.length; i++){
    for (j=0; j<=arr2.length; j++){
      if (indexOf(arr1[i]) === indexOf(arr2[j]));
        return;
        } else {
          newArr.push();
        }

    }
  }
  return newArr;


diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
This was my first stab at the bonfire.
That code was awful. Just...awful.
tinako97
@tinako97
Aug 15 2015 01:38
I don't see a way to avoid 2 maps and a 3rd array.
Donavin Northrup
@dnorthrupva
Aug 15 2015 01:38
So I guess my successful code wasn't -that- bad. I feel like I caved, though. Resorting to if/else'.
Omar
@oab00
Aug 15 2015 01:38
there is a way
combining both arrays then filtering
tinako97
@tinako97
Aug 15 2015 01:39
Does that assume there are no dupes in either array already?
Omar
@oab00
Aug 15 2015 01:40
combining [1, 2, 3] and [2, 3, 4] becomes [1, 2, 3, 2, 3, 4] then filter dupes
Danny Fritz
@dannyfritz
Aug 15 2015 01:41
finding dupes is pretty expensive though @oab00 :P
unless it is guaranteed to be sorted
tinako97
@tinako97
Aug 15 2015 01:42
None of the test cases seem to have dupes within arrays, so combine and filter would work I believe. You can look for dupes by seeing if indexOf = the current index.
Omar
@oab00
Aug 15 2015 01:44
for each element in the array slice it out then indexOf() if anything is found means its a dupe
tinako97
@tinako97
Aug 15 2015 01:45
I would think that the way I suggested would be more efficient, since nothing is sliced, just looked at?
Maybe it makes no difference.
Omar
@oab00
Aug 15 2015 01:47
indexOf = the current index returns true for both dupes and uniques ?
tinako97
@tinako97
Aug 15 2015 01:47
Not when you get to the second of the dupe.
Oh, you need to remove both.
You're right, slice will get you there. I'll have to make note of that trick. Thanks.
Robert Richey
@0x0936
Aug 15 2015 02:07
@dnorthrupva here's my Diff of Two Arrays - the code isn't pretty to look at, but this was written with the goal of fewest lines in mind
function diff(arr1, arr2) {
  var newArr = [];  
  newArr = arr1.filter(function(el) { if (arr2.indexOf(el) < 0) { return el; }}).concat(
    arr2.filter(function(el) { if (arr1.indexOf(el) < 0) { return el; }})
  );
  return newArr;
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
could probably just return all of that instead of assigning to newArr
function diff(arr1, arr2) {  
  return arr1.filter(function(el) { if (arr2.indexOf(el) < 0) { return el; }})
    .concat(arr2.filter(function(el) { if (arr1.indexOf(el) < 0) { return el; }}));  
}

diff([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Donavin Northrup
@dnorthrupva
Aug 15 2015 02:19
Oh nice @0x0936 You used all filter and concat. Interesting.
and indexOf, hah.
I'll have to keep this for reference later. Thank you.
Robert Richey
@0x0936
Aug 15 2015 02:22
@dnorthrupva Cheers :)
dc
@dcsan
Aug 15 2015 02:41
botstatus
CamperBot
@camperbot
Aug 15 2015 02:41
All bot systems are go!
botVersion: 0.0.9a
env: prod
botname: camperbot
Robert
@rc242
Aug 15 2015 02:47
heyo!
Robert Richey
@0x0936
Aug 15 2015 03:02
heyo @rc242
Mohamed A. Farouk
@captainmoha
Aug 15 2015 03:03
Hey :smile:
S. Solomon
@SHSolomon
Aug 15 2015 03:06
@matteverson No to sound like an idiot, but how do I check profile pages?
Mohamed A. Farouk
@captainmoha
Aug 15 2015 03:08
If you mean on gitter, Then just hover over a picture and a little thing will pop up.
Rex Schrader
@SaintPeter
Aug 15 2015 03:09
@SHSolomon Usually it's http://freecodecamp.com/username
M Used
@mildused
Aug 15 2015 03:09
@SaintPeter This is my dummy account though...d
Rex Schrader
@SaintPeter
Aug 15 2015 03:10
@mildused You're no dummy - I've seen your code ;)
M Used
@mildused
Aug 15 2015 03:10
@SaintPeter mildused is my throwaway
tinako97
@tinako97
Aug 15 2015 03:16
Does anyone know why a browser would ignore &nbsp; and break the words on either side onto two lines in some cases? I want a word and its associated value to be on the same line, but I don't want to set them on a new line if I don't have to. There's always plenty of room to move both parts onto a second line, but sometimes the browser splits them.
Rex Schrader
@SaintPeter
Aug 15 2015 03:17
@tinako97 In order to force words to stay on the same line you need to play with the whitespace and overflow css parameters
tinako97
@tinako97
Aug 15 2015 03:18
@SaintPeter OK, thx for the pointer. I will look those up.
M Used
@mildused
Aug 15 2015 03:18
Anyone want to learn React with me?
HayleeNeal
@HayleeNeal
Aug 15 2015 03:42
I just got to my jquery waypoints... and they're confusing me. Am I supposed to do the full jquery course on course academy, or just the first page that pops up?
Rex Schrader
@SaintPeter
Aug 15 2015 03:42
@HayleeNeal The full "section" - you'll get to a section ending type message for each element.
dc
@dcsan
Aug 15 2015 03:43
@mildused i want to learn react native
HayleeNeal
@HayleeNeal
Aug 15 2015 03:43
Okay. I just got to the second 'slide' in it and none of it's making any sense at all. idk why I took to html css and bootstrap really easily
M Used
@mildused
Aug 15 2015 03:45
@dcsan Pm'ed
Luis Felipe López G.
@luishendrix92
Aug 15 2015 03:45
@HayleeNeal Preferably, don't just do CodeAcademy, after you finish, watch videos about jQuery and Ajax, try blogs that write about it and practise it like mad.
Mohamed A. Farouk
@captainmoha
Aug 15 2015 03:47
@HayleeNeal jQuery was confusing for me at first too. What I did -and I don't know if it would help you or not- is that I turned to the Javascript waypoints and after I had finished them I returned to the jQuery ones.
it made a little more sense.
@HayleeNeal But the most important thing is like @luishendrix92 said. practice practice practice.
@HayleeNeal Don't give up.
HayleeNeal
@HayleeNeal
Aug 15 2015 03:54
I think I might do the JS waypoints first if it doesn't make sense tomorrow night. I'm getting tired so it might just be my mind calling it quits for the day.
jameswlytle
@jameswlytle
Aug 15 2015 04:07
function mutation(arr) {
  var ex = ('/[' + arr[1].toLowerCase() + ']+/g');
  var str = arr[0].toString();

  if (str.match(ex)) {
    return true;
  }

  return false;  
}
Anyone know why the above code might not work? Been working on this all day, and may just be too tired. thanks!!!
Further information regarding my question:

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.

The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.

Lastly, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.

Alex Marrufo
@AlexMarrufo
Aug 15 2015 04:11
anyone here?
Robert
@rc242
Aug 15 2015 04:11
@jameswlytle still trying to figure it out?
Alex Marrufo
@AlexMarrufo
Aug 15 2015 04:11
I need help with the gray background..
jameswlytle
@jameswlytle
Aug 15 2015 04:11
@rc242 yes. i know i am missing something simple. just trying to finish course.
Alex Marrufo
@AlexMarrufo
Aug 15 2015 04:12
.gray-background{background-color: gray;}
jameswlytle
@jameswlytle
Aug 15 2015 04:13
@AlexMarrufo looks right. does it give error or something?
@AlexMarrufo also what waypoint?
Robert
@rc242
Aug 15 2015 04:13
@jameswlytle the brackets match containing any char, not the same order.
Dayne Wright
@daynewright
Aug 15 2015 04:13
bf mutation
CamperBot
@camperbot
Aug 15 2015 04:13

:fire:Bonfire: Mutations :link:

function mutation(arr) {
  return arr;
}

mutation(['hello', 'hey']);

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

more info:  bf details | bf links | hint

jameswlytle
@jameswlytle
Aug 15 2015 04:13
@rc242 btw this is a different problem than earlier. I finally figured that one out. i was making it way too complicated.
Alex Marrufo
@AlexMarrufo
Aug 15 2015 04:13
it just doesn't seem to work, i put that between the <style> </style> element..
@jameswlytle
and waypoint 55 @jameswlytle
I know I'm supposed to put something in the <div> </div> class as well?
Robert
@rc242
Aug 15 2015 04:16
@jameswlytle oh, you have a new problem then?
jameswlytle
@jameswlytle
Aug 15 2015 04:16
@rc242 yep. it took a bit but i got the other one earlier.
Robert
@rc242
Aug 15 2015 04:17
@AlexMarrufo If you have the code, just post it.
jameswlytle
@jameswlytle
Aug 15 2015 04:26
@rc242 I think it is time to put this away for the night. I think that is probably the problem right now. thanks!
CamperBot
@camperbot
Aug 15 2015 04:26
jameswlytle sends brownie points to @rc242 :sparkles: :thumbsup: :sparkles:
Mistereo
@Mistereo
Aug 15 2015 04:27

@hansinla

var str = “”;
str += “Yes, you can”;
// is the same as
str = str + "Yes, you can"; // which is actually reassigning str to new string.

So, nope, you can't.

Amardeep
@Amardeep91
Aug 15 2015 04:50
hi ppl
viznev
@viznev
Aug 15 2015 04:51
@Amardeep91 howdy
Hans van Riet
@hansinla
Aug 15 2015 04:57
@Mistereo touché
Abhisek Pattnaik
@abhisekp
Aug 15 2015 05:08
@mildused no one will partner a dummy. :P
Abhisek Pattnaik
@abhisekp
Aug 15 2015 05:18
@jameswlytle What's your mutation code using regex?
M Used
@mildused
Aug 15 2015 05:24
@abhisekp Thanks for the compliment :cry:
CamperBot
@camperbot
Aug 15 2015 05:24
mildused sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 30 | @abhisekp | http://www.freecodecamp.com/abhisekp
dc
@dcsan
Aug 15 2015 05:26
haha, there's no regex for sarcasm!
M Used
@mildused
Aug 15 2015 05:27
Figured... @dcsan Thanks, you good for nothing loser ;)
CamperBot
@camperbot
Aug 15 2015 05:27
mildused sends brownie points to @dcsan :sparkles: :thumbsup: :sparkles:
:star: 96 | @dcsan | http://www.freecodecamp.com/dcsan
dc
@dcsan
Aug 15 2015 05:27
i'll take it :)
Abhisek Pattnaik
@abhisekp
Aug 15 2015 05:31
@dcsan nice creation there :)
Robert
@rc242
Aug 15 2015 05:53
oi.
dc
@dcsan
Aug 15 2015 06:08
@rc242 oi back!
about @rc242
Robert
@rc242
Aug 15 2015 06:12
who am i?! i don't even know half the time.
Harshal
@McQuinTrix
Aug 15 2015 06:12
@rc242 you are android
made by Dr. Gero
Robert
@rc242
Aug 15 2015 06:14
I prefer Tyrell.
Harshal
@McQuinTrix
Aug 15 2015 06:16
:::::
Binny Kim
@removed~BinnyK
Aug 15 2015 06:50
Is it just me or is it strange that the example Front End Development challenges (Twitch API, Camper News, Clock) etc are all written in ANGULAR even though angular hasn't been introduced yet?
I know i know... I peeked at the code (shhh!)
Abhisek Pattnaik
@abhisekp
Aug 15 2015 07:24
tx @dcsan
CamperBot
@camperbot
Aug 15 2015 07:24
abhisekp sends brownie points to @dcsan :sparkles: :thumbsup: :sparkles:
:star: 104 | @dcsan | http://www.freecodecamp.com/dcsan
Marcus Eisele
@eiselems
Aug 15 2015 08:20
Just finished the part about different Patterns for object-orientated programming in javascript. Is there (until now) a reason to use the functional class pattern?
Metazor
@metazor
Aug 15 2015 08:21
hey all
<style>
  .box {
    border-style: solid;
    border-color: black;
    border-width: 5px;
    text-align: center;
  } 
   .a-box {
    background-color: white;
    padding-left: 60px;
    padding-right: 20px;   
  }
  .b-box {
    background-color: white;
    padding-left: 50px;
    padding-right: 30px;    
  }
</style>
  <h5 class="box a-box">A</h5>
  <h5 class="box b-box">B</h5>
i have this code but i dont understand why A and B doesn't align
alt
looks like this
Marcus Eisele
@eiselems
Aug 15 2015 08:25
different padding?
Metazor
@metazor
Aug 15 2015 08:26
padding-left 60 and padding-right 20 for A and padding-left 50 and padding-right 30 for B
yes, but they add up to the same no? :)
just experimenting with css
Marcus Eisele
@eiselems
Aug 15 2015 08:26
if you have a 100cm table and two coins
one: you define the area where the coin may be placed from 20cm to 80cm
two: the area is from 0 to 60cm
now you center both coins in there area
where are they? (both got 60cm place)
Metazor
@metazor
Aug 15 2015 08:31
ok i get it now
thanks eiselems
Marcus Eisele
@eiselems
Aug 15 2015 08:31
no problem, problem with css is you only get good at it by using it :)
and I think even after a while you are sometimes still surprised after hitting refresh and seeing the results of changed css
Metazor
@metazor
Aug 15 2015 08:32
yeah, i started a few days ago
going over everything twice so my fundamentals will be solid
its crazy to do bootstrap and jquery after only a few days of coding
seems overwhelming a bit but doable
Marcus Eisele
@eiselems
Aug 15 2015 08:35
my first reaction to JQuery was how easy it is in comparison to plain Javascript
Metazor
@metazor
Aug 15 2015 08:36
well, i havent tried js yet
Marcus Eisele
@eiselems
Aug 15 2015 08:36
nice how much you can do in a limited space of time after firstly learning it
Metazor
@metazor
Aug 15 2015 08:36
sounds complicated
Andreia Melo
@andreiamlm
Aug 15 2015 08:37
hi! is it doable to use a virtualization of an OS X on win? using virtual box or something similar?
Metazor
@metazor
Aug 15 2015 08:38
yes eiselems, feels awesome to do fancy looking things so early
they will seem so basic after a few weeks
Abhisek Pattnaik
@abhisekp
Aug 15 2015 08:41
@andreiamlm i guess OSX works on Apple's proprietary arch. But there must be some hacks.
Andreia Melo
@andreiamlm
Aug 15 2015 08:41
i'm trying to run a virtualization don't know if will freeze my laptop :P
Abhisek Pattnaik
@abhisekp
Aug 15 2015 08:42
@andreiamlm It's always the RAM. Do you've enough of it?
Andreia Melo
@andreiamlm
Aug 15 2015 08:51
good question @abhisekp
well 8 Gb is not so bad right?
Abhisek Pattnaik
@abhisekp
Aug 15 2015 08:59
@andreiamlm good to go. :+1:
denisnurboja
@denisnurboja
Aug 15 2015 09:23
bonfire Roman Numeral Converter
CamperBot
@camperbot
Aug 15 2015 09:23

:fire:Bonfire: Roman Numeral Converter :link:

function convert(num) {
 return num;
}

convert(36);

Convert the given number into a roman numeral.

more info:  bf details | bf links | hint

denisnurboja
@denisnurboja
Aug 15 2015 09:23
hint
CamperBot
@camperbot
Aug 15 2015 09:23
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jonny Morley
@morley92
Aug 15 2015 10:32
Bonfire Factorialize a Number
CamperBot
@camperbot
Aug 15 2015 10:32

:fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
  return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

Jonny Morley
@morley92
Aug 15 2015 10:35
bf links
CamperBot
@camperbot
Aug 15 2015 10:35
Jonny Morley
@morley92
Aug 15 2015 10:35
bf hint
CamperBot
@camperbot
Aug 15 2015 10:35
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Marcus Eisele
@eiselems
Aug 15 2015 10:53
Has anyone found a free API for the "Build a Random Quote Machine" zipline? And minds sharing?
tinako97
@tinako97
Aug 15 2015 10:58
@eiselems I and some others used quotesondesign. If you get stuck on the api I can give you a tip. It was a little tricky.
Marcus Eisele
@eiselems
Aug 15 2015 11:00
http://codepen.io/eiselems/pen/rVbEQY just started with this but used theysaidso.com and they only offer a single quote of the day in the free plan
The button is pretty pointless then :), thank you
tinako97
@tinako97
Aug 15 2015 11:04
I'm having trouble with a space breaking that I don't want. I've tried &nbsp; and also I added a nowrap span: " <span class='.text-nowrap' >Upvotes:&nbsp;<span class='badge'>" + upvotes + "</span></span>". Either of these works in partial window mode to keep Upvotes and its value together, but as soon as I am in full screen, they are split apart whenever there's an img in the way. Problem goes away if I make it not a badge, but in that case it never needs to break, so that may be why. Anyone know why my code breaks on full screen? (Firefox and Chrome)
@eiselems Yes, that's not going to fly.
tinako97
@tinako97
Aug 15 2015 11:22
blob
Here's an image to show my problem described above.
tinako97
@tinako97
Aug 15 2015 12:03
I gave up and changed the words to icons.
Deepanshu Kaushik
@daksh844
Aug 15 2015 12:06
Hi Guys, can you please help me out on this code?
blob
it dosen't seems to work
Daniel Neumann
@NeuwDk
Aug 15 2015 12:08
@daksh844 this is a variable, you shouldn't pass it in as a string :)
Marcus Eisele
@eiselems
Aug 15 2015 12:08
@tinako97 think you set the class wrong
why the dot at the beginning?
tinako97
@tinako97
Aug 15 2015 12:10
Ah, you're probably right. Thanks.
Deepanshu Kaushik
@daksh844
Aug 15 2015 12:10
but in the hint section of codeacademy it's presented like this only
Marcus Eisele
@eiselems
Aug 15 2015 12:10
dont mix class names and selectors ;)
Deepanshu Kaushik
@daksh844
Aug 15 2015 12:11
@eiselems I've tried using single quotes as well, but nothing seems to work
Daniel Neumann
@NeuwDk
Aug 15 2015 12:11
@daksh844 yes. You should write $(this) and not $('this')
Marcus Eisele
@eiselems
Aug 15 2015 12:12
and then i think the color is invalid syntax. one # is enough
Deepanshu Kaushik
@daksh844
Aug 15 2015 12:12
@NeuwDk thanks worked now
CamperBot
@camperbot
Aug 15 2015 12:12
daksh844 sends brownie points to @neuwdk :sparkles: :thumbsup: :sparkles:
Daniel Neumann
@NeuwDk
Aug 15 2015 12:13
@daksh844 inside the function, this will refer to the DOM-object that received the event.
Arunav Konwar
@arunavkonwar
Aug 15 2015 13:38
for what reasons can there be an error while trying to publish after changing the version in NPM?
Lucas Vorsteveld
@Lucashv
Aug 15 2015 13:39
Bonfire Chunky Monkey
CamperBot
@camperbot
Aug 15 2015 13:39

:fire:Bonfire: Chunky Monkey :link:

function chunk(arr, size) {
  // Break it up.
  return arr;
}

chunk(['a', 'b', 'c', 'd'], 2);

Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.

more info:  bf details | bf links | hint

Lucas Vorsteveld
@Lucashv
Aug 15 2015 13:40
hint
CamperBot
@camperbot
Aug 15 2015 13:40
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Arunav Konwar
@arunavkonwar
Aug 15 2015 13:45
how to create a new file while in a console?
node js console
Soumya Rauth
@soumyaRauth
Aug 15 2015 14:06
WHY THERE ARE UNSOLVED bonfires within my solved bonfire map... How did i miss them??
Marceia Egler
@megler
Aug 15 2015 14:08

i just finished the loops module on code academy, but I have no understanding of what I've done. Here's my code:

var text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer faucibus Marceia nunc, sed luctus ante pulvinar eu. \ Fusce imperdiet elit rutrum tortor dictum, sed imperdiet est convallis. Curabitur ullamcorper, dui vel interdum tincidunt, nisi est \ interdum lacus, id rutrum odio nisi eu libero. Duis ac magna in lacus tempor cursus. Etiam ullamcorper gravida massa, vel \ maximus dolor sagittis sed. Duis ipsum risus, auctor ut scelerisque eget, sollicitudin a ex. Quisque tincidunt varius mi, eget \ condimentum enim. Vivamus mattis, augue vitae rutrum mattis, velit dui euismod metus, ut posuere mi eros vel ex. Fusce quis \ justo Marceia, lobortis enim nec, tristique sapien. Donec nisi nisi, blandit at sapien vitae, dignissim fermentum nisl. Integer \ ullamcorper velit eu dolor condimentum tempor";
var myName = "Marceia";
var hits = [];
for (var i=0; i <= text.length; i++) {
    if (text[i] === 'M') {
        for (var j = i; j < (myName.length + i); j++) {
            hits.push(text[j]);

        }
    }
}
if(hits.length === 0) {
    console.log("Your name wasn't found!");
} else {
    console.log(hits);
}

I understand first 3 var (text, myName, hits), but I don't understand what the loops are actually doing. Can someone explain it a little more clearly? Thanks!

This message was deleted
CamperBot
@camperbot
Aug 15 2015 14:08
:bulb: to format code use backticks! ``` more info
Bakulesh Singh
@bakulcsingh
Aug 15 2015 14:15
hey guys
Could someone please help me with accessing the javascript console in chrome devtools where we can see the output of bonfires
CamperBot
@camperbot
Aug 15 2015 14:17
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Soumya Rauth
@soumyaRauth
Aug 15 2015 14:17
WHY THERE ARE UNSOLVED bonfires within my solved bonfire map... How did i miss them?? What to do now?? plz help...
Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:20
@soumyaRauth goto http://freecodecamp.com/map and solve them
Bakulesh Singh
@bakulcsingh
Aug 15 2015 14:21
anyone at all?
Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:22
@bakulcsingh press F12
Bakulesh Singh
@bakulcsingh
Aug 15 2015 14:24
thanks @abhisekp
CamperBot
@camperbot
Aug 15 2015 14:24
bakulcsingh sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 39 | @abhisekp | http://www.freecodecamp.com/abhisekp
Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:25
@bakulcsingh but i recommend you to solve it in http://coderpad.io
Bakulesh Singh
@bakulcsingh
Aug 15 2015 14:25
Ill do that in a bit @camperbot but F12 doesnt seem to help
i see
let me check that
F12 is just seeming to affect my screen brightness :P
Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:26
@bakulcsingh remember to console.log your function name
@bakulcsingh Press Fn + F12 keys
Fn might be next to your spacebar somewhere
Bakulesh Singh
@bakulcsingh
Aug 15 2015 14:26
Ohk
Michael Perkhofer
@mperkh
Aug 15 2015 14:27
bonfire Friendly Date Ranges
CamperBot
@camperbot
Aug 15 2015 14:27

:fire:Bonfire: Friendly Date Ranges :link:

function friendly(str) {
  return str;
}

friendly(['2015-07-01', '2015-07-04']);

Implement a way of converting two dates into a more friendly date range that could be presented to a user.

more info:  bf details | bf links | hint

Michael Perkhofer
@mperkh
Aug 15 2015 14:27
bf details
CamperBot
@camperbot
Aug 15 2015 14:27

:fire:Bonfire: Friendly Date Ranges :link:

function friendly(str) {
  return str;
}

friendly(['2015-07-01', '2015-07-04']);
Implement a way of converting two dates into a more friendly date range that could be presented to a user.
It must not show any redundant information in the date range.
For example, if the year and month are the same then only the day range should be displayed.
Secondly, if the starting year is the current year, and the ending year can be inferred by the reader, the year should be omitted.
Input date is formatted as YYYY-MM-DD
Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>RSAP</a> if you get stuck. Try to pair program. Write your own code.
links:
Michael Perkhofer
@mperkh
Aug 15 2015 14:27
hint
CamperBot
@camperbot
Aug 15 2015 14:27
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Bakulesh Singh
@bakulcsingh
Aug 15 2015 14:27
got it @abhisekp
thanks
@abhisekp do we have a facebook page for indian campers?
Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:29
explain rooms
CamperBot
@camperbot
Aug 15 2015 14:29

:point_right: casual chat rooms [wiki]

The following are our casual chat rooms.

Please note that all chat rooms listed here are publicly accessible and indexed by search engines, so only share email addresses or other sensitive information in private messages.

Chat Room Description
Hardware chat about computer hardware and Internet of Things
GameDev chat about designing and developing video games
Gaming chat about gaming of all kinds, such as video games and table top games
TVandMovies chat about TV shows and movies
Sports chat about sports
Music chat about music
Art and Photography chat about art, photography and videography
Business chat about business and entrepreneurship
Saving chat about saving, investing, and home economics
SelfImprovement chat about productivity, self improvement and quantified self

By joining these chat rooms, you accept our Code of Conduct. If you think we should add a chat room, please message @quincylarson in Gitter.

Official Free Code Camp chat rooms
:pencil: read more about casual chat rooms on the FCC Wiki

Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:30
rooms
CamperBot
@camperbot
Aug 15 2015 14:30

rooms

See all the FreeCodeCamp rooms at gitter.im/FreeCodeCamp/rooms
Or check this wiki article for a shortlist
Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:30
help rooms
CamperBot
@camperbot
Aug 15 2015 14:30

:point_right: casual chat rooms [wiki]

The following are our casual chat rooms.

Please note that all chat rooms listed here are publicly accessible and indexed by search engines, so only share email addresses or other sensitive information in private messages.

Chat Room Description
Hardware chat about computer hardware and Internet of Things
GameDev chat about designing and developing video games
Gaming chat about gaming of all kinds, such as video games and table top games
TVandMovies chat about TV shows and movies
Sports chat about sports
Music chat about music
Art and Photography chat about art, photography and videography
Business chat about business and entrepreneurship
Saving chat about saving, investing, and home economics
SelfImprovement chat about productivity, self improvement and quantified self

By joining these chat rooms, you accept our Code of Conduct. If you think we should add a chat room, please message @quincylarson in Gitter.

Official Free Code Camp chat rooms
:pencil: read more about casual chat rooms on the FCC Wiki

Abhisek Pattnaik
@abhisekp
Aug 15 2015 14:30
help
CamperBot
@camperbot
Aug 15 2015 14:30

Hi I'm CamperBot! I can help you in this chatroom :smile:

Basic commands:

  • find TOPIC find all entries about topic. ex: find js
  • wiki TOPIC show contents of topic page
  • thanks @username send brownie points to another user
  • about @username shows info on that user
  • bonfire BFNAME info on a bonfire

:speech_balloon: meet camperbot in this room!

:pencil: read more about camperbot on the FCC Wiki

Martin Morissette
@studur
Aug 15 2015 14:49
find where art thou
CamperBot
@camperbot
Aug 15 2015 14:49
find where art thou
nothing found
fateshaper
@fateshaper
Aug 15 2015 14:50
hi guys
working on map the debris right now
would love your input on my code that i'm troubleshooting right now
function orbitalPeriod(arr) {

  var newarr = arr;
  var finalarr = [];

  for (i=0; i < arr.length; i++){
    finalarr.push([]);
    var orbitalperiod = calculate(newarr[i].avgAlt); 
    finalarr[i].name = newarr[i].name;
    finalarr[i].orbitalPeriod = orbitalperiod;
  }
  return(finalarr);
};

function calculate(avgAlt){
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  var finalradius = earthRadius + avgAlt;
  var first = Math.pow(finalradius,3);
  var lolcat = first/GM;
  var lolcat2 = Math.pow(lolcat,0.5);
  var orbitalperiod = Math.round(2 * Math.PI * lolcat2);

  return orbitalperiod;
}



orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]);
returning finalarr returns [[],[],[]] (ie. only the finalarr.push affected finalarr
but the finalarr[i].name = newarr[i].name lines don't add objects into the array. any idea? is this due to scope/closure?
Moisés Man
@moigithub
Aug 15 2015 15:03
@fateshaper u pushing an empty array.. then.. ?
what u doin here ??
finalarr[i].name = newarr[i].name;
finalarr[i].orbitalPeriod = orbitalperiod;
Feners4
@Feners4
Aug 15 2015 15:03
can I get some help with getting my search icon to display http://codepen.io/Feners4/pen/ZGZORX
fateshaper
@fateshaper
Aug 15 2015 15:03
creating new object in the array
Moisés Man
@moigithub
Aug 15 2015 15:11
@fateshaper but.. ur last push its an array.....
so to that array u "trying" to change its name property.. wich do not exist.. and cant be added.. cuz its an array, arrays dont behave as objects
@fateshaper but.. i think.. IF u push an object instead an array....
finalarr.push( {} );
Teejay Parker
@TeejayParker
Aug 15 2015 15:55
Added to the PlugDJ RCS settings "ReadMe" in case reCursive or myself aren't around: https://github.com/Majeye/majeye.github.io
Tyler
@teesloane
Aug 15 2015 16:03
can anyone link me some help for learning how to implement a search box a la twitch api zipline ... I just don't know where to get started.
Cristián Berríos
@crisberrios
Aug 15 2015 16:04
well... if it's using jQuery
1st there's the search box
Tyler
@teesloane
Aug 15 2015 16:05
I've built that in html.
Cristián Berríos
@crisberrios
Aug 15 2015 16:05
and you have to be able to listen to its changes
Tyler
@teesloane
Aug 15 2015 16:05
right.
Cristián Berríos
@crisberrios
Aug 15 2015 16:05
so... $(searchbox).on(change).... or similar
then... with the data from the searchbox hit some API
Tyler
@teesloane
Aug 15 2015 16:06
"hit some API" >?
Cristián Berríos
@crisberrios
Aug 15 2015 16:06
at this point, a rate limiter for the searchbox is often useful
Tyler
@teesloane
Aug 15 2015 16:06
can you give me an ELI5?
Cristián Berríos
@crisberrios
Aug 15 2015 16:06
hmm ask a server for results
like google?
Tyler
@teesloane
Aug 15 2015 16:06
ie> "build an html search box >style it if you want > you need to connect it to your javascript file >
Cristián Berríos
@crisberrios
Aug 15 2015 16:06
well yes
1st you build the box, then you connect it to JS... but "connecting to js" is most of the zipline
Tyler
@teesloane
Aug 15 2015 16:07
right.
Cristián Berríos
@crisberrios
Aug 15 2015 16:07
so on this part
Tyler
@teesloane
Aug 15 2015 16:07
it's a bonus "user story" at this point for me.
Cristián Berríos
@crisberrios
Aug 15 2015 16:07
1 would be listening to the changes on the search box
ok. Listening for changes = looking for a text input and doing something based on it.
Cristián Berríos
@crisberrios
Aug 15 2015 16:09
yes
well I see you're mostly done I think?
if you got there by yourself then many of these steps are already solved
Tyler
@teesloane
Aug 15 2015 16:10
yes, I'm mostly done - I just want to learn how to create a search bar that queries my array of uers.
Users.
Cristián Berríos
@crisberrios
Aug 15 2015 16:10
though you are still missing some parts of course
Tyler
@teesloane
Aug 15 2015 16:10
yep.
Thanks for reminding me :|
currently working on them.
ha
Cristián Berríos
@crisberrios
Aug 15 2015 16:11
so you want to query the array of users
not the server
Tyler
@teesloane
Aug 15 2015 16:11
you mean not the API server?
Cristián Berríos
@crisberrios
Aug 15 2015 16:11
yes
Tyler
@teesloane
Aug 15 2015 16:11
right--I have an array of users called regulars
Is there a documentation that I should refer to for figuring this out?
I know the example listed of FCC uses angular—and I don't know angular well enough / if it uses angular for the search bar that is not much help for me.
Cristián Berríos
@crisberrios
Aug 15 2015 16:13
hmm I think regex and Array.filter should be enough to deal with this scenario
but of course there are many ways to search
Tyler
@teesloane
Aug 15 2015 16:13
ahhh
Cristián Berríos
@crisberrios
Aug 15 2015 16:13
like fuzzy search and whatnot
Tyler
@teesloane
Aug 15 2015 16:13
(what is fuzzy search)?
Cristián Berríos
@crisberrios
Aug 15 2015 16:13
couldn't explain it so google it :(
Tyler
@teesloane
Aug 15 2015 16:13
so the search bar more so just displays what matches the input.
ok.
SarthakAdhikari
@SarthakAdhikari
Aug 15 2015 16:14
Hi guys
Cristián Berríos
@crisberrios
Aug 15 2015 16:14
there's also many ways of doing a typeahead which is often useful for this scenario too
SarthakAdhikari
@SarthakAdhikari
Aug 15 2015 16:14
anyone here to help me with a JS challenge @codecademy? :D
Cristián Berríos
@crisberrios
Aug 15 2015 16:14
to show the search results as options
sure @SarthakAdhikari what's the problem?
Tyler
@teesloane
Aug 15 2015 16:15
ah, thanks @crisberrios
CamperBot
@camperbot
Aug 15 2015 16:15
ozlone sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
:star: 112 | @crisberrios | http://www.freecodecamp.com/crisberrios
Tyler
@teesloane
Aug 15 2015 16:15
WOAH CAMPERBOT THATS NEW
Thanks @camperbot
CamperBot
@camperbot
Aug 15 2015 16:15
ozlone sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 12 | @camperbot | http://www.freecodecamp.com/camperbot
Cristián Berríos
@crisberrios
Aug 15 2015 16:15
lol
Mike Moss
@MMux
Aug 15 2015 16:21
Pomodoro Timer: I'm thoroughly confused on how to approach. I built out the visual, now I'm doing the JS. Do I first build a time object, and feed it into a function that decrements?
Michael Bomholt
@bomholtm
Aug 15 2015 16:21
hey guys really dont know in which channel to ask. does some know a simple and open source ecommerce solution using mean stack or js?
Cristián Berríos
@crisberrios
Aug 15 2015 16:23
@MMux that would be a good way of using closures and a better reasoning than just going with a simple variable.
that could allow you to create multiple timers for a more complex case
Mike Moss
@MMux
Aug 15 2015 16:24
@crisberrios k. time to read up on that. I'm a newbie to closures.
Cristián Berríos
@crisberrios
Aug 15 2015 16:24
have you read any JS book before?
Mike Moss
@MMux
Aug 15 2015 16:25
i have eloquent JS, and I read the John Duckett book, JavaScript and jQuery
you recommend a specific resource?
Cristián Berríos
@crisberrios
Aug 15 2015 16:26
hmm those should cover closures at some chapter, but you could jump to JS: The good parts or YDKJS: Scope and closures
the 2nd one is free (digital)
Mike Moss
@MMux
Aug 15 2015 16:27
I will check it out. thx
Cristián Berríos
@crisberrios
Aug 15 2015 16:28
and I recommend the 1st one a lot since it's very insightful and concise
Mike Moss
@MMux
Aug 15 2015 16:28
I have that book too.
just realized...
Cristián Berríos
@crisberrios
Aug 15 2015 16:28
well then you're on your way to become a js master
:D
Mike Moss
@MMux
Aug 15 2015 16:29
@crisberrios yeah, maybe next week! :)
Sudeepto
@Sudeepto
Aug 15 2015 16:29

Good evening campers.

@crisberrios Are you suggesting this book ??

Cristián Berríos
@crisberrios
Aug 15 2015 16:29
yep all the series
they can be found on github
Michael Berlet
@MrNegimaki
Aug 15 2015 16:31
Working on "Chunky Monkey" Bonfire. Code provides successful return of [[0, 1], [2, 3], [4, 5]] for chunk([0, 1, 2, 3, 4, 5], 2), but [ [ 'a', 'b' ], [ 'b', 'c' ] ] for chunk(['a', 'b', 'c', 'd'], 2). Why does this discrepancy occur? Any thoughts on how to fix it?
function chunk(arr, size) {
  if(arr.length % size === 0)
    {
    var coreArray = [];
    var howManySubArrays = arr.length / size;
    var subArray = [];
    var newSub = 0;
    for(j=0; j<howManySubArrays; j+=1) // this loop working correctly
      {

      for(i=(0+newSub); i<(size+newSub); i++)
        {
          subArray.push(arr[i]);
        }
      newSub += (howManySubArrays-1);
      coreArray.push(subArray);
      subArray = [];
      }
    return coreArray;
    }
}

chunk(['a', 'b', 'c', 'd'], 2);
Sudeepto
@Sudeepto
Aug 15 2015 16:32

@crisberrios BTW, I am doing the Practice Functional Programming waypoint.

Have you completed all of them ??

Cristián Berríos
@crisberrios
Aug 15 2015 16:33
yes, I think I was one of the ppl who proposed it to be part of the curriculum
Mike Moss
@MMux
Aug 15 2015 16:34
@crisberrios is there a specific order in which to read the series that you recommend?
Cristián Berríos
@crisberrios
Aug 15 2015 16:34
but somehow http://reactive-extensions.github.io/learnrx/ this version has less bugs
I haven't compared the code but at least the challenges are the same
@MMux hmm nope, they should be in the "advanced" category so at that point you should be able to understand any of them
Sudeepto
@Sudeepto
Aug 15 2015 16:35
@crisberrios So should I use the above website or the one in bonfire ??
Cristián Berríos
@crisberrios
Aug 15 2015 16:36
hmm maybe the one I posted, I don't know because many ppl have completed the bonfire one without problems
but if you haven't started then go with the one I posted since it's "newer"
Sudeepto
@Sudeepto
Aug 15 2015 16:39
@crisberrios Thanks. I will use the one you suggested.
How many exercises should I complete before moving on to the next waypoint. As someone told me that there are well over 30 exercises ?? Should I complete all the exercise as the bonfire hasn't mentioned any limit ??
CamperBot
@camperbot
Aug 15 2015 16:39
sudeepto sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
:star: 113 | @crisberrios | http://www.freecodecamp.com/crisberrios
Cristián Berríos
@crisberrios
Aug 15 2015 16:39
Hmm only the last ones use reactive extensions
Sudeepto
@Sudeepto
Aug 15 2015 16:39
Hey !! What are brownie points ??
Cristián Berríos
@crisberrios
Aug 15 2015 16:39
I think it's good to do those
but also I think you can skip them
Sudeepto
@Sudeepto
Aug 15 2015 16:40
@crisberrios Thanks . I will try to complete them :smile:
CamperBot
@camperbot
Aug 15 2015 16:40
sudeepto sends brownie points to @crisberrios :sparkles: :thumbsup: :sparkles:
:star: 114 | @crisberrios | http://www.freecodecamp.com/crisberrios
Cristián Berríos
@crisberrios
Aug 15 2015 16:40
it's like reddit karma I think
Michael Berlet
@MrNegimaki
Aug 15 2015 16:46
@ozydesign Thanks, man!
CamperBot
@camperbot
Aug 15 2015 16:46
mrnegimaki sends brownie points to @ozydesign :sparkles: :thumbsup: :sparkles:
:star: 9 | @ozydesign | http://www.freecodecamp.com/ozydesign
Robert
@rc242
Aug 15 2015 16:51
heyo.
ronald
@ronstarcool
Aug 15 2015 16:54
anyone tips for me on the "Binary Agents" bonfire??
Robert
@rc242
Aug 15 2015 17:00
bf binary agents
CamperBot
@camperbot
Aug 15 2015 17:00

:fire:Bonfire: Binary Agents :link:

function binaryAgent(str) {
  return str;
}

binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111');

Return an English translated sentence of the passed binary string.

more info:  bf details | bf links | hint

Luis Felipe López G.
@luishendrix92
Aug 15 2015 17:01
@ronstarcool ParseInt base 2, fromCharCode (ASCII codes to letters).
Robert
@rc242
Aug 15 2015 17:01
@ronstarcool what are you having problems with?
Young Lee
@young92117
Aug 15 2015 17:01
Is my solution to bonfire exercise saved? I think I’ve seen someone said that it is saved but I don’t see my solution get saved. Is there any way to retrived my past solution?
ronald
@ronstarcool
Aug 15 2015 17:02
@luishendrix92 i got a tip now....lets see if i can work it out.
@rc242 im gonna try!
Young Lee
@young92117
Aug 15 2015 17:11
Never mind… I found out… I’m kind of new at this… :)
Michael Berlet
@MrNegimaki
Aug 15 2015 17:12
If anyone wants to take a quick peek at my Chunky monkey code via screenhero, my email is berlmd8@gmail.com. Just let me know
Young Lee
@young92117
Aug 15 2015 17:16
@MrNegimaki What is the problem that you are having?
Michael Berlet
@MrNegimaki
Aug 15 2015 17:26
I think I resolved it.
Mahtab
@RoadToCode822
Aug 15 2015 17:28
Why isn’t my palindrome function working?
function palindrome(str) {
  str = str.toLowerCase().replace(/\W/g, '');
  str = str.split('').reverse().join('');
  return true;
}

//race car

palindrome("eye");
Nic Galluzzo
@ngalluzzo
Aug 15 2015 17:28
it’s returning true every time
needs an if statement in there
and you need two different variables so you can compare against them.
Luis Felipe López G.
@luishendrix92
Aug 15 2015 17:42
@RoadToCode822 YOu are replacing str two times, one to make it clean and the second to reverse it, you only have one value and that's str. You need, according to your approach, another variable to hold the reversed one.
Robert
@rc242
Aug 15 2015 17:44
@RoadToCode822 @luishendrix92 Strings are immutable. If you wish, you could just use a conditional directly on str and the "reversed" str.
@RoadToCode822 In fact, you never have to assign any values, but this makes the code slightly harder to read.
...and extremely inefficient.
Cody Bouscaren
@codybousc
Aug 15 2015 17:51
Hi all,
I'm stuck on Bonfire# 31, the sum of all primes! I commented my code to show what I think is happening. At this point, I'm just trying to build an array of primes, and I will then sum that array. Right now though, I'm unable to get prime numbers into the array. Any advice would be greatly appreciated!!! Also, the console.logs are there just to help me understand the code.
function sumPrimes(num) {
    var arr = []; 
    var primes = [];
    //creates an array from 2 up to 1 less than the provided parameter 
    for (var i = 2; i < num; i++){
        arr.push(i)
    }
    //last value in arr
    var lastElement = arr.slice(-1)[0];
    //sets evenlyDivisible value to false 
    var evenlyDivisible = false; 

    //should divide (1 less than) num by every value in arr (starting from the 0 index) 
    for (var i = lastElement; i > 1; i--) {
        for (var j = arr[0]; j < lastElement; j++) {
            console.log("I is : " + i);
            console.log("J is : " + j); 
            if (i % j === 0 && j !== i) {
                console.log(i + " IS EVENLY DIVISIBLE BY " + j); 
                evenlyDivisible = true; 
                break; 
           }        
        }//inner for loop closing bracket 
            //if the i was not evenly divisible by j (j being every value in arr) then push j to the primes array
            if (evenlyDivisible === false) {
                 primes.push(i)   
            }
          console.log(primes); 
    }//outer for loop closing bracket

}

console.log(sumPrimes(10));
Robert
@rc242
Aug 15 2015 17:54
@codybousc well, for one, you appear to iterate up to lastElement in your inner for-loop. You'll want to iterate over all elements.
@codybousc n/m. I just noticed it's sorted.
Cody Bouscaren
@codybousc
Aug 15 2015 17:59
@rc242 for some reason, when i hit a prime and 'evenlyDivisible' is false it still won't push to the primes array
not sure why
Robert
@rc242
Aug 15 2015 18:01
@codybousc oh, you never reset the evenlyDivisible to false after 9.
Cody Bouscaren
@codybousc
Aug 15 2015 18:02
@rc242 after 9?
Robert
@rc242
Aug 15 2015 18:02
or 10.. whatever.
Cody Bouscaren
@codybousc
Aug 15 2015 18:03
where in the code should that happen?
Robert
@rc242
Aug 15 2015 18:03
@codybousc you're setting a boolean value to true. it's always true after you find the first evenlyDivisble.
Cody Bouscaren
@codybousc
Aug 15 2015 18:04
hmm
so do i need an else block that sets it to false?
Robert
@rc242
Aug 15 2015 18:04
@codybousc well, when's the last time you care about the value of evenlyDivisible?
Cody Bouscaren
@codybousc
Aug 15 2015 18:05
@rc242 that was it!
grrrr
thank you!
Mahtab
@RoadToCode822
Aug 15 2015 18:42
Why doesn’t this work?
function palindrome(str) {
  var oldString = str.toLowerCase().replace(/\w/g, '');
  var newString = oldString.split('').reverse().join('');
  if (oldString == newString){
    return true;
  }
  else {
    return false;
  }
}



palindrome("eye");
never mind, i changed the regex to \W, and now its working
Pepe Miyashiro
@beatpeep
Aug 15 2015 19:06
It looks like your var newString becomes an Array after using join
So you are compating string and an Array.
Rex Schrader
@SaintPeter
Aug 15 2015 19:26

Be Aware that the site is currently migrating to beta. No progress will be saved until this is complete. Check the main chat for status updates.

Robert
@rc242
Aug 15 2015 19:28
@SaintPeter Oh?
Christopher Stewart
@cjstewart13
Aug 15 2015 19:29
I may not be understanding Object.key() or obj.hasOwnProperty(); but I don't know why this is returning an empty array.
function where(collection, source) {
  var arr = [];
  // What's in a name?
  for(var i in collection){

  if (collection.hasOwnProperty(source) === collection.keys(source)){
    arr = arr.push(collection);
  }

  }
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
Rex Schrader
@SaintPeter
Aug 15 2015 19:29
@rc242 Yup - Quincy just announced it a little while ago in main chat.
Christopher Stewart
@cjstewart13
Aug 15 2015 19:29
its the where art thou bonfire
ronald
@ronstarcool
Aug 15 2015 19:33
anyone in for : Bonfire: Everything Be True ?
Robert
@rc242
Aug 15 2015 19:41
@cjstewart13 Not sure what you're trying to do there actually.
Omar
@oab00
Aug 15 2015 19:42
new release! it's about time :)
Robert
@rc242
Aug 15 2015 19:43
@cjstewart13 you're iterating over a set of keys, but not doing anything with the keys.
Christopher Stewart
@cjstewart13
Aug 15 2015 19:43
So collection is an array of objects (in this case the keys are first and last names). function where should search through collection and push out an array of objects that match the source object (in this case, key last name value capulet)
Nic Galluzzo
@ngalluzzo
Aug 15 2015 19:43
anything I can do to make my no repeats solution better?
function permAlone(str) {
  var permutations = [],
      newPerm = [],
      theString = str.split('');
  var dupes = new RegExp(/(.)\1+/);
  function permutate(theString) {

    if (theString.length === 0) {
      permutations.push(newPerm.join(''));
    }

    for(var i = 0; i < theString.length; i++) {
        theString.push(theString.shift());
        newPerm.push(theString[0]);
        permutate(theString.slice(1));
        newPerm.pop();
    }
  }

  permutate(theString);
  var no_repeats = permutations.filter(function(permutation) {
    return !dupes.test(permutation);
  });

  return no_repeats.length;
}

permAlone('aab');
Christopher Stewart
@cjstewart13
Aug 15 2015 19:46
The first if statement. Couldn't you just return str @ngalluzzo
Nic Galluzzo
@ngalluzzo
Aug 15 2015 19:47
@cjstewart13 nope.. because theString ends up being an empty array, so it’s still an object therefore true
Christopher Stewart
@cjstewart13
Aug 15 2015 19:48
Ahh now I see
Robert
@rc242
Aug 15 2015 19:49
@cjstewart13 Perhaps if you do console.log(collection) you'll see the error. The properties you're looking for don't exist as you think.
@ngalluzzo memoization.
Nic Galluzzo
@ngalluzzo
Aug 15 2015 19:50
@rc242 i’ll look into that
Robert
@rc242
Aug 15 2015 19:51
@ngalluzzo it appears you probably use the same prefix multiple times.
Nic Galluzzo
@ngalluzzo
Aug 15 2015 19:51
for theString?
Robert
@rc242
Aug 15 2015 19:53
@ngalluzzo you're also generating all the possible permutations and then filtering the repeats.
@ngalluzzo there's no reason to continuing generating strings with a prefix of abb. They'll all be invalid.
Nic Galluzzo
@ngalluzzo
Aug 15 2015 19:54
yeah true that!
Mahtab
@RoadToCode822
Aug 15 2015 19:54
Why isn’t this working? Console log in FCC is yielding: [5,27,39,1001], which is correct
var largest = 0;
var num = [];
function largestOfFour(arr) {
  for (i=0; i<arr.length; i++){
  var subArray = arr[i];
  for (j = 0; j < subArray.length; j++){
      if(largest < subArray[j]) {
        largest = subArray[j];
      }
    }
  num.push(largest);
  }
  return num;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Nic Galluzzo
@ngalluzzo
Aug 15 2015 19:55
that should be a pretty easy check too.. and would get rid of the entire bottom block
Feners4
@Feners4
Aug 15 2015 19:55
@SaintPeter hey! could you help me with getting my search icon to display, i cant get this to work! http://codepen.io/Feners4/pen/ZGZORX
Rex Schrader
@SaintPeter
Aug 15 2015 19:56
@Feners4 I've only got a couple mins, but let me take a look
Robert
@rc242
Aug 15 2015 19:56
@cjstewart13 Also, I would keep in mind that collection is an object. {last, first} is an object in your collection.
Ozy Design & Software
@OzySky
Aug 15 2015 19:58
@RoadToCode822 what is the error that is displayed?
Robert
@rc242
Aug 15 2015 19:58
@RoadToCode822 why not just move the num array inside the loop?
er, function
Christopher Stewart
@cjstewart13
Aug 15 2015 19:58
@rc242 So with each iteration it is looking at each object. So then I would have to have something to look at collection[i]?
Robert
@rc242
Aug 15 2015 19:59
@cjstewart13 right, this will get you access to the indices of that array object.
Rex Schrader
@SaintPeter
Aug 15 2015 19:59
@Feners4 It looks like you need to add your glypicon classes to something other than the input element.
Mahtab
@RoadToCode822
Aug 15 2015 20:00
Errors:
(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);expected [ Array(8) ] to deeply equal [ 5, 27, 39, 1001 ]
assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));expected [ Array(8) ] to deeply equal [ 9, 35, 97, 1000000 ]
Feners4
@Feners4
Aug 15 2015 20:00
@SaintPeter thanks!
CamperBot
@camperbot
Aug 15 2015 20:00
feners4 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
api offline
Mahtab
@RoadToCode822
Aug 15 2015 20:00
@rc242 what do you mean ??
oh why do you think i should move the num array inside the loop? and which loop? @rc242
Robert
@rc242
Aug 15 2015 20:01
@RoadToCode822 You have the num array int he global scope.
@RoadToCode822 So, it's probably never getting reinitialized. You'll want to move it to the function to have it initialized when in the function scope.
Mahtab
@RoadToCode822
Aug 15 2015 20:03
Can you explain what you mean by initialization
Robert
@rc242
Aug 15 2015 20:04
This message was deleted
er
Mahtab
@RoadToCode822
Aug 15 2015 20:04
i’m having trouble with the concept of initialization. Why would the num array need to be initialized? What is initializing? Why can’t it be re-initialized when its in the global scope
Robert
@rc242
Aug 15 2015 20:04
var num = [];
Mahtab
@RoadToCode822
Aug 15 2015 20:07
when does one need to reinitialize?
Robert
@rc242
Aug 15 2015 20:07
@RoadToCode822 Initialized is just setting a variable to some initial value. You may be reusing the num array depending on the backend of the testing platform that FCC uses.
Mahtab
@RoadToCode822
Aug 15 2015 20:08
What if you just did “var num = new Array();"
is that initialized as well
or just declared
Robert
@rc242
Aug 15 2015 20:08
@RoadToCode822 that's really dependent on what you're trying to accomplish. Here, you'll need to have largest and num initialized to get the largest value of each array.
@RoadToCode822 again, you can just move both variables outside the global scope and into the function scope. There's no need to have them at the global scope.
Jesse
@jctm30
Aug 15 2015 20:09
is maintenance still going on?
Rex Schrader
@SaintPeter
Aug 15 2015 20:10
@jctm30 Check the top of the map page for status: http://www.freecodecamp.com/map
It's still going on
Jesse
@jctm30
Aug 15 2015 20:10
@SaintPeter thanks got it
CamperBot
@camperbot
Aug 15 2015 20:10
api offline
jctm30 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
Robert
@rc242
Aug 15 2015 20:10
@RoadToCode822 I would just call that a declaration and initialization.
Mahtab
@RoadToCode822
Aug 15 2015 20:12
After changing the scope of the variables, it worked, but would like to know in practicality whether my solution would still be correct?
i’m guessing that it should be due to scope chaining
Robert
@rc242
Aug 15 2015 20:13
@RoadToCode822 It may work for the first invocation of the function, but never again.
Mahtab
@RoadToCode822
Aug 15 2015 20:13
But good practice would be to not pollute the global scope, hence keeping variables within their respective function scope?
why never again @rc242 ?
Robert
@rc242
Aug 15 2015 20:13
@RoadToCode822 You may still have a problem with the "largest" value.
Mahtab
@RoadToCode822
Aug 15 2015 20:14
what problem? its showing i got it right using this code:
function largestOfFour(arr) {
  var largest = 0;
  var num = [];
  for (i=0; i<arr.length; i++){
  var subArray = arr[i];
  for (j = 0; j < subArray.length; j++){
    if(largest < subArray[j]) {
      largest = subArray[j];
    }
    }
   num.push(largest);
  }
  return num;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Robert
@rc242
Aug 15 2015 20:14
@RoadToCode822 The num array is in the global scope. It's initialized once to an empty array, and you continue to reuse it and add values onto that array.
@RoadToCode822 That still has bugs. It works because the largest in each array is larger than the largest in the previous array.
@RoadToCode822 I would suggest adding console.log() methods in that function to see what's going on in the code.
@RoadToCode822 to give you an example that would fail, try using [[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1,2,3,4]]
Mahtab
@RoadToCode822
Aug 15 2015 20:20
how about now:
function largestOfFour(arr) {
  var largest = 0;
  var num = [];
  for (i=0; i<arr.length; i++){
  var subArray = arr[i];
  for (j = 0; j < subArray.length; j++){
    if(largest < subArray[j]) {
      largest = subArray[j];
    }
    }
   num.push(largest);
   largest = 0;
  }
  return num;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1,2,3,4]]);
the 1,2,3,4 array now allows largest to be 4.
Did you have a different way of fixing the bug? If so, i’d love to know. I also know that I could do this using math max, which i will try next, but I wanted to use something I learned from the factorialize bonfire to do this as a challenge
Mark Dang
@dangm24
Aug 15 2015 20:28
Hey all I could use some help on Bonfire: Make a Person
CamperBot
@camperbot
Aug 15 2015 20:28
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Tim Millar
@tim-millar
Aug 15 2015 20:29
I think a nice clean why to write the largestOfFour function is to write a helper that finds the max of an array and then map it to the input array.
Jakob Dahl
@saadanerdetbare
Aug 15 2015 20:30
@RoadToCode822 you should take a look at Math.max.apply() https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max for that bonfire
Mahtab
@RoadToCode822
Aug 15 2015 20:30
function largestOfFour(arr) {
  var num = [];
  for (i=0; i<arr.length; i++){
  var largest = Math.max.apply(null, arr[i]);
  num.push(largest);
  }
  return num;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
I just wrote that as an alternative solution as well
@saadanerdetbare
Jakob Dahl
@saadanerdetbare
Aug 15 2015 20:31
:)
Mahtab
@RoadToCode822
Aug 15 2015 20:31
I have a question: Why did they use null as a parameter in this var largest = Math.max.apply(null, arr[i]);
Jakob Dahl
@saadanerdetbare
Aug 15 2015 20:33
@RoadToCode822 the first parameter is what you pass as the thing to use as this in the operation
you can also pass the Math object itself
Mahtab
@RoadToCode822
Aug 15 2015 20:34
what do you mean by “as the thing to use as this in the operation"
Robert
@rc242
Aug 15 2015 20:34
@RoadToCode822 I would read what the function does before really using it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
Jakob Dahl
@saadanerdetbare
Aug 15 2015 20:35
the mdn docs can explain that much better than i can :)
Rafael J. Rodriguez
@Rafase282
Aug 15 2015 20:48
was ist das?
Sophanarith Sok
@sok213
Aug 15 2015 20:57
Can anyone help me with loading the Twitch JS SDK?
I am trying to load it as instructed here https://github.com/justintv/twitch-js-sdk but the console has an error that says "Cannot read property 'extend' of undefined" I have already included my twitch client ID within the script source. Any help or suggestions would really help me out.
Cody Bouscaren
@codybousc
Aug 15 2015 21:17
This message was deleted
Hey all, I've got a question about Bonfire #34. The assignment instructions say to continually delete the first value in an array until the function (second argument passed) equals true. I'm slightly confused though, because when I 'access' the second argument in my code it's equal to 'function anonymous(n)' and not a boolean. I imagine that i'm missing something here. Any advice would be greatly appreciated!
function drop(arr, func) {
  var arg = arguments[1]; //will this ever = true or will it always equal 'function anonymous(n)'?

    while(arg === false) {
        arr.shift(); 
    } 
  return arr;
}
drop([1, 2, 3], function(n) {return n < 3; });
Tim Millar
@tim-millar
Aug 15 2015 21:21
@codybousc you need to repeatdely apply the function to the elements of the array until it returns true
Cody Bouscaren
@codybousc
Aug 15 2015 21:22
@tim-millar that's what i was attempting to do with the 'while(arg === false)' loop
is there a better way to approach this?
Tim Millar
@tim-millar
Aug 15 2015 21:23
arg will never equal false
it is a function
you need to apply it in order to evaluate it to a boolean
Cody Bouscaren
@codybousc
Aug 15 2015 21:25
i guess i'm a bit confused about how to 'apply' it seeing that it's the second parameter passed into a function. @tim-millar
Tim Millar
@tim-millar
Aug 15 2015 21:29
you just need to call it on the elements of the array in the usual way
function application in js is like this: for some function, func, which takes one numeric argument, call it by writing the function name and then the argument inside parens, func(6).
now, it seems to me that you might have a couple of other problems in your code, but maybe they will be easier to spot when you are calling the predicate properly
Ozy Design & Software
@OzySky
Aug 15 2015 21:36
can anyone explain to me why on no repeats aab = 2 permutations?
Chocobowings
@chocobowings
Aug 15 2015 21:41
@ozydesign Permutations for "aab" = "aab","aba","baa","aab","aba","baa".
Ozy Design & Software
@OzySky
Aug 15 2015 21:42
so it should be one, no? @chocobowings
Chocobowings
@chocobowings
Aug 15 2015 21:42
@ozydesign So the two permutations are: "aba" ,"aba";
Ozy Design & Software
@OzySky
Aug 15 2015 21:43
@chocobowings didn't quite catch why, since they are the same....
Chocobowings
@chocobowings
Aug 15 2015 21:44
@ozydesign Cause it is treating each character as unique . So each "a" character is diferent
@ozydesign Imagine: "aba" = 123, so the permutations is 123 and 321
Ozy Design & Software
@OzySky
Aug 15 2015 21:46
@chocobowings so the link is a bit misleading really...
Chocobowings
@chocobowings
Aug 15 2015 21:46
@ozydesign Yeah
Cody Bouscaren
@codybousc
Aug 15 2015 21:57
@tim-millar am i getting closer with this?
function drop(arr, func) {

  while (arr.length >= 0)
    if (func(arr) === false) {
      arr.shift(); 
    }
  return arr;
}

drop([1, 2, 3], function(n) {return n < 3; });
the func(arr) returns a boolean
though i seem to be creating an infinite loop
i'm not sure how though, since the loop should stop after three iterations
Cody Bouscaren
@codybousc
Aug 15 2015 22:04
anyone else feel free to chime in as well!
Mark Dang
@dangm24
Aug 15 2015 22:06
If someone could help clarify the instructiosn of Bonfire: Pairwise that would be very helpful
CamperBot
@camperbot
Aug 15 2015 22:06
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Tim Millar
@tim-millar
Aug 15 2015 22:07
@codybousc closer but your while loop will never terminate and you are passing the whole array to the predicate
Tim Millar
@tim-millar
Aug 15 2015 22:14
if you look at the example, the function they pass expects a number, so you need to access the individual elements of the array somehow and run it on them
Cody Bouscaren
@codybousc
Aug 15 2015 22:40
@tim-millar well, i came up with an answer that passes the specs. it wouldn't work in all cases though. I guess that's good enough for now. anyway, thanks for your help!
CamperBot
@camperbot
Aug 15 2015 22:40
codybousc sends brownie points to @tim-millar :sparkles: :thumbsup: :sparkles:
api offline
Tim Millar
@tim-millar
Aug 15 2015 22:48
@codybousc good stuff
DJ Nixon
@tGxcoder
Aug 15 2015 23:00
ok guys. newbie is stuck. how do i change the font size for the p elements....
Rich Churcher
@richchurcher
Aug 15 2015 23:00
p { font-size: 2rem; }
DJ Nixon
@tGxcoder
Aug 15 2015 23:00
i think i have the coding right but the placement i think is off
thats the formet i used but the greem check mark isnt showing up
Rich Churcher
@richchurcher
Aug 15 2015 23:01
can you show your code?
DJ Nixon
@tGxcoder
Aug 15 2015 23:01
well.. p{font-size: 16px;}
or were you wanting a screen shot
Rich Churcher
@richchurcher
Aug 15 2015 23:02
copy paste the code here with a ``` on the line before and after
(those are backticks, top left of most keyboards)
DJ Nixon
@tGxcoder
Aug 15 2015 23:03

```<style>
.red-text {
color: red;
.p { font-size: 16px; }
}

</style>

<h2 class='red-text'>CatPhotoApp</h2>

<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p> Kitty ipsum Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched</p>

Rich Churcher
@richchurcher
Aug 15 2015 23:04
aha
ok you just need to add font-size to the class, not add a whole new selector for it so:
.red-text {
    font-size: 16px;
}
(with the other definitions in the curly braces as well
the red-text class is already added to the p element, so you don't need to select it again using p {}
DJ Nixon
@tGxcoder
Aug 15 2015 23:06
@richchurcher thanks man
CamperBot
@camperbot
Aug 15 2015 23:06
tgxcoder sends brownie points to @richchurcher :sparkles: :thumbsup: :sparkles:
api offline
Rich Churcher
@richchurcher
Aug 15 2015 23:06
yw :)
DJ Nixon
@tGxcoder
Aug 15 2015 23:07
i have been reading up on jave so i think i was over thinking
  .red-text {
    color: red;
  }

  p {
    font-size: 16px;
  }
</style>
Rich Churcher
@richchurcher
Aug 15 2015 23:09
yeah the trick with selectors in vanilla CSS3 is (to the best of my knowledge) there are never any nested braces, so if you have some inside another set you've probably gone wrong somewhere
DJ Nixon
@tGxcoder
Aug 15 2015 23:10
ahhhh ok so no braces inside braces
Rich Churcher
@richchurcher
Aug 15 2015 23:11
p {
    font-size: 16px;
}

.red-text {
    font-size: 10px;
}
Note that in the above example ALL p tags will be 16px, except if they have the red-text class
Robert
@rc242
Aug 15 2015 23:12
heyo.
DJ Nixon
@tGxcoder
Aug 15 2015 23:12
ahhh ok. yeah that make sense
a secondary exception
Rich Churcher
@richchurcher
Aug 15 2015 23:13
the way selectors work, they go from general to specific
DJ Nixon
@tGxcoder
Aug 15 2015 23:13
ok so the oppsite of jave
i think
Rich Churcher
@richchurcher
Aug 15 2015 23:14
well perhaps that's not a good way of putting it... I guess the more accurate you are with which element you're trying to select (using id's, classes, etc) the better
DJ Nixon
@tGxcoder
Aug 15 2015 23:16
ok cool. thanks for the info man. @richchurcher thanks
CamperBot
@camperbot
Aug 15 2015 23:16
tgxcoder sends brownie points to @richchurcher :sparkles: :thumbsup: :sparkles:
api offline
Jakob Dahl
@saadanerdetbare
Aug 15 2015 23:58

@tGxcoder its called order of specificity. that way

nav li {
}

wins over

li {
}