These are chat archives for FreeCodeCamp/Help

7th
Nov 2017
Abdelmalek LAHMAR
@malix213
Nov 07 2017 00:20
Hi
Supra01
@Supra01
Nov 07 2017 01:52
function rot13(str) {
  var charNum = [];
  for (var i = 0; i < str.length; i++) {
    if (isNaN(str.charCodeAt(i))) {
      charNum.push(str.charCodeAt(i) - 13);
    } else {
      charNum.push(str.charCodeAt(i));
    }
  }

  var res = [];
  for (var j = 0; j < charNum.length; j++) {
    res.push(String.fromCharCode(charNum[j]));
  }
  console.log(res);
  return charNum
}


console.log(rot13("SERR PBQR PNZC"));
I'm working on the Caesars Cipher Challenge. In my If-statement the Else is tripping but my if-condition is not working. Can someone help give some insight as to why that is happening? Thank you.
Alexander Køpke
@alexanderkopke
Nov 07 2017 02:10
@heroiczero @thekholm80 @DarrenfJ @daddycardona @longnt80 @khaduch @GitHub-Henry @sjames1958gm @Marmiz ty @Manish-Giri @longnt80 @sjames1958gm @Marmiz @korzo
CamperBot
@camperbot
Nov 07 2017 02:10
:star2: 1584 | @thekholm80 |http://www.freecodecamp.com/thekholm80
alexanderkopke sends brownie points to @heroiczero and @thekholm80 and @darrenfj and @daddycardona and @longnt80 and @khaduch and @github-henry and @sjames1958gm and @marmiz and @manish-giri and @korzo :sparkles: :thumbsup: :sparkles:
:star2: 2029 | @heroiczero |http://www.freecodecamp.com/heroiczero
:cookie: 476 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 2258 | @darrenfj |http://www.freecodecamp.com/darrenfj
:cookie: 751 | @korzo |http://www.freecodecamp.com/korzo
:cookie: 477 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 3473 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1091 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 8674 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 6780 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 660 | @longnt80 |http://www.freecodecamp.com/longnt80
Stephen James
@sjames1958gm
Nov 07 2017 02:26
@Supra01 why would you think charCodeAt would ever return NaN
You should compare the char code to the codes for A-M and N-Z
Supra01
@Supra01
Nov 07 2017 02:31
Thank you @sjames1958gm ! I mixed those two up. I'll get back to it.
CamperBot
@camperbot
Nov 07 2017 02:31
supra01 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8675 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Albert Cardona II
@daddycardona
Nov 07 2017 03:07
@khaduch I am not getting an error message just not able to install it or some strange reason sorry about not getting back until now fell asleep
I figured it out
Ken Haduch
@khaduch
Nov 07 2017 03:23
@daddycardona - okay - I understand the falling asleep part. :) Good that you figured it out!
Albert Cardona II
@daddycardona
Nov 07 2017 03:25
yeah most sites actually automatically set it up to download according to your OS not this one I kept downloading it for redhat boy do I feel dumb lmao @khaduch
Claudio Restifo
@Marmiz
Nov 07 2017 03:40
@longnt80 this is great news!! Congrats :sparkles: :+1: :fire:
If I may what role did you end up getting? I remember you interviewed with multiple companies :)
Long Nguyen
@longnt80
Nov 07 2017 03:44
@Marmiz thanks
it is front end dev for react
CamperBot
@camperbot
Nov 07 2017 03:44
longnt80 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1092 | @marmiz |http://www.freecodecamp.com/marmiz
Long Nguyen
@longnt80
Nov 07 2017 03:44
which is what I like
also this is a small team
I don't want to work in a big agency for now
Albert Cardona II
@daddycardona
Nov 07 2017 03:48
nice :)
Claudio Restifo
@Marmiz
Nov 07 2017 03:48
@longnt80 makes sense.
Have fun Reacting around :smile:
Long Nguyen
@longnt80
Nov 07 2017 03:49
@daddycardona @Marmiz thank you guys
anh thanks to everyone in this community again :+1:
CamperBot
@camperbot
Nov 07 2017 03:49
longnt80 sends brownie points to @daddycardona and @marmiz :sparkles: :thumbsup: :sparkles:
api offline
:cookie: 477 | @daddycardona |http://www.freecodecamp.com/daddycardona
Ravi Kishore Thella
@ravikishorethella
Nov 07 2017 07:45
@longnt80 congrats man :clap:
Long Nguyen
@longnt80
Nov 07 2017 08:32
@ravikishorethella thank you :fire:
CamperBot
@camperbot
Nov 07 2017 08:32
longnt80 sends brownie points to @ravikishorethella :sparkles: :thumbsup: :sparkles:
:star2: 1055 | @ravikishorethella |http://www.freecodecamp.com/ravikishorethella
Henry
@GitHub-Henry
Nov 07 2017 09:21
@longnt80 congrats :boom: :sparkles: :+1:
Long Nguyen
@longnt80
Nov 07 2017 09:43
@GitHub-Henry thanks
CamperBot
@camperbot
Nov 07 2017 09:43
longnt80 sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 478 | @github-henry |http://www.freecodecamp.com/github-henry
Bob Guo
@boblao0714
Nov 07 2017 10:54
How to solve this:Use Responsive Design with Bootstrap Fluid Containers
heroiczero
@heroiczero
Nov 07 2017 11:57
@longnt80 congratz on your job :+1:
@thekholm80 @DarrenfJ @daddycardona @longnt80 @khaduch @GitHub-Henry @sjames1958gm @Marmiz @Manish-Giri @longnt80 @sjames1958gm @Marmiz @korzo @alexanderkopke TY to the regulars
CamperBot
@camperbot
Nov 07 2017 11:58
heroiczero sends brownie points to @thekholm80 and @darrenfj and @daddycardona and @longnt80 and @khaduch and @github-henry and @sjames1958gm and @marmiz and @manish-giri and @korzo and @alexanderkopke :sparkles: :thumbsup: :sparkles:
:cookie: 478 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 661 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 8678 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1585 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 1093 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 6781 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 3476 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 752 | @korzo |http://www.freecodecamp.com/korzo
:star2: 1722 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:star2: 2259 | @darrenfj |http://www.freecodecamp.com/darrenfj
:cookie: 479 | @github-henry |http://www.freecodecamp.com/github-henry
Aita Kane
@aita-kane
Nov 07 2017 12:30
hello guys i'm having a problem with my code when i add a new section it appears behind the first while i want it to be after the first . Can someone help me please here is the pen : https://codepen.io/akane96/pen/VrKzVp
Ken Haduch
@khaduch
Nov 07 2017 12:50
@aita-kane - when you use absolute positioning, it breaks the normal flow of the element placement. That is the main source of your problem with this.
mstellaluna
@mstellaluna
Nov 07 2017 12:56
@heroiczero :point_up: Hello, I gave you a warning yesterday about the cookie spamming. November 6, 2017 7:53 AM. Please read our code of conduct at https://code-of-conduct.freecodecamp.org/. Please consider this as your 2nd warning.
Nnenanya Chinedu
@Manpee
Nov 07 2017 15:12
Hello house, I am trying to use the string concatenation operator + to build a string, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb. and this is what I have but not passing Test; var result = " I saw a " + "dog" + " chasing a " + "big" + " rat, and they " + "ran" + " across the road " + "quickly.";
Pls who can assist me here?
Nnenanya Chinedu
@Manpee
Nov 07 2017 15:21
Any one here to help me pls?
Kelechi Chinaka
@ke1echi
Nov 07 2017 15:37
pls format your code properly @Manpee
Nnenanya Chinedu
@Manpee
Nov 07 2017 15:39
@kelechy pls how do I format it. Could you be more specific. Thanks.
CamperBot
@camperbot
Nov 07 2017 15:39
manpee sends brownie points to @kelechy :sparkles: :thumbsup: :sparkles:
:cookie: 320 | @kelechy |http://www.freecodecamp.com/kelechy
Kelechi Chinaka
@ke1echi
Nov 07 2017 15:41
insert your code between ```
your need to use the variables and seperated them with spaces @Manpee
Nnenanya Chinedu
@Manpee
Nov 07 2017 15:45
@kelechy that is what I did. I separated them with spaces.
Kelechi Chinaka
@ke1echi
Nov 07 2017 15:46
no you did not... i meant
var a + ' ' + var b
Daniel
@dkapexhiu
Nov 07 2017 16:03
someone can explain me this code?

$(document).ready(function(){
// Add smooth scrolling to all links in navbar + footer link
$(".navbar a, footer a[href='#myPage']").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== ""){
// Prevent default anchor click behavior
event.preventDefault();

  // Store hash
  var hash = this.hash;

  // Using jQuery's animate() method to add smooth page scroll
  // The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
  $('html, body').animate({
    scrollTop: $(hash).offset().top
  }, 900, function(){

    // Add hash (#) to URL when done scrolling (default click behavior)
    window.location.hash = hash;
  });
} // End if

});
})

it doesn't function in my page
Albert Cardona II
@daddycardona
Nov 07 2017 16:11
$(document).ready(function(){
  // Add smooth scrolling to all links in navbar + footer link
  $(".navbar a, footer a[href='#myPage']").on('click', function(event) {
    // Make sure this.hash has a value before overriding default behavior
    if (this.hash !== ""){
      // Prevent default anchor click behavior
      event.preventDefault();

      // Store hash
      var hash = this.hash;

      // Using jQuery's animate() method to add smooth page scroll
      // The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
      $('html, body').animate({
        scrollTop: $(hash).offset().top
      }, 900, function(){

        // Add hash (#) to URL when done scrolling (default click behavior)
        window.location.hash = hash;
      });
    } // End if
  });
})
what is not working @dkapexhiu
you can use ('#myPage').on('click' etc..
and since you did not define or pass in a parameter hash how are you going to do this.hash where does this.hash come from
Marc
@MWBauer
Nov 07 2017 16:19
I'm gonna make you laugh. It's been so long since I did the card counting challenge that I've forgotten how. lol
Albert Cardona II
@daddycardona
Nov 07 2017 16:19
@Manpee in order for your code to work if you want myNoun to work like how you are saying you need to do something like
var myNoun = 'dog';
var myVerb = 'ran';

var combinedString = "Yesterday my "+ myNound +" got hit by a car because he " + myVerb+" into the street";
Daniel
@dkapexhiu
Nov 07 2017 16:23
when i click to the links in navbar it does nothing .. @daddycardona
Albert Cardona II
@daddycardona
Nov 07 2017 16:24
yeah because you're not defining what you mean by hash
also I don't know why you have all those in your function call `(navbar , a
Marc
@MWBauer
Nov 07 2017 16:25
And I'm gonna' make you laugh more. I had most of it worked out, then checked the help and I made a couple of adjustments and now it reads the same way but doesn't work.
Albert Cardona II
@daddycardona
Nov 07 2017 16:25
if you are trying to say you want all your calls by clicking them to your button or href links you might need to say something else lol
Marc
@MWBauer
Nov 07 2017 16:27
Got it.
Albert Cardona II
@daddycardona
Nov 07 2017 16:29
@MWBauer I know how you feel about forgetting stuff especially when they just keep throwing new stuff at you so you have to do it with react or whatever new programming stuff you understand
$(document).on("click", "a", function() {

        //console.log($(this).attr('href'));
        if ($(this).attr('href') !== '#top') {
            $("html, body").animate({
                    scrollTop: $($.attr(this, "href")).offset().top - 60
                },
                1250
            );
        } else {
            $("html, body").animate({
                    scrollTop: 0
                },
                1250
            );
        }
        $('[data-toggle=tab]').click(function() {
            if ($(this).parent().hasClass('active')) {
                $($(this).attr("href")).toggleClass('active');
            }
        });
    });
@dkapexhiu this might be what you want to do vs what you are doing
Daniel
@dkapexhiu
Nov 07 2017 16:38
@daddycardona thanks, it works but the scrolling isnt smooth
CamperBot
@camperbot
Nov 07 2017 16:38
dkapexhiu sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 479 | @daddycardona |http://www.freecodecamp.com/daddycardona
Albert Cardona II
@daddycardona
Nov 07 2017 16:39
it should be smooth you can take out the data-toggle- that whole section was just for something else on my site ;)
@dkapexhiu
zootechdrum
@zootechdrum
Nov 07 2017 16:52
@rscales02 YES THANKS MAN
CamperBot
@camperbot
Nov 07 2017 16:52
zootechdrum sends brownie points to @rscales02 :sparkles: :thumbsup: :sparkles:
:cookie: 315 | @rscales02 |http://www.freecodecamp.com/rscales02
Daniel
@dkapexhiu
Nov 07 2017 16:52
thank you very much @daddycardona it was a jquery problem
CamperBot
@camperbot
Nov 07 2017 16:52
dkapexhiu sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
api offline
Albert Cardona II
@daddycardona
Nov 07 2017 16:53
:)
zootechdrum
@zootechdrum
Nov 07 2017 16:54
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' && value!==''){
  collection[id][prop]=value;
}else if (prop == "tracks" && value == "" || prop == "artist" && value == "") {
  delete collection[id][prop];
}else {
  collection[id][prop].push(value); 
}


