These are chat archives for FreeCodeCamp/HelpJavaScript

30th
Jun 2016
Jonathan Haber
@jryanhaber
Jun 30 2016 00:00
This message was deleted
CamperBot
@camperbot
Jun 30 2016 00:00
jryanhaber sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1580 | @moigithub |http://www.freecodecamp.com/moigithub
andreas2249
@andreas2249
Jun 30 2016 00:00
@cjrutherford, I found it. You need a space at the end of the first sentence. Otherwise, when displayed, the two strings will run into each other.
Chris Rutherford
@cjrutherford
Jun 30 2016 00:00
a that makes sense thanks @andreas2249
CamperBot
@camperbot
Jun 30 2016 00:00
cjrutherford sends brownie points to @andreas2249 :sparkles: :thumbsup: :sparkles:
:cookie: 222 | @andreas2249 |http://www.freecodecamp.com/andreas2249
andreas2249
@andreas2249
Jun 30 2016 00:01
yw, @cjrutherford
Jonathan Haber
@jryanhaber
Jun 30 2016 00:02
This message was deleted
Moisés Man
@moigithub
Jun 30 2016 00:02
@jryanhaber u can use ANY library u like,,,
the whole point of doing a javascript course.. its to learn ?
if u know the basis probably would be easier to solve other exercises, wrap ur mind on the programming world
if u already have experience.. u can just SKIP all the basics.. its all up to u :)
Jonathan Haber
@jryanhaber
Jun 30 2016 00:03
This message was deleted
This message was deleted
This message was deleted
Moisés Man
@moigithub
Jun 30 2016 00:04
if u dont know how to load a script.. probably u dont know the basics... using library wont help ur learning process
the basic javascript part of FCC challenges is for u to learn the language.. not to get the cerfiticate (u can skip all the basics exercices)
Jonathan Haber
@jryanhaber
Jun 30 2016 00:05
This message was deleted
This message was deleted
This message was deleted
andreas2249
@andreas2249
Jun 30 2016 00:06
@jryanhaber, if you have a link to a CDN with the scripts, I'm quite sure you can link to them at the top of the page <link...>
Jonathan Haber
@jryanhaber
Jun 30 2016 00:07
@andreas2249 thank you
CamperBot
@camperbot
Jun 30 2016 00:07
jryanhaber sends brownie points to @andreas2249 :sparkles: :thumbsup: :sparkles:
:cookie: 223 | @andreas2249 |http://www.freecodecamp.com/andreas2249
andreas2249
@andreas2249
Jun 30 2016 00:08
Give it a try, @jryanhaber. I'm pretty sure I remember doing that in some early lessons. Moreover, I do know you can link to Google Fonts, etc.
@jryanhaber, the unanswered question would be: Is that what the exercise is specifically asking for? Some of the exercises are very "picky" in how something gets ultimately rendered... Just a thought.
ive got the functionWithArgs() part but my math keeps coming out with only one answer and they want 2 seperate ones?
Brendan Kinahan
@BKinahan
Jun 30 2016 00:14
@acres164 The way a function works is that you can define it once, and use it many times. So you can have different inputs that result in different outputs using the same operations within the function.
acres164
@acres164
Jun 30 2016 00:14
so i would call the function again with different inputs?
Brendan Kinahan
@BKinahan
Jun 30 2016 00:15
@acres164 Right, you would normally, but in the way the tests are run, they call the function for you with different inputs, behind the scenes.
@acres164 For that challenge you should leave the example function the way it is, and write a new one like it down below. Your function will have a different internal operation, and so the same inputs will result in different outputs.
@acres164 Specifically the example function returns the difference of two input numbers, and yours should return the sum of two input numbers.
As long as it does that, it will output the correct value for any given input :)
acres164
@acres164
Jun 30 2016 00:17
omg i didnt even notice the - sign as being a subtraction.
i thought it was just grouping them like a to b
now i feel stupid lol
thanks @BKinahan
CamperBot
@camperbot
Jun 30 2016 00:17
acres164 sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:star2: 1866 | @bkinahan |http://www.freecodecamp.com/bkinahan
Brendan Kinahan
@BKinahan
Jun 30 2016 00:18
@acres164 haha, no worries, it's easy to miss things when you're learning something new. And yeah it's the same - as seen previously in "Subtract One Number from Another with JavaScript"
acres164
@acres164
Jun 30 2016 00:19
that was literally all i was missing...and i thought i was going crazy
Charles Bakar
@charlesBak
Jun 30 2016 00:20
@musicsmithnz you need to check if the collection has the id property
Khalil Ahmad
@skkarimi
Jun 30 2016 00:23
hello people i am stuck in increment section and i cant increment 87 to 88
can anyone help me with that
Dan Couper
@DanCouper
Jun 30 2016 00:23
@andreas2249 Yeah; you can test it - if you’re using codepen, you can open the developer tools in the browser and inspect the element. jQuery’s .css() literally just adds the style attributes directly to the element. Or just write the CSS for a set of elelemtns. If it’s a propery that inherits, unless you write something more specific, e.g. targeting one of the p elements in a the div, it’ll just go ahead and colour everything below it.
musicsmithnz
@musicsmithnz
Jun 30 2016 00:23

@charlesBak function updateRecords(id, prop, value) {
// If value is non-blank (value !== "")
// and prop is not "tracks"
// then update or set the value for the prop.
// Your code here
if(prop!=="tracks" && value!==""){
collection[id][prop]=value;
}
// If the prop is "tracks" and value is non-blank,
// push the value onto the end of the tracks array.
// Your code here
if(prop === "tracks" && value !== ""){
if (collection[id][prop].hasOwnProperty(prop)===false){
collection[id][prop]=[];
}
collection[id][prop].push(value);
}
// If value is blank,
// delete that prop.
// Your code here
if(value === ""){
delete collection[id].prop;
}
// Always return the entire collection object.
}

Output is:

function updateRecords(id, prop, value) {
// If value is non-blank (value !== "")
// and prop is not "tracks"
// then update or set the value for the prop.
// Your code here
if(prop!=="tracks" && value!==""){
collection[id][prop]=value;
}
// If the prop is "tracks" and value is non-blank,
// push the value onto the end of the tracks array.
// Your code here
if(prop === "tracks" && value !== ""){
if (collection[id][prop].hasOwnProperty(prop)===false){
collection[id][prop]=[];
}
collection[id][prop].push(value);
}
// If value is blank,
// delete that prop.
// Your code here
if(value === ""){
delete collection[id].prop;
}
// Always return the entire collection object.
}
sorry that was too long

This is the important part

function updateRecords(id, prop, value) {
if(prop!=="tracks" && value!==""){
collection[id][prop]=value;
}
if(prop === "tracks" && value !== ""){
if (collection[id][prop].hasOwnProperty(prop)===false){
collection[id][prop]=[];
}
collection[id][prop].push(value);
}
if(value === ""){
delete collection[id].prop;
}
}

chubacca21
@chubacca21
Jun 30 2016 00:25
I am extremely confused on the "Return Early Pattern for Functions" exercise
Brendan Kinahan
@BKinahan
Jun 30 2016 00:26
@chubacca21 what has gotten you stuck?
allon-z
@allon-z
Jun 30 2016 00:26
Still can't figure out what I did wrong. It returns "TypeError: Cannot read property 'length' of undefined" Here is my code:
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for(var i=0; i < multiplyAll.length; i++){
for(var j=0; j < multiplyAll[i].length; j++){
product*=multiplyAll[i][j];
}
}
// Only change code above this line
return product;
}
chubacca21
@chubacca21
Jun 30 2016 00:27
@BKinahan It's hard to say because I'm just not really sure what it is that I just don't understand. I see the hint that says that undefined is a keyword, and not a string, but I don't know even where to begin with this one
Dan Couper
@DanCouper
Jun 30 2016 00:27
@allon-z multiplyAll is the name of the function
Brendan Kinahan
@BKinahan
Jun 30 2016 00:28
@allon-z yup, the array is referred to within your function by the parameter arr
chubacca21
@chubacca21
Jun 30 2016 00:28
@BKinahan Oh wait, give me two seconds... I might have just realizes...
Brendan Kinahan
@BKinahan
Jun 30 2016 00:28
@chubacca21 :bulb:
allon-z
@allon-z
Jun 30 2016 00:29
@DanCouper and @BKinahan Thanks! I tried that earlier but must have missed something so it worked this time. Thanks again!
CamperBot
@camperbot
Jun 30 2016 00:29
allon-z sends brownie points to @dancouper and @bkinahan :sparkles: :thumbsup: :sparkles:
:cookie: 153 | @dancouper |http://www.freecodecamp.com/dancouper
:star2: 1867 | @bkinahan |http://www.freecodecamp.com/bkinahan
Charles Bakar
@charlesBak
Jun 30 2016 00:29
@musicsmithnz you need a main if-statemenent
  if(collection.hasOwnProperty(id)){
 if(!collection.hasOwnProperty(prop)) {    
     collection[id][prop] === value;
 }
 if(!collection.hasOwnProperty(prop)) {    
 // you check for the track   
}
// here you check for the value
  }
Diego Mayer
@Chrono79
Jun 30 2016 00:30
@charlesBak that's not ok
musicsmithnz
@musicsmithnz
Jun 30 2016 00:30
@charlesBak around which part ?
Charles Bakar
@charlesBak
Jun 30 2016 00:31
@Chrono79 sorry youre were saying?
Diego Mayer
@Chrono79
Jun 30 2016 00:32
@charlesBak you should test collection[id].hasOwnProperty(prop)
Brendan Kinahan
@BKinahan
Jun 30 2016 00:32
yup ^
chubacca21
@chubacca21
Jun 30 2016 00:33
  if (a<0 || b<0) {
    var c;
    return c;
  }
