These are chat archives for FreeCodeCamp/HelpJavaScript

11th
Mar 2016
Angel Jimenez
@aJimmer
Mar 11 2016 00:00
has any one done sorted union?
Ivan Perez
@joannesalfa
Mar 11 2016 00:00
@aJimmer me
Brian van Vlymen
@arduino731
Mar 11 2016 00:01
help Using Objects for Lookups
CamperBot
@camperbot
Mar 11 2016 00:01

:point_right: challenge using objects for lookups [wiki]

Challenge: Using Objects for Lookups

Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to "lookup" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.

Here is an example of a simple reverse alphabet lookup:

var alpha = {
  1:"Z",
  2:"Y",
  3:"X",
  4:"W",
  ...
  24:"C",
  25:"B",
  26:"A"
};
alpha[2]; // "Y"
alpha[24]; // "C"

:pencil: read more about challenge using objects for lookups on the FCC Wiki

Angel Jimenez
@aJimmer
Mar 11 2016 00:01
cool @joannesalfa i made it work except the arrays inside of the arguments which only have one value don't concat as arrays
@joannesalfa did you have that issue?
Aleksander Gębicki
@Takumar
Mar 11 2016 00:01
@awgm 1 second passed ;-)
Ivan Perez
@joannesalfa
Mar 11 2016 00:02
@aJimmer I'd use arguments.length to get count of arguments, then do loop with push for new array to mix all values with concat in one array and use filter with indexOf to remove duplicated values, that's all
Angel Jimenez
@aJimmer
Mar 11 2016 00:02
how do i post my code on here? we did it a little differently...
Ivan Perez
@joannesalfa
Mar 11 2016 00:03
In that case [1,2], [3,4,3], [1,1,5,] then [1,2,3,4,3,1,1,5] then with filter function using indexOf to remove duplicated values and returns [1,2,3,4,5]
Angel Jimenez
@aJimmer
Mar 11 2016 00:03
function unite(arr1, arr2, arr3) {

  var newStr = [];
  if(arguments.length === 0){
      console.log("not enough arguments");

  } else if(arguments.length > 3){
      console.log("too many arguments");
  } else{

    for(var i = 0; i < arguments.length; i++){
        for(var k = 0; k < arguments[i].length; k++){
            if(newStr.indexOf(arguments[i][k]) == -1){
                newStr = newStr.concat(arguments[i][k]);
            }
        } 
    }
  }
  return newStr;
}

unite([1, 3, 2], [1, [5]], [2, [4]]);
Alex Glenn-Murray
@awgm
Mar 11 2016 00:04
@Takumar sorry having trouble formatting it grr
Ivan Perez
@joannesalfa
Mar 11 2016 00:04
@aJimmer arguments.length > 3 that's not recommended
Angel Jimenez
@aJimmer
Mar 11 2016 00:04
i see. you're right
Rex Schrader
@SaintPeter
Mar 11 2016 00:04
@joannesalfa If you want to file an issue for that, I'll flag it as help wanted and I'm sure we'll get a fix in a few days.
Alex Glenn-Murray
@awgm
Mar 11 2016 00:05
@Takumar http://hastebin.com/uheqazodof.js there's the code i'm testing. I get an error on the first case
Ivan Perez
@joannesalfa
Mar 11 2016 00:06
@SaintPeter would you mind to link where I can file an issue?
Angel Jimenez
@aJimmer
Mar 11 2016 00:06
that limits a user. besides that my code is filtering everything just fine bcc isn't taking it
Aleksander Gębicki
@Takumar
Mar 11 2016 00:06
@arduino731 you have to convert your switch() statement to lookup object with key: value pairs.
Then you assign value to result variable from your object using val property.
Angel Jimenez
@aJimmer
Mar 11 2016 00:06
fcc*
Ivan Perez
@joannesalfa
Mar 11 2016 00:06
@arduino731 "undefined" should be undefined without quotes and do not use "case"
Alex Mancheno
@alexmancheno
Mar 11 2016 00:06
Before I log I just want to say.. FCC rocks!!!!!!!! :D
Aleksander Gębicki
@Takumar
Mar 11 2016 00:07
@awgm you need to start your switch() {} statement with switch
switch(val) {
  case 1:
    answer = "alpha";
    break;
  // rest of cases here
}
Ivan Perez
@joannesalfa
Mar 11 2016 00:08
@arduino731 replace switch to object.props like this
  var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
  ...
  };