return(collection);

}

i CANT SEET TO GET THIS ONE TO PASS 'After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element.'

ANYONE KNOW Y? I am assuming its because the specific id{5249) does not have a key named tracks

Moisés Man
@moigithub
Nov 07 2017 16:59
u r right.. cuz 5249 dont have tracks property.. u need to check if that exist before push data to it...
if not u need to create it as array so u can use push @zootechdrum
zootechdrum
@zootechdrum
Nov 07 2017 17:04
@moigithub Ahh okay i know am halfway there now.
Albert Cardona II
@daddycardona
Nov 07 2017 17:04
what @moigithub said
@zootechdrum I did the same thing twice and just finished it lol
Moisés Man
@moigithub
Nov 07 2017 17:05
@zootechdrum u can use a nested if condition
and hasOwnProperty method to check if the "tracks" property exist
zootechdrum
@zootechdrum
Nov 07 2017 17:20
var collectionCopy = JSON.parse(JSON.stringify(collection));

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

   }




console.log(collection);

}
Tried this and didnt work. I will try to experiment with the nested if condition
Moisés Man
@moigithub
Nov 07 2017 17:22
check HOW u using collection on ur other codelines..
how u will refer to [5439]
cuz "tracks" property dont belong to collection itself..but to a "sub" object inside @zootechdrum
zootechdrum
@zootechdrum
Nov 07 2017 17:26
@moigithub I think i understand know your the man
Albert Cardona II
@daddycardona
Nov 07 2017 17:26
you can try if(!collection.hasOwnProperty("tracks"))
the exclamation point means does not have so instead of checking ture or false you're checking if it doesn't exist
Abdelmalek LAHMAR
@malix213
Nov 07 2017 17:48
hi
I want to aline a div "join me" to the bottom of parent div using bootstrap class i search but i didn't find solution .
Albert Cardona II
@daddycardona
Nov 07 2017 19:15
you should use css then @malix213
also you don't have a div join me
Abdelmalek LAHMAR
@malix213
Nov 07 2017 19:35
I mean social media doc
Div*
Anthony DeSordi
@desordi3
Nov 07 2017 19:36
function power(base, exponent) {
  if (exponent == 0) {
      return 1;
  } else {
      return base * power(base, exponent - 1);
  } 
 }