@BKinahan This is what I ended up doing, which passed the level, but is that what the exercise wanted me to do?
Diego Mayer
@Chrono79
Jun 30 2016 00:33
@chubacca21 no need to declare c var, simply return undefined
Brendan Kinahan
@BKinahan
Jun 30 2016 00:33
@chubacca21 Well, that works, because c is declared, but not given a value, so its value is undefined and you return that value (undefined)
Charles Bakar
@charlesBak
Jun 30 2016 00:33
@Chrono79 where should i do that
Brendan Kinahan
@BKinahan
Jun 30 2016 00:34
@chubacca21 but as @Chrono79 says you can just use return undefined; for the same effect, or simply return; (if a function returns without a value, it still returns the value undefined)
Diego Mayer
@Chrono79
Jun 30 2016 00:34
@charlesBak whenever you check for prop
Charles Bakar
@charlesBak
Jun 30 2016 00:34
i mean is that still needed if i do
  if(collection.hasOwnProperty(id)){
 if(!collection.hasOwnProperty(prop)) {
Diego Mayer
@Chrono79
Jun 30 2016 00:35
@charlesBak yes, collection is not the same as collection[id]
collection only has ids as properties
Charles Bakar
@charlesBak
Jun 30 2016 00:36
@Chrono79 so i should be doing that instead?
 if(collection.hasOwnProperty(id)){
 if(!collection[id].hasOwnProperty(prop)) {
musicsmithnz
@musicsmithnz
Jun 30 2016 00:36
if(prop === "tracks" && value !== ""){
if (collection[id][prop].hasOwnProperty(prop)===false){
collection[id].tracks=[""];
}
collection[id][prop].push(value);
}
how do i enter code ?
chubacca21
@chubacca21
Jun 30 2016 00:37
Ohhh gotcha @Chrono79 @BKinahan... I didn't realize that's what that meant. Cheers, thanks
CamperBot
@camperbot
Jun 30 2016 00:37
chubacca21 sends brownie points to @chrono79 and @bkinahan :sparkles: :thumbsup: :sparkles:
:star2: 1358 | @chrono79 |http://www.freecodecamp.com/chrono79
:star2: 1868 | @bkinahan |http://www.freecodecamp.com/bkinahan
Diego Mayer
@Chrono79
Jun 30 2016 00:37
@charlesBak you could that, but I wouldn't check for id, the challenge doesn' t say that id could be blank
Brendan Kinahan
@BKinahan
Jun 30 2016 00:37
This message was deleted
Diego Mayer
@Chrono79
Jun 30 2016 00:37
This message was deleted
Brendan Kinahan
@BKinahan
Jun 30 2016 00:37
@chubacca21 yup, it's like if it said you should return 2, you could write var c = 2; return c; or you can just return 2; :)
levante
@menefotto
Jun 30 2016 00:38
Hello everyone!
Brendan Kinahan
@BKinahan
Jun 30 2016 00:38
@Chrono79 sorry, wasn't paying attention and thought it was Profile Lookup, mixed up collection and contacts. I should go to bed :D
Diego Mayer
@Chrono79
Jun 30 2016 00:39
no problem, I was in doubt myself ;)
chubacca21
@chubacca21
Jun 30 2016 00:39
@BKinahan cool cool. I totally sailed past "undefined is a keyword" without really understanding it would seem
levante
@menefotto
Jun 30 2016 00:39
has anyone found a bug while doind the "Drop it" challange (part of the front end cert)?
Diego Mayer
@Chrono79
Jun 30 2016 00:40
@wind85 no that I remember
Brendan Kinahan
@BKinahan
Jun 30 2016 00:40
@wind85 probably that has happened, but probably the bugs were fixed quite quickly :) Do you think you might've found a new one?
Charles Bakar
@charlesBak
Jun 30 2016 00:40
alright thank you @Chrono79 @BKinahan
CamperBot
@camperbot
Jun 30 2016 00:40
charlesbak sends brownie points to @chrono79 and @bkinahan :sparkles: :thumbsup: :sparkles:
:star2: 1869 | @bkinahan |http://www.freecodecamp.com/bkinahan
:star2: 1359 | @chrono79 |http://www.freecodecamp.com/chrono79
levante
@menefotto
Jun 30 2016 00:41
@BKinahan I have just found one...
Juan Moraza
@Morazajuan
Jun 30 2016 00:41
OMG im in challenge 200 already!!! I just want to motivate all the campers in the community! WE CAN DO IT! I've struggled but thanks to the community, I've received help. Actually @BKinahan Have helped me before lol Lets keep moving on and CODE! :D
CamperBot
@camperbot
Jun 30 2016 00:41
morazajuan sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:star2: 1870 | @bkinahan |http://www.freecodecamp.com/bkinahan
levante
@menefotto
Jun 30 2016 00:41
@BKinahan actually two....
Diego Mayer
@Chrono79
Jun 30 2016 00:42
@wind85 let's see your code then
Brendan Kinahan
@BKinahan
Jun 30 2016 00:43
@Morazajuan :thumbsup:
Jonathan Haber
@jryanhaber
Jun 30 2016 00:46

You guys think I should keep trying to refactor this code?

If so, what opportunities seem most relevant?

function convertHTML(str) {


console.log(str);
str = str.replace(/&/gmi, "&amp;")   ; 
str = str.replace(/</gmi, "&lt;" )   ;
str = str.replace(/>/gmi, "&gt;" )   ;
str = str.replace(/'/gmi, "&apos;")  ;
str = str.replace(/"/gmi, "&quot;")  ;

console.log(str);

return str;
}

convertHTML("Dolce & Gabbana");
levante
@menefotto
Jun 30 2016 00:46
@Chrono79 just one sec my screeshot software isn't really working...
Diego Mayer
@Chrono79
Jun 30 2016 00:47
@jryanhaber do you know what the modifiers do?
Co Giang
@Gianglian
Jun 30 2016 00:47

I don't get what we're supposed to be for record collection: You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number (its key) 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 prop does not contain the key "tracks", then update or set the value for that incomplete prop.

If prop does not contain the key "tracks" before you update it, create an empty array before pushing a track to it.

If prop does contain the key "tracks" and its value is non-blank, then push the value onto the end of its existing tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

oops didn't mean to post all that
musicsmithnz
@musicsmithnz
Jun 30 2016 00:48

@charlesBak @chiztorismo @khaleelsyed

I have completed the challenge! Ask me for extra help if you like. I copied some comments from someone elses post. I filled each one out, and checked which parts of the test passed until I found out which parts of the code were breaking. (by the way, I don't know how to paste blocks of code properly, can someone tell me how to do this please?)

function updateRecords(id, prop, value) {
// If value is non-blank (value !== "")
// and prop is not "tracks"
// then update or set the value for the prop.
// Your code here
// If the prop is "tracks" and value is non-blank,
// push the value onto the end of the tracks array.
// Your code here
// If value is blank,
// delete that prop.
// Your code here
// Always return the entire collection object.
return collection;
}

Co Giang
@Gianglian
Jun 30 2016 00:49
oh thanks music, that makes a lot more sense, the original description was just confusing me
Brendan Kinahan
@BKinahan
Jun 30 2016 00:50
@jryanhaber the global/multiline/ignore case flags seem a little excessive, particularly considering the inputs aren't multiline and the symbols don't have any uppercase/lowercase variants :)
musicsmithnz
@musicsmithnz
Jun 30 2016 00:52
@Gianglian Yes, have a go at using these instructions, tell me how you are going after you've had a solid attempt at it.
levante
@menefotto
Jun 30 2016 00:53
possible_bug.png
@Chrono79 that's what I am talking about
@Chrono79 maybe I am tired and I am but that to me looks like a bug...
Diego Mayer
@Chrono79
Jun 30 2016 00:55

@wind85 no, it's ok:
Drop the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true.

The second argument, func, is a function you'll use to test the first elements of the array to decide if you should drop it or not.

Return the rest of the array, otherwise return an empty array.

in that case, you drop 1 and 2 and when you reach 3 you don't drop anymore, and return [3,9,2]
otherwise it would be as easy as using filter
levante
@menefotto
Jun 30 2016 00:57
@Chrono79 Ok I have miss-understood the assignment...
Diego Mayer
@Chrono79
Jun 30 2016 00:57
no problem
levante
@menefotto
Jun 30 2016 00:58
@Chrono79 I have to truncate the array once it gets true... thanls...
@Chrono79 thanks a lot...
CamperBot
@camperbot
Jun 30 2016 00:58
wind85 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1360 | @chrono79 |http://www.freecodecamp.com/chrono79
levante
@menefotto
Jun 30 2016 00:58
@Chrono79 do you also know why some assignment in that part are starred?
Brendan Kinahan
@BKinahan
Jun 30 2016 01:00
@wind85 challenges/projects marked by asterisks are required to be completed in order to earn the certificate for that section.
levante
@menefotto
Jun 30 2016 01:00
@BKinahan thanks I thought they are all required... :)
CamperBot
@camperbot
Jun 30 2016 01:00
wind85 sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:star2: 1872 | @bkinahan |http://www.freecodecamp.com/bkinahan
endlessetudes
@endlessetudes
Jun 30 2016 01:02
hello. has anyone here completed Wherefore Art Thou?
levante
@menefotto
Jun 30 2016 01:03
@endlessetudes yes why?
Andrew Vanboxel
@avanbox
Jun 30 2016 01:03
Hey everyone. Ive almost passed the "Arguments Optional" Bonfire. There is one test I cant pass and im lost. any hints?
function addTogether(a, b) {
  var theAnswer;
  //console.log(arguments[0]+" "+arguments[1]);
  for (var i = 0; i < arguments.length; i++) {
    if (typeof arguments[i] !== 'number') {
      theAnswer = undefined;
    } else if (!arguments[1]) {
      theAnswer = function sumTwoAnd(x) {
        return a + x;

      };

    } else {
      console.log(a);
      console.log(b);
      theAnswer = a + b;
    }
  }
  console.log(theAnswer);
  return theAnswer;
}
addTogether(2)([3]);
i just finished it @endlessetudes
musicsmithnz
@musicsmithnz
Jun 30 2016 01:04
Can anyone tell me how to post code in chat?
Andrew Vanboxel
@avanbox
Jun 30 2016 01:04
hit ```
then shift+enter
paste your code
ctrl+/
then enter
musicsmithnz
@musicsmithnz
Jun 30 2016 01:04
oh ok !!! great thanks!!
Andrew Vanboxel
@avanbox
Jun 30 2016 01:04
np
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:05
Is anyone free who can help walk me through some code for the Sum All Primes challenge?
Andrew Vanboxel
@avanbox
Jun 30 2016 01:05
i might be able to help where are you stuck
endlessetudes
@endlessetudes
Jun 30 2016 01:05
@wind85 i'm really struggling with this one. here's my most recent attempt.
function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];

  // Only change code below this line
  var prop = Object.keys(source);

  function isInSource(obj){
    for(var i = 0; i < prop.length; i++){
      console.log("prop[i]: " + prop[i]);
      return (obj[prop[i]] === source[prop[i]]);
    }
  }

  arr = collection.filter(isInSource);
  // Only change code above this line
  return arr;
}
Santiago Gómez
@Sperkajugglite
Jun 30 2016 01:06
hi :) can you tell me what wrong with my code?

function sym(args) {

  var result = [];

  function isInArr(arr, item) {
    if (arr.indexOf(arguments[argument]) === -1) {
      result.push(arguments[argument]);
    }
  }

  for (var argument =0; argument < arguments.length; argument++) {
    arguments.forEach(isInArr);
  }
  return result;
}

sym([1, 2, 3], [5, 2, 1, 4]);
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:06
@avanbox I was following the hints on the wiki, but im totally lost on what the code for the Sieve of Eratosthenes does
Here is the code:
Andrew Vanboxel
@avanbox
Jun 30 2016 01:06
i got lost there too
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:06
function getPrimes(max) {
    var sieve = [], i, j, primes = [];
    for (i = 2; i <= max; ++i) {
        if (!sieve[i]) {
            // i has not been marked -- it is prime
            primes.push(i);
            for (j = i << 1; j <= max; j += i) {
                sieve[j] = true;
            }
        }
    }
    return primes;
}
Andrew Vanboxel
@avanbox
Jun 30 2016 01:06
i did it a little differently
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:06
How did you approach it?
levante
@menefotto
Jun 30 2016 01:07
@endlessetudes I went on and manipulated everything like it was a string :)
Andrew Vanboxel
@avanbox
Jun 30 2016 01:07
function sumPrimes(num) {
  var total=0;
  var primesArr = [];
  generatePrimes(num);


  function generatePrimes(max) {
    for (var i = 2; i <= max; i++) {
      if (testForPrime(i)) {
        primesArr.push(i);

      }
    }
  }

  function testForPrime(n) {


      if (n === 1) {
        return false;
      } else if (n === 2) {
        return true;
      } else {
        for (var x = 2; x < n; x++) {
          if (n % x === 0) {
            return false;
          }
        }
        return true;
      }
    }

total = primesArr.reduce(function(previousValue, currentValue, currentIndex, array) {
  return previousValue + currentValue;
});
  console.log(total);
  console.log(primesArr);
  return total;
}

sumPrimes(977);
@ConnHurr
pretty much i put 2 in the array automatically
then made a function to test the rest of the numbers
if they were prime add them to the array then use reduce to sum the array
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:09
You just tested if they were prime by looping through and checking the divisbility of each number?
Andrew Vanboxel
@avanbox
Jun 30 2016 01:10
yeah checked for the remainder
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:10
Oh that works too
Andrew Vanboxel
@avanbox
Jun 30 2016 01:10
i had a much more complex answer but it got out of hand and i got lost
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:10
Yeah im trying to understand how to implement the sieve but I have no clue whats going on
Andrew Vanboxel
@avanbox
Jun 30 2016 01:12
it hurt my brain i do want to go back to it
Co Giang
@Gianglian
Jun 30 2016 01:13
@musicsmithnz thnz Finally passed it! Thanks.
CamperBot
@camperbot
Jun 30 2016 01:13
gianglian sends brownie points to @musicsmithnz :sparkles: :thumbsup: :sparkles:
:cookie: 219 | @musicsmithnz |http://www.freecodecamp.com/musicsmithnz
longgaoliu
@longgaoliu
Jun 30 2016 01:13
/?
endlessetudes
@endlessetudes
Jun 30 2016 01:15
@wind85 i don't know. i can't process it. i hit this road block like a week ago and keep coming back to torture myself
Jonathan Haber
@jryanhaber
Jun 30 2016 01:17
@Chrono79 - I dont understand the context of your question. Are you asking if I have a basic sense, or if I have them down to memory, or something in between?
levante
@menefotto
Jun 30 2016 01:18
@endlessetudes use JSON.stringify to transform the 2nd argument to string the loop over each collection element, make them string a well....
Jonathan Haber
@jryanhaber
Jun 30 2016 01:18
@Chrono79 - I know I could grab a lot of these items for string replace, and I think there was a way to define an object with keys to swap based on keys, but I have no idea how long that would take to figure out... think its important? Is there something else you have in mind?
levante
@menefotto
Jun 30 2016 01:20
@endlessetudes and apply you own logic to it...
Santiago Gómez
@Sperkajugglite
Jun 30 2016 01:21
do advanced algorithms give extra credit or they are just for practice?
endlessetudes
@endlessetudes
Jun 30 2016 01:21
@wind85 i'll give it a shot
Charles Bakar
@charlesBak
Jun 30 2016 01:21
thanks i have done it @musicsmithnz
CamperBot
@camperbot
Jun 30 2016 01:21
charlesbak sends brownie points to @musicsmithnz :sparkles: :thumbsup: :sparkles:
:cookie: 220 | @musicsmithnz |http://www.freecodecamp.com/musicsmithnz
Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:22

`
for (var index = 0; index < str.length; index++) {

if (consonants.indexOf(str[index].toLowerCase()) != -1) {

  console.log(consonants.indexOf(str[index].toLowerCase()) < 0);

}
else {
 break;   
}

}

I dont understand why vowels are able to pass through my if statement.

According to the MDN docs, .indexOf() returns a number and if -1 is returned the value that was searched for is non existent. But in my if statement, vowels pass through. Why?

Also, the variable consonants contains all of the consonants in the alphabet in case you are wondering.

levante
@menefotto
Jun 30 2016 01:22
@endlessetudes regex are a good possible way to approach the challenge...
Jonathan Haber
@jryanhaber
Jun 30 2016 01:24
@Chrono79 How does this look? Wondering if theres something important I am missing...
```

$(document).ready(function() {
  function convertHTML(str) {
  var r = replace;
  str = str.r(/&/gmi, "&amp;").r(/</gmi, "&lt;" ).r(/>/gmi, "&gt;" ).r(/'/gmi, "&apos;").r(/"/gmi, "&quot;");
  return str;
  }
convertHTML("Dolce & Gabbana");

});
Josh
@joshweaver23
Jun 30 2016 01:24
looking for some help with "No repeats please", I've got working code, but my array sizes seem to be blowing something up (maybe?). Wanting to know if this is the problem before I start trying to address it
var permutations;

function permAlone(str, arr) {
  if (typeof str == 'string') {
    str = str.split("");
    arr = [];
    permutations = [];
  }

  if (str.length === 0) {
    permutations.push(arr.join(""));
  }
  for (var i = 0; i < str.length; i++) {
    var x = str.splice(i, 1);
    arr.push(x);
    permAlone(str, arr);
    arr.pop();
    str.splice(i, 0, x);
  }

  for (var j = 0; j < permutations.length; j++) {
    if (/(\w)\1{1,}/.test(permutations[j])) {
      permutations.splice(j, 1);
      j--;
    }    
  }

  return permutations.length;
}

permAlone('abccd');
Santiago Gómez
@Sperkajugglite
Jun 30 2016 01:25
@jryanhaber looks great
Jonathan Haber
@jryanhaber
Jun 30 2016 01:28
@Sperkajugglite Thank you... oddly its crashing the freecodecamp interface now -- lol
CamperBot
@camperbot
Jun 30 2016 01:28
jryanhaber sends brownie points to @sperkajugglite :sparkles: :thumbsup: :sparkles:
:cookie: 298 | @sperkajugglite |http://www.freecodecamp.com/sperkajugglite
musicsmithnz
@musicsmithnz
Jun 30 2016 01:28
@Gianglian @charlesBak Great good work guys!
How does this @camperbot guy work? Does he/she give points based on just mentions ?
Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:30
Mentions with thx or smileys at the start
Connor Hastey-Palindat
@cpalindat
Jun 30 2016 01:30
help smallest common multiple
CamperBot
@camperbot
Jun 30 2016 01:30

:point_right: algorithm smallest common multiple [wiki]

Algorithm Smallest Common Multiple

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem 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.

Relevant Links

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

Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:30
@musicsmithnz or you can ask for help
Stefan Bekirov
@bekir0v
Jun 30 2016 01:30
Hi I need help with Stand in Line
I don't understand what should do in this task.
If anybody can help me
thank you!
function nextInLine(arr, item) {
  // Your code here

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:31
thx @camperbot
CamperBot
@camperbot
Jun 30 2016 01:31
htmlnoob sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 1979 | @camperbot |http://www.freecodecamp.com/camperbot
Jonathan Haber
@jryanhaber
Jun 30 2016 01:31

@Sperkajugglite || Ah, looks like i cannot define

var r = replace

and then use it in a function... I guess that makes sense sort of...

musicsmithnz
@musicsmithnz
Jun 30 2016 01:32
thx @HTMLNoob
CamperBot
@camperbot
Jun 30 2016 01:32
:cookie: 285 | @htmlnoob |http://www.freecodecamp.com/htmlnoob
musicsmithnz sends brownie points to @htmlnoob :sparkles: :thumbsup: :sparkles:
musicsmithnz
@musicsmithnz
Jun 30 2016 01:32
thx @camperbot
CamperBot
@camperbot
Jun 30 2016 01:32
musicsmithnz sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 1980 | @camperbot |http://www.freecodecamp.com/camperbot
musicsmithnz
@musicsmithnz
Jun 30 2016 01:32
haha @camperbot got lots of brownie points
Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:36

`
for (var index = 0; index < str.length; index++) {

if (consonants.indexOf(str[index].toLowerCase()) != -1) {

  console.log(consonants.indexOf(str[index].toLowerCase()) < 0);

}
else {
 break;   
}

}

I dont understand why vowels are able to pass through my if statement.

According to the MDN docs, .indexOf() returns a number and if -1 is returned the value that was searched for is non existent. But in my if statement, vowels pass through. Why?

Also, the variable consonants contains all of the consonants in the alphabet in case you are wondering.

Josh
@joshweaver23
Jun 30 2016 01:36
any help for "No repeats please"?
Norvin Burrus
@ndburrus
Jun 30 2016 01:38
@bekir0v start here: Add the number to the end of the array :dart: the array is arr the number is item
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:39
@HTMLNoob how can i posr code screen shot liek tht?
^post
Norvin Burrus
@ndburrus
Jun 30 2016 01:39
help format @boruchwoolstone if/when you need assistance, type "help (subject)", and camperbot will offer information, if possible. :)
CamperBot
@camperbot
Jun 30 2016 01:39

: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 thecode`.

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

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

Stefan Bekirov
@bekir0v
Jun 30 2016 01:40
@ndburrus
arr.push(number);
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:41

'''
function titleCase(str) {
var words = str.split(" ");
str ="";
for (var i = 0; i < words.length; i++) {
words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1).toLowerCase();
// for(var j = 1; j < words[i].length; j++) {
// words[i] = words[i][j].toLowerCase();
// }
str += words[i] + " ";
}
return str;
}

titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");
'''

CamperBot
@camperbot
Jun 30 2016 01:41
:bulb: to format code use backticks! ``` more info
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:41
what is a backtick?
Norvin Burrus
@ndburrus
Jun 30 2016 01:41
@bekir0v ...is number a function (nextInLine) input?
Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:41
@boruchwoolstone Its right beside number one on your keyboard like such `
@boruchwoolstone Left of number one on your keyboard
anyone can help me
Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:43
@quekzhongrui What do you need help with?
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:44
?
Tyler Del Rosario
@TylerDelRosario
Jun 30 2016 01:44
@boruchwoolstone Did you find it?
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:45
yes i found the `
but cannt seem to make it work
clintonjohn
@clintonjohn
Jun 30 2016 01:46
For an hour or two, I've been trying to fully understand the concepts and practices around the challenge
Record Collection
Still pretty clueless

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

For the given id in collection:

If prop does not contain the key "tracks", then update or set the value for that incomplete prop.

boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:51
trh
@clintonjohn i had the smae problems yesterday, its a very confusing question
Ryan Garant
@protoEvangelion
Jun 30 2016 01:51
Record Collection Challenge issues: Hey there, I have tried numerous variations for several hours with no success. Here is my current code:

`function updateRecords(id, prop, value) {

if(value!=="" && prop==="tracks"){
  collection[id][prop].push(value);
}
  else if(value!=="") {
    collection[id][prop] = value;
  } 
  else {
    delete collection[id][prop];
  }

return collection;

} `

boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:51
post the question and i will try rmeber what i dis yester
quekzhongrui
@quekzhongrui
Jun 30 2016 01:52
@HTMLNoob myVar = myVar should be changed
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:52
@quekzhongrui you shoudl say myVar++
not myVar = myVar + 1;
Ryan Garant
@protoEvangelion
Jun 30 2016 01:52

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

For the given id in collection:

If prop does not contain the key "tracks", then update or set the value for that incomplete prop.

If prop does not contain the key "tracks" before you update it, create an empty array before pushing a track to it.

If prop does contain the key "tracks" and its value is non-blank, then push the value onto the end of its existing tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

clintonjohn
@clintonjohn
Jun 30 2016 01:53
@boruchwoolstone

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

For the given id in collection:

If prop does not contain the key "tracks", then update or set the value for that incomplete prop.

If prop does not contain the key "tracks" before you update it, create an empty array before pushing a track to it.

If prop does contain the key "tracks" and its value is non-blank, then push the value onto the end of its existing tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

Ryan Garant
@protoEvangelion
Jun 30 2016 01:53
@clintonjohn Hopefully we will both figure this one out haha:)
quekzhongrui
@quekzhongrui
Jun 30 2016 01:54
@boruchwoolstone thank you
CamperBot
@camperbot
Jun 30 2016 01:54
quekzhongrui sends brownie points to @boruchwoolstone :sparkles: :thumbsup: :sparkles:
:cookie: 245 | @boruchwoolstone |http://www.freecodecamp.com/boruchwoolstone
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:55
whats the name of the question
i iwll post my completed code
Ryan Garant
@protoEvangelion
Jun 30 2016 01:55
@boruchwoolstone "Record Collection"
This message was deleted
boruchwoolstone
@boruchwoolstone
Jun 30 2016 01:57
found , i tought the completed code stayed saved in my account, give me a second to type it out again.
Ryan Garant
@protoEvangelion
Jun 30 2016 01:57
@boruchwoolstone Thank you!!!!!!!!!!
CamperBot
@camperbot
Jun 30 2016 01:57
ryangarant sends brownie points to @boruchwoolstone :sparkles: :thumbsup: :sparkles:
:cookie: 246 | @boruchwoolstone |http://www.freecodecamp.com/boruchwoolstone
bitgrower
@bitgrower
Jun 30 2016 01:59
if you want to see someone's completed challenge code ... MOST of the time all you have to do is type in freecodecamp.com/<their-user-name> ... and just find the challenge you want to look at ..
clintonjohn
@clintonjohn
Jun 30 2016 02:00
@boruchwoolstone it should save your completed
bitgrower
@bitgrower
Jun 30 2016 02:00
so ... if you @RyanGarant want to see @boruchwoolstone 's solution for record collection .. just go here: https://www.freecodecamp.com/boruchwoolstone search for record collection and click on view solution ...
clintonjohn
@clintonjohn
Jun 30 2016 02:01
code in the profile , but not always in the maps section
Thanks @boruchwoolstone @bitgrower
CamperBot
@camperbot
Jun 30 2016 02:01
clintonjohn sends brownie points to @boruchwoolstone and @bitgrower :sparkles: :thumbsup: :sparkles:
:star2: 1121 | @bitgrower |http://www.freecodecamp.com/bitgrower
bitgrower
@bitgrower
Jun 30 2016 02:01
map section is yours, I believe, no matter whose profile page you happen to be on ...
CamperBot
@camperbot
Jun 30 2016 02:01
:cookie: 247 | @boruchwoolstone |http://www.freecodecamp.com/boruchwoolstone
Ryan Garant
@protoEvangelion
Jun 30 2016 02:02
@bitgrower Thanks! that worked :)
CamperBot
@camperbot
Jun 30 2016 02:02
ryangarant sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star2: 1122 | @bitgrower |http://www.freecodecamp.com/bitgrower
boruchwoolstone
@boruchwoolstone
Jun 30 2016 02:03
oh nice you found it, i was typing it out again for yall
bitgrower
@bitgrower
Jun 30 2016 02:03
caveat is ... challenges do change over time .. . so, if you had clicked on my record collection solution until fairly recently, it would not have been updated to one that passes the way it's currently written (it does now, I fixed that) ...
@boruchwoolstone -- no need to ... :)
save your energy ! Let the computers do the work for you !!! :)
Ryan Garant
@protoEvangelion
Jun 30 2016 02:04
Thanks you all !! Hopefully the language used in this challenge will be a bit more clear going forward :)
boruchwoolstone
@boruchwoolstone
Jun 30 2016 02:04
yeah nice just saw that, thanks @bitgrower
CamperBot
@camperbot
Jun 30 2016 02:04
boruchwoolstone sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star2: 1123 | @bitgrower |http://www.freecodecamp.com/bitgrower
bitgrower
@bitgrower
Jun 30 2016 02:07
well, one of the challenges (no pun intended) in programming is understanding what the problem is to solve ... and sometimes (more often than not, actually) ... that's just part of programming ... won't go away ... so, even if FCC's challenges may not be brilliantly explained, consider it part of the challenge...
With Record Collection, in particular, they made a change so that how to solve, I think it is, the 2nd test case, needs a bit more finagling ...
boruchwoolstone
@boruchwoolstone
Jun 30 2016 02:08
maybe someone can help me:

function titleCase(str) {
// split string into an array of string, by spaces.
var words = str.split(" ");

//clear the old string
str ="";
//loop throught he words inmy string.
for (var i = 0; i < words.length; i++) {

// capitalise the first letter add back the
// rest of teh word in lwercase and assign back the array
words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1).toLowerCase();

// build teh new string with formated words frmthe array.
str += words[i] + " ";
}
return str;
}

titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");

thats my code for "Title Case A sentence
Jonathan Haber
@jryanhaber
Jun 30 2016 02:09
Struggling, any idea what is wrong here?
str = "AllThe-small Things"
// HERE IS THE ERROR - does not capture the value of the index just prior to the correct character
        console.log(str[(i-1)]);
boruchwoolstone
@boruchwoolstone
Jun 30 2016 02:09
when i run hte code wiht the exmaples the work fine on the output but the site is saying that my code is wrong
clintonjohn
@clintonjohn
Jun 30 2016 02:10
@bitgrower I'm going to have to study your answer quite a bit. Thanks. The maps section keeps a record of what you have completed, but the browser doesn't always save the code you put in. It saves your code under the profile section that has all your completed challenges only. Those have public links.
CamperBot
@camperbot
Jun 30 2016 02:10
clintonjohn sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:warning: clintonjohn already gave bitgrower points
Jonathan Haber
@jryanhaber
Jun 30 2016 02:10
Here is the context if desired to understand it... contains all my debug consoles...


function spinalCase(str) {
  // "It's such a fine line between stupid, and clever."
  // --David St. 
  console.log("starting with:");
  console.log( str);
  var newWordPositions  = [];
  for ( var i = 0 ; i < str.length ; i++ ){
    if ( str[i].match( /[A-Z]/ ) != null ){
      // you have the index of capital letters now in str[i], so if there is no space before them, put one there.. 

      // if there is an item before this index
      if ( str[i-1] != null ) {

        // and if it is not a space
       if ( str[i-1].match( /^ / ) != null ){

        console.log("***");
        console.log("str[i]:");
        console.log("so we need to inject a space before this");
        // check that I have the correct character here
        console.log(str[i]);
        console.log("str[i-1]:");
        // HERE IS THE ERROR - does not capture the value of the index just prior to the correct character
        console.log(str[(i-1)]);
        // thinking this should work, replace the character at the index with the same character plus a space before it... 
        str.replace(str[i]," " + str[i]);
        str.replace("T","QQQ");

       }
     }
      newWordPositions.push((str[i]));
    }


  }

  console.log("positions of new words:");
  console.log(newWordPositions);
  console.log(str);

  // console.log( str.toLowerCase().replace(/" "/gmi,"-"));
  // return str.toLowerCase().replace(/" "/gmi,"-");
}