Alex Glenn-Murray
@awgm
Mar 11 2016 00:08
@Takumar Thanks Takumar
CamperBot
@camperbot
Mar 11 2016 00:08
awgm sends brownie points to @takumar :sparkles: :thumbsup: :sparkles:
:star: 2659 | @takumar | http://www.freecodecamp.com/takumar
Alex Glenn-Murray
@awgm
Mar 11 2016 00:08
worked perfectly
Angel Jimenez
@aJimmer
Mar 11 2016 00:09
found my issue thanks fcc
Brian van Vlymen
@arduino731
Mar 11 2016 00:10
thanks @Takumar and @joannesalfa for the tips.
CamperBot
@camperbot
Mar 11 2016 00:10
arduino731 sends brownie points to @takumar and @joannesalfa :sparkles: :thumbsup: :sparkles:
:star: 2661 | @takumar | http://www.freecodecamp.com/takumar
:star: 474 | @joannesalfa | http://www.freecodecamp.com/joannesalfa
Ivan Perez
@joannesalfa
Mar 11 2016 00:12
@arduino731 youre welcome
Im going to leave office, Im excited to release new app as service in next week
im nervous!
have a nice day, guys
and girls
Fyrequelle
@Fyrequelle
Mar 11 2016 00:21
Can someone explain to me what exactly I'm supposed to get back on the "Stand in Line" challenge? I'm having some trouble with this one.
Amir Eskandari
@AmirEskandari87
Mar 11 2016 00:22
@Fyrequelle Hey, you're supposed to get back (return) the element you shift off of the array (arr)
@Fyrequelle the shift() method takes the first element (at index[0]) off of the array
Li Zhang
@vorpus
Mar 11 2016 00:23
Been stuck on this Profile Lookup question forever, not sure what's wrong with my code, could someone take a look please?
function lookUp(firstName, prop){
// Only change code below this line

  for (var i = 0 ; i < contacts.length ; i++) {
    if (contacts[i].firstName === firstName) {

      if (contacts[i].hasOwnProperty(prop)) {
        return contacts[i][prop];
      }
      else {
        return "No such property";
      }
    }
    else {
      return "No such contact";
    }

  }

// Only change code above this line
}
CamperBot
@camperbot
Mar 11 2016 00:23
:bulb: to format code use backticks! ``` more info
Fyrequelle
@Fyrequelle
Mar 11 2016 00:25
Right... I set a variable equal to arr.shift() and returned it. I thought that was what the problem is asking for, but it's not entirely right.
(First time asking for help here.)
Amir Eskandari
@AmirEskandari87
Mar 11 2016 00:26
@vorpus You are very close
@vorpus but your for loop doesn't check all of the contacts because one of your three conditions is met on the first pass through
@Fyrequelle Can you show me your code?
Fyrequelle
@Fyrequelle
Mar 11 2016 00:27
Haha. Trying to figure out how to do that right now.
Amir Eskandari
@AmirEskandari87
Mar 11 2016 00:28
@Fyrequelle help format
help format
CamperBot
@camperbot
Mar 11 2016 00:28

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Fyrequelle
@Fyrequelle
Mar 11 2016 00:29
function queue(arr, item) {
  // Your code here
  var removed = arr.shift();

  arr.push();
  return removed;  // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 10)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Amir Eskandari
@AmirEskandari87
Mar 11 2016 00:30
@vorpus Think about what happens when you pass in "Kristian" as a contact? Why is it saying No such contact?
@Fyrequelle your return and shift look good
@Fyrequelle but you want to push (something) to the end of the array right?
@Fyrequelle you have the right setup, but need to pass the push() method an argument now
@Fyrequelle in that problem, what does it want you to add to the end of the array?
Fyrequelle
@Fyrequelle
Mar 11 2016 00:33
Ahh... arr.push(item);
Amir Eskandari
@AmirEskandari87
Mar 11 2016 00:33
@Fyrequelle bingo
@Fyrequelle and order is important, see the instructions: "Add the number to the end of the array, THEN remove the first element of array."
@Fyrequelle otherwise, you may not have anything in the array when you call the shift method
Fyrequelle
@Fyrequelle
Mar 11 2016 00:35
@AmirEskandari87 Gotcha. I fixed it and passed that challenge. Thanks for your help!
CamperBot
@camperbot
Mar 11 2016 00:35
fyrequelle sends brownie points to @amireskandari87 :sparkles: :thumbsup: :sparkles:
:star: 280 | @amireskandari87 | http://www.freecodecamp.com/amireskandari87
Amir Eskandari
@AmirEskandari87
Mar 11 2016 00:35
@Fyrequelle Awesome! No problem.
Nickolas Gettel
@nickolaskg
Mar 11 2016 00:42
Hey guys, i'm working on the 'Inventory Update' advanced algorithm. My solution passes all the tests except for one. I think there is a discrepancy with the answer, or atleast how I understand the problem. The challenge is to update the inventory quantity, or add the item to the list and then sort it alphabetically. When I update the inventory item hair-pin from 1 to 2 the solution it expects is 3, but the problem says to update the quantity, not add it. Am I just understanding this wrong?
Here is my solution...
function inventory(arr1, arr2) {
    // All inventory must be accounted for or you're fired!
var curInvObj = {};

for(var x in arr1){ //create new object with inventory items as key, and amount as value
  curInvObj[arr1[x][1]] = arr1[x][0];
}

for(var y in arr2){ //update object with new inventory items, and quantities
  curInvObj[arr2[y][1]] = arr2[y][0];
}

  var keys = Object.keys(curInvObj);
  keys.sort();


  return keys.map(function(item){
      return [curInvObj[item], item];
         });
}

// Example inventory lists
var curInv = [
    [21, "Bowling Ball"],
    [2, "Dirty Sock"],
    [1, "Hair Pin"],
    [5, "Microphone"]
];

var newInv = [
    [2, "Hair Pin"],
    [3, "Half-Eaten Apple"],
    [67, "Bowling Ball"],
    [7, "Toothpaste"]
];
Francis
@Francis-p
Mar 11 2016 00:47
/\s+/g
what does the + do?
Nickolas Gettel
@nickolaskg
Mar 11 2016 00:48
matches 1 or more of the preceding token
Nicholas
@nugoose
Mar 11 2016 00:59
console.log("totalCID: " + totalCID);
console.log("change: " + change);


// magic
if(change > totalCID){
  console.log("Insufficient Funds");
}

outputs

totalCID: 335.41
change: 96.74
Insufficient Funds

can someone shed some light on this?
Darwin RC
@darwinrc
Mar 11 2016 01:03
@nugoose can you show your code? It seems it's comparing string and not numeric
Nicholas
@nugoose
Mar 11 2016 01:03
the whole thing? it's pretty long
Darwin RC
@darwinrc
Mar 11 2016 01:04
they must be strings, try to parse them to numbers
Nicholas
@nugoose
Mar 11 2016 01:04
oh....
damn
toFixed is the culprit
thank you sir :pray:
m-farooqui
@m-farooqui
Mar 11 2016 01:16
var myStr;
var myStr="I am a \"double quoted\"string inside\"double quotes\"";
Darwin RC
@darwinrc
Mar 11 2016 01:16
you're welcome @nugoose . You can send brownie points mention me in your thanks ;)
CamperBot
@camperbot
Mar 11 2016 01:16
darwinrc sends brownie points to @nugoose :sparkles: :thumbsup: :sparkles:
:star: 407 | @nugoose | http://www.freecodecamp.com/nugoose
Nicholas
@nugoose
Mar 11 2016 01:17
@darwinrc sure, thanks man
CamperBot
@camperbot
Mar 11 2016 01:17
nugoose sends brownie points to @darwinrc :sparkles: :thumbsup: :sparkles:
:star: 405 | @darwinrc | http://www.freecodecamp.com/darwinrc
m-farooqui
@m-farooqui
Mar 11 2016 01:17
hi i am in waypoint 186 but i am having trouble putting commas after "double quotes
Nicholas
@nugoose
Mar 11 2016 01:18
you should remove the 2nd var
BendersBender
@BendersBender
Mar 11 2016 01:22
help where do i belong
CamperBot
@camperbot
Mar 11 2016 01:22

:point_right: algorithm where do i belong [wiki]

Explanation:

This can be a tricky problem to understand. You need to find where in the array a number should be inserted by order, and return the index where it should go.

:pencil: read more about algorithm where do i belong on the FCC Wiki

Darwin RC
@darwinrc
Mar 11 2016 01:22
@m-farooqui I think your problem is with spaces between the quotes
yoni chanowitz
@yonichanowitz
Mar 11 2016 01:23
help Caesars Cipher
CamperBot
@camperbot
Mar 11 2016 01:23

:point_right: algorithm caesars cipher [wiki]

Problem Explanation:

  • You need to write a function, which will take string encoded with
    Caesar cipher as a parameter and decode it.
  • The one used here is ROT13 where the value of the letter is
    shifted by 13 places.
    e.g. 'A' ↔ 'N', 'T' ↔ 'G'.
  • You have to shift it back 13 positions, such that 'N' ↔ 'A'.
:pencil: read more about algorithm caesars cipher on the FCC Wiki
Steve Carroll
@SteveCarroll
Mar 11 2016 01:26
Hey, everyone... anyone :)
RE: Build a Random Quote Machine, are we supposed to build a button that anyone can add a zillion tweets with?
m-farooqui
@m-farooqui
Mar 11 2016 01:26
@darwinrc i tried that it didn't work
Darwin RC
@darwinrc
Mar 11 2016 01:27
@m-farooqui can you please post your code?
m-farooqui
@m-farooqui
Mar 11 2016 01:27
var myStr;
var myStr="I am a \"double quoted\"string inside\"double quotes\"";
Darwin RC
@darwinrc
Mar 11 2016 01:30
missing spaces quoted\"string and inside\"double
m-farooqui
@m-farooqui
Mar 11 2016 01:33
@darwinrc if you don't mind can you post the code
how it should be
Darwin RC
@darwinrc
Mar 11 2016 01:33
"I am a \"double quoted\" string inside \"double quotes\""
Collin
@collinferry
Mar 11 2016 01:34
@SteveCarroll What do you mean by "add a zillion tweets"?
Steve Carroll
@SteveCarroll
Mar 11 2016 01:34
@collinferry Nevermind, I just clicked the example tweet andgot the clue
Collin
@collinferry
Mar 11 2016 01:35
@SteveCarroll Yeah, just tweeting out the current quote :)
m-farooqui
@m-farooqui
Mar 11 2016 01:35
@darwinrc thank you
CamperBot
@camperbot
Mar 11 2016 01:35
m-farooqui sends brownie points to @darwinrc :sparkles: :thumbsup: :sparkles:
:star: 406 | @darwinrc | http://www.freecodecamp.com/darwinrc
Steve Carroll
@SteveCarroll
Mar 11 2016 01:35
But the video say it's "Bonus", the instructions don't say that.
Darwin RC
@darwinrc
Mar 11 2016 01:35
@m-farooqui :+1:
Jonah Barreto
@JBarreto1
Mar 11 2016 01:37
Just a general question: I write helper functions when I solve the Javascript Algorithms. Is this a frowned upon practice? Sometimes I'm just coding and it helps me think and sort things out, but at the same time I feel like it's a little bit sloppy. Thoughts?
Steve Carroll
@SteveCarroll
Mar 11 2016 01:38
@JBarreto1 If the functions are sloppy, then, yes... if not, then, no.
I think it's better to write focused functions that don't try to do everything.
BendersBender
@BendersBender
Mar 11 2016 01:40
help caesars cipher
CamperBot
@camperbot
Mar 11 2016 01:40

:point_right: algorithm caesars cipher [wiki]

Problem Explanation:

  • You need to write a function, which will take string encoded with
    Caesar cipher as a parameter and decode it.
  • The one used here is ROT13 where the value of the letter is
    shifted by 13 places.
    e.g. 'A' ↔ 'N', 'T' ↔ 'G'.
  • You have to shift it back 13 positions, such that 'N' ↔ 'A'.
:pencil: read more about algorithm caesars cipher on the FCC Wiki
Darwin RC
@darwinrc
Mar 11 2016 01:41
@JBarreto1 Single responsibility is the first SOLID principle for clean code. So it's always better to have many small functions rather than a big one.
Collin
@collinferry
Mar 11 2016 01:45
@darwinrc Would you say the same about nested functions? Basically avoid them if possible, but otherwise they're fine?
Steve Carroll
@SteveCarroll
Mar 11 2016 01:45
@BendersBender What's your cipher issue?
bitgrower
@bitgrower
Mar 11 2016 01:48
Hey SteveCarroll -- is that your amazing playlist of js stuff I came across on YT ?
Steve Carroll
@SteveCarroll
Mar 11 2016 01:48
@bitgrower where?
bitgrower
@bitgrower
Mar 11 2016 01:48
ahhh ... I dunno -- but the owner's name is SteveCarroll .(or very close) ... let me see if I can find the link ...
Steve Carroll
@SteveCarroll
Mar 11 2016 01:49
could be mine... but I don;t know if it's all that amazing :)
bitgrower
@bitgrower
Mar 11 2016 01:50
https://www.youtube.com/playlist?list=PLFbLP1hcx1BBwNjDjNevgEX3OozhU4WJb well, I liked the video on Array reduce -- that's one very slick video ...
Steve Carroll
@SteveCarroll
Mar 11 2016 01:50
Yeah, that's mine
bitgrower
@bitgrower
Mar 11 2016 01:51
of course, it's kinda long ... 63 videos!!!
Steve Carroll
@SteveCarroll
Mar 11 2016 01:51
That guy is great IMO
Darren Teo
@sonyteo
Mar 11 2016 01:51
Hey I'm stuck at the Converting Celsius to Fahrenheit challenge, can anyone help me?
bitgrower
@bitgrower
Mar 11 2016 01:52
the array reduce guy? or the one that's showing above, the promises guy
thanks, @SteveCarroll ...
CamperBot
@camperbot
Mar 11 2016 01:52
bitgrower sends brownie points to @stevecarroll :sparkles: :thumbsup: :sparkles:
:star: 287 | @stevecarroll | http://www.freecodecamp.com/stevecarroll
bitgrower
@bitgrower
Mar 11 2016 01:52
@sonyteo -- it's a pretty straightforward problem, where are you having problems ? Got any code we can see ?
Steve Carroll
@SteveCarroll
Mar 11 2016 01:53
Mattias Petter Johansson... great stuff. The best js video I've seen is by Tony Alicea, his series on Udemy.
bitgrower
@bitgrower
Mar 11 2016 01:54
oh yeah, Tony Alicea was like the first js thing I bought -- I watched the first 3.5 hours on my Kindle one weekend and then scouted around for $10 coupons to pick up his course with ... (speaking of which, I should go find another one and pick up his node.js course ... udemy's changing their pricing in early April ... )
Steve Carroll
@SteveCarroll
Mar 11 2016 01:54
I saw it available for $10 awhile back (I got it for $20).
LOL!
Darren Teo
@sonyteo
Mar 11 2016 01:54
function convert(celsius) {
  // Only change code below this line


  // Only change code above this line
  if ( typeof fahrenheit !== 'undefined' ) {
    return fahrenheit;
  } else {
    return 'fahrenheit not defined';
  }
}

// Change the inputs below to test your code
I don't understand it
bitgrower
@bitgrower
Mar 11 2016 01:55
do you know how to convert fahrenheit temps into celsius without javascript ?
Darren Teo
@sonyteo
Mar 11 2016 01:55
yea.
So i just do it myself like that?
m-farooqui
@m-farooqui
Mar 11 2016 01:55
i am in waypoint 187 and i am having a hard time what they are trying to ask
var myStr;
var myStr=\backslash\t \t \r \n
this is my code
bitgrower
@bitgrower
Mar 11 2016 01:56
@sonyteo -- pretty much ... and waypoints don't have numbers, that number is the number of your brownie points
about @sonyteo
CamperBot
@camperbot
Mar 11 2016 01:56
:star: 152 | @sonyteo | http://www.freecodecamp.com/sonyteo
bitgrower
@bitgrower
Mar 11 2016 01:57
oh kay ... well that seems to prove me wrong ... wonder where the 187 number comes from
Darren Teo
@sonyteo
Mar 11 2016 01:57
yea
bitgrower
@bitgrower
Mar 11 2016 01:57
@m-farooqui -- first, how do you make a string variable in javascript
@sonyteo -- well ... I've never known waypoints to have numbers ... but the number in the upper right corner of your profile is the # of your brownie points
m-farooqui
@m-farooqui
Mar 11 2016 01:59
@bitgrower myStr=..
Darren Teo
@sonyteo
Mar 11 2016 01:59
Yea i know. @bitgrower
bitgrower
@bitgrower
Mar 11 2016 02:00
anyway ... you can say fahrenheit = <some arithmetic expression here, involving Celsius>
Nicholas
@nugoose
Mar 11 2016 02:00
@bitgrower he might have skipped stuff
bitgrower
@bitgrower
Mar 11 2016 02:00
@nugoose you mean @m-farooqui ?
Tyler Del Rosario
@TylerDelRosario
Mar 11 2016 02:00

I'm having a hard time with "Stand in Line". I dont really know what they are asking for. Here is my code: function queue(arr, item) {
// Your code here
testArr.push(item);
item = testArr.shift();
return item; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];
var num = 7;
queue(testArr, num);
// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Nicholas
@nugoose
Mar 11 2016 02:00
@bitgrower sony
bitgrower
@bitgrower
Mar 11 2016 02:00
ah ...
bitgrower @bitgrower wonders why so many people have trouble with stand in line ...
Darren Teo
@sonyteo
Mar 11 2016 02:02
I didn't skip stuff. i did all of them
Nicholas
@nugoose
Mar 11 2016 02:02
@m-farooqui when you make a string you need " "
Tyler Del Rosario
@TylerDelRosario
Mar 11 2016 02:02
The way they are asking can be understood in a variety of ways.
bitgrower
@bitgrower
Mar 11 2016 02:02
@HTMLNoob -- tbh, your code looks like it should work ...
Pascal T.
@omegga
Mar 11 2016 02:02
@HTMLNoob you have to erase the first element in the array and return it
Ken Haduch
@khaduch
Mar 11 2016 02:04
@HTMLNoob - you are working in a function queue, and you are passing in "testArr" as an argument to the function. Within the function, you have two arguments arr, and item. You have to work with the function arguments within the function (in general), so instead of using testArr as the array argument in the function, you should use something else...
and, are you supposed to return the item or the array? I forget that part...
bitgrower
@bitgrower
Mar 11 2016 02:05
item @khaduch --
I missed the ambiguity there with the global variable being named ... sigh ...
Tyler Del Rosario
@TylerDelRosario
Mar 11 2016 02:07
@khaduch I'm supposed to erase the first element and return it. I did exactly that through my code item = testArr.shift();
return item;
Ken Haduch
@khaduch
Mar 11 2016 02:07
@HTMLNoob - they are assuming a certain level of understanding of functions at this point, I think? So they are not spelling out the details as they do in other places...
@bitgrower - I'm with you on that... I think that it's just 'crossing the boundary' between some of the plain stuff and functions?
Kyle Morton
@kmorton1988
Mar 11 2016 02:07
help Title Case A Sentence
CamperBot
@camperbot
Mar 11 2016 02:07

:point_right: algorithm title case a sentence [wiki]

Explanation:

We have to return a sentence with camel case. This means that the first letter will always be in uppercase and the rest lowercase.

:pencil: read more about algorithm title case a sentence on the FCC Wiki

bitgrower
@bitgrower
Mar 11 2016 02:10
@khaduch -- ah yes, the world before functions ... :)
Kyle Morton
@kmorton1988
Mar 11 2016 02:11
why doesn't the following work? it seems like it should...
function titleCase(str) {
  return str.split(" ").toLowerCase().charAt(0).toUpperCase().join(" ");
}

titleCase("I'm a little tea pot");
Tyler Del Rosario
@TylerDelRosario
Mar 11 2016 02:12
@khaduch I'm not asking for copy and paste code. I want to know what I'm doing wrong.
bitgrower
@bitgrower
Mar 11 2016 02:12
well, for one thing, you have a whole set of strings you need to do this to ...
@HTMLNoob -- you are currently using the global variable testArr, you need to use the parameter that was passed into the function, arr
Kyle Morton
@kmorton1988
Mar 11 2016 02:13
oh jeeze...I think I see what I"m doing wrong.
Ken Haduch
@khaduch
Mar 11 2016 02:14
@HTMLNoob - well, if you aren't passing the tests, then something is not right. If your code is exactly as you posted it, you've changed the setup of the test quite a bit. There is only one place where you should change code, and that's between those two comments.
Kyle Morton
@kmorton1988
Mar 11 2016 02:14
trying to apply a string.funciton to an array.
Pascal T.
@omegga
Mar 11 2016 02:14
@kmorton1988 you are trying to lower an array
Kyle Morton
@kmorton1988
Mar 11 2016 02:14
hmm.
bitgrower
@bitgrower
Mar 11 2016 02:14
yeah, that can be a problem @kmorton1988
Kyle Morton
@kmorton1988
Mar 11 2016 02:14
yeah, so would a for loop iteration work?
go through each string, then then apply all the shinanigans?
after splitting them
nvm I'll just go try it
bitgrower
@bitgrower
Mar 11 2016 02:14
you need to be doing some sort of looping somewhere, yes ... and it depends on what shenanigins you try ... :)
Kyle Morton
@kmorton1988
Mar 11 2016 02:15
thanks @bitgrower and @Scriptonaut
CamperBot
@camperbot
Mar 11 2016 02:15
kmorton1988 sends brownie points to @bitgrower and @scriptonaut :sparkles: :thumbsup: :sparkles:
:star: 275 | @scriptonaut | http://www.freecodecamp.com/scriptonaut
:star: 792 | @bitgrower | http://www.freecodecamp.com/bitgrower
Todd Easter
@justplaintodd
Mar 11 2016 02:15
help Record Collection
CamperBot
@camperbot
Mar 11 2016 02:15

:point_right: checkpoint record collection [wiki]

Checkpoint: Record Collection

Instructions

You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and has several properties. Not all albums have complete information.

Write a function which takes an id, a property (prop), and a value.

For the given id in collection:

If value is non-blank (value !== ""), then update or set the value for the prop.

If the prop is "tracks" and value is non-blank, push the value onto the end of the tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint record collection on the FCC Wiki

Ken Haduch
@khaduch
Mar 11 2016 02:15
@HTMLNoob - I'm trying to help. You have the basic idea with the push and shift. You just have modified too much code, and you aren't using the arguments within the function. You should probably reset your code and then fill in the space between the comments with the code, and use the function arguments within that space...
bitgrower
@bitgrower
Mar 11 2016 02:17
@justplaintodd -- are you comfortable with this challenge: http://www.freecodecamp.com/challenges/using-objects-for-lookups
yoni chanowitz
@yonichanowitz
Mar 11 2016 02:18
thanks @anuragaryan @SaintPeter
CamperBot
@camperbot
Mar 11 2016 02:18
yonichanowitz sends brownie points to @anuragaryan and @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 2634 | @saintpeter | http://www.freecodecamp.com/saintpeter
:star: 301 | @anuragaryan | http://www.freecodecamp.com/anuragaryan
m-farooqui
@m-farooqui
Mar 11 2016 02:23
i am in waypoint 189 and i am having trouble setting the value to my string

var ourStr = "I come first. ";
ourStr += "I come second.";

var myStr = "This is the first sentence.";
myStr += "This is the second sentence.";

this is the code
philipsiu
@philipsiu
Mar 11 2016 02:24
Hi can anyone help with the challenge Diff Two Arrays?
rphares
@rphares
Mar 11 2016 02:26
@m-farooqui , good start, but--
you need a space, right now your output would be This is the first sentence.This is the second sentence.
see how the sentences run together? Stick a space in the end of the first string or at the beginning of the second so it looks nice :)
Brian van Vlymen
@arduino731
Mar 11 2016 02:27
help using object for lookup
CamperBot
@camperbot
Mar 11 2016 02:27
no wiki entry for: using object for lookup
Kyle Morton
@kmorton1988
Mar 11 2016 02:27
Oh. well damn.
Ken Haduch
@khaduch
Mar 11 2016 02:27
@m-farooqui - you have to mind the spacing and things when you concatenate strings with + - add one in. You can do it by changing the strings, or if you don't have that option (because they are feeding them to in from test data) add the space with + ' ' +
that didn't show up too well:
 var stringOut = string1 + ' ' + string2;
bitgrower
@bitgrower
Mar 11 2016 02:29
whassup, @kmorton1988 ?
oscar
@oscarg91
Mar 11 2016 02:29
hey everyone i need help withConcatenating Strings with Plus Operator
Kyle Morton
@kmorton1988
Mar 11 2016 02:29
just realized I'm literally ONLY passing the first letter of each word capilalized ot the finished string
so I'm getting "I A L T P"
instead of "I'm A Little Tea Pot"
Pascal T.
@omegga
Mar 11 2016 02:29
@oscarg91 what's the issue ?
oscar
@oscarg91
Mar 11 2016 02:30
here is my code
var myStr = 'This is the start. ' + ' This is the end.';
pvestal
@pvestal
Mar 11 2016 02:30
Could someone help me understand what is being asked?
Ken Haduch
@khaduch
Mar 11 2016 02:30
@oscarg91 - look up in this thread a few entries, I'll bet it's this problem that someone else had...
pvestal
@pvestal
Mar 11 2016 02:30
Correct the assignment to myStr to achieve the desired effect.

// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "H"; // Fix Me

bitgrower
@bitgrower
Mar 11 2016 02:31
must be "string" season, eh @khaduch ?
Kyle Morton
@kmorton1988
Mar 11 2016 02:31
More like String Theory :P
bitgrower
@bitgrower
Mar 11 2016 02:31
hahahahaha
oscar
@oscarg91
Mar 11 2016 02:31
@khaduch i did but i dont see what is wrong
Ken Haduch
@khaduch
Mar 11 2016 02:31
@pvestal - you cannot assign individual characters into a string literal... at least not that way. You might just have to edit that one?
rphares
@rphares
Mar 11 2016 02:31
@pvestal , you want myStr to say "Hello World"
oscar
@oscarg91
Mar 11 2016 02:31
is there something wrong with the spacing that I'm missing?
rphares
@rphares
Mar 11 2016 02:31
so the part that says Fix me needs to be changed,
Because, as @khaduch points out, you cannot change it that way...
bitgrower
@bitgrower
Mar 11 2016 02:32
@kmorton1988 -- probably easier if you create a new string by concatenating the .charAt(0) result with the .lowerCase() result for the rest of the string ...
rphares
@rphares
Mar 11 2016 02:32
@oscarg91 , no your spacing is okay, but
philipsiu
@philipsiu
Mar 11 2016 02:32
Hi can anyone help with the challenge Diff Two Arrays?
rphares
@rphares
Mar 11 2016 02:32
you were supposed to use the += operator, no? @oscarg91
Kyle Morton
@kmorton1988
Mar 11 2016 02:33
@bitgrower yeah, that's what I'm trying to wrap my head around how to do without making it "Ii'm Aa Llittle Ttea Ppot"
Ken Haduch
@khaduch
Mar 11 2016 02:33
@oscarg91 - you should only have one space between the two sentences...
rphares
@rphares
Mar 11 2016 02:33
so, check out what someone else was trying earlier (their answer isn't correct yet, but the idea is right) :point_up: March 10, 2016 6:23 PM @oscarg91
oscar
@oscarg91
Mar 11 2016 02:33
@rphares no that was the last practice
pvestal
@pvestal
Mar 11 2016 02:33
@rphares there is an error when I try to fix it. TypeError: Cannot assign to read only property '0' of string 'Jellow World'
m-farooqui
@m-farooqui
Mar 11 2016 02:34
@khaduch can you print my code
Pascal T.
@omegga
Mar 11 2016 02:34
@oscarg91 there are 2 requirements for this exercice .1) you need to use += 2)you should have exactly this sentence : "This is the first sentence. This is the second sentence."
m-farooqui
@m-farooqui
Mar 11 2016 02:34
i printed it earlier
oscar
@oscarg91
Mar 11 2016 02:34
@rphares this is the sample code 'My name is Alan,' + ' I concatenate.'
rphares
@rphares
Mar 11 2016 02:34
Yes, that line doesn't work-- the myStr[0] part will never work because strings are immutable, which means you can't change just parts of them,
bitgrower
@bitgrower
Mar 11 2016 02:35
@kmorton1988 -- hint: substring
Kyle Morton
@kmorton1988
Mar 11 2016 02:35
omg. eureka. Brb.
rphares
@rphares
Mar 11 2016 02:35
@pvestal Yes, that line doesn't work-- the myStr[0] part will never work because strings are immutable, which means you can't change just parts of them, so you will need to re-set that whole str ...
@oscarg91 , sorry, can you tell me the name of the exercise? I'm not quite recalling that one :pensive:
pvestal
@pvestal
Mar 11 2016 02:36
@rphares do you mean create a new var and assign the old value to it?
m-farooqui
@m-farooqui
Mar 11 2016 02:36
and i am a little bit confused
Prashant Kumar
@Prashantkn
Mar 11 2016 02:36
hi,I'm having some trouble in solving Caesars Cipher

function rot13(str) { // LBH QVQ VG!
var i=0;
var a=[];
var str2="";
var code;
for(i=0;i<str.length;++i){ code = str.charCodeAt(i); if ( ((code >= 65) && (code <= 90)) || ((code >= 97) && (code <= 122)) ) {
a[i]=code+13;
}
else{
a[i]=code;
}
}
for(i=0;i<str.length;++i){
str2=str2+str.fromCharCode(a[i]);
}
return str2;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC"); this is my code

could u pls help me with this.
rphares
@rphares
Mar 11 2016 02:37
@pvestal , no-- take the old var and assign the new value to it :)
Kyle Morton
@kmorton1988
Mar 11 2016 02:39
i feel like I'm closer.
oscar
@oscarg91
Mar 11 2016 02:39
@rphares sorry you're right it is +=
Kyle Morton
@kmorton1988
Mar 11 2016 02:40
gah, why do I feel like I"m THIS close
function titleCase(str) {
  str.split(" ");
  var tempstr = [];
  for (i = 0; i < str.length; i++) {

    tempstr.push(str[i].toLowerCase.replace(str[i].charAt(0), str[i].charAt(0).toUpperCase()));
  }
  tempstr.join(" ");
  return tempstr;

}
rphares
@rphares
Mar 11 2016 02:40
Cool-- give that a go, and if its still an issue, come back (and let us know the challenge name) with the new code and we'll figure it out together :) @oscarg91
Kyle Morton
@kmorton1988
Mar 11 2016 02:42
LOL capitalizes EVERY letter :/
bitgrower
@bitgrower
Mar 11 2016 02:42
@kmorton1988 -- hahaha feeling real close is a common feeling ... a not quite accurate feeling most of the time ... but a common one ... :)
Kyle Morton
@kmorton1988
Mar 11 2016 02:42
-.-
I'm missing something, obviously.
bitgrower
@bitgrower
Mar 11 2016 02:44

@kmorton1988 -- my brain doesn't handle all the chaining going back between various formats...but remember ... strings are immutable ... so you cannot just go str.charAt(0).upperCase(); ... you have to set this to a new variable ...

str2 = str.charAt(0).upperCase();

Kyle Morton
@kmorton1988
Mar 11 2016 02:44
ahh.
pvestal
@pvestal
Mar 11 2016 02:44
@rphares thank you
CamperBot
@camperbot
Mar 11 2016 02:44
pvestal sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 3194 | @rphares | http://www.freecodecamp.com/rphares
oscar
@oscarg91
Mar 11 2016 02:44
@rphares the challenge is concatenating strings with plus equals operator
Kyle Morton
@kmorton1988
Mar 11 2016 02:45
damn this is tough.
oscar
@oscarg91
Mar 11 2016 02:45
@rphares here is my new code
var myStr= "This is the first sentence. " += " This is the second sentence.";
Ken Haduch
@khaduch
Mar 11 2016 02:45
hi - I'm now confused about who needs help with what... so many strings to be tangled in! :banana:
Kyle Morton
@kmorton1988
Mar 11 2016 02:45
space after "myStr"?
oscar
@oscarg91
Mar 11 2016 02:45
tried that
its saying left side is not a reference
bitgrower
@bitgrower
Mar 11 2016 02:46
LOL @khaduch -- like a kitten with a ball of string, eh ?
Kyle Morton
@kmorton1988
Mar 11 2016 02:46
oh god the puns
Ken Haduch
@khaduch
Mar 11 2016 02:46
@oscarg91 - one too many spaces in there...
@bitgrower :cat2:
@oscarg91 oh, wait, I see that += in there... that is not correct in that context...
@oscarg91 - is that "concatenating strings with the plus operator"?
if so, you aren't using the correct sentences.
oscar
@oscarg91
Mar 11 2016 02:48
@khaduch yes it is
plus equals operator
Ken Haduch
@khaduch
Mar 11 2016 02:49
Build myStr from the strings "This is the start. " and "This is the end." using the + operator.
Pascal T.
@omegga
Mar 11 2016 02:49
@Prashantkn the real word is 13 letters before, not 13 letters after
oscar
@oscarg91
Mar 11 2016 02:50
ok i got it thanks @khaduch @rphares @Scriptonaut
CamperBot
@camperbot
Mar 11 2016 02:50
oscarg91 sends brownie points to @khaduch and @rphares and @scriptonaut :sparkles: :thumbsup: :sparkles:
:star: 694 | @khaduch | http://www.freecodecamp.com/khaduch
:star: 3195 | @rphares | http://www.freecodecamp.com/rphares
:star: 276 | @scriptonaut | http://www.freecodecamp.com/scriptonaut
rphares
@rphares
Mar 11 2016 02:50
Sweet! Happy coding~
Ken Haduch
@khaduch
Mar 11 2016 02:52
@oscarg91 - a helpful hint - pay very close attention to what they are telling you, sometimes they want you to just get familiar with the mechanics of doing some operation without having to over-complicate things... but it does get tougher! The early stages are set up to methodically introduce the basics.
and you're welcome!
Pascal T.
@omegga
Mar 11 2016 02:52
@Prashantkn also you cannot use fromCharCode with a string variable.You have to write String.fromCharCode()
Kyle Morton
@kmorton1988
Mar 11 2016 02:54
SUCCESS!
bitgrower
@bitgrower
Mar 11 2016 02:54
YAY !!!! @kmorton1988
what did you learn ?
Kyle Morton
@kmorton1988
Mar 11 2016 02:54
I'm not really sure.
lol.
Robert Richey
@0x0936
Mar 11 2016 02:55
lol :+1:
Kyle Morton
@kmorton1988
Mar 11 2016 02:55
I learned when in doubt, overcomplicate.
there's gotta be a way to slim this down.
any rules against posting spoilers?
GOWTHAMAN NATARAJAN
@GowthamanN
Mar 11 2016 02:56
In javascript, Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr
help anyone
CamperBot
@camperbot
Mar 11 2016 02:56
no wiki entry for: anyone
Ken Haduch
@khaduch
Mar 11 2016 02:57
@GowthamanN - hi there.
we're listening...
Robert Richey
@0x0936
Mar 11 2016 02:57
:cat:
Ken Haduch
@khaduch
Mar 11 2016 02:58
you have to use the backslash prefix character as they show in the table and just build a string, e.g. var str = '\t \n'; as an example.
@kmorton1988 - @GowthamanN - this is not regular expressions... just basic 'special character' usage in a string.
GOWTHAMAN NATARAJAN
@GowthamanN
Mar 11 2016 02:59
ok thanks @kmorton1988 @khaduch
CamperBot
@camperbot
Mar 11 2016 02:59
gowthamann sends brownie points to @kmorton1988 and @khaduch :sparkles: :thumbsup: :sparkles:
:star: 259 | @kmorton1988 | http://www.freecodecamp.com/kmorton1988
:star: 695 | @khaduch | http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Mar 11 2016 02:59
@GowthamanN - you're welcome. let us know how you're doing!
GOWTHAMAN NATARAJAN
@GowthamanN
Mar 11 2016 03:00
k
Prashant Kumar
@Prashantkn
Mar 11 2016 03:01
@Scriptonaut thanks :)
CamperBot
@camperbot
Mar 11 2016 03:01
prashantkn sends brownie points to @scriptonaut :sparkles: :thumbsup: :sparkles:
:star: 277 | @scriptonaut | http://www.freecodecamp.com/scriptonaut
Kyle Morton
@kmorton1988
Mar 11 2016 03:13
god, figuring out where to put a variable for scope reasons is irritating
bitgrower
@bitgrower
Mar 11 2016 03:15
whatcha workin' on now, @kmorton1988
Kyle Morton
@kmorton1988
Mar 11 2016 03:15
just finished Return Largest Numbers in Arrays
i had the concept right, just couldn't figure out which scope to put a certain variable.
finally got it, thoguh.
Eddie Salas
@esalas012
Mar 11 2016 03:15
i'm doing the Convert Celsius to Fahrenheit challenge but i'm stuck i can only solve the equation for one variable. How do i add multiple variables to the same equation to get different results
rphares
@rphares
Mar 11 2016 03:16
could you paste your code, @esalas012 ? it sounds like you may be overthinking it...
(you can use celsius as you set var fahrenheit...)
Eddie Salas
@esalas012
Mar 11 2016 03:20

var = celsius1;
var = fahrenheit1;

celsius1 = 0;
fahrenheit1 = (celsius1 (9/5)) + 32 ;
celsius2 = -30;
fahrenheit2 = (celsius2
(9/5)) + 32 ;
celsius3 = -10;
fahrenheit3 = (celsiu3 * (9/5)) + 32 ;

i have tried multiple things but nothings works

var = celsius;
var = fahrenheit;

celsius = 0;
fahrenheit = (celsius (9/5)) + 32 ;
celsius = -30;
fahrenheit = (celsius
(9/5)) + 32 ;
celsius = -10;
fahrenheit = (celsius * (9/5)) + 32 ;

rphares
@rphares
Mar 11 2016 03:22
oh, def overthinking,
okay-- @esalas012 -- you need just one line
Ken Haduch
@khaduch
Mar 11 2016 03:22
@esalas012 - you only need to add a computation to the function that they provide and just implement the calculation that they describe. Make sure you use the same variable names that they do!
@rphares - you're right... :)
rphares
@rphares
Mar 11 2016 03:22
lets take, say, the last on, delete all the rest...
and make sure you are putting that operation in var fahrenheit ... :blushL
( @khaduch !! Sorry i didn't greet you properly earlier-- its great to see you, as always ~)
Ken Haduch
@khaduch
Mar 11 2016 03:25
@rphares - yes, likewise! It's good to see you, too! :)
Eddie Salas
@esalas012
Mar 11 2016 03:25

var fahrenheit;

celsius = 0;
fahrenheit = (celsius * (9/5)) + 32 ;

Ken Haduch
@khaduch
Mar 11 2016 03:25
that was a crazy time in the chat room earlier... :cake:
Eddie Salas
@esalas012
Mar 11 2016 03:26
how do i add multiple values to the variable celsius?
Ken Haduch
@khaduch
Mar 11 2016 03:27
@esalas012 - they are passing 'celsius' as the argument to the function, so you do not want to change it, just use the value that they provide...
Eddie Salas
@esalas012
Mar 11 2016 03:28
oh wow!! thank you I got it. Yes i was overthinking this
rphares
@rphares
Mar 11 2016 03:29
indeed, yes... think i'll spend a lil less time online, seems to be getting a bit rambunctious and certainly dont wanna alienate ppl coming for help!
Congrats, @esalas012 ~ happy coding!
(and thanks, @khaduch , wise advice as always ~)
Todd Easter
@justplaintodd
Mar 11 2016 03:30
anyone have any help for Record Collection?
bitgrower
@bitgrower
Mar 11 2016 03:31
did you read the question I asked you earlier, @justplaintodd ?
Ken Haduch
@khaduch
Mar 11 2016 03:31
@esalas012 - I'll repeat some advice I gave earlier - these early exercises are set up to almost give you the answer, you just have to do the mechanics of setting up the code, so you just have to really focus on what they are asking. Don't worry, it does get harder and more challenging! :)
@rphares -- thank you, too - you always give helpful and encouraging advice!
CamperBot
@camperbot
Mar 11 2016 03:32
khaduch sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 3197 | @rphares | http://www.freecodecamp.com/rphares
Todd Easter
@justplaintodd
Mar 11 2016 03:32
@bitgrower no, i didnt see it
Robert Richey
@0x0936
Mar 11 2016 03:32
happy 3198 @rphares thanks!
CamperBot
@camperbot
Mar 11 2016 03:32
0x0936 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 3198 | @rphares | http://www.freecodecamp.com/rphares
Ken Haduch
@khaduch
Mar 11 2016 03:33
@rphares - and you have a TON of brownie points to show for it! :clap:
bitgrower
@bitgrower
Mar 11 2016 03:33
@justplaintodd -- do you understand the challenge "using objects for lookup" ?
rphares
@rphares
Mar 11 2016 03:33
shakes head at @0x0936 ...
Robert Richey
@0x0936
Mar 11 2016 03:33
:dog:
rphares
@rphares
Mar 11 2016 03:33
lol, heh, yeah... really ought to clean account soon...
philipsiu
@philipsiu
Mar 11 2016 03:34
help Diff Two Arrays
CamperBot
@camperbot
Mar 11 2016 03:34

:point_right: algorithm diff two arrays [wiki]

Explanation:

Check two arrays and return a new array that contains only the items that are not in either of the original arrays.

:pencil: read more about algorithm diff two arrays on the FCC Wiki

Todd Easter
@justplaintodd
Mar 11 2016 03:34
@bitgrower yes, i understood it
bitgrower
@bitgrower
Mar 11 2016 03:37
so if I reset the code in your copy of the challenge, how quickly do you think you could solve it (just trying to assess your comfort level with addressing different parts of objects)
Todd Easter
@justplaintodd
Mar 11 2016 03:38
probably in a couple minutes, probably less
bitgrower
@bitgrower
Mar 11 2016 03:38
okay ... so where are you having trouble with this particular challenge? Can you post some code ?
Todd Easter
@justplaintodd
Mar 11 2016 03:39
honestly with getting started. i understand the concepts i need to put together to solve it, but im making a small oversight with how to access the parts of the object.
im almost afraid to ask for help because i feel like ill figure it out at any moment
bitgrower
@bitgrower
Mar 11 2016 03:40
well, the first things you need to do is have to do with checking the function parameters ...
so .. those should be easy enough to code ... :)
Francis
@Francis-p
Mar 11 2016 03:41
OMG!!! how do you guys remember all the js code?
Todd Easter
@justplaintodd
Mar 11 2016 03:42
repetition helps me with remembering code
even then i wouldnt try to memorize it all
Francis
@Francis-p
Mar 11 2016 03:43
so how many time do you redo the coding? ha!
bitgrower
@bitgrower
Mar 11 2016 03:43
practice, practice, practice ...
Robert Richey
@0x0936
Mar 11 2016 03:43
^
bitgrower
@bitgrower
Mar 11 2016 03:43
depends on how much I hate the solution I have, @Francis-p
and I love learning new stuff and going ... oh wait, I could solve this in such a cooler way by using ... (array.filter, array.reduce, array.map --- etc. Or whatever other method I've just learned about ... )
Francis
@Francis-p
Mar 11 2016 03:46
i mean where do you guys pratice at? each lesson only have one challenge…
bitgrower
@bitgrower
Mar 11 2016 03:47
there are sites beyond sites beyond sites where you can get more problems if you want ...
sites like hackerrank, coderwars ... and there is a plethora of these kinds of sites ... just google for 'em
Daniel Bashir
@db7894
Mar 11 2016 03:47
@Francis-p Project Euler has some really cool problems
Robert Richey
@0x0936
Mar 11 2016 03:47
@Francis-p today, for example, I spent time arbitrarily learning how to write a responsive flexbox layout
bitgrower
@bitgrower
Mar 11 2016 03:47
set yourself a project to accomplish something ...
Robert Richey
@0x0936
Mar 11 2016 03:48
tomorrow, I may finally get around to implementing minimax for my tic tac toe
Francis
@Francis-p
Mar 11 2016 03:48
@bitgrower hmm! alright. cause i am done with basic java and move on to the next. but to think back i actually forgot most of them that is taught.
Robert Richey
@0x0936
Mar 11 2016 03:48
the next day, curiosity might take me into learning more about ES6 promises
Suprith Aireddy
@sup-rith
Mar 11 2016 03:48
Can someone help me on the chunky monkey challenges?
function chunk(arr, size) {
  // Break it up.
  var fullArray =[];

  for(var i =0; i < arr.length; i++){
    fullArray += arr[i] + " ";
  }
  fullArray.pop();

  return arr;
}

chunk(["a", "b", "c", "d"], 2);
ive read all the elements into 1 big array, i dont know what to do with it after that.
Francis
@Francis-p
Mar 11 2016 03:50
@justplaintodd @bitgrower @0x0936 @db7894 Thanks! i willl try it out!
CamperBot
@camperbot
Mar 11 2016 03:50
francis-p sends brownie points to @justplaintodd and @bitgrower and @0x0936 and @db7894 :sparkles: :thumbsup: :sparkles:
:star: 1240 | @0x0936 | http://www.freecodecamp.com/0x0936
:star: 793 | @bitgrower | http://www.freecodecamp.com/bitgrower
:star: 225 | @justplaintodd | http://www.freecodecamp.com/justplaintodd
:star: 252 | @db7894 | http://www.freecodecamp.com/db7894
bitgrower
@bitgrower
Mar 11 2016 03:51
@sup-rith -- what are you supposed to be doing (your words) ... ?
Suprith Aireddy
@sup-rith
Mar 11 2016 03:52
@bitgrower okay so im supposed to be returning a 2 dimensional array.
Thomas Honeyman
@thomashoneyman
Mar 11 2016 03:52

Hey guys — I’m curious about the Symmetric Difference bonfire (http://www.freecodecamp.com/challenges/symmetric-difference).

The symmetric difference of two sets removes the intersecting values; so [1,2,3] and [1,3,4] would have [2,4] left over.

But if you have three sets, then if there’s a value in all 3 sets then it gets kept instead of removed! So [1,2,3], [1,3,4], and [1,5] would have [1,2,4,5] left over.

Anyone know why exactly this is? I would think that if a value is intersected by all three sets it definitely would be removed (it would have been removed if there were only two sets).

Suprith Aireddy
@sup-rith
Mar 11 2016 03:53
@bitgrower i have to return it in intervals devending on the size
bitgrower
@bitgrower
Mar 11 2016 03:53
@saylu -- by the definition of symmetric difference ...
Thomas Honeyman
@thomashoneyman
Mar 11 2016 03:53
the mathematical term "symmetric difference" of two sets is the set of elements which are in either of the two sets, but not in both
I suppose it’s impossible to have the symmetric difference of 3 sets, if the definition states two sets
So it’s just applied over and over again to each subsequent pair
bitgrower
@bitgrower
Mar 11 2016 03:54
@saylu -- yup!
devonwilson1
@devonwilson1
Mar 11 2016 03:54
hello is there any body that can help me get started on the assignment "cover celsius to Fahrenheit " i am just not sure how to create the function..
bitgrower
@bitgrower
Mar 11 2016 03:54
@sup-rith -- do you know how to create a 2-D array (in code?)
Suprith Aireddy
@sup-rith
Mar 11 2016 03:54
no lol
is it var array = [][];
bitgrower @bitgrower takes stock in "convert celsius to Fahrenheit"
Pascal T.
@omegga
Mar 11 2016 03:55
@sup-rith use the function arr.slice() to return elements from arr
Suprith Aireddy
@sup-rith
Mar 11 2016 03:55
yes but how do i add that to a 2dimensional array?
@Scriptonaut
devonwilson1
@devonwilson1
Mar 11 2016 03:56
anyone out there??
anybody/??????
Pascal T.
@omegga
Mar 11 2016 03:56
@sup-rith use the function push(yourArray)
Ken Haduch
@khaduch
Mar 11 2016 03:57
@bitgrower - that's a hot one! :sun_with_face:
bitgrower
@bitgrower
Mar 11 2016 03:57
hahahahahaha @khaduch -
Pascal T.
@omegga
Mar 11 2016 03:57
@Scriptonaut @sup-rith push an array into an array
bitgrower
@bitgrower
Mar 11 2016 03:57
especially during the summer @khaduch
Suprith Aireddy
@sup-rith
Mar 11 2016 03:57
@Scriptonaut okay ill try that.
Guillermo Hernandez Jr
@guillermohernandez
Mar 11 2016 03:57
@devonwilson1
°F to °C Deduct 32, then multiply by 5, then divide by 9
°C to °F Multiply by 9, then divide by 5, then add 32
@devonwilson1 just do a function that does that.
Ken Haduch
@khaduch
Mar 11 2016 03:58
@devonwilson1 - here's a hint - they mostly have the function created and tell you where to add code... you only have to construct the "equation" in javascript code to calculate the answer...
Amir Eskandari
@AmirEskandari87
Mar 11 2016 03:58
@devonwilson1 they provide the equation.
Hasitha Kumara
@Crizando
Mar 11 2016 04:00
Need a hand hear
Profile Lookup
devonwilson1
@devonwilson1
Mar 11 2016 04:00
thanks @guillermohernandez
CamperBot
@camperbot
Mar 11 2016 04:00
devonwilson1 sends brownie points to @guillermohernandez :sparkles: :thumbsup: :sparkles:
:star: 296 | @guillermohernandez | http://www.freecodecamp.com/guillermohernandez
Daniel Bashir
@db7894
Mar 11 2016 04:00
Having some trouble on the Reverse a String algorithm
I'm just supposed to make the function return true if the string passed is a palindrome and false if it isn't. It's working for palindromes, but won't for inputs that aren't. Is there something wrong with my if/else statements?
function palindrome(str) {
  // Good luck!
  str = str.replace(/\W/g, '');
  str = str.toLowerCase();
  str = str.split();
  if (str == str.reverse()) {
    return true;
  } else {
    return false;
  }
}



palindrome("not a palindrome");
devonwilson1
@devonwilson1
Mar 11 2016 04:00
thanks @khaduch
CamperBot
@camperbot
Mar 11 2016 04:00
devonwilson1 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star: 696 | @khaduch | http://www.freecodecamp.com/khaduch
bitgrower
@bitgrower
Mar 11 2016 04:00
do you have some code @Crizando
devonwilson1
@devonwilson1
Mar 11 2016 04:01
but it says it doesn't recognize "to" and i don't know how you made the f have the little circle sign
thing
Hasitha Kumara
@Crizando
Mar 11 2016 04:01

@bitgrower //Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUp(firstName, prop){
// Only change code below this line
var i = 0;
while(i < contacts.lenght) {
if("firstName" == firstName && contacts[])
i++;
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");

Stuck in the 'if'
devonwilson1
@devonwilson1
Mar 11 2016 04:02
@khaduch i am not sure how to creat an "equation" in javascript...
bitgrower
@bitgrower
Mar 11 2016 04:02
do you know the difference between dot & bracket notation @Crizando ?
devonwilson1
@devonwilson1
Mar 11 2016 04:02
i just need help in how to create things specifically
any one
Hasitha Kumara
@Crizando
Mar 11 2016 04:03
@bitgrower Mm not sure
Daniel Bashir
@db7894
Mar 11 2016 04:03
@devonwilson1 Do you have any code written yet?
devonwilson1
@devonwilson1
Mar 11 2016 04:03
@AmirEskandari87 i need help creating the equation i know what to do just now sure exactly how to write it
bitgrower
@bitgrower
Mar 11 2016 04:03
okay ... Profile Lookup relies quite a bit on your understanding of how to address (access) different parts of an object ...
devonwilson1
@devonwilson1
Mar 11 2016 04:03
none written yet @db7894
bitgrower
@bitgrower
Mar 11 2016 04:04
@devonwilson1 -- how would you write it if you were solving it on paper ?
Amir Eskandari
@AmirEskandari87
Mar 11 2016 04:04
@devonwilson1 step 1, create a variable
@devonwilson1 set it equal to the equation @db7894 @guillermohernandez mentioned
devonwilson1
@devonwilson1
Mar 11 2016 04:04
great this is perfect @AmirEskandari87 thanks so how do i create the variable
CamperBot
@camperbot
Mar 11 2016 04:04
devonwilson1 sends brownie points to @amireskandari87 :sparkles: :thumbsup: :sparkles:
:star: 282 | @amireskandari87 | http://www.freecodecamp.com/amireskandari87
Daniel Bashir
@db7894
Mar 11 2016 04:05
@devonwilson1 use var
devonwilson1
@devonwilson1
Mar 11 2016 04:05
var convert(celsius)
Amir Eskandari
@AmirEskandari87
Mar 11 2016 04:05
@devonwilson1 with the var keyword.'
@devonwilson1 var variableName
Daniel Bashir
@db7894
Mar 11 2016 04:05
@devonwilson1 Easier to just say var celsius
Hasitha Kumara
@Crizando
Mar 11 2016 04:05
@bitgrower aa hha
Daniel Bashir
@db7894
Mar 11 2016 04:05
convert(celsius) makes it look like you're crating a function with the input celsius
devonwilson1
@devonwilson1
Mar 11 2016 04:06
var celsuis=
Todd Easter
@justplaintodd
Mar 11 2016 04:06
finally got started! i see what you mean now @bitgrower. Thanks for getting me started!
CamperBot
@camperbot
Mar 11 2016 04:06
justplaintodd sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
devonwilson1
@devonwilson1
Mar 11 2016 04:06
does that look good so far?
CamperBot
@camperbot
Mar 11 2016 04:06
:star: 794 | @bitgrower | http://www.freecodecamp.com/bitgrower
Amir Eskandari
@AmirEskandari87
Mar 11 2016 04:06
@devonwilson1 yes
bitgrower
@bitgrower
Mar 11 2016 04:06
awesome, @justplaintodd .. :)
Daniel Bashir
@db7894
Mar 11 2016 04:06
@devonwilson1 Yup! Now you can use the conversion formula they gave you
devonwilson1
@devonwilson1
Mar 11 2016 04:06
what should i write to represent fahrenheit? just that?
Amir Eskandari
@AmirEskandari87
Mar 11 2016 04:07
@devonwilson1 except if you read the instructions for that problem, it says:"Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit."
Daniel Bashir
@db7894
Mar 11 2016 04:07
@devonwilson1 Ok so just make the variable you created fahrenheit
Amir Eskandari
@AmirEskandari87
Mar 11 2016 04:07
@devonwilson1 so.. make the var fahrenheit
Daniel Bashir
@db7894
Mar 11 2016 04:07
@devonwilson1 If celsius is already declared in the function then you can just use it in your code without having to create it separately
devonwilson1
@devonwilson1
Mar 11 2016 04:07
var celsuis=fahrenheit
this what i got so far lol
Daniel Bashir
@db7894
Mar 11 2016 04:08
Alright, now you also have a formula
For how to convert fahrenheit to celsius
Hasitha Kumara
@Crizando
Mar 11 2016 04:08
How to write codes for this?
"The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact."
Daniel Bashir
@db7894
Mar 11 2016 04:09
@Crizando Based on whatever you're given, how would you check for those without using code?
bitgrower
@bitgrower
Mar 11 2016 04:09
how would you look at the value of the firstname property in one of your objects, @Crizando ?
devonwilson1
@devonwilson1
Mar 11 2016 04:10
so now that i have made var celsius to be fahrenheit i made fahrenheit equal the equation?
Dan Logajan
@hiltydiggs
Mar 11 2016 04:10
Has anyone solved Validate US Telephone Numbers since they added new tests for '(' with no closing ')' or ')' with no opening '('? I just looked back at it and noticed.
Hasitha Kumara
@Crizando
Mar 11 2016 04:10
@db7894 @bitgrower contacts["firstName"] == firsName ?
Daniel Bashir
@db7894
Mar 11 2016 04:11
@devonwilson1 If you weren't using code, how would you write the equation to convert from celsius to fahrenheit?
bitgrower
@bitgrower
Mar 11 2016 04:11
close ... @Crizando -- but go back and look at your data structure ... can you describe it for me ?
devonwilson1
@devonwilson1
Mar 11 2016 04:11
celsius equals fahrenheit
Daniel Bashir
@db7894
Mar 11 2016 04:11
@devonwilson1 But it doesn't...
devonwilson1
@devonwilson1
Mar 11 2016 04:11
thats what i would put
Daniel Bashir
@db7894
Mar 11 2016 04:12
@devonwilson1 If I remember correctly they give you the equation to convert from celsius to fahrenheit
bitgrower
@bitgrower
Mar 11 2016 04:12
celsius = fahrenheit ... followed by what ?
devonwilson1
@devonwilson1
Mar 11 2016 04:12
thats all i got so far
now should i put the equation in?
Daniel Bashir
@db7894
Mar 11 2016 04:12
@devonwilson1 Yes, look at the formula that they gave you
bitgrower
@bitgrower
Mar 11 2016 04:13
yeah, sounds like a good start ... try and and if you go off the road, we'll get you back on ... :)
devonwilson1
@devonwilson1
Mar 11 2016 04:13
should i next make the value of fahrenheit the equation i have?
Hasitha Kumara
@Crizando
Mar 11 2016 04:13
@bitgrower There is an array called contacts which has several properties
devonwilson1
@devonwilson1
Mar 11 2016 04:13
like var hafrenheit= the equation?
bitgrower
@bitgrower
Mar 11 2016 04:13
awesome -- how do you address a member of an array, @Crizando ?
Daniel Bashir
@db7894
Mar 11 2016 04:14
@devonwilson1 sounds right
So can anyone help me out with the Check for Palindromes algorithm? This is what I have
function palindrome(str) {
  // Good luck!
  str = str.replace(/\W/g, '');
  str = str.toLowerCase();
  str = str.split();
  if (str == str.reverse()) {
    return true;
  } else {
    return false;
  }
}



palindrome("not a palindrome");
It works for palindromes and returns true but won't return false for non palindromes
bitgrower
@bitgrower
Mar 11 2016 04:14
lol -- so it returns true all the time, @db7894 ?
Hasitha Kumara
@Crizando
Mar 11 2016 04:15
@bitgrower mm an element?
Daniel Bashir
@db7894
Mar 11 2016 04:16
@bitgrower Yeah it does
Suprith Aireddy
@sup-rith
Mar 11 2016 04:16
@db7894 you have to also check the last full ford
Daniel Bashir
@db7894
Mar 11 2016 04:16
@bitgrower I entered it into that website you told me about but I can't figure out what's wrong
@sup-rith Last full word?
Suprith Aireddy
@sup-rith
Mar 11 2016 04:16
yes
Daniel Bashir
@db7894
Mar 11 2016 04:17
@sup-rith Do you mean the last full word in the string? I think what I have checks the whole string
Suprith Aireddy
@sup-rith
Mar 11 2016 04:17
yea check the last full work of the string as well as the whole string
Daniel Bashir
@db7894
Mar 11 2016 04:18
@sup-rith I don't understand why that's needed or how it would be done separately...
bitgrower
@bitgrower
Mar 11 2016 04:18

[ 'a', 'b', 'c', 'd' ]

^^^^ @Crizando those things which make up the array are sometimes called elements

or members
Hasitha Kumara
@Crizando
Mar 11 2016 04:18
@bitgrower ok, so?
Pascal T.
@omegga
Mar 11 2016 04:19
@db7894 reverse() is mutating your array
Mas hary
@mas212
Mar 11 2016 04:19
timesFive(2) should return 10 ??
bitgrower
@bitgrower
Mar 11 2016 04:19

if I give you arr = [ 'a', 'b', 'c', 'd' ];

how would I address 'c' ? @Crizando

Daniel Bashir
@db7894
Mar 11 2016 04:20
@Scriptonaut Do I need to join it again or something for this to work?
Suprith Aireddy
@sup-rith
Mar 11 2016 04:20
@db7894 What does the reverse method do?
Hasitha Kumara
@Crizando
Mar 11 2016 04:20
@bitgrower arr[2];
Pascal T.
@omegga
Mar 11 2016 04:20
@db7894 you need to make a copy of the array
Daniel Bashir
@db7894
Mar 11 2016 04:20
@sup-rith Reverses the order of the elements in the string
bitgrower
@bitgrower
Mar 11 2016 04:21
okay you have an array of objects ... so how are you going to address the object you want to look at ? @Crizando
Daniel Bashir
@db7894
Mar 11 2016 04:21
@Scriptonaut I'll try that
Suprith Aireddy
@sup-rith
Mar 11 2016 04:21
oh ok. That is your problem @db7894
Richard Corbett
@reacorbett
Mar 11 2016 04:22
hello everyone!!! :)
bitgrower
@bitgrower
Mar 11 2016 04:22
hey @reacorbett
Daniel Bashir
@db7894
Mar 11 2016 04:22
Ok I changed it around but now everything returns false
function palindrome(str) {
  // Good luck!
  str = str.replace(/\W/g, '');
  str = str.toLowerCase();
  str = str.split();
  var strNew = str;
  strNew.reverse();
  strNew.join();
  if (str.join() === strNew) {
    return true;
  } else {
    return false;
  }
}



palindrome("not a palindrome");
Richard Corbett
@reacorbett
Mar 11 2016 04:23
@bitgrower hey. Igot pretty far on my random quote machine last night.
bitgrower
@bitgrower
Mar 11 2016 04:23
WTG !!!!
Richard Corbett
@reacorbett
Mar 11 2016 04:24
thank you.
bitgrower
@bitgrower
Mar 11 2016 04:24
@db7894 -- you might look at your split call and make sure it's the kind of split call you want
it might be ... I don't recall offhand, but I think you might want something slightly different than what you have ...
Daniel Bashir
@db7894
Mar 11 2016 04:25
@bitgrower OH I see
And it's the same with join
Darn it still has the same issue
bitgrower
@bitgrower
Mar 11 2016 04:26
well, I dunno about that -- I think if you get split right, join will do what you want
Daniel Bashir
@db7894
Mar 11 2016 04:26
@bitgrower Changed it to this
function palindrome(str) {
  // Good luck!
  str = str.replace(/\W/g, '');
  str = str.toLowerCase();
  str = str.split('');
  var strNew = str;
  strNew.reverse();
  strNew.join("");
  if (str.join("") === strNew) {
    return true;
  } else {
    return false;
  }
}



palindrome("not a palindrome");
Still has the same issue though
Richard Corbett
@reacorbett
Mar 11 2016 04:26
I have to change the background because I changed directions in the theme part ways through. I also have to add the twitter feature and the format of the text. but all in all, I am proud of it. @bitgrower
http://codepen.io/reacorbett/full/dMGQxK/
Pascal T.
@omegga
Mar 11 2016 04:26
@db7894 when you do strNew.reverse(), you're also reversing str
Daniel Bashir
@db7894
Mar 11 2016 04:27
@Scriptonaut Ah right... I'll try to figure out how to make a copy differently
bitgrower
@bitgrower
Mar 11 2016 04:28
if it's an array, slice works nicely :)
Daniel Bashir
@db7894
Mar 11 2016 04:28
@bitgrower Yes I just found that one :smile:
If I leave the parentheses blank will it slice from beginning to end?
Pascal T.
@omegga
Mar 11 2016 04:29
yes
Daniel Bashir
@db7894
Mar 11 2016 04:29
Alright so this is what it looks like now
function palindrome(str) {
  // Good luck!
  str = str.replace(/\W/g, '');
  str = str.toLowerCase();
  str = str.split('');
  var strNew = str.slice();
  strNew.reverse();
  strNew.join("");
  if (str.join("") === strNew) {
    return true;
  } else {
    return false;
  }
}



palindrome("not a palindrome");
Still the same issue but hopefully I'm getting closer
Todd Easter
@justplaintodd
Mar 11 2016 04:31
@bitgrower Record Collection solved! I knew I was close!
bitgrower
@bitgrower
Mar 11 2016 04:31
sweet !!!! @justplaintodd !!!
Todd Easter
@justplaintodd
Mar 11 2016 04:32
Thanks for pointing me in the right direction without giving me an answer @bitgrower
CamperBot
@camperbot
Mar 11 2016 04:32
justplaintodd sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:warning: justplaintodd already gave bitgrower points
Todd Easter
@justplaintodd
Mar 11 2016 04:33
aww, thought i could give you more
Pascal T.
@omegga
Mar 11 2016 04:33
@db7894 you're almost there
bitgrower
@bitgrower
Mar 11 2016 04:33
@justplaintodd -- 1 point per hour ... if you're still around in howmany ever minutes, you can give me another ... :)
thanks for the thought, though -- much appreciated ...
demipixel
@demipixel
Mar 11 2016 04:33
meh
Stefan Gisi
@stgisi
Mar 11 2016 04:33
wiki smallest common
CamperBot
@camperbot
Mar 11 2016 04:33

:point_right: algorithm smallest common multiple [wiki]

Explanation:

The smallest common multiple between two numbers is the smallest number that
both numbers can divide into. This concept can be extended to more than two
numbers as well.

We can first start with just finding the smallest common multiple between two
numbers. Naively, you can start writing out multiple of each number until you
write a multiple that exists from both numbers.

An example would be the numbers 3 and 4. The multiples of 3 are 3, 6, 9, 12, 15, 18, ... and the multiples of 4 are 4, 8, 12, 16, 20, .... The
first smallest number we run into in both lists is 12 so this is the smallest
common multiple between 3 and 4.

This problem can be confusing because most people look for the smallest common
multiple of just the two numbers but forget the keyword range. However, this
means that if you are given [1,5], then you have to check for the smallest
common multiple for all the numbers [1,2,3,4,5] that is evenly divisible by
all of them.

:pencil: read more about algorithm smallest common multiple on the FCC Wiki

demipixel
@demipixel
Mar 11 2016 04:34
How hard is it to make 20 bots which give you each a point every hour
:D
Sell it to people for 200 points
*stars
Catalin Scripcariu
@CatalinScr
Mar 11 2016 04:34
wiki inventory update
CamperBot
@camperbot
Mar 11 2016 04:34

:point_right: algorithm inventory update [wiki]

Problem Explanation:

  • Look through an array of new products, in the format: [quantity, name]
  • Return an array containing updated quantities for each item that already existed, and any new products
:pencil: read more about algorithm inventory update on the FCC Wiki
Richard Corbett
@reacorbett
Mar 11 2016 04:35
thanks @reacorbett
CamperBot
@camperbot
Mar 11 2016 04:35
sorry reacorbett, you can't send brownie points to yourself! :sparkles: :sparkles:
Daniel Bashir
@db7894
Mar 11 2016 04:35
Still don't know why the if statement gets skipped over in execution...
@reacorbett LOL
Richard Corbett
@reacorbett
Mar 11 2016 04:35
ehwell you cant give yourself points
Daniel Bashir
@db7894
Mar 11 2016 04:35
Good try
demipixel
@demipixel
Mar 11 2016 04:35
@reacorbett Yeah but you just need 50 github accounts
Then you have 50 gitter accounts
And every hour, they all say "Thanks @DemiPixel"
CamperBot
@camperbot
Mar 11 2016 04:35
sorry demipixel, you can't send brownie points to yourself! :sparkles: :sparkles:
demipixel
@demipixel
Mar 11 2016 04:36
Boom, 50 points per hour
in a day you have 1200 poinst ez
Screen Shot 2016-01-23 at 12.45.09 AM.png
Richard Corbett
@reacorbett
Mar 11 2016 04:37
lol.
Daniel Bashir
@db7894
Mar 11 2016 04:37
Literally just changed the if statement from having "===" to "==" and now it works for almost all of them
function palindrome(str) {
  // Good luck!
  str = str.replace(/\W/g, '');
  str = str.toLowerCase();
  str = str.split('');
  var strNew = str.slice();
  strNew.reverse();
  strNew.join("");
  if (str.join() == strNew) {
    return true;
  } else {
    return false;
  }
}



palindrome("not a palindrome");
Except for palindrome("0_0 (: /-\ :) 0-0")
devonwilson1
@devonwilson1
Mar 11 2016 04:38
can someone tell me what is wrong with this
var myStr = "I am a /"double quoted" string inside /"double quotes";
bitgrower
@bitgrower
Mar 11 2016 04:38
awesome ... you're getting closer ...
Richard Corbett
@reacorbett
Mar 11 2016 04:39
@devonwilson1 It is the quotes
you have three
bitgrower
@bitgrower
Mar 11 2016 04:39
@db7894 -- the next trick is to make sure you are keeping or removing the characters you think you are ... :) (yeah, it's sort of a "trick" -- but you'll remember it, I'll wager)
Daniel Bashir
@db7894
Mar 11 2016 04:39
Apparently it removes everything except _
devonwilson1
@devonwilson1
Mar 11 2016 04:39
this still doesn't work
var myStr = "I am a /"double quoted" string inside /"double quotes"";
Richard Corbett
@reacorbett
Mar 11 2016 04:40
"I am a /"double quoted/" string inside /" double quotes/"";
you have to use a backslash for all the double quotes inside a string.
devonwilson1
@devonwilson1
Mar 11 2016 04:41
var myStr = "I am a /"double quoted/" string inside /"double quotes/"";
this did not work I'm nor sure why
Richard Corbett
@reacorbett
Mar 11 2016 04:41
what is the name of the challenge.
?
@devonwilson1
devonwilson1
@devonwilson1
Mar 11 2016 04:42
escaping literal quotes in strings
Daniel Bashir
@db7894
Mar 11 2016 04:42
@bitgrower Can't seem to figure out what it is... I found the .replace(/\W+/g, '') on a forum but I can't figure out why it doesn't remove the "_" from an expression when it does that to everything else
bitgrower
@bitgrower
Mar 11 2016 04:43
research, @db7894 - don't trust what you read on a forum -- trust the documentation ... :)
Richard Corbett
@reacorbett
Mar 11 2016 04:43
@devonwilson1 ahh!!! duh!!! the backslashes are wrong. try this way |\"
"I am a \"double quoted\" string inside \"double quotes\""
devonwilson1
@devonwilson1
Mar 11 2016 04:44
what way I'm seeing a vertical line
oh you mean forward slash?
Daniel Bashir
@db7894
Mar 11 2016 04:44
@bitgrower I got it but I did a remove that specifically went for the underscore
devonwilson1
@devonwilson1
Mar 11 2016 04:44
i can't even find it lol
Richard Corbett
@reacorbett
Mar 11 2016 04:44
yes
devonwilson1
@devonwilson1
Mar 11 2016 04:44
\
lol
Richard Corbett
@reacorbett
Mar 11 2016 04:44
right above enter
devonwilson1
@devonwilson1
Mar 11 2016 04:45
thanks @db7894
CamperBot
@camperbot
Mar 11 2016 04:45
devonwilson1 sends brownie points to @db7894 :sparkles: :thumbsup: :sparkles:
:star: 254 | @db7894 | http://www.freecodecamp.com/db7894
devonwilson1
@devonwilson1
Mar 11 2016 04:45
thanks @reacorbett
CamperBot
@camperbot
Mar 11 2016 04:45
devonwilson1 sends brownie points to @reacorbett :sparkles: :thumbsup: :sparkles:
:star: 308 | @reacorbett | http://www.freecodecamp.com/reacorbett
Richard Corbett
@reacorbett
Mar 11 2016 04:45
no problem
Daniel Bashir
@db7894
Mar 11 2016 04:45
@devonwilson1 No problem
@bitgrower Can't find anything in the documentation about non alphanumeric characters...
Removing them that is
bitgrower
@bitgrower
Mar 11 2016 04:48
search and see what \W does ...
Daniel Bashir
@db7894
Mar 11 2016 04:50
@bitgrower Not finding anything...
Daniel Bashir
@db7894
Mar 11 2016 04:51
So it matches any non word character
But then that should cover _ as well...
Richard Corbett
@reacorbett
Mar 11 2016 04:51
@db7894 this is a good site to get familliar with regex. http://regexr.com/
Daniel Bashir
@db7894
Mar 11 2016 04:52
I guess maybe that's the only one it doesn't cover
Thanks @bitgrower @Scriptonaut @reacorbett
CamperBot
@camperbot
Mar 11 2016 04:52
db7894 sends brownie points to @bitgrower and @scriptonaut and @reacorbett :sparkles: :thumbsup: :sparkles:
:star: 309 | @reacorbett | http://www.freecodecamp.com/reacorbett
:star: 795 | @bitgrower | http://www.freecodecamp.com/bitgrower
:star: 281 | @scriptonaut | http://www.freecodecamp.com/scriptonaut
bitgrower
@bitgrower
Mar 11 2016 04:53
right from the page @Scriptonaut pointed to: "Matches any non-word character. Equivalent to [^A-Za-z0-9_]." <-- what \W matches
Daniel Bashir
@db7894
Mar 11 2016 04:53
Right so I just have to cover that one separately... Awesome!
Got it
Andres Ariel Alvarez-Saucedo
@Andr3sAlv
Mar 11 2016 04:55
how do I assign backslash tab tab carriage-return new-line to myStr?
Darrel Adams
@dadams-510
Mar 11 2016 04:56
Has anyone completed the "Search and Destroy" challenge.
走你飛艇
@gofighting123
Mar 11 2016 04:56
This message was deleted
Darrel Adams
@dadams-510
Mar 11 2016 04:56
I'm not completely sure what it's asking me to do.
走你飛艇
@gofighting123
Mar 11 2016 04:56
....
This message was deleted
...
help paste
CamperBot
@camperbot
Mar 11 2016 04:58
no wiki entry for: paste
bitgrower
@bitgrower
Mar 11 2016 04:58
@dadams-510 -- seek and destroy -- and yes ...
Darrel Adams
@dadams-510
Mar 11 2016 04:59
Hey @bitgrower what is this challenge asking me to do?
I can't seem to wrap my head around it.
走你飛艇
@gofighting123
Mar 11 2016 05:00
This message was deleted
Pascal T.
@omegga
Mar 11 2016 05:00
@dadams-510 destroy( [1,2,3,4,5] , 4,5 ) will erase 4 and 5 and return [1,2,3]
Darrel Adams
@dadams-510
Mar 11 2016 05:00
Ah perfect.
thanks @Scriptonaut
CamperBot
@camperbot
Mar 11 2016 05:01
dadams-510 sends brownie points to @scriptonaut :sparkles: :thumbsup: :sparkles:
:star: 282 | @scriptonaut | http://www.freecodecamp.com/scriptonaut
Richard Corbett
@reacorbett
Mar 11 2016 05:01
This message was deleted
between 0-10
走你飛艇
@gofighting123
Mar 11 2016 05:02
This message was deleted
oh my god..
Darrel Adams
@dadams-510
Mar 11 2016 05:03
I wonder if a "slice" method would work with this one.
Hasitha Kumara
@Crizando
Mar 11 2016 05:06

Why is this return false?

//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUp(firstName, prop){
// Only change code below this line
var i = 0;
while (i < contacts.length) {
if (contacts[i].firstName == firstName && contacts[i] == prop) {
return true;
} else {
return false;
}
i++;
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");

@bitgrower Why this returns false?

//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUp(firstName, prop){
// Only change code below this line
var i = 0;
while (i < contacts.length) {
if (contacts[i].firstName == firstName && contacts[i] == prop) {
return true;
} else {
return false;
}
i++;
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");

demipixel
@demipixel
Mar 11 2016 05:07
@reacorbett yes it is
Although, if it's like an array of length ten, you'll do Math.floor(Math.random()*10)
Daniel Bashir
@db7894
Mar 11 2016 05:07
My code for finding the longest word in a string keeps returning false... Any ideas on why?
function findLongestWord(str) {
  str.split('');
  var length = 0;
  for (i = 0; i < str.length; i++) {
    if (length < str[i].length) {
      length = str[i].length;
    }
  }
  return length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Wait got it
demipixel
@demipixel
Mar 11 2016 05:08
haha
Daniel Bashir
@db7894
Mar 11 2016 05:08
Never mind
Hasitha Kumara
@Crizando
Mar 11 2016 05:08
blob
bitgrower
@bitgrower
Mar 11 2016 05:08
@Crizando -- because of the if contacts[i] == prop part of your conditional
I never remember if I can actually do this: str.split(''); -- I always assign the result of such calls to a new variable ...
Daniel Bashir
@db7894
Mar 11 2016 05:10
Still returns 1...
Hasitha Kumara
@Crizando
Mar 11 2016 05:10
@bitgrower Ok, if so how I can correct that part?
bitgrower
@bitgrower
Mar 11 2016 05:11
@Crizando -- look at the instructions, and make sure you are checking the prop variable as you should ...
Kyle Morton
@kmorton1988
Mar 11 2016 05:12
can someone explain a bit how the string.substr() function works? or is that a method? Either way, what exactly am I seeing there? It takes 2 arguments, the "search" patter, and then a number of strings after it. I think.
number of characters*
bitgrower
@bitgrower
Mar 11 2016 05:13
@kmorton1988 -- I would refer you to the most excellent documentation for substr() that can be found on the Mozilla Developer Network ... :) I always am having to look up stuff ...
Kyle Morton
@kmorton1988
Mar 11 2016 05:13
yeah, that's where I am.
I'm still lost.
or at least lost in how I'm supposed to use it in this challenge.
bitgrower
@bitgrower
Mar 11 2016 05:14
which challenge, @kmorton1988 ?
Kyle Morton
@kmorton1988
Mar 11 2016 05:14
Confirm the Ending
confirm if a substring is the end of a string
bitgrower
@bitgrower
Mar 11 2016 05:16
my recommendation, @krmorton -- would be to go to something like jsbin or jsfiddle or even codepen ... and play with the substr function ... look at the examples on the MDN page -- see if you can follow them enough to make sense of them ... sometimes you just have to look at things and play with them until they make sense ...
Kyle Morton
@kmorton1988
Mar 11 2016 05:17
good thinking. Will try that
thanks
bitgrower
@bitgrower
Mar 11 2016 05:17
I never remember if I can actually do this: str.split(''); -- I always assign the result of such calls to a new variable ...
@Crizando -- were you asking me how to set the value return by str.split(''); to a variable ?
Hasitha Kumara
@Crizando
Mar 11 2016 05:18
@bitgrower function lookUp(firstName, prop){
// Only change code below this line
var i = 0;
while (i < contacts.length) {
if (contacts[i].firstName == firstName && contacts[i] == prop) {
return contacts[i];
} else if (contacts[i].firstName !== firstName) {
return "No such contact";
} else if (contacts[i] == prop) {
return "No such property";
}
i++;
}
// Only change code above this line
}
bitgrower
@bitgrower
Mar 11 2016 05:18
@kmorton1988 -- it's kinda like going on vacation and staying at a hotel, and you have to figure out how to navigate around the hotel ...
Otman Bouchari
@obouchari
Mar 11 2016 05:18
Hello FCC fellows
Hasitha Kumara
@Crizando
Mar 11 2016 05:18
Still not correct
Ryan Price
@rsprice
Mar 11 2016 05:18
@Crizando help format
help format
CamperBot
@camperbot
Mar 11 2016 05:18

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Hasitha Kumara
@Crizando
Mar 11 2016 05:19
@rsprice ??
bitgrower
@bitgrower
Mar 11 2016 05:19
I don't see any change in the contacts[i] == prop part of your conditional statement, @Crizando ...
Pascal T.
@omegga
Mar 11 2016 05:19
@db7894 if it returns 1 , you have likely found the longest character in the string, not the longest word
Ryan Price
@rsprice
Mar 11 2016 05:19
@Crizando you should format your code so it's easier to read :)
Daniel Bashir
@db7894
Mar 11 2016 05:19
@Scriptonaut Yeah I figured out what I did wrong, I didn't include a space in my split function so it split it all into characters and not by words
bitgrower
@bitgrower
Mar 11 2016 05:20
LOL ... I love that .. "longest character", @Scriptonaut
Daniel Bashir
@db7894
Mar 11 2016 05:20
I mean they are all the longest character
Kyle Morton
@kmorton1988
Mar 11 2016 05:20
stupid question: how do you get jsbin to output the javascript?
bitgrower
@bitgrower
Mar 11 2016 05:20
(actually, it's not quite as funny as I wish it were .. unicode characters are 2 bytes -- but there are other codeplanes in unicode ... so those can be 32 bits ... argh)
Hasitha Kumara
@Crizando
Mar 11 2016 05:21
@rsprice Will you tell me how to do so? And tell me how to post my code with a black background in here. like others do
bitgrower
@bitgrower
Mar 11 2016 05:21
@kmorton1988 -- console.log works ...
Ryan Price
@rsprice
Mar 11 2016 05:21
@Crizando
help format
CamperBot
@camperbot
Mar 11 2016 05:21

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

bitgrower
@bitgrower
Mar 11 2016 05:21

@Crizando -- :point_up: March 10, 2016 9:18 PM

follow those instructions...

Ryan Price
@rsprice
Mar 11 2016 05:22
@Crizando that's how you get the black background :D
Kyle Morton
@kmorton1988
Mar 11 2016 05:22
lol. thanks @bitgrower
CamperBot
@camperbot
Mar 11 2016 05:22
kmorton1988 sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 796 | @bitgrower | http://www.freecodecamp.com/bitgrower
Otman Bouchari
@obouchari
Mar 11 2016 05:22
Anyone finished the TicTacToe project?
bitgrower
@bitgrower
Mar 11 2016 05:22
lol, @kmorton1988 -- I had the same problem when I first saw jsbin ...
not me @obouchari
Otman Bouchari
@obouchari
Mar 11 2016 05:23
@bitgrower Are you sure ;)
bitgrower
@bitgrower
Mar 11 2016 05:23
maybe denizens of the frontend room, or folks in the Codereview room ...
LOL yeah, I'm sure, @obouchari ... I'd not lie about that ... :)
Daniel Bashir
@db7894
Mar 11 2016 05:23
Anyone have an idea why this only returns "I"?
function titleCase(str) {
  str = str.toLowerCase();
  str = str.split(' ');
  for (var i = 0; i < str.length; i++) {
    str = str[i].charAt(0).toUpperCase();
  }
  return str;
}

titleCase("I'm a little tea pot");
Kyle Morton
@kmorton1988
Mar 11 2016 05:24
@db7894 when you call "charAt(0) it literally grabs only that one character.
Otman Bouchari
@obouchari
Mar 11 2016 05:24
@bitgrower I'll try that, I just want an opinion!
Hasitha Kumara
@Crizando
Mar 11 2016 05:24
@rsprice :D I know it sounds funny but didn't know how to ask it proper
Daniel Bashir
@db7894
Mar 11 2016 05:24
@kmorton1988 So the for loop doesn't fix that? I'm pretty sure str[i] should refer to each word and then adding .charAt would refer to a letter in the word...
bitgrower
@bitgrower
Mar 11 2016 05:24
what sort of opinion did you want, @obouchari ?
Maddah Anass
@unlimiworks
Mar 11 2016 05:25
Hi there folks :smile:
Hasitha Kumara
@Crizando
Mar 11 2016 05:25
This message was deleted
CamperBot
@camperbot
Mar 11 2016 05:25
:bulb: to format code use backticks! ``` more info
Ryan Price
@rsprice
Mar 11 2016 05:25
@Crizando it doesn't sound funny at all :P it's good to know how to do
bitgrower @bitgrower is sad she couldn't satisfy @obouchari 's request
Gershom
@jinmanbok
Mar 11 2016 05:25
js
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i < arr.length; i++) {
      for (var j=0; j < arr[i].length; j++) {


        product = arr[i] * arr[j];}
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
bitgrower
@bitgrower
Mar 11 2016 05:25
hello @UnlimiWorks
Daniel Bashir
@db7894
Mar 11 2016 05:25
Hi @UnlimiWorks
Kyle Morton
@kmorton1988
Mar 11 2016 05:25
@db7894 yeah, but your variable declaration there specifically tells it to capture the capitalized first letter of each string, and that's it.
Gershom
@jinmanbok
Mar 11 2016 05:25
I'm trying to display the value of product but it's not working...
bitgrower
@bitgrower
Mar 11 2016 05:25
@jinmanbok -- they had such a nice little piece of code in the challenge written to the console.log, too ...
Daniel Bashir
@db7894
Mar 11 2016 05:26
@kmorton1988 Ah, I see that I'm making the entire string into just the first letters. I still don't understand why it stops only at the first one though
Ryan Price
@rsprice
Mar 11 2016 05:26
@jinmanbok what is it doing?
Gershom
@jinmanbok
Mar 11 2016 05:26
Unexpected end of input
It's supposed to multiply the array inputs
bitgrower
@bitgrower
Mar 11 2016 05:26
I think it's something like console.log(arr[i][j]);
Gershom
@jinmanbok
Mar 11 2016 05:26
I think I tried that before
Kyle Morton
@kmorton1988
Mar 11 2016 05:27
@db7894 because that was charAt(0) does. It takes only the specified position (index 0 in this case)
Hasitha Kumara
@Crizando
Mar 11 2016 05:27
This message was deleted
CamperBot
@camperbot
Mar 11 2016 05:27
:bulb: to format code use backticks! ``` more info
bitgrower
@bitgrower
Mar 11 2016 05:27
well -- it's worth looking at, @jinmanbok :)
Otman Bouchari
@obouchari
Mar 11 2016 05:27
@bitgrower In that project you have that board with 9 cells, right so to win you have to hit a specific order, I named theose cells as follows: tl, tc, tr, ml, mc, mr, bl, bc, br. t for top m for middle etc..
So I just defined an array with winning orders. but thats not effective if the board grows (add more cells)
Hasitha Kumara
@Crizando
Mar 11 2016 05:28
function lookUp(firstName, prop){
// Only change code below this line
  var i = 0;
  while (i < contacts.length) {
     if (contacts[i].firstName == firstName && contacts[i] == prop) {
       return contacts[i];
     } else if (contacts[i].firstName !== firstName) {
       return "No such contact";
     } else if (contacts[i] == prop) {
       return "No such property";
     }   
  i++;  
  }   
// Only change code above this line
}
Daniel Bashir
@db7894
Mar 11 2016 05:28
@kmorton1988 But why doesn't it do that for each word when I've specifically made a for loop that should cycle through each?
Hasitha Kumara
@Crizando
Mar 11 2016 05:28
Ah finally :D
Ryan Price
@rsprice
Mar 11 2016 05:28
@Crizando now you know!
Hasitha Kumara
@Crizando
Mar 11 2016 05:29
Thankooo... Now, please help me to fix my code too@rsprice
Maddah Anass
@unlimiworks
Mar 11 2016 05:29
@db7894 Because you're assigning it to str; after your first iteration, str will equal I and the loop will end
bitgrower
@bitgrower
Mar 11 2016 05:29
you know ... (and it's been years & years since I've played) -- chess players have a way of describing squares on the chessboard -- maybe you can use it analogously ?
Daniel Bashir
@db7894
Mar 11 2016 05:29
Ok this fixed it a bit
function titleCase(str) {
  str = str.toLowerCase();
  str = str.split(' ');
  for (var i = 0; i < str.length; i++) {
    str[i] = str[i].charAt(0).toUpperCase();
  }
  return str;
}

titleCase("I'm a little tea pot");
bitgrower
@bitgrower
Mar 11 2016 05:29
YAY !!!! @Crizando
Daniel Bashir
@db7894
Mar 11 2016 05:29
Now I just need to add the rest of the words back in
bitgrower
@bitgrower
Mar 11 2016 05:29
congrats!!!!
Maddah Anass
@unlimiworks
Mar 11 2016 05:29
@db7894 Nevermind. 5am again
Otman Bouchari
@obouchari
Mar 11 2016 05:29
@bitgrower I'll look into that, Thanks
CamperBot
@camperbot
Mar 11 2016 05:29
obouchari sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 797 | @bitgrower | http://www.freecodecamp.com/bitgrower
Hasitha Kumara
@Crizando
Mar 11 2016 05:30
@bitgrower he he. Now will you help me to fix my code
Daniel Bashir
@db7894
Mar 11 2016 05:30
@UnlimiWorks You need to get some sleep
bitgrower
@bitgrower
Mar 11 2016 05:30
if you're very very nice ...... (she says, coyly)
Maddah Anass
@unlimiworks
Mar 11 2016 05:30
@db7894 I do really. i should stop trying to help people when I need the most help xD
Sorry about the faulty answer
Hasitha Kumara
@Crizando
Mar 11 2016 05:30
function lookUp(firstName, prop){
// Only change code below this line
  var i = 0;
  while (i < contacts.length) {
     if (contacts[i].firstName == firstName && contacts[i] == prop) {
       return contacts[i];
     } else if (contacts[i].firstName !== firstName) {
       return "No such contact";
     } else if (contacts[i] == prop) {
       return "No such property";
     }   
  i++;  
  }   
// Only change code above this line
}
bitgrower
@bitgrower
Mar 11 2016 05:31
LOL I feel ya @UnlimiWorks ...
helping can be a bit addictive -- and those brownie points do not help ...
Daniel Bashir
@db7894
Mar 11 2016 05:31
@UnlimiWorks Haha no it helped
bitgrower
@bitgrower
Mar 11 2016 05:32
@Crizando -- for the THIRD time .... this part of your conditional statement is WRONG: contacts[i] == prop
Ryan Price
@rsprice
Mar 11 2016 05:32
@Crizando what output are you getting currently?
Maddah Anass
@unlimiworks
Mar 11 2016 05:32
It was a productive day at the very least. Cleared the intermediate algorithms. Gonna try the advanced ones tomorrow if I have the time :)
Daniel Bashir
@db7894
Mar 11 2016 05:32
Now to make it so that the rest of the words are still there...
bitgrower
@bitgrower
Mar 11 2016 05:32
if you reference contacts[i] you are looking at the ENTIRE object
Daniel Bashir
@db7894
Mar 11 2016 05:32
@UnlimiWorks Did you do them all in one day??
bitgrower
@bitgrower
Mar 11 2016 05:32
I have NO cluse what the js interpreter makes of that ... LOL
Hasitha Kumara
@Crizando
Mar 11 2016 05:32
@bitgrower Then how?
Kyle Morton
@kmorton1988
Mar 11 2016 05:33
@db7894 so now you're properly capitalizing all the first letters, you just need to replace the first letter of each string in the str array with the capitlalized letter.
Maddah Anass
@unlimiworks
Mar 11 2016 05:33
@db7894 except the first 2 :)
I went hard at it today lol
Hasitha Kumara
@Crizando
Mar 11 2016 05:33
@rsprice "No such contact"
Kyle Morton
@kmorton1988
Mar 11 2016 05:33
@db7894 keyword being "replace"
bitgrower
@bitgrower
Mar 11 2016 05:33
how did you get the value of the firstname property, @Crizando (except you have to use the OTHER way of addressing parts of the object -- you can't use the dot notation)
Suprith Aireddy
@sup-rith
Mar 11 2016 05:33
Can someone help me with the mutation challenge?
Ryan Price
@rsprice
Mar 11 2016 05:33
@bitgrower wouldn't that just return the object at that index?
@sup-rith yes
Suprith Aireddy
@sup-rith
Mar 11 2016 05:34
@rsprice this is what I have so far,
function mutation(arr) {

  var firstString = arr[0];
  firstString.toLowerCase();
  var secondString = arr[1];
  secondString.toLowerCase();



  return false;
}

mutation(["hello", "hey"]);
Im struggling on what I should do nect
bitgrower
@bitgrower
Mar 11 2016 05:34
well, except it's a conditional -- so it would compare the entire object (whatever that means, address maybe?) to the parameter "prop"
or rather the value in the parameter "prop"
Ryan Price
@rsprice
Mar 11 2016 05:36
@sup-rith ok cool, so it looks like you're stuck :)
@sup-rith what are you having trouble with
Kyle Morton
@kmorton1988
Mar 11 2016 05:36
ok, so how do I go about using variables with the substring method?
bitgrower
@bitgrower
Mar 11 2016 05:36
myStr.substr() ...
Kyle Morton
@kmorton1988
Mar 11 2016 05:36
no, the other way around. if I have a variable named num, how do I use it like this:
bitgrower
@bitgrower
Mar 11 2016 05:36
with parameters you need passed within the parens ...
Kyle Morton
@kmorton1988
Mar 11 2016 05:36
myStr.substr(num)
bitgrower
@bitgrower
Mar 11 2016 05:37
makes sense to me @kmorton1988 ..
Suprith Aireddy
@sup-rith
Mar 11 2016 05:37
@rsprice I dont know what to do after that,
Kyle Morton
@kmorton1988
Mar 11 2016 05:37
yeah, but if I'm given a letter string, it doesn't work.
Daniel Bashir
@db7894
Mar 11 2016 05:37
@kmorton1988 I see... I'm not sure how I would pick the first letter in each word to replace
I have this now but it doesn't work and I figure there are a few things wrong with it...
function titleCase(str) {
  str = str.toLowerCase();
  str = str.split(' ');
  for (var i = 0; i < str.length; i++) {
    str[i] = str[i].charAt(0).replace(str[i].charAt(0).toUpperCase());
  }
  return str;
}

titleCase("I'm a little tea pot");
Ryan Price
@rsprice
Mar 11 2016 05:37
@sup-rith that's ok. Can you explain to me in simple english what your algorithm is trying to accomplish?
Kyle Morton
@kmorton1988
Mar 11 2016 05:37
@db7894 you're close. Replace needs 2 inputs, one to tell it what to find, and one to tell it what to replace it with.
Ryan Price
@rsprice
Mar 11 2016 05:38
@sup-rith that's usually the approach I take when I'm stuck
Daniel Bashir
@db7894
Mar 11 2016 05:38
@kmorton1988 So something like this?
function titleCase(str) {
  str = str.toLowerCase();
  str = str.split(' ');
  for (var i = 0; i < str.length; i++) {
    str[i] = str.replace(str[i].charAt(0), str[i].charAt(0).toUpperCase());
  }
  return str;
}

titleCase("I'm a little tea pot");
Wait hold on
Ok yeah it still says str.replace is not a function
Wait I got it
Maddah Anass
@unlimiworks
Mar 11 2016 05:39
@db7894 replace needs 2 parameters
replace(target, newValue)
Hasitha Kumara
@Crizando
Mar 11 2016 05:39
@bitgrower Mmm only have to check the properties. But..
Daniel Bashir
@db7894
Mar 11 2016 05:39
Thanks @kmorton1988 @UnlimiWorks
I got it
CamperBot
@camperbot
Mar 11 2016 05:39
db7894 sends brownie points to @kmorton1988 and @unlimiworks :sparkles: :thumbsup: :sparkles:
:star: 349 | @unlimiworks | http://www.freecodecamp.com/unlimiworks
:star: 262 | @kmorton1988 | http://www.freecodecamp.com/kmorton1988
Kyle Morton
@kmorton1988
Mar 11 2016 05:39
welcome :)
Richard Corbett
@reacorbett
Mar 11 2016 05:40
@sup-rith Ok so far you have two variables for the string values in your array. you want to see if the first string has all of the letters that the second string consists of. So what I would sudgest doing is finding a way to .split() that second string into individual characters.
Ryan Price
@rsprice
Mar 11 2016 05:40
Like this:
//loop through the second array
    // do things at each iteration
    // etc etc etc
// return the answer
@sup-rith ^
Kyle Morton
@kmorton1988
Mar 11 2016 05:41
so, does substr() need a number as its two options?
or can you pass it a literal string to find?
bitgrower
@bitgrower
Mar 11 2016 05:41
@kmorton1988 -- sure you're not looking to just index into the string ... like this? myStr[0] ?
Ryan Price
@rsprice
Mar 11 2016 05:41
Try to write out in steps what you are trying to accomplish. It's called pseudocode. You write your logic in english, debug it, and then write your code.
Maddah Anass
@unlimiworks
Mar 11 2016 05:41
@db7894 Glad i helped :grin:
Suprith Aireddy
@sup-rith
Mar 11 2016 05:41
hmm @rsprice okay ill try that
bitgrower
@bitgrower
Mar 11 2016 05:42
YAY!!!! Pseudocode !!!
Maddah Anass
@unlimiworks
Mar 11 2016 05:42
Well time to sleep.
Take care everybody. Have a great day, and happy coding :)
Kyle Morton
@kmorton1988
Mar 11 2016 05:42
the goal is to find out if a target string matches the last characters of a larger string
Ryan Price
@rsprice
Mar 11 2016 05:42
@sup-rith @reacorbett gave you some pretty solid advice as well
bitgrower
@bitgrower
Mar 11 2016 05:43
ahhh ... sorry ... thought you were on mutation ... but you're on confirm the ending ?
Kyle Morton
@kmorton1988
Mar 11 2016 05:43
yes
so, I guess, my question is, must substr() be passed a number? or can you pass it a litteral string to find?
Suprith Aireddy
@sup-rith
Mar 11 2016 05:43
@rsprice @reacorbett thanks guys!
CamperBot
@camperbot
Mar 11 2016 05:43
sup-rith sends brownie points to @rsprice and @reacorbett :sparkles: :thumbsup: :sparkles:
:star: 367 | @rsprice | http://www.freecodecamp.com/rsprice
:star: 310 | @reacorbett | http://www.freecodecamp.com/reacorbett
Gershom
@jinmanbok
Mar 11 2016 05:44
js


function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i < arr.length; i++) {
      for (var j=0; j < arr[i].length; j++) {


     product = console.log(arr[i][j]);}}
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1],[2],[3]]);
I tried to make product equal to the i *j but the code is still not working
Kyle Morton
@kmorton1988
Mar 11 2016 05:45
@jinmanbok, the goal there is to continuously multiply the result of previous multiplacations by the next number in the series.
Richard Corbett
@reacorbett
Mar 11 2016 05:45
@jinmanbok product doesnt need to be equal to console.log
Kyle Morton
@kmorton1988
Mar 11 2016 05:45
yeah, that too ^
Gershom
@jinmanbok
Mar 11 2016 05:46
Hmmm so I have to multiply before console.log(arr[i][j]_;
Kyle Morton
@kmorton1988
Mar 11 2016 05:47
the goal isn't to output to console, though. It's to return the product.
Daniel Bashir
@db7894
Mar 11 2016 05:47
So I managed to make an algorithm for returning largest numbers in arrays that returns the largest number in the whole multidimensional array, but I'm not sure what I can do to make it so that it outputs the largest for the 4 subarrays
function largestOfFour(arr) {
  // You can do this!
  var largest = 0;
  for (var i = 0; i < arr.length; i++) {
    for (var j = 0; j < arr[i].length; j++) {
      if (largest < arr[i][j]) {
        largest = arr[i][j];
      }
    }
  }
  return largest;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Richard Corbett
@reacorbett
Mar 11 2016 05:47
@jinmanbok think about what is happening with your code. The first for loop is accessing the outer brackets of your array i.e. arr[i]. the second loop is accessing the idividual brackets inside the array i.e. arr[j].
Gershom
@jinmanbok
Mar 11 2016 05:47
I know I have to do math to multiply the contents of the arrays
can't i do like arr.[i] * arr.[j];
and store that into product?
product = arr.[i] * arr.[j];?
then when it returns product... it displays the value of the product?
Richard Corbett
@reacorbett
Mar 11 2016 05:48
what is the name of the challenge? @jinmanbok
Gershom
@jinmanbok
Mar 11 2016 05:49
@reacorbett "Nesting For Loops"
bitgrower
@bitgrower
Mar 11 2016 05:49
think it's nest for loops
oops ..
@db7894 -- so, you need to collect a number for each sub array, yeah ?
Richard Corbett
@reacorbett
Mar 11 2016 05:49
ok well you are very close @jinmanbok
Gershom
@jinmanbok
Mar 11 2016 05:50
dangit lol any hints? @reacorbett @bitgrower thanks
CamperBot
@camperbot
Mar 11 2016 05:50
jinmanbok sends brownie points to @reacorbett and @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 311 | @reacorbett | http://www.freecodecamp.com/reacorbett
:star: 798 | @bitgrower | http://www.freecodecamp.com/bitgrower
Richard Corbett
@reacorbett
Mar 11 2016 05:50
first off you want to remove product = that is in from of console.log
@jinmanbok
console.log doesnt need to be assigned to a var.
Gershom
@jinmanbok
Mar 11 2016 05:52
Aww ok... so the value of console.log is put into "product" when it's returned?
inside the multiplyAll function?
Richard Corbett
@reacorbett
Mar 11 2016 05:52
and think about it for a second. product need to be equal to product times arr[i][j]
@jinmanbok
Gershom
@jinmanbok
Mar 11 2016 05:53
@reacorbett return product * arr[i][j];
Richard Corbett
@reacorbett
Mar 11 2016 05:53
read and think about what I just said.
Gershom
@jinmanbok
Mar 11 2016 05:53
if product is 1 * value of array i and array j it should give the value right?
Richard Corbett
@reacorbett
Mar 11 2016 05:54
test it out.
Gershom
@jinmanbok
Mar 11 2016 05:54
@reacorbett just equals 1
Richard Corbett
@reacorbett
Mar 11 2016 05:55
post your code again. I thinkyour formatting is off.
@jinmanbok
Gershom
@jinmanbok