console.log(power(2, 3));
learning recursion from reading eloquent JS, i understand the fact that you’re reusing the function within the same function, i just dont understand the return base * power(base, exponent -1); part. What exactly are you multiplying the base by here?
Garrus Napp
@GarrusNapp
Nov 07 2017 19:40
@desordi3 by power(base, exponent - 1) which is calling the same function, but with exponent lowered by one
console.log(power(2, 3)); base is 2, and exponent 3
so it calls power(2, 2);
Anthony DeSordi
@desordi3
Nov 07 2017 19:43
oh jesus i think it finally clicked for me
so basically the program is thinking to itself “okay, if the exponent is anything but zero, im going to mulitply the base by the amount of times I have to run (power(base, exponent -1); until the exponent is subtracted to zero, then the program is done and I simply multiply 2 2 2
or more simply put, in the statement {return base * power (base, exponent - 1) , base is being multiplied by the amount of times it has to count down until the exponent is 0
Garrus Napp
@GarrusNapp
Nov 07 2017 19:47
@desordi3 yea, more or less
base is being multiplied by whatever the "power(....)" will return
Anthony DeSordi
@desordi3
Nov 07 2017 19:48
let me just make sure i understand it 100%
Garrus Napp
@GarrusNapp
Nov 07 2017 19:48
it will become more clear
Anthony DeSordi
@desordi3
Nov 07 2017 19:50
wow this is a great tool
thank you!
@GarrusNapp thanks
CamperBot
@camperbot
Nov 07 2017 19:50
desordi3 sends brownie points to @garrusnapp :sparkles: :thumbsup: :sparkles:
:cookie: 850 | @garrusnapp |http://www.freecodecamp.com/garrusnapp
Anthony DeSordi
@desordi3
Nov 07 2017 19:50
my biggest problem was, I was looking for base to be multiplied by a number
not necessarily the amount of times the function calls itself through the conditional statement
Garrus Napp
@GarrusNapp
Nov 07 2017 19:51
it is by a number
but the number is unknown, until the last function return 1
Anthony DeSordi
@desordi3
Nov 07 2017 19:52
and that number is the amount of times the function calls itself?
and we find that out once it returns 1 correct
Garrus Napp
@GarrusNapp
Nov 07 2017 19:52
Yes
I suggest you write a function for factorial now
This is similar principle
Anthony DeSordi
@desordi3
Nov 07 2017 19:56
will do
Darren
@DarrenfJ
Nov 07 2017 19:57
afternoon fCC
popping in to say hi and thanks to the regulars who help out
thanks @heroiczero @thekholm80 @daddycardona @longnt80 @khaduch @GitHub-Henry @sjames1958gm @Marmiz @Manish-Giri @sjames1958gm @korzo @alexanderkopke
CamperBot
@camperbot
Nov 07 2017 20:00
darrenfj sends brownie points to @heroiczero and @thekholm80 and @daddycardona and @longnt80 and @khaduch and @github-henry and @sjames1958gm and @marmiz and @manish-giri and @korzo and @alexanderkopke :sparkles: :thumbsup: :sparkles:
:star2: 1586 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:cookie: 662 | @longnt80 |http://www.freecodecamp.com/longnt80
:cookie: 480 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 2031 | @heroiczero |http://www.freecodecamp.com/heroiczero
:cookie: 753 | @korzo |http://www.freecodecamp.com/korzo
:star2: 1094 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 3477 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 480 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 8679 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1723 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:star2: 6782 | @manish-giri |http://www.freecodecamp.com/manish-giri
Darren
@DarrenfJ
Nov 07 2017 20:00
I'm sure I'm missing some of the new people who help out as well... but kudos everyone
Lauri Välja
@OFFLlNE
Nov 07 2017 21:56
:+1: @DarrenfJ Nice to see you thanking peeps for their hard work :)
@diomed you alive?