// spinalCase("This Is Spinal Tap") ;
// should return "this-is-spinal-tap".
// spinalCase("thisIsSpinalTap") ;
// should return "this-is-spinal-tap".
// spinalCase("The_Andy_Griffith_Show") ;
// should return "the-andy-griffith-show".
// spinalCase("Teletubbies say Eh-oh") ;
// should return "teletubbies-say-eh-oh".
spinalCase("AllThe-small Things") ;
// should return "all-the-small-things".
x981
@x981
Jun 30 2016 02:10
@jryanhaber console.log(str[i-1]);
Justin Woodward
@jwoo92
Jun 30 2016 02:11
@ConnHurr i am having trouble on that one as well if it makes you feel any better.
Jonathan Haber
@jryanhaber
Jun 30 2016 02:11
@x981 || Great point, tried that too...
Frank
@Frankbono
Jun 30 2016 02:12
Hi, I'm on the Palindrones algorithm. I am having difficulty using the replace() method. Whenever I put in the symbols I want replaced in the (), I receive a syntax error. I have tried so many ways to fix but I don't understand what I am doing wrong. Can someone help me please?
Justin Woodward
@jwoo92
Jun 30 2016 02:12
@Frankbono can you post your code so far?
Alex Harshaw
@aharshaw
Jun 30 2016 02:12
This message was deleted
CamperBot
@camperbot
Jun 30 2016 02:12
no wiki entry for: needed
Jonathan Haber
@jryanhaber
Jun 30 2016 02:12
@Frankbono || Yes, post your code between and
Frank
@Frankbono
Jun 30 2016 02:12
Screen Shot 2016-06-29 at 10.12.21 PM.png
here you go
Alex Harshaw
@aharshaw
Jun 30 2016 02:13
Can someone tell me where my logic falls short here?
Profile Lookup
function lookUpProfile(firstName, prop){
// Only change code below this line
  for(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
}

// Change these values to test your function
lookUpProfile("Harry", "likes");
I get the impression that I'm not nesting properly
Jonathan Haber
@jryanhaber
Jun 30 2016 02:13
@Frankbono || I think it might be easier then that
@Frankbono At first glance can you not just check to see if the first character is the same as the last, and then second compared to second to last?
if ( str[i] == str[str.length -1])...
Alex Harshaw
@aharshaw
Jun 30 2016 02:15
I've seen people attempt to do this with only one if statement, I don't know if that's where I'm going wrong. I've been stuck on this all day
Doing my best not to just copy the answer from somewhere so please walk me though if you choose to assist. Thanks
Frank
@Frankbono
Jun 30 2016 02:15
@jryanhaber I'm sorry i don't understand
Jonathan Haber
@jryanhaber
Jun 30 2016 02:16
@Frankbono || Ah... I think that a palindrome just means the first letter is the same as the last, and so on, correct?
@Frankbono || So, perhaps the need for the regular expressions is complicating the thing for you?
Frank
@Frankbono
Jun 30 2016 02:16
@jryanhaber ok
Jonathan Haber
@jryanhaber
Jun 30 2016 02:17
@Frankbono Ill take a look at the excersise again, but are you familiar with str[str.length -1])
?
Frank
@Frankbono
Jun 30 2016 02:17
@jryanhaber i don't know that
Jonathan Haber
@jryanhaber
Jun 30 2016 02:18
That grabs the last character of the string, because if it is 10 characters long, the index is 9 of the last character, and the str.length is 10, so str.length -1 will give the index of the last character...
x981
@x981
Jun 30 2016 02:18
@aharshaw Can you give me codepen
?
Jonathan Haber
@jryanhaber
Jun 30 2016 02:19
so, in theory, you could test if the first character is the same as the last, @Frankbono , and the 2nd the same as the 2nd to last, etc.. , ill double check how i did it now...
Frank
@Frankbono
Jun 30 2016 02:19
@jryanhaber That's really cool. I never heard of this before
Justin Woodward
@jwoo92
Jun 30 2016 02:19
@Frankbono you can complete the challenge a little bit easier. first step would to eliminate anything that would throw you off ex. symbols, whitespaces, case sensitive, ext. then you simply can check that with a reversed version of itself and return it.
Alex Harshaw
@aharshaw
Jun 30 2016 02:19
@x981 I've never done that before. I have a codepen account. One moment
William Cabell
@wbac88
Jun 30 2016 02:20
I'm having trouble with the Find Longest Word Challenge. This is my code so far, any thoughts? Just getting an output of 0

function findLongestWord(str) {

  var words = str.split(" ");
  var longest = 0;

  for (var i = 0; i < words.length; i++) {

    if (longest.length < words[i].length) {

      longest = words[i].length;
    }

  }

return longest;


}

findLongestWord("The quick brown fox jumped over the lazy dog");
x981
@x981
Jun 30 2016 02:20
No, That page you are doing.
@aharshaw
Jonathan Haber
@jryanhaber
Jun 30 2016 02:20
@Frankbono || Ah, I just checked the exercise and I can see why you need the regular expressions
Frank
@Frankbono
Jun 30 2016 02:21
@jwoo92 I was trying to do that but I was getting syntax errors when trying to eliminate the symbals, whitespaces etc.
Alex Harshaw
@aharshaw
Jun 30 2016 02:21
Justin Woodward
@jwoo92
Jun 30 2016 02:21
@Frankbono okay, lets explore your regex for .replace().
bitgrower
@bitgrower
Jun 30 2016 02:21
@clintonjohn -- yep ... your code "in progress" is kept on your machine, only when you complete a challenge does it get saved ...
x981
@x981
Jun 30 2016 02:22
@aharshaw :D, not freecodecam, codepen page
Jonathan Haber
@jryanhaber
Jun 30 2016 02:22
@Frankbono Ahh... I just found your problem
Frank
@Frankbono
Jun 30 2016 02:22
@jwoo92 ok
Jonathan Haber
@jryanhaber
Jun 30 2016 02:22
@Frankbono Your \ should be //
Frank
@Frankbono
Jun 30 2016 02:22
@jryanhaber I very curious
Alex Harshaw
@aharshaw
Jun 30 2016 02:22
Jonathan Haber
@jryanhaber
Jun 30 2016 02:22
for example if ( str[i-1].match( /^ / ) != null ){
x981
@x981
Jun 30 2016 02:23
@aharshaw Your loop is wrong, Your loop need lookup all item in array, but at the first item you returned "No such contact" is wrong.
Frank
@Frankbono
Jun 30 2016 02:23
@jryanhaber I went to w3schools and looked at the symbol i should put for spaces and it said to put \s
Justin Woodward
@jwoo92
Jun 30 2016 02:23
@Frankbono so we want to keep all letters both upper and lower case (for now) and any numbers. that means we want to select anything that arent those characters and remove them.
Jonathan Haber
@jryanhaber
Jun 30 2016 02:24
@Frankbono that might be right... the thing is, I think you need the / / symbols to wrap all your selectors in
@Frankbono another example: if ( str[i].match( /[A-Z]/ ) != null ){
selectors go @Frankbono - inside of / / and the spaces one may be \, I dont recall that;
x981
@x981
Jun 30 2016 02:25
@aharshaw
Jonathan Haber
@jryanhaber
Jun 30 2016 02:25
@Frankbono which might look like /\/ in some cases..
x981
@x981
Jun 30 2016 02:25
This message was deleted
Justin Woodward
@jwoo92
Jun 30 2016 02:26
@Frankbono so if that is true the first thing would be using the ^ which selects anything not enclosed in the given brackets. ex: str = str.replace(/[^a-z]/g, '') would replace anything not lowercase letters between a-z with nothing basically eliminating it.
x981
@x981
Jun 30 2016 02:26
function lookUpProfile(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";
      }
    }
  }
  return "No such contact";
// Only change code above this line
}
@aharshaw
Frank
@Frankbono
Jun 30 2016 02:26
@jryanhaber Just to make sure I have to put // around selectors i.e. //#*\
Justin Woodward
@jwoo92
Jun 30 2016 02:27
@Frankbono remember it specifically states "A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing."
x981
@x981
Jun 30 2016 02:27
@aharshaw You can try this.
Jonathan Haber
@jryanhaber
Jun 30 2016 02:27
@Frankbono I think your example would be /#*/
Frank
@Frankbono
Jun 30 2016 02:27
@jwoo92 very cool. So i wouldn't need to use toLowerCase() then
Jonathan Haber
@jryanhaber
Jun 30 2016 02:27
/*#\/
Alex Harshaw
@aharshaw
Jun 30 2016 02:27

@x981 so this is mostly because I didn't declare "i" as a variable? @x981

Nevermind, I see that's not making a difference. Let me try to understand the logic of your loop. I'm getting the impression that I returned "No such contact" too early somehow.

Justin Woodward
@jwoo92
Jun 30 2016 02:27
@Frankbono we will actually, but not yet. lets perfect our regex first.
are you understanding the regex so far?
Frank
@Frankbono
Jun 30 2016 02:28
@jwoo92 yeah
Jonathan Haber
@jryanhaber
Jun 30 2016 02:28
I like your style @jwoo92 , thank you
CamperBot
@camperbot
Jun 30 2016 02:28
jryanhaber sends brownie points to @jwoo92 :sparkles: :thumbsup: :sparkles:
:cookie: 365 | @jwoo92 |http://www.freecodecamp.com/jwoo92
Frank
@Frankbono
Jun 30 2016 02:28
@jryanhaber ok so all selectors are inbetween / \/ ?
Justin Woodward
@jwoo92
Jun 30 2016 02:29
@Frankbono this will be the first thing for your code, whatever you had before we are not using currently. so far we selected anything not lowercase a-z. we also want to include uppercase A-Z and our numbers.
Jonathan Haber
@jryanhaber
Jun 30 2016 02:29
@Frankbono I think you put / (selectors here ) /
x981
@x981
Jun 30 2016 02:29
@aharshaw Yes
MertKulte
@MertKulte
Jun 30 2016 02:30
if(Math.floor(changeval/100)!==0){
      if(Math.floor(changeval/100)*100>cid[8][1]){
        change.push(["ONE HUNDRED",cid[8][1]]);
        changeval=changeval-cid[8][1];
        console.log(changeval);
      }
      else if(Math.floor(changeval/100)*100<=cid[8][1]){
        change.push(["ONE HUNDRED",Math.floor(changeval/100)*100]);
        changeval=changeval-Math.floor(changeval/100)*100;
        console.log(changeval);
      }
    }
Hello campers, in exact change challange, code up there is my base block for taking out every value (100,20,10 etc). When I use this, change value should go to 0 but instead, its value at the end is 0.009999999999994874. Because of that my code thinks it cant make it zero, also calculates number of dimes 1 less than it should be. What is wrong with my code?
Frank
@Frankbono
Jun 30 2016 02:30
@jryanhaber ok perfect, I didn't know about that, Thanks man!
CamperBot
@camperbot
Jun 30 2016 02:30
:cookie: 189 | @jryanhaber |http://www.freecodecamp.com/jryanhaber
frankbono sends brownie points to @jryanhaber :sparkles: :thumbsup: :sparkles:
MertKulte
@MertKulte
Jun 30 2016 02:30
In short why do I get values like 0.0099999.. instead of 0?
Alex Harshaw
@aharshaw
Jun 30 2016 02:30
@x981 why isn't "No such contact" included in the loop?
Justin Woodward
@jwoo92
Jun 30 2016 02:30
@Frankbono look over this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp. tell me how you would select uppercase a-z letters. we already have lowercase a-z selected.
@jryanhaber thank you.
CamperBot
@camperbot
Jun 30 2016 02:31
jwoo92 sends brownie points to @jryanhaber :sparkles: :thumbsup: :sparkles:
:cookie: 190 | @jryanhaber |http://www.freecodecamp.com/jryanhaber
Alex Harshaw
@aharshaw
Jun 30 2016 02:32

I'm suprised that

if (contacts[i].firstName === firstName){

doesn't have an "else" statement

Frank
@Frankbono
Jun 30 2016 02:33
@jwoo92 I read this before. I'm guessing ignoreCase
clintonjohn
@clintonjohn
Jun 30 2016 02:34
Hi @jryanhaber I was in emeryville today. I'm from Berkeley Working on the record update challenge in basic JavaScript section
Justin Woodward
@jwoo92
Jun 30 2016 02:34
@Frankbono so far you should have:
function palindrome(str) {
str = str.replace(/[^a-z]/g, '');
}

palindrome("eye");
@Frankbono if [a-z] is lowercase, then to select uppercase you would use [A-Z].
we want to select both lower and uppercase for now.
clintonjohn
@clintonjohn
Jun 30 2016 02:35
@jryanhaber hope to see you at an east bay FCC meetup!
Frank
@Frankbono
Jun 30 2016 02:35
@jwoo92 so [^A-Z]
x981
@x981
Jun 30 2016 02:35
@aharshaw Assuming that your have 3 items and your item you search's index = 1, When your loop run, at the first item your loop return "No such contact " and finish. Another items will not lookup in your loop.
Justin Woodward
@jwoo92
Jun 30 2016 02:36
@Frankbono to add that into our regex it would look like this: str = str.replace(/[^a-zA-Z]/g, '');. is this making sense to you?
Frank
@Frankbono
Jun 30 2016 02:36
@jwoo92 yes big time!
Justin Woodward
@jwoo92
Jun 30 2016 02:36
you only need to use one ^ at the beginning of your bracket.
@Frankbono okay cool. so we have all our letters selected to save, now we only have our numbers left to save. how will we do that with what you have learned so far?
MertKulte
@MertKulte
Jun 30 2016 02:37
anyone here who finished exact change challange? I need a little help
Frank
@Frankbono
Jun 30 2016 02:38
@jwoo92 0-9
Justin Woodward
@jwoo92
Jun 30 2016 02:39
@Frankbono exactly, add that in and show me what you have.
Frank
@Frankbono
Jun 30 2016 02:39
@jwoo92 str = str.replace(/[^a-zA-Z0-9]/g, '');
Brian Phillips
@unipheas
Jun 30 2016 02:40
In jQuery, how do you select all other elements that are similar but not just the siblings, every element on the dom?
Justin Woodward
@jwoo92
Jun 30 2016 02:40

@Frankbono perfect. our regex is done. here is what the note says: Note
You'll need to remove all non-alphanumeric characters (punctuation, spaces and symbols) and turn everything lower case in order to check for palindromes.

what do we need to do next?

Frank
@Frankbono
Jun 30 2016 02:42
@jwoo92 we would put the punctuations, spaces and symbols in our replace() and add .toLowerCase()
Justin Woodward
@jwoo92
Jun 30 2016 02:44
@Frankbono we have our string already processing all characters and eliminating what we do not need. that is why we have str = str.replace.... so slap on .toLowerCase() on the end of your regex and show me what you have.
Frank
@Frankbono
Jun 30 2016 02:45
@jwoo92 I wasn't sure that it took out the symbols. Good to know
@jwoo92 str = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
Justin Woodward
@jwoo92
Jun 30 2016 02:46
@Frankbono yes, that is what the ^ is for. it is basically saying select anything that is not a-zA-Z0-9 and changing them into '' which just eliminates it completely.
Frank
@Frankbono
Jun 30 2016 02:46
@jwoo92 I went on StackOverflow and I was under this understanding I would have to put each symbol in. Very good tip you gave me
Justin Woodward
@jwoo92
Jun 30 2016 02:47
@Frankbono your first line is done. now you have a perfect string to compare. now we need to create a variable that is str, but reversed to compare to. how will we do that?
Frank
@Frankbono
Jun 30 2016 02:49
str = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase().reverse();
@jwoo92 sorry i saw my mistake
I would have to add .split() and then .reverse()
Actually, come to think of it, just reverse() is needed
Justin Woodward
@jwoo92
Jun 30 2016 02:50
@Frankbono you already reversed a string in a challenge before this. look at it if you have forgotten how.
Frank
@Frankbono
Jun 30 2016 02:51
@jwoo92 your right, sorry
Justin Woodward
@jwoo92
Jun 30 2016 02:51
@Frankbono you have the right idea, but what you said so far will not work.
Frank
@Frankbono
Jun 30 2016 02:53
@jwoo92 I'm thinking using an if statement. If ( str === str = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase().reverse() ) {return true;}
Justin Woodward
@jwoo92
Jun 30 2016 02:53
@Frankbono this was right "I would have to add .split() and then .reverse()" but you forgot something on the end.
@Frankbono no need for if statement.
Nany
@NanyR
Jun 30 2016 02:54
does anyone know how to filter a single array argument with 2+ arguments?; I can't figure it out.
Frank
@Frankbono
Jun 30 2016 02:55
@jwoo92 I don't know
Justin Woodward
@jwoo92
Jun 30 2016 02:56
@Frankbono currently you split your string into an array and reversed its contents. you want to make it a string again. check into this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join.
Shola Abaogun
@codephoo
Jun 30 2016 02:56
@NanyR post example of what you need.
Justin Woodward
@jwoo92
Jun 30 2016 02:57
@Frankbono currently you have a string and an array. those can not be compared in those different forms.
Frank
@Frankbono
Jun 30 2016 02:58
@jwoo92 I think this is similar to the reverse the string algorithm i did. str.split("").reverse().join("")
clintonjohn
@clintonjohn
Jun 30 2016 02:59
@j
Magnus Holm
@mghlm
Jun 30 2016 03:00
I am at the "Word Blanks” assignment in JavaScript and I am completely lost. I have no idea what to do…
Justin Woodward
@jwoo92
Jun 30 2016 03:00

@Frankbono i will try to simplify it for you. here is an example on how .join() will work:

var array = [h, e, l, l, o];
array = array.join;

now array looks like this : array = 'hello';

Greg Duncan
@GregatGit
Jun 30 2016 03:00
@NanyR have you looked here http://www.w3schools.com/jsref/jsref_filter.asp -
Justin Woodward
@jwoo92
Jun 30 2016 03:01
@Frankbono thats perfect so now create a var and equal it to all that one your second line.
ex: var reverse = .....
clintonjohn
@clintonjohn
Jun 30 2016 03:01
In the record collection challenge, I don't know how the following is accomplished: If prop does not contain the key "tracks" before you update it, create an empty array before pushing a track to it.
Frank
@Frankbono
Jun 30 2016 03:01
@jwoo92 var str1 = str.split().reverse().join;
Justin Woodward
@jwoo92
Jun 30 2016 03:02
@Frankbono awesome. how does your code look now so far?
Nany
@NanyR
Jun 30 2016 03:02

I need to remove all of the elements from the first array that are in the following arguments, this is what I have but I can't figure out how to filter for all arguments: function destroyer() {
// Remove all the values
var firstArg= arguments[0];
var finalArr=[];

function filterArr(value){

return arguments[i] !== value;
}
for (var i=1; i<arguments.length; i++){
finalArr= firstArg.filter(filterArr);

}
return finalArr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Frank
@Frankbono
Jun 30 2016 03:02
@jwoo92 str = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase().reverse();
var str1 = str.split().reverse().join;
Justin Woodward
@jwoo92
Jun 30 2016 03:03
@Frankbono perfect. now the third line. its time to return what you have. if you return str === str1, it will either give you true if it is a palindrome or false if not.
Greg Duncan
@GregatGit
Jun 30 2016 03:05
@NanyR I recommend using indexOf
also put ``` before and after you code on seperate line (not ''')
Frank
@Frankbono
Jun 30 2016 03:06
@jwoo92 Would i put that in an If statement or just return str ===str1;
Justin Woodward
@jwoo92
Jun 30 2016 03:06
@Frankbono try returning :)
Chris Rutherford
@cjrutherford
Jun 30 2016 03:06
Okay, it may just be that it's late for me, but could anyone explain the algorithm for "Record Collection"?
Justin Woodward
@jwoo92
Jun 30 2016 03:07
@Frankbono if str1 is not equal to str, it will automatically return false. if it does equal, it will return true.
that is what the challenge wants to have as the answer.
Frank
@Frankbono
Jun 30 2016 03:08
@jwoo92 I get an error
Justin Woodward
@jwoo92
Jun 30 2016 03:08
@Frankbono show me your code.
@Frankbono what is the error?
Frank
@Frankbono
Jun 30 2016 03:09

function palindrome(str) {
str = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase().reverse();
var str1 = str.split().reverse().join();
return str === str1;

}
palindrome("eye");

Justin Woodward
@jwoo92
Jun 30 2016 03:09
@Frankbono look at your second line.
Frank
@Frankbono
Jun 30 2016 03:10
@jwoo92 TypeError: str.replace(…).toLowerCase(…).reverse is not a function
Justin Woodward
@jwoo92
Jun 30 2016 03:10
@Frankbono look at the end of your second line.
Frank
@Frankbono
Jun 30 2016 03:10
@jwoo92 ok
Justin Woodward
@jwoo92
Jun 30 2016 03:10
@Frankbono i meant first line, im sorry. end of the regex line
Frank
@Frankbono
Jun 30 2016 03:12
@jwoo92 I'm not sure. Maybe '' has to be ""
clintonjohn
@clintonjohn
Jun 30 2016 03:12
I've gone through FCC the last 112 or so days and the Record Collection challenge seems like the most non linear type of question I've encountered it's hard
Justin Woodward
@jwoo92
Jun 30 2016 03:12
@Frankbono we only need reverse on our reversed string. have you noticed you have the .reverse() method twice in your code?
clintonjohn
@clintonjohn
Jun 30 2016 03:13
12 days not 112
Frank
@Frankbono
Jun 30 2016 03:13
@jwoo92 ahh, that one slip by me big time
clintonjohn
@clintonjohn
Jun 30 2016 03:13
I can't walk myself through it
Magnus Holm
@mghlm
Jun 30 2016 03:14
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line

  var wordBlanks = "the" + myNoun + "is" + myAdjective + "and it once" + myVerb + "very" + myAdverb;

  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Justin Woodward
@jwoo92
Jun 30 2016 03:14
@clintonjohn it is a more challenging one for the expected knowledge level at that point in the course.
Magnus Holm
@mghlm
Jun 30 2016 03:14
what am i doing wrong?
Bnobo
@acloud12345678
Jun 30 2016 03:14
hey guys
Magnus Holm
@mghlm
Jun 30 2016 03:14
i am completely lost
Justin Woodward
@jwoo92
Jun 30 2016 03:14
@m4gnusholm are you suppose to be adding your whitespaces for your wording?
Magnus Holm
@mghlm
Jun 30 2016 03:15
@jwoo92 no idea man. i don’t understand the task

@jwoo92 You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.

Frank
@Frankbono
Jun 30 2016 03:15
@jwoo92 I ran the code again but I didn't meet all the perimeters. Basically all the perimeters where it has to return a false
Justin Woodward
@jwoo92
Jun 30 2016 03:16
@m4gnusholm example: if your myNoun is equal to a random word, lets say myNoun = 'bird'. well then if you do "the" + myNoun... it will result thebird. you need to do spaces in your wording for correct sentence structuring. example "the "
Greg Duncan
@GregatGit
Jun 30 2016 03:16
@m4gnusholm you should have done result = not var wordBlanks
Juan Moraza
@Morazajuan
Jun 30 2016 03:16
why my code isnt storing the value?

var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count = +1;
      break;
    case 7:
    case 8:
    case 9:
      count = +0;
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":  
     count = -1;
  }

  return count;
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Justin Woodward
@jwoo92
Jun 30 2016 03:16
@Frankbono show me your code.
Frank
@Frankbono
Jun 30 2016 03:16

@jwoo92 function palindrome(str) {
str = str.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
var str1 = str.split().reverse().join();
return str === str1;

}
palindrome("eye");

Magnus Holm
@mghlm
Jun 30 2016 03:17
@GregatGit it says result is already defined
Justin Woodward
@jwoo92
Jun 30 2016 03:17
@m4gnusholm i havent looked at the challenge so i do not know exactly what youre suppose to do. that was just something that caught my eye initially.
Greg Duncan
@GregatGit
Jun 30 2016 03:17
@m4gnusholm and don't forget to add spaces
Justin Woodward
@jwoo92
Jun 30 2016 03:17
@Frankbono what is the error again?
Greg Duncan
@GregatGit
Jun 30 2016 03:17
@m4gnusholm at the end you return result - you didn't do anything to result so it will be "";
Frank
@Frankbono
Jun 30 2016 03:18
@jwoo92 No error, I ran the code but I didn't meet all the perimeters. Basically all the perimeters where it has to return a false weren't met
Justin Woodward
@jwoo92
Jun 30 2016 03:18
@Frankbono your .join() is wrong.
Greg Duncan
@GregatGit
Jun 30 2016 03:18
@m4gnusholm change var wordBlanks = to result =
clintonjohn
@clintonjohn
Jun 30 2016 03:18
@jwoo92 thanks for the validation
CamperBot
@camperbot
Jun 30 2016 03:18
:cookie: 366 | @jwoo92 |http://www.freecodecamp.com/jwoo92
clintonjohn sends brownie points to @jwoo92 :sparkles: :thumbsup: :sparkles:
Justin Woodward
@jwoo92
Jun 30 2016 03:19
@Frankbono you have to tell it where to join at. same with your split.
@Frankbono .split('') will split at every character. same goes for joining.
Juan Moraza
@Morazajuan
Jun 30 2016 03:19
help! my code isnt adding the values it just gives me the last value
CamperBot
@camperbot
Jun 30 2016 03:19
no wiki entry for: my code isnt adding the values it just gives me the last value
Juan Moraza
@Morazajuan
Jun 30 2016 03:19

var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count = +1;
      break;
    case 7:
    case 8:
    case 9:
      count = +0;
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":  
     count = -1;
  }

  return "count is "+count;
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3);
Magnus Holm
@mghlm
Jun 30 2016 03:19
@GregatGit oh yes, it works
but i don’t know why
Juan Moraza
@Morazajuan
Jun 30 2016 03:20
it supposed to return 2 but it returns 1
Magnus Holm
@mghlm
Jun 30 2016 03:20
i don’t understand it :(
Frank
@Frankbono
Jun 30 2016 03:20
@jwoo92 I did the same mistake when doing the reversing a string algorithm. It works now :)
Juan Moraza
@Morazajuan
Jun 30 2016 03:20
@jwoo92 @GregatGit
Magnus Holm
@mghlm
Jun 30 2016 03:20
@GregatGit Can you please explain how I was supposed to know to write result if you haven’t told me?
Greg Duncan
@GregatGit
Jun 30 2016 03:20
@m4gnusholm because you meant to alter result not create a new variable call wordBlanks
Michelle Geng
@MGHammer
Jun 30 2016 03:21
What is wrong with my code? I'm trying to modify the function checkObj to test myObj for checkProp. If property is found, return property's value. If not, return "Not Found".

function checkObj(checkProp) {
var storage1;
if(myObj.hasOwnProperty(checkProp)){
storage1 = myObj.checkProp;
return storage1;
}
else{
return "Not Found";
}

}

myObj is given in the setup
Greg Duncan
@GregatGit
Jun 30 2016 03:21
@m4gnusholm Because thats what is returned at the end of the function (which you are told not to change)
Magnus Holm
@mghlm
Jun 30 2016 03:21
@GregatGit becuase it said =“”; ?
clintonjohn
@clintonjohn
Jun 30 2016 03:22
@jwoo92 I notice different successful answers on different profiles, varying in efficiency
Justin Woodward
@jwoo92
Jun 30 2016 03:22
@Frankbono awesome. the algorithms will seem very hard and do not doubt the 50 hours it notes. i struggled just the same where you are at. just dont give up. i have had my fair share of frustrations.
Greg Duncan
@GregatGit
Jun 30 2016 03:22
@m4gnusholm
// Your code above this line
  return result;
Frank
@Frankbono
Jun 30 2016 03:22
@jwoo92 Thank you soooooooo much Justin! I really appreciate you taking the time to teach me. You sir are awesome!!!
CamperBot
@camperbot
Jun 30 2016 03:22
frankbono sends brownie points to @jwoo92 :sparkles: :thumbsup: :sparkles:
:cookie: 367 | @jwoo92 |http://www.freecodecamp.com/jwoo92
Justin Woodward
@jwoo92
Jun 30 2016 03:22
@Frankbono eventrually though, you will start to catch on with time.
Magnus Holm
@mghlm
Jun 30 2016 03:22
@GregatGit ok, i just think it’s hard to understand. so far haven’t learned about function or results yet.
or return
Frank
@Frankbono
Jun 30 2016 03:23
@jwoo92 I definitely won't give up
Justin Woodward
@jwoo92
Jun 30 2016 03:23
@clintonjohn there are many ways to paint the same picture :) what do you have so far?
Greg Duncan
@GregatGit
Jun 30 2016 03:23
@m4gnusholm don't worry - we all had to learn it
Magnus Holm
@mghlm
Jun 30 2016 03:23
@GregatGit But I’m sure it gets better with more practice. thanks a lot for explaining !
CamperBot
@camperbot
Jun 30 2016 03:23
m4gnusholm sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 634 | @gregatgit |http://www.freecodecamp.com/gregatgit
Juan Moraza
@Morazajuan
Jun 30 2016 03:23
I want to learn what am i doing wrong
Magnus Holm
@mghlm
Jun 30 2016 03:23
@GregatGit Thanks :smile:
CamperBot
@camperbot
Jun 30 2016 03:23
m4gnusholm sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:warning: m4gnusholm already gave gregatgit points
x981
@x981
Jun 30 2016 03:25
@GregatGit Today i can't get data from link http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=77b646ea6f08891aca84686309edeb47 Request had been blog and required "https"
Justin Woodward
@jwoo92
Jun 30 2016 03:25
@GregatGit i may be able to use your help on a logical question here soon. i am going to get off here for the moment. i may or may not be back on tonight.
clintonjohn
@clintonjohn
Jun 30 2016 03:25
@jwoo92 nothing. I'm merely trying to figure out what the question is asking, by reverse engineering other people's answers. I'm learning 🙂
Justin Woodward
@jwoo92
Jun 30 2016 03:26
@Frankbono you will be fine if you want it bad enough.
Greg Duncan
@GregatGit
Jun 30 2016 03:26
@MGHammer i think that myObj.hasOwnProperty(checkProp) if it is not there will be -1 which is also true
clintonjohn
@clintonjohn
Jun 30 2016 03:27
The language in the question is not written in a way I can comprehend
but by seeing how the code gives the proper result, I get clues into how I would have understood the question to be written, or I realize what I was missing
Greg Duncan
@GregatGit
Jun 30 2016 03:28
@MGHammer what it probably should be is if(myObj.hasOwnProperty(checkProp) > -1)
Justin Woodward
@jwoo92
Jun 30 2016 03:28
@clintonjohn it is almost like it is the first real challenge in the course that gets you thinking logically for algorithm scripting. just take it slow and steady. make sure to understand everything you do rather than pushing through just for a checkmark.
Michelle Geng
@MGHammer
Jun 30 2016 03:29
Thanks! I actually got it fixed by changing the object notation from myObj.checkProp to myobj[checkProp]
Greg Duncan
@GregatGit
Jun 30 2016 03:29
@x981 can you put your pen up
Michelle Geng
@MGHammer
Jun 30 2016 03:29
not sure why that makes a difference
Greg Duncan
@GregatGit
Jun 30 2016 03:30
@MGHammer myObj.checkProp looks for "checkProp" not the variable checkprop
James S.
@Mrblue27
Jun 30 2016 03:31

function nextInLine(arr, item) {
// Your code here
arr.push(item);
var removed = arr.shift();
return item; // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr)); any advice need some help on getting nextInLine ([2], 1) and nextInLine([5,6,7,8,9], 1)

Greg Duncan
@GregatGit
Jun 30 2016 03:32
@x981 your page can't be https then use http api in chrome - try it in http
Juan Moraza
@Morazajuan
Jun 30 2016 03:33
nvm guys i figured out THANKS for your help 😒
Michelle Geng
@MGHammer
Jun 30 2016 03:34
@GregatGit Got it, thanks so much!
CamperBot
@camperbot
Jun 30 2016 03:34
mghammer sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 635 | @gregatgit |http://www.freecodecamp.com/gregatgit
Greg Duncan
@GregatGit
Jun 30 2016 03:36
@x981 also if you can't have the second api call outside the other one if it depends on the data from the first. While js is waiting for the first call to come back it moves on and does the second api call that needs info from the first - so it wont work
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:39
Hi all... just finished my Local Weather App and would love some feedback on this, specifically the JS. I've never written this much javascript before and while I'm confident in the functionality, I'd be curious to hear feedback from a more experienced coder on how the structure and everything looks overall. Everything is explained in the comments, but i got myself into some difficult situations with my design, which required changing CSS using jquery (depending on str.lenghth) to make sure all outputs fit within the confines of their containers - so please let me know if any text looks off or is too big and pushes other elements out of their divs!
x981
@x981
Jun 30 2016 03:40
@GregatGit I try in chrome, get same error, request had been blocked
Greg Duncan
@GregatGit
Jun 30 2016 03:40
@x981 and these two lines will be executed before the api calls come back
$("#province").html(city + ", " + country);
  $("#degree").html(infotemp.main.temp + "°");
Coy Sanders
@coymeetsworld
Jun 30 2016 03:42
takes a while to load @no-stack-dub-sack
x981
@x981
Jun 30 2016 03:42
@GregatGit I deleted two lines, but i get same error. :)
Greg Duncan
@GregatGit
Jun 30 2016 03:42
@x981 what error
Coy Sanders
@coymeetsworld
Jun 30 2016 03:43
actually going faster now, notice that when you switch between units the spans shift on another panel (i.e. the update weather button and the wind)
everything else looks good though
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:44
@coymeetsworld sometimes quicker than others - not sure if this is because of my code or the location API i'm using...
x981
@x981
Jun 30 2016 03:44
@GregatGit I don't know why, i also deleted two lines.
Greg Duncan
@GregatGit
Jun 30 2016 03:44
@no-stack-dub-sack looks really good
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:45
@coymeetsworld you mean when you toggle the temp/wind its actually pushing the text and button down outside the box?
Coy Sanders
@coymeetsworld
Jun 30 2016 03:45
yeah @no-stack-dub-sack
something weird going there
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:45
@coymeetsworld what's the wind dir out of curiosity?
Coy Sanders
@coymeetsworld
Jun 30 2016 03:46
hmm hit update weather going slow again, im not familiar with the APIs so many its just that
although nothing on the page is rendered, its just a white screen
going to refresh page
for me its 11mph wnw
im using openweathermap and ip-api and I'm getting 9.19 SW though
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:47
@GregatGit thanks! couple of bugs to work out it sounds like...but pretty proud of it overall. feels good to be a true beginner and see the fruits of your labor!
CamperBot
@camperbot
Jun 30 2016 03:47
no-stack-dub-sack sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 636 | @gregatgit |http://www.freecodecamp.com/gregatgit
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:47
@coymeetsworld ip-api keeps crashing on me
Bnobo
@acloud12345678
Jun 30 2016 03:48
Try rebooting
just kidding
Coy Sanders
@coymeetsworld
Jun 30 2016 03:48
i haven't had too many problems, im in US
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:48
had to use another one... it was down for days at a time while i was building this
Coy Sanders
@coymeetsworld
Jun 30 2016 03:48
hmm strange
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:48
so am i
Greg Duncan
@GregatGit
Jun 30 2016 03:48
@x981 your weather api is fine - try this for you location http://ip-api.com/json
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:49
today it was down too, i tried going back toi it earlier
@coymeetsworld nope, says page took too long to respond. so weird.
Coy Sanders
@coymeetsworld
Jun 30 2016 03:50
hmm well maybe its your geographical location, as I said im in US and haven't had problems w/ it
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:52
odd, well i'm in NYC region so maybe too much traffic in this area?
@coymeetsworld it's weird that the wind toggle did that though, I tried testing it out with every direction to make sure there was enough room with that font size, what browser are you using?
Coy Sanders
@coymeetsworld
Jun 30 2016 03:53
chrome
full screen, have 24"
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:55
hmm... well I just modified the font size, so should be good now.
Coy Sanders
@coymeetsworld
Jun 30 2016 03:56
yeah now it looks fixed
cannelflow
@cannelflow
Jun 30 2016 03:56
function isUniform(arg) {
    'use strict';
    for (i = 0; i < arg.length; i++) {
        if (arg[0] === arg[i]) {
            return true;
        } else {
            return false;
        }
    }
}
isUniform([1, 1, 1, 1]);
can anyone tell me what this is not working ? expecting to get true since every value is same
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:56
@coymeetsworld nice, thanks for the feedback and for taking a look, those are exactly the kind of things i was looking to have pointed out
CamperBot
@camperbot
Jun 30 2016 03:56
no-stack-dub-sack sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1221 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Nick Neuman
@neecholaus
Jun 30 2016 03:57

'''

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("bravo");
'''

CamperBot
@camperbot
Jun 30 2016 03:57
:bulb: to format code use backticks! ``` more info
Coy Sanders
@coymeetsworld
Jun 30 2016 03:57
np @no-stack-dub-sack overall looks well done, just issues with responsiveness
Nick Neuman
@neecholaus
Jun 30 2016 03:57
can someone help me with the Using Objects for Lookups exercise?
I cant figure out what im doing wrong
cannelflow
@cannelflow
Jun 30 2016 03:57
@neecholaus you need to assign value to reasult
@neecholaus like how you are going to get value of Adams
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 03:58
@coymeetsworld yeah, that's been bothering me too. do you think the code could be responsible for slow rendering? Someone mentioned in an earlier discussion that perhaps running the clock function on an interval like it is not the best idea, but that's the only way so far I could figure out how to make the clock run accurately. I might have bit off more than I could chew with the idea of adding that... @coymeetsworld
Coy Sanders
@coymeetsworld
Jun 30 2016 03:59
don't think its the clock, but not sure would have to look
you could always remove or disable the clock and see, but I think its with the API call
or the code that processes the information from the API call
Nick Neuman
@neecholaus
Jun 30 2016 04:00
@cannelflow like put var result = val; ?
cannelflow
@cannelflow
Jun 30 2016 04:00
@neecholaus yes like that
but how you will get value of Adams there
@neecholaus
its inside lookup object
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:01
@coymeetsworld good idea, I'll try that to see. Yeah my gut was the API call as well. I'll try switching back to ip-api when it seems to be running for me and go from there. Maybe it's my IP somehow.......... wait a second.....
Nick Neuman
@neecholaus
Jun 30 2016 04:02
so do i need to put var result = val inside the lookup var? @cannelflow ?
sorry im pretty confused about this
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:03
ehhh, nevermind. Thought I figured out why ip-api wasn't working for me - thought it might have been somehow tied into the clock and that that was causing me to go over my call limit, but they aren't really connected so...
cannelflow
@cannelflow
Jun 30 2016 04:03
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

  var lookup={
   "alpha":"Adams",
  "bravo":"Boston",
  "charlie":"Chicago",
  "delta":"Denver",
  "echo":"Easy",
  "foxtrot":"Frank"
};

  // Only change code above this line
  get the value of adams and assign it to reasult <======
  return result;<====return result
}

// Change this value to test
phoneticLookup("charlie");
@neecholaus
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:06
@coymeetsworld do me a favor and run it again if you don't mind - I switched the code back to IP-API, if it's working from your location, I'd be curious to know if it runs faster for you now.
cannelflow
@cannelflow
Jun 30 2016 04:07
@neecholaus ?
Nick Neuman
@neecholaus
Jun 30 2016 04:07
sorry im working on it right now @cannelflow thank you
CamperBot
@camperbot
Jun 30 2016 04:07
neecholaus sends brownie points to @cannelflow :sparkles: :thumbsup: :sparkles:
:star2: 1187 | @cannelflow |http://www.freecodecamp.com/cannelflow
cannelflow
@cannelflow
Jun 30 2016 04:08
@neecholaus :+1:
Coy Sanders
@coymeetsworld
Jun 30 2016 04:09
seems to be a little more responsive
James S.
@Mrblue27
Jun 30 2016 04:09

A little help I need nextInLine ([2], 1) and ([5,6,7,8,9], 1) Need advice on where to input command. Here's what I have so far .
function nextInLine(arr, item) {
// Your code here
arr.push(item);
var removed = arr.shift();
return item; // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

https://www.freecodecamp.com/challenges/stand-in-line#?solution=%0Afunction%20nextInLine(arr%2C%20item)%20%7B%0A%20%20%2F%2F%20Your%20code%20here%0A%20%20arr.push(item)%3B%0A%20%20var%20removed%20%3D%20arr.shift()%3B%0A%20%20return%20item%3B%20%20%2F%2F%20Change%20this%20line%0A%7D%0A%0A%2F%2F%20Test%20Setup%0Avar%20testArr%20%3D%20%5B1%2C2%2C3%2C4%2C5%5D%3B%0A%0A%2F%2F%20Display%20Code%0Aconsole.log(%22Before%3A%20%22%20%2B%20JSON.stringify(testArr))%3B%0Aconsole.log(nextInLine(testArr%2C%206))%3B%20%2F%2F%20Modify%20this%20line%20to%20test%0Aconsole.log(%22After%3A%20%22%20%2B%20JSON.stringify(testArr))%3B%0A

Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:09
@Will-is-Coding was that link meant for me Will?
Coy Sanders
@coymeetsworld
Jun 30 2016 04:09
one thing though @no-stack-dub-sack is check the wind direction, you may have it calculated wrong
although I'm actually redoing my weather project right now I could have it wrong
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:10
@coymeetsworld I'll show you how I made the calculations, hang tight
mine are correct
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:11
I used this... to be honest though, I didn't check to make sure this was accurate, but I think my function accurately converts to this - it's just a bunch of if/else chains
Coy Sanders
@coymeetsworld
Jun 30 2016 04:11
for my location im getting 222 degrees, I'm saying its SW which it is
you have it as WNW
which means youre off by at least 50 degrees or so
Will
@Will-is-Coding
Jun 30 2016 04:12
@no-stack-dub-sack Oh sorry. It was meant for @neecholaus
Nick Neuman
@neecholaus
Jun 30 2016 04:13
@cannelflow so when i try to make var result = val; it says that result already has a value and i can only change stuff in between those two lines and result is above the boundaries
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:13
@coymeetsworld that's weird, check out this part of my function:
} else if (num > 213.75 && num <= 236.25) { direction = "SW";\
Coy Sanders
@coymeetsworld
Jun 30 2016 04:13
yeah, maybe its your weather provider, they could be providing different data
so may not be best way to compare what I have with what you do
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:15
well I'm using openweathermap like everyone else I thought, but i'll look at it again. there might be something fishy because I was messing with the returns on that function a bit when testing to see what would fit, specifically I used WNW because that was the longest of the directions, so I'll have to carefully look through that function again...
Nick Neuman
@neecholaus
Jun 30 2016 04:15

'''

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};

get = lookup.val;
// Only change code above this line
return get;
}

// Change this value to test
phoneticLookup("bravo");

'''

CamperBot
@camperbot
Jun 30 2016 04:15
:bulb: to format code use backticks! ``` more info
Nick Neuman
@neecholaus
Jun 30 2016 04:16
so should this work? @cannelflow ?
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 04:16
need help
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:16
@coymeetsworld unless you didn't use open weather map
Coy Sanders
@coymeetsworld
Jun 30 2016 04:16
i used openweather
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 04:16
strict mode is not working in chrome Developers tool
Coy Sanders
@coymeetsworld
Jun 30 2016 04:17
my results could be stale, who knows
its probably ok
Nick Neuman
@neecholaus
Jun 30 2016 04:17

'''js

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};

get = lookup.val;
// Only change code above this line
return get;
}

// Change this value to test
phoneticLookup("bravo");

'''

CamperBot
@camperbot
Jun 30 2016 04:17
:bulb: to format code use backticks! ``` more info
Peter Weinberg
@no-stack-dub-sack
Jun 30 2016 04:17
if you open the console in my pen, the JSON data should be there... what do the degrees say?
x981
@x981
Jun 30 2016 04:17
Thanks @GregatGit
CamperBot
@camperbot
Jun 30 2016 04:17
x981 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 637 | @gregatgit |http://www.freecodecamp.com/gregatgit
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 04:18
function foo() {
"use strict";
a = 1;
}
foo();
its give me o error in chrome developer tool
Greg Duncan
@GregatGit
Jun 30 2016 04:19
@x981 nice one - it's working on my local machine
@neecholaus try get = lookup[val];
@neecholaus I think look.val is looking for the property call "val" not the variable
Nick Neuman
@neecholaus
Jun 30 2016 04:24
lol wow. @GregatGit that was it. thanks man
CamperBot
@camperbot
Jun 30 2016 04:24
neecholaus sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 638 | @gregatgit |http://www.freecodecamp.com/gregatgit
Daniel Ekwuazi
@Dcwind
Jun 30 2016 04:30

Please how do I go about solving this. ```

// Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2468": {
"album": "1999",
"artist": "Prince",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
if (prop != "tracks" && (collection[id].hasOwnProperty("prop")) === true) {
collection[id].tracks = [];
collection[id].tracks.push(value);
}

return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA"); ```

NixonRichard
@NixonRichard
Jun 30 2016 04:31
How to check if a number is power of 2 ?
Daniel Ekwuazi
@Dcwind
Jun 30 2016 04:31

```// Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2468": {
"album": "1999",
"artist": "Prince",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
if (prop != "tracks" && (collection[id].hasOwnProperty("prop")) === true) {
collection[id].tracks = [];
collection[id].tracks.push(value);
}

return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
```

help format
CamperBot
@camperbot
Jun 30 2016 04:32

: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 thecode`.

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

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

Gyeognphil Choi
@creativeworkers10
Jun 30 2016 04:32

Hi guys! I am on a challenge: Escape Sequences in Strings,

and I did what they want me to do, but it doesn'

it doesn't work:
var myStr='\ \t \t \r \n' ; // Change this line
Can anyone tell me why it doesn't work?
NixonRichard
@NixonRichard
Jun 30 2016 04:33
Setup
var collection = {
"2548": {
"album": "Slippery When Wet",
"artist": "Bon Jovi",
"tracks": [
"Let It Rock",
"You Give Love a Bad Name"
]
},
"2468": {
"album": "1999",
"artist": "Prince",
"tracks": [
"1999",
"Little Red Corvette"
]
},
"1245": {
"artist": "Robert Palmer",
"tracks": [ ]
},
"5439": {
"album": "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));
// Only change code below this line
function updateRecords(id, prop, value) {
if (prop != "tracks" && (collection[id].hasOwnProperty("prop")) === true) {
collection[id].tracks = [];
collection[id].tracks.push(value);
}
return collection;
}
// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:33
@NixonRichard what your code was suppose to do?
clintonjohn
@clintonjohn
Jun 30 2016 04:34
This isn't logical:

If prop does not contain the key "tracks", then update or set the value for that incomplete prop.

If prop does not contain the key "tracks" before you update it, create an empty array before pushing a track to it.

Magnus Holm
@mghlm
Jun 30 2016 04:35
There are so many of the javascript assignments that I don’t understand….
clintonjohn
@clintonjohn
Jun 30 2016 04:35
Which comes first?
That makes no sense whatsoever to me
They are mutually exclusive sentences
They are instructions for Record Collection
NixonRichard
@NixonRichard
Jun 30 2016 04:37
@peterAzv it suppose to check if an integer is power of 2
then it return true or false
clintonjohn
@clintonjohn
Jun 30 2016 04:37
It's saying create
create an empty array for the !-- track property?
so first I must create an empty array
Tarun sehgal
@FCCtarun
Jun 30 2016 04:40

hey
Storing Values with the Assignment Operator

code
// Setup
var a = 7;
var b = a;

// Only change code below this line

error: Do not change code above the line.

what does it mean?

clintonjohn
@clintonjohn
Jun 30 2016 04:41
if (prop !-- "tracks) create an empty value array?
what does an empty value array look like?
if (prop !-- "tracks) value === ('')
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:42
@NixonRichard
function isPowerOfTwo(num){
  num = (1 << Math.ceil(Math.log2(num))) - num;
  return  num === 0 ? true : false;
}
isPowerOfTwo(32);
NixonRichard
@NixonRichard
Jun 30 2016 04:43
never seen that code before
hmm
clintonjohn
@clintonjohn
Jun 30 2016 04:44
if (prop !== "tracks") {value === (''}
NixonRichard
@NixonRichard
Jun 30 2016 04:44
maybe that s a way to solve the problem
Janodus
@janodus
Jun 30 2016 04:44
hello all
NixonRichard
@NixonRichard
Jun 30 2016 04:44
that seems good
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:44
@NixonRichard without ternary if
function isPowerOfTwo(num){
  num = (1 << Math.ceil(Math.log2(num))) - num;
  if(num === 0){
     return  true ;
   }
   return false;
}
isPowerOfTwo(32);
clintonjohn
@clintonjohn
Jun 30 2016 04:44
I think that's the way to start the challenge: record container
NixonRichard
@NixonRichard
Jun 30 2016 04:47
@peterAzv can u make it any shorter and cooler ?
( =
clintonjohn
@clintonjohn
Jun 30 2016 04:48
Can someone help me with the record collection challenge?
NixonRichard
@NixonRichard
Jun 30 2016 04:48
u can find the solution in ironion s blog
clintonjohn
@clintonjohn
Jun 30 2016 04:49
ironion?
NixonRichard
@NixonRichard
Jun 30 2016 04:49
ironion
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:49
@NixonRichard haha i don't think so... i think the most simple way to get this is using: n&(-n)==n and explicity check for 0...
clintonjohn
@clintonjohn
Jun 30 2016 04:49
I've already found multiple solutions. I still don't understand what the problem is
NixonRichard
@NixonRichard
Jun 30 2016 04:50
u r not good at english ?
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:50
its not my first language
NixonRichard
@NixonRichard
Jun 30 2016 04:50
me too lol
Sam
@alakasam
Jun 30 2016 04:51
Hi, I've a question about terminology. What do you call the object on which a method is called? (i'm not even sure i'm using the corret terminology here).
NixonRichard
@NixonRichard
Jun 30 2016 04:51
@clintonjohn it s hard to tell but i think ironion have the simpliest explanation for now
Sam
@alakasam
Jun 30 2016 04:51
as in oldArray.concat(newArray) - i know newArray is the argument and concat is the method
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:51
@NixonRichard you always could put all in return, but its not a good pratice.
function isPowerOfTwo(num){
  return  ((1 << Math.ceil(Math.log2(num))) - num) === 0 ? true : false;
}
96street
@96street
Jun 30 2016 04:52
when using .ajax(), what does this mean in the success object:
success: function(data) {
    if(data) {
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:53
@96street data is the body from the response that you get.
96street
@96street
Jun 30 2016 04:53
yeah
so what does if(data) mean?
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:53
@96street if data is true.
clintonjohn
@clintonjohn
Jun 30 2016 04:53
@NixonRichard you mean his FCC blog or website. I can't find it on his website blog
96street
@96street
Jun 30 2016 04:53
@peterAzv so if the data has been successfully loaded? @peterAzv
NixonRichard
@NixonRichard
Jun 30 2016 04:55
did u check out both ? @clintonjohn
@peterAzv i saw they made it in one line and very short somewhere but i forgot it
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:57
@96street yeah... basically if data is not null.
clintonjohn
@clintonjohn
Jun 30 2016 04:58
@NixonRichard he hasn't completed it
i checked
NixonRichard
@NixonRichard
Jun 30 2016 04:58
im not sure but u may skip the challenge until someone can help u just wait till they go online while doing other challenges
that s what i wuold do
Peterson de Azevedo
@peterAzv
Jun 30 2016 04:59
@NixonRichard well... this solution just use one line... the others are... declare the function... return true or false... and call the function haha, but its the only way that i know... :/
Ghost
@ghost~570d03d4187bb6f0eadf12a6
Jun 30 2016 04:59

help please, i am stuck with the palindrome challenge,it keeps returning true for the "1 eye for of 1 eye." here is my code : function palindrome(str) {
// Good luck!
var cont='';
var rev='';
var low=str.toLowerCase();
var up=str.toUpperCase();

for(var i=0;i<str.length;i++){

if(up[i]!==low[i]){
                    cont+=low[i];
                        }
                           }

rev=cont.split('').reverse().join('');

if(rev===cont){
return true;
}else return false;

}
palindrome("1 eye for of 1 eye.");
palindrome("eye");

CamperBot
@camperbot
Jun 30 2016 04:59
no wiki entry for: please i am stuck with the palindrome challengeit keeps returning true for the 1 eye for of 1 eye here is my code function palindromestr good luck var cont var rev var lowstrtolowercase var upstrtouppercase forvar i0istrlengthi ifupilowi contlowi revcontsplitreversejoinifrevcont return trueelse return false palindrome1 eye for of 1 eyepalindromeeye
Anirudha Kasralikar
@akasralikar
Jun 30 2016 05:01
I am done with challenge Profile Lookup, but interested if there can be better ( or shorter ) solution to it.
NixonRichard
@NixonRichard
Jun 30 2016 05:01
send a link to ur challenge
Anirudha Kasralikar
@akasralikar
Jun 30 2016 05:01
function lookUpProfile(firstName, prop){
  var isMatch = false;

  for(var i=0; i < contacts.length; i++) {
    if( true === isMatch || firstName !== contacts[i].firstName ) {
      continue;
    }

    if( firstName === contacts[i].firstName ) {
      isMatch = true;
    }

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

    return contacts[i][prop];
  }

  return "No such contact";
}
96street
@96street
Jun 30 2016 05:01
@peterAzv sweet
Anirudha Kasralikar
@akasralikar
Jun 30 2016 05:02
can this be possible without using for loops?
NixonRichard
@NixonRichard
Jun 30 2016 05:04
@peterAzv it s a very cool way ( they said) but i forgot the link to that page )=
Ghost
@ghost~570d03d4187bb6f0eadf12a6
Jun 30 2016 05:04
isn't "1 eye for of 1 eye. " a palindrome concerning the palindrome(str) function ?
NixonRichard
@NixonRichard
Jun 30 2016 05:04
it can be solve in a very short and simple way
deepakSpatil
@deepakSpatil
Jun 30 2016 05:05
@deepakSpatil
any one knows how to use angular UI tree?
https://github.com/angular-ui-tree/angular-ui-tree
Anirudha Kasralikar
@akasralikar
Jun 30 2016 05:05
@NixonRichard where I can optimize current code?
Wilfred
@wilfredtommy
Jun 30 2016 05:05

How do I do this challenge?
You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.

It's a madlib challenge, but I didn't really understand what to do
Peterson de Azevedo
@peterAzv
Jun 30 2016 05:08

@abdel-dreamer if you want the "1 eye for of 1 eye" be false, you have to account the different characters in the loop

for(var i=0;i<str.length;i++){
   cont+=low[i];
}

Just remove the "if"

NixonRichard
@NixonRichard
Jun 30 2016 05:08
@akasralikar im talking about the palindromes challenge lol u code s fine if u can understand it cuz u have to be used to JS before trying to optimize ur code
Anirudha Kasralikar
@akasralikar
Jun 30 2016 05:09
ok
Peterson de Azevedo
@peterAzv
Jun 30 2016 05:09
@NixonRichard if you found the page, let me know :D
well.. good night @everyone
lazy_bunny
@lazyCoder036
Jun 30 2016 05:11
can anyone please explain what it they mean by non word character

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

result ="Smart" + myNoun + "chased by a " + myAdjective + "jello monster and" + myVerb + "rather" + myAdverb;

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

Peterson de Azevedo
@peterAzv
Jun 30 2016 05:11
see ya
NixonRichard
@NixonRichard
Jun 30 2016 05:12
Sure cu
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:12
need help

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card == 2 || card == 3 || card == 4 || card == 5 || card == 6) {
    count++;
    return count + " Bet";
  }
  else if (card == 7 || card == 8 || card == 9) {
    return count + " Hold";
  }
  else if (card == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A') {
    count--;
    return count + " Hold";
  }

  return "count";
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc('J'); cc(9); cc(2); cc(7);
the result is
1 Hold
NixonRichard
@NixonRichard
Jun 30 2016 05:13
@mitul036 ur code seems wrong
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:14
the error
Cards Sequence 2, J, 9, 2, 7 should return "1 Bet"
lazy_bunny
@lazyCoder036
Jun 30 2016 05:14
@NixonRichard how
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:14
Cards Sequence 2, 2, 10 should return "1 Bet"
this is Counting card challenge
any help
lazy_bunny
@lazyCoder036
Jun 30 2016 05:15
well I understand it now
they mean white space
Magnus Holm
@mghlm
Jun 30 2016 05:15
What to do if I am COMPLETELY lost at an assignment? I’ve been looking at it now for 30 minutes, and I don’t understand anything
lazy_bunny
@lazyCoder036
Jun 30 2016 05:15
thanks @NixonRichard
CamperBot
@camperbot
Jun 30 2016 05:15
mitul036 sends brownie points to @nixonrichard :sparkles: :thumbsup: :sparkles:
:cookie: 29 | @nixonrichard |http://www.freecodecamp.com/nixonrichard
NixonRichard
@NixonRichard
Jun 30 2016 05:15
my pleasure @mitul036
lazy_bunny
@lazyCoder036
Jun 30 2016 05:15
:smile:
sherdildeveloper
@sherdildeveloper
Jun 30 2016 05:16

function largest(arra){
var largestNum=0;
for (i=0;i<arra.length;i++){ if(arra[i]>largestNum){
largestNum=arra[i];
}
}
return largestNum;
}

function largestOfFour(arr) {
// You can do this!
newArr=[];
for(i=0;i<arr.length;i++)
{
a=largest(arr[i]);
console.log(a);
newArr.push(a);
}
return newArr;
}

anyone can help with this code?
Wilfred
@wilfredtommy
Jun 30 2016 05:17
@mitul036 could you please explain that to me?
i'm stuck on the same thing
sherdildeveloper
@sherdildeveloper
Jun 30 2016 05:17
return largest numbers in arrays
Anirudha Kasralikar
@akasralikar
Jun 30 2016 05:17
help format
CamperBot
@camperbot
Jun 30 2016 05:17

: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 thecode`.

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

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

Anirudha Kasralikar
@akasralikar
Jun 30 2016 05:17
@sherdildeveloper please use code formatting while posting code it very useful for other to read it
Magnus Holm
@mghlm
Jun 30 2016 05:17

Please help!!


function nextInLine(arr, item) {
  // Your code here

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

This is the assignment: Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.

I have NO idea what to do
96street
@96street
Jun 30 2016 05:18
can someone please explain to me what .extract does?
pages[page].extract
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:19
@m4gnusholm
NixonRichard
@NixonRichard
Jun 30 2016 05:20
he EXTRACT() function is used to return a single part of a date/time, such as year, month, day, hour, minute, etc. @96street
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:20
@96street use arr.push() for adding element in last
NixonRichard
@NixonRichard
Jun 30 2016 05:20
*the EXTRACT()
sherdildeveloper
@sherdildeveloper
Jun 30 2016 05:21

```
function largest(arra){
var largestNum=0;
for (i=0;i<arra.length;i++){ if(arra[i]>largestNum){
largestNum=arra[i];
}
}
return largestNum;
}

function largestOfFour(arr) {
// You can do this!
newArr=[];
for(i=0;i<arr.length;i++)
{
a=largest(arr[i]);
console.log(a);
newArr.push(a);
}
return newArr;
}

sorry didn't get how to use code formating
96street
@96street
Jun 30 2016 05:21
@NixonRichard nah that's not how it's used here ..
Charles Bakar
@charlesBak
Jun 30 2016 05:21
This message was deleted
96street
@96street
Jun 30 2016 05:21
@abhishekdevinfo
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:22
@96street and use arr.shift() to remove first
sunny yuen
@yuens1002
Jun 30 2016 05:22
hi all, i'm stuck on the smallest common multiple challenge, pls help if any one can shed some light on implementing the greatest common denominator (gcd), below is my current code
function smallestCommons(arr) {

  //so we can use the same increment 
  //  loop to find the largest common
  arr[0] > arr[1] ? Comn(arr[1], arr[0]) : Comn(arr[0], arr[1]);


  function Comn(start, end) {
    var sum = start;
    for (var i = start; i < end; i++) {
      sum*=(i+1);

    }
    gcd(sum, start, end);
  }

  function gcd(num, start, end) {
    //num / gcd = lcm
    // return lcm
    // i stuck on trying to implement gcd in code
  }
}
smallestCommons([5,13]);
Charles Bakar
@charlesBak
Jun 30 2016 05:22
@abhishekdevinfo remoce the returns in the if-statements and check the count like this
var count = 0;

function cc(card) {
  // Only change code below this line
  if (card == 2 || card == 3 || card == 4 || card == 5 || card == 6) {
    count++;
  }
  else if (card == 7 || card == 8 || card == 9) {
    count+= 0;
  }
  else if (card == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A') {
    count--;
  }
 if(count <= 0){
    return count + " Hold";
    }
    else
    return count + " Bet";
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc('J'); cc(9); cc(2); cc(7);
96street
@96street
Jun 30 2016 05:23
@abhishekdevinfo where do I put that?
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:24
function nextInLine(arr, item) {
  // Your code here
after this line
@charlesBak thanks
CamperBot
@camperbot
Jun 30 2016 05:24
abhishekdevinfo sends brownie points to @charlesbak :sparkles: :thumbsup: :sparkles:
:cookie: 295 | @charlesbak |http://www.freecodecamp.com/charlesbak
Magnus Holm
@mghlm
Jun 30 2016 05:26
@abhishekdevinfo ?
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:26
@m4gnusholm yes
96street
@96street
Jun 30 2016 05:27
@abhishekdevinfo i don't see that function in the code :/ ... and what does that do?
Charles Bakar
@charlesBak
Jun 30 2016 05:28
@m4gnusholm push item in the array first, then do var elmt = arr.shift(); and return elmt;
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:28
@96street the first argument of nestInLine function is arr it will work like an array becoz its input is an array
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);

  return arr.shift();  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log("Remove" + nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
@96street when u will want to remove an element from an array pop and shift will be use
pop for last
shift for first
sunny yuen
@yuens1002
Jun 30 2016 05:30
@sherdildeveloper you just need to close the code block with the three ``` at the end
96street
@96street
Jun 30 2016 05:30
thanks @abhishekdevinfo
CamperBot
@camperbot
Jun 30 2016 05:30
96street sends brownie points to @abhishekdevinfo :sparkles: :thumbsup: :sparkles:
:cookie: 207 | @abhishekdevinfo |http://www.freecodecamp.com/abhishekdevinfo
luapvu
@luapvu
Jun 30 2016 05:30
Hey guys i'm working on the seek and destroy bonfire...but am having trouble with understanding what i'm working with here
This is what the template is

function destroyer(arr) {
// Remove all the values
return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:31
@96street and for take append data push and unshift will be use push for last
unshift for first place
Justin Woodward
@jwoo92
Jun 30 2016 05:31
@yuens1002 i just used arr.sort(); to get my array least to greatest. then i filled in my array. so [1,5] would be [1,2,3,4,5]. reversed it. then take the largest number (first in array now) and divide by all other numbers in array. if it has a remainder after using %, restart from the beginning of array after adding one multiple to your largest number.
luapvu
@luapvu
Jun 30 2016 05:31
So FCC calls destroyer with 3 paramaters, but the function only takes in 1 paramater?
When FCC writes their test cases they can pass in....a multitude of paramaters...how do we account for this in our function?
Justin Woodward
@jwoo92
Jun 30 2016 05:32
@yuens1002 once all other numbers divide your largest number evenly, you have your answer.
luapvu
@luapvu
Jun 30 2016 05:32
I'm thinking we use an array as the paramater...but i'm not sure the syntax
mburakbozbey
@mburakbozbey
Jun 30 2016 05:32
i just didnt get it7
var myStr = Here is a backslash: \.\n \t \t Here is a new line with two tabs.;
luapvu
@luapvu
Jun 30 2016 05:33
@mburakbozbey theres a space after
\t and here
remove it
\tHere
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:33
@mburakbozbey remove all spaces after every escape
mburakbozbey
@mburakbozbey
Jun 30 2016 05:34
var myStr = Here is a backslash:\.\n\t\tHere is a new line with two tabs.; like this?
luapvu
@luapvu
Jun 30 2016 05:35
@mburakbozbey does it work?
mburakbozbey
@mburakbozbey
Jun 30 2016 05:36

@luapvu almost

var myStr = "Here is a backslash:\.\n\t\tHere is a new line with two tabs.";

and it says myStr should have encoded text with th proper escape sequences and spacing

what am i missin
luapvu
@luapvu
Jun 30 2016 05:36
hmm
Charles Bakar
@charlesBak
Jun 30 2016 05:36
@luapvu you need varible for the first arugment[0] and an array for the rest of your arguments expect argument[0] so you have to do slice(1)
luapvu
@luapvu
Jun 30 2016 05:37
@mburakbozbey
Charles Bakar
@charlesBak
Jun 30 2016 05:37
then for loop and a filter to return the values !== array[i]@luapvu
mburakbozbey
@mburakbozbey
Jun 30 2016 05:37
i did it just a space after blackslash: and it worked
luapvu
@luapvu
Jun 30 2016 05:37
@mburakbozbey try var myStr= "Here is a backslash: \.\n\t\tHere is a new line with two tabs.";
okay nice
mburakbozbey
@mburakbozbey
Jun 30 2016 05:37
@luapvu thanks
CamperBot
@camperbot
Jun 30 2016 05:37
mburakbozbey sends brownie points to @luapvu :sparkles: :thumbsup: :sparkles:
:cookie: 207 | @luapvu |http://www.freecodecamp.com/luapvu
luapvu
@luapvu
Jun 30 2016 05:38
@charlesBak thanks! I have the logic down but didn't have a clue how to grab the paramaters needed
CamperBot
@camperbot
Jun 30 2016 05:38
luapvu sends brownie points to @charlesbak :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @charlesbak |http://www.freecodecamp.com/charlesbak
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:38
@mburakbozbey use one more (\) to show \
Charles Bakar
@charlesBak
Jun 30 2016 05:39
@luapvu they show you how to set an array of Argument in the link they gave you
Alex Wilkerson
@alexwilkerson
Jun 30 2016 05:44
anyone know why this example on codepen won't work?
http://codepen.io/xcvfd/full/OXmVBr/
sunny yuen
@yuens1002
Jun 30 2016 05:44
@jwoo92 , VERY SMART! thank you. i think i can see how my code will work
CamperBot
@camperbot
Jun 30 2016 05:44
yuens1002 sends brownie points to @jwoo92 :sparkles: :thumbsup: :sparkles:
:cookie: 370 | @jwoo92 |http://www.freecodecamp.com/jwoo92
Alex Wilkerson
@alexwilkerson
Jun 30 2016 05:44
i have already imported the jquery library, but can't seem to pull the json file in
it works fine on the fcc page
Justin Woodward
@jwoo92
Jun 30 2016 05:45
@yuens1002 no problem :)
Oleg Uzunov
@aisforanti
Jun 30 2016 05:46
Hello all, I completed the "Reverse a String" challenge, but I am wondering if there is another way to do it with less code? Here's my code
function reverseString(str) {
  var stringSplit = str.split("");
  var stringReverse = stringSplit.reverse();
  var stringFinal = stringReverse.join("");
  return stringFinal;
}

reverseString("hello");
Jessica Mattick
@jmatty16
Jun 30 2016 05:46
can anyone help me with the escape sequences challenge? I cant seem to figure out what's wrong
Markus Kiili
@Masd925
Jun 30 2016 05:46
@aisforanti You can chain the methods on one line. No need for those variables.
Abhishek Baliyan
@abhishekdevinfo
Jun 30 2016 05:47
@jmatty16 remove all the spaces after escape seq
Eric Bezanson
@ericbezanson
Jun 30 2016 05:47
hey im on seek and destroy and im wondering what i should be using as identifiers. the function is supposed to be able to work with different ammounts of arguments so im not exactly sure what I would use in this case... heres what i have so far
function destroyer(arr) {
  // Remove all the values

  for (i=1; i < arguments.length; i++) {
    arr.filter(arguments[i]);
  }


  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Markus Kiili
@Masd925
Jun 30 2016 05:48
@ericbezanson Filter method will do the iterating through the arr. Just do return arr.filter(callbackFunction);
@ericbezanson The callback function should have one parameter, which is the err element being iterated.