These are chat archives for FreeCodeCamp/HelpJavaScript

3rd
Jun 2017
Joseph Henshaw
@Big-jo
Jun 03 2017 00:03 UTC
@camperbot please can you write a snippet for me?
MrChizzy
@MrChizzy
Jun 03 2017 00:03 UTC
Can someone help me with newline backslashes and carriage-return backslashes please?
Matthew Greene
@mattkgreene
Jun 03 2017 00:04 UTC
@sjames1958gm hmm alright gunna give it a shot , thanks
CamperBot
@camperbot
Jun 03 2017 00:04 UTC
mattkgreene sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7596 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jun 03 2017 00:04 UTC
@mattkgreene :+1:
Joseph Henshaw
@Big-jo
Jun 03 2017 00:04 UTC
@moigithub please can you write a snippet for me?
can some one please expalin the counting cards challenge
Jose Alejandro Becerra
@JoseeAlejandro
Jun 03 2017 00:07 UTC
HELP!!
Joseph Henshaw
@Big-jo
Jun 03 2017 00:08 UTC
@JoseeAlejandro with what?
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:08 UTC
Hello
BrunoM24
@BrunoM24
Jun 03 2017 00:09 UTC
hello
MrChizzy
@MrChizzy
Jun 03 2017 00:09 UTC
I need help with escape sequences
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:09 UTC
I was wondering if anyone could help me with this algorithm problem, I have to return the largest numbers in array. I wrote the code blow and was wondering what is wrong with it.
function largestOfFour(arr) {
  // You can do this!
  var largestNumber = [0, 0, 0, 0];
  for (var indexVal = 0; indexVal < arr.length; indexVal++) {
    for (var subIndexVal = 0; subIndexVal < arr[indexVal].length; subIndexVal++) {
      if (arr[indexVal][subIndexVal] > largestNumber[subIndexVal]) {
        largestNumber[subIndexVal] = arr[indexVal][subIndexVal];
      }
    }
  }
  return largestNumber;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Joseph Henshaw
@Big-jo
Jun 03 2017 00:11 UTC
@JoseeAlejandro you are ahead of me, can you help me with the counting cards challenge
mikesyoon
@mikesyoon
Jun 03 2017 00:11 UTC
could someone help with java escape sequences
BrunoM24
@BrunoM24
Jun 03 2017 00:11 UTC
@Andrewngabriel your variable largestNumber
it should be a number not a array
Jose Alejandro Becerra
@JoseeAlejandro
Jun 03 2017 00:11 UTC
@Big-jo what is that??
mikesyoon
@mikesyoon
Jun 03 2017 00:12 UTC
'''var myStr = "FirstLine\nSecondLine\nThirdLine"; // Change this line
CamperBot
@camperbot
Jun 03 2017 00:12 UTC
:bulb: to format code use backticks! ``` more info
mikesyoon
@mikesyoon
Jun 03 2017 00:12 UTC
```
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:12 UTC
@BrunoM24 But the challenge mentions that the result should return an array
mikesyoon
@mikesyoon
Jun 03 2017 00:12 UTC
var myStr = "FirstLine\nSecondLine\nThirdLine"; // Change this line
BrunoM24
@BrunoM24
Jun 03 2017 00:12 UTC
@Andrewngabriel you should compare each number of each subArray with a number
Joseph Henshaw
@Big-jo
Jun 03 2017 00:12 UTC
@JoseeAlejandro never mind
BrunoM24
@BrunoM24
Jun 03 2017 00:12 UTC
@Andrewngabriel yes but you need to campare the number, and them create the array
mikesyoon
@mikesyoon
Jun 03 2017 00:13 UTC
need to produce
FirstLine
\SecondLine\
ThirdLine
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:13 UTC
@BrunoM24 Hmmmm, ok I will give that a try. Thanks
CamperBot
@camperbot
Jun 03 2017 00:13 UTC
andrewngabriel sends brownie points to @brunom24 :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @brunom24 |http://www.freecodecamp.com/brunom24
BrunoM24
@BrunoM24
Jun 03 2017 00:13 UTC
@Andrewngabriel ok, good luck, say something after
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:14 UTC
Will do @BrunoM24
I just figured out the problem
Dovydas Stirpeika
@Giveback007
Jun 03 2017 00:16 UTC
how to set a cool down on all click events after clicking one
BrunoM24
@BrunoM24
Jun 03 2017 00:16 UTC
@Andrewngabriel nice
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:16 UTC
Here is the correction

function largestOfFour(arr) {
  // You can do this!
  var largestNumber = [0, 0, 0, 0];
  for (var indexVal = 0; indexVal < arr.length; indexVal++) {
    for (var subIndexVal = 0; subIndexVal < arr[indexVal].length; subIndexVal++) {
      if (arr[indexVal][subIndexVal] > largestNumber[indexVal]) {
        largestNumber[indexVal] = arr[indexVal][subIndexVal];
      }
    }
  }
  return largestNumber;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
largestNumber should be checked using indexVal to target the index value
I was using subIndexValue
The iteration of indexVal is 4 however the iteration of subIndexVal is also 4 which doubles the evaluation when it comes to comparing the arr to largestNumber
however by using indexVal, we are only checking 4 times which is the array size we have to return
This one was a bit tricky, I spent about 6 - 8 hours thinking about it
Derek
@Dmdrapp
Jun 03 2017 00:22 UTC
How do I apply celcius code to fahrenheit?
I wrote the following code...
haris8
@haris8
Jun 03 2017 00:22 UTC
Hello, I need help with the Check for Palindromes
Derek
@Dmdrapp
Jun 03 2017 00:23 UTC
var fahrenheit = celcius * (9 / 5) + 32;
I know it's wrong, but I don't know what is causing it to be wrong... lol
Joseph Henshaw
@Big-jo
Jun 03 2017 00:23 UTC
@Dmdrapp celcius *((9/5) + 32)
haris8
@haris8
Jun 03 2017 00:23 UTC
This is my code:

function palindrome(str) {
// Good luck!
var str1 = str.replace(/[\W\s_]+/gi, "");
str1.toLowerCase();
var str2 = str1.split('').reverse().join('');

if (str2.localeCompare(str1) === 0)
return true;
else
return false;
}

palindrome("A man, a plan, a canal. Panama");

Joseph Henshaw
@Big-jo
Jun 03 2017 00:24 UTC
@Dmdrapp it's called precedence, like you have order of operations in maths
Derek
@Dmdrapp
Jun 03 2017 00:24 UTC
Thanks you @haris8! Does that mean that fahrenheit is correct?
CamperBot
@camperbot
Jun 03 2017 00:24 UTC
dmdrapp sends brownie points to @haris8 :sparkles: :thumbsup: :sparkles:
:cookie: 240 | @haris8 |http://www.freecodecamp.com/haris8
Derek
@Dmdrapp
Jun 03 2017 00:24 UTC
I see. That makes sense
Joseph Henshaw
@Big-jo
Jun 03 2017 00:24 UTC
@Dmdrapp you're welcome
haris8
@haris8
Jun 03 2017 00:25 UTC
You sent the brownie point to the wrong person @Dmdrapp
Derek
@Dmdrapp
Jun 03 2017 00:25 UTC
I didn't know that I sent any 0_0
Thank you @Big-jo
CamperBot
@camperbot
Jun 03 2017 00:26 UTC
dmdrapp sends brownie points to @big-jo :sparkles: :thumbsup: :sparkles:
:cookie: 207 | @big-jo |http://www.freecodecamp.com/big-jo
haris8
@haris8
Jun 03 2017 00:26 UTC
I'm not sure how it works, I don't even know what they are
Derek
@Dmdrapp
Jun 03 2017 00:26 UTC
Haha. You and me both
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:26 UTC
They are virtual brownies :D
haris8
@haris8
Jun 03 2017 00:26 UTC
How do you send or is it automatic?
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:27 UTC
I think every time you say "thank you" it triggers it and send points to the person you are @
Thank you @haris8
CamperBot
@camperbot
Jun 03 2017 00:27 UTC
andrewngabriel sends brownie points to @haris8 :sparkles: :thumbsup: :sparkles:
:cookie: 241 | @haris8 |http://www.freecodecamp.com/haris8
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:27 UTC
you see?
haris8
@haris8
Jun 03 2017 00:27 UTC
Ah ok, thank you @Andrewngabriel
CamperBot
@camperbot
Jun 03 2017 00:27 UTC
haris8 sends brownie points to @andrewngabriel :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @andrewngabriel |http://www.freecodecamp.com/andrewngabriel
Andrew Gabriel
@Andrewngabriel
Jun 03 2017 00:27 UTC
:D
Derek
@Dmdrapp
Jun 03 2017 00:28 UTC
Haha! Brownie points around!
Joseph Henshaw
@Big-jo
Jun 03 2017 00:28 UTC
@Dmdrapp thanks
Derek
@Dmdrapp
Jun 03 2017 00:28 UTC
Screen Shot 2017-06-02 at 7.27.37 PM.png
This is the code I'm using... It still isn't working for some reason.
Joseph Henshaw
@Big-jo
Jun 03 2017 00:29 UTC
fahrenheit = your stuff @Dmdrapp
fahrenheit = celcius *((9/5)+32);
@Dmdrapp
Derek
@Dmdrapp
Jun 03 2017 00:30 UTC
Okay! So I have too many spaces in between?
Stephen James
@sjames1958gm
Jun 03 2017 00:31 UTC
@Dmdrapp You mispelled the parameter and you aren't assigning it and you have wrong parenthesis.
fahrenheit = celsius * 9/5 + 32;
Joseph Henshaw
@Big-jo
Jun 03 2017 00:31 UTC
@Dmdrapp no , you didnt set your fahrenheit variable to your celcius stuff
Derek
@Dmdrapp
Jun 03 2017 00:31 UTC
Ah.. Thanks @Big-jo and @sjames1958gm
CamperBot
@camperbot
Jun 03 2017 00:31 UTC
dmdrapp sends brownie points to @big-jo and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: dmdrapp already gave big-jo points
:star2: 7597 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jun 03 2017 00:32 UTC
celsius *((9/5)+32); this is wrong because it does 9/5 + 32 then multiplies by celsius
Derek
@Dmdrapp
Jun 03 2017 00:32 UTC
I figured it out :D I didn't realize the spelling.
Thanks for helping me with the mix up...
I really appreciate this team!
Stephen James
@sjames1958gm
Jun 03 2017 00:33 UTC
@Dmdrapp :+1:
haris8
@haris8
Jun 03 2017 00:33 UTC
Can someone help me with the check for Palindromes?

function palindrome(str) {
// Good luck!
var str1 = str.replace(/[\W\s_]+/gi, "");
str1.toLowerCase();
var str2 = str1.split('').reverse().join('');

if (str2.localeCompare(str1) === 0)
return true;
else
return false;
}
palindrome("A man, a plan, a canal. Panama");

It's supposed to return true for this string
And this as well "My age is 0, 0 si ega ym."
Stephen James
@sjames1958gm
Jun 03 2017 00:35 UTC
@haris8 str1.toLowerCase(); this doesn't have any effect without assigning
SAIDI YASSINE
@Nero00
Jun 03 2017 00:35 UTC
can any one help me with logic please
my button didn't work
haris8
@haris8
Jun 03 2017 00:36 UTC
ok @sjames1958gm. I'll try correcting that and see if it fixes the issue. Thank you
CamperBot
@camperbot
Jun 03 2017 00:36 UTC
haris8 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7598 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jun 03 2017 00:37 UTC
@Nero00 Floor this should be floor
mattr12
@mattr12
Jun 03 2017 00:37 UTC
I am stuck on "Stand in Line"
Has anyone here completed that challenge?
Stephen James
@sjames1958gm
Jun 03 2017 00:37 UTC
@mattr12 What do you have
SAIDI YASSINE
@Nero00
Jun 03 2017 00:38 UTC
@sjames1958gm thank you that makes me crazy ;v
CamperBot
@camperbot
Jun 03 2017 00:38 UTC
nero00 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7599 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jun 03 2017 00:39 UTC
@Nero00 :+1:
@Nero00 I opened the developer console and saw and error saying Floor was not a function
mattr12
@mattr12
Jun 03 2017 00:39 UTC
we're supposed to create a function that takes two arguments, an array arr and an item, the function is then supposed to add the item to the end of the array and remove the first element of the array--then return the element that was removed
SAIDI YASSINE
@Nero00
Jun 03 2017 00:40 UTC
@sjames1958gm idk i dont get that error in main :/
haris8
@haris8
Jun 03 2017 00:40 UTC
Thanks @sjames1958gm . I can finally move forward
CamperBot
@camperbot
Jun 03 2017 00:40 UTC
haris8 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: haris8 already gave sjames1958gm points
mattr12
@mattr12
Jun 03 2017 00:40 UTC
I used arr.push(item) to add the item to the end of the array, and arr.shift to remove the first element--but I am not sure how to return the element that was removed
Joseph Henshaw
@Big-jo
Jun 03 2017 00:41 UTC
@mattr12 lemme see your code
SAIDI YASSINE
@Nero00
Jun 03 2017 00:42 UTC
@sjames1958gm what you mean with the developer console ?
mattr12
@mattr12
Jun 03 2017 00:42 UTC

@Big-jo `
function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();

return item; // Change this line
} `

Joseph Henshaw
@Big-jo
Jun 03 2017 00:42 UTC
assign item to arr.shift()
mattr12
@mattr12
Jun 03 2017 00:43 UTC
Doesn't arr.shift() just remove the first element?
Joseph Henshaw
@Big-jo
Jun 03 2017 00:44 UTC
@mattr12 yh but the arr.push(item) adds a number, so the number behind the one being pushed takes it's space
Stephen James
@sjames1958gm
Jun 03 2017 00:44 UTC
@mattr12 Yes, but if you don't capture the return then it is just lost
Cuong Nguyen
@cuong-nguyen
Jun 03 2017 00:45 UTC
I don't know what the problem is with my "steamrollArray" problem
pass all the sample tests but does not solve it?
Stephen James
@sjames1958gm
Jun 03 2017 00:45 UTC
@Nero00 On chrome in windows you can use F12 to get to the console.
There are several videos later in the MAP that talk about the console
@cuong-nguyen Make sure you are not using any globals
Cuong Nguyen
@cuong-nguyen
Jun 03 2017 00:46 UTC
oh :(
Stephen James
@sjames1958gm
Jun 03 2017 00:46 UTC
@mattr12 arr.shift(); this (without assignment) loses the shifted value
Cuong Nguyen
@cuong-nguyen
Jun 03 2017 00:46 UTC
Thanks @sjames1958gm
CamperBot
@camperbot
Jun 03 2017 00:46 UTC
cuong-nguyen sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7600 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
mattr12
@mattr12
Jun 03 2017 00:46 UTC
I see, so arr.shift(item) stores the shifted element into item?
Stephen James
@sjames1958gm
Jun 03 2017 00:46 UTC
@cuong-nguyen :+1:
@mattr12 No. arr.shift() returns a value. so you need something like item = arr.shift();
mattr12
@mattr12
Jun 03 2017 00:48 UTC
ahh, I did not know that... @sjames1958gm and @Big-jo
thanks guys
Stephen James
@sjames1958gm
Jun 03 2017 00:48 UTC
@mattr12 :+1:
Joseph Henshaw
@Big-jo
Jun 03 2017 00:48 UTC
@mattr12 :+1:
jude obi
@lighthous
Jun 03 2017 00:50 UTC

hello guys, i've been stuck for two weeks on conditional logic with if statement, i need help asap.here is my code snippet.
// Example
function ourTrueOrFalse(isItTrue) {
if (isItTrue) {
return "Yes, it's true";
}
return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {

// Only change code below this line.
if(wasThatTrue) {
return "yes, that was true";
}
return "no, that was false";

// Only change code above this line.

}

// Change this value to test
trueOrFalse(true);

Stephen James
@sjames1958gm
Jun 03 2017 00:50 UTC
@lighthous Make sure the case of the strings is correct, possibly "Yes, that was true"?
AJ Brommy
@AJ-Brommy
Jun 03 2017 00:53 UTC
@AhmedChaibi Did you resolve the issue in the end??
@lighthous Capital letter start a sentence ;) is another clue to aid @sjames1958gm 's point
Joshua
@jfc246
Jun 03 2017 00:56 UTC

can anyone give me their thoughts on this?

https://codepen.io/jfc246/pen/rrRNgp

if anyone would like help email at the address
AJ Brommy
@AJ-Brommy
Jun 03 2017 01:01 UTC
So far so good, keep going, that's my thoughts :) :P :)
Joshua
@jfc246
Jun 03 2017 01:01 UTC
@AJ-Brommy is there any suggestions?
Derek
@Dmdrapp
Jun 03 2017 01:04 UTC
Does this look right?
var myStr = "First Line\n\Second Line\\rThird Lin
e"
Nevermind! I see it.
Joshua
@jfc246
Jun 03 2017 01:04 UTC
ok i was just about to tell you!!
Joseph Henshaw
@Big-jo
Jun 03 2017 01:04 UTC
@Dmdrapp please can you explain i skipped it
survenant
@survenant
Jun 03 2017 01:05 UTC
@Dmdrapp I just finished that one! we're in the same place. code on :)
Derek
@Dmdrapp
Jun 03 2017 01:05 UTC
I need to double check my typing...
Wait... It is showing the double backslash
survenant
@survenant
Jun 03 2017 01:06 UTC
I stared at the following challenge for awhile and realized it wasn't working because I was missing a word. hah.
AJ Brommy
@AJ-Brommy
Jun 03 2017 01:06 UTC
Get a finished page, then ask? It seems odd to me that you would be asking at this stage. It's your page, you are supposed to be the artist. Lay it how you want? Sure if you want to achieve something you are unsure how to achieve, then ask for help. So, my thoughts are, it looks ok with what you have done so far. Complete the mission. It's not for us to tell you how to build "your" page!
@jfc246
Joshua
@jfc246
Jun 03 2017 01:07 UTC
@AJ-Brommy ok
Derek
@Dmdrapp
Jun 03 2017 01:08 UTC
There had to be no spacing whatsoever? Haha
Joseph Henshaw
@Big-jo
Jun 03 2017 01:08 UTC

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

  // Only change code below this line
 lookup ={
   "alpha":"Adams",
   "bravo":"boston",
   "charlie":"Chicago",
   "delta":"denver",
   "echo":"Essay",
   "foxtrot":"Frank"
 };


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

// Change this value to test
phoneticLookup("charlie");
what else after this i dont understand the "use it to look-up val"
oh i figured it out
sinsukh
@sinsukh
Jun 03 2017 01:20 UTC
Screen Shot 2017-06-02 at 9.17.11 PM.png
Hi, any help with this?
AJ Brommy
@AJ-Brommy
Jun 03 2017 01:22 UTC
I did it slightly differently but i think we have the same problem lol
You can't determine that a contact doesn't exist until it has looped through the whole array ;)
Manish Giri
@Manish-Giri
Jun 03 2017 01:23 UTC
@sinsukh you also need to "return" stuff
logging to console won't do anything
Jonathan Tuer
@N3M3SIS20
Jun 03 2017 01:23 UTC
hello everyone
AJ Brommy
@AJ-Brommy
Jun 03 2017 01:29 UTC
@sinsukh I also don't think contacts[i].prop will work, there was a challenge showing how to test if a property exists using .hasOwnProperty() which returns true or false ;)
frederickalcantara
@frederickalcantara
Jun 03 2017 01:30 UTC
who knows apis, ajax, and json stuff?
i needs help
Jonathan Tuer
@N3M3SIS20
Jun 03 2017 01:31 UTC
i MIGHT be able to assist
AJ Brommy
@AJ-Brommy
Jun 03 2017 01:31 UTC
sorry @frederickalcantara you have passed me :(
frederickalcantara
@frederickalcantara
Jun 03 2017 01:32 UTC
I want to know how come certain details on specific characters arent showing up?
To be specific, characters bran stark, jon snow, and arya stark are not showing their seasons and played by indexes
aRtoo
@artoodeeto
Jun 03 2017 01:35 UTC
hey guys need help. this is from the challenge seek and destroy.
function destroyer(arr) {

        var arrArg = [];

        for(var i=1; i<arguments.length; i++){
          arrArg.push(arguments[i]);
        }

   return arr.filter(function eliminate(val){

            for(var c=0; c<arrArg.length; c++){   

                return arr.indexOf(arrArg[c]) !== -1;

            } 

   });
}

//destroyer([1, 2, 3, 1, 2, 3], 2, 3); //should return [1, 1].
//destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3); //should return [1, 5, 1].
destroyer([3, 5, 1, 2, 2], 2, 3, 5); //should return [1].
Manish Giri
@Manish-Giri
Jun 03 2017 01:36 UTC
@artoodeeto why do you have a for loop in function eliminate
aRtoo
@artoodeeto
Jun 03 2017 01:37 UTC
@Manish-Giri thats for loop the array arrArg.
Manish Giri
@Manish-Giri
Jun 03 2017 01:38 UTC
why?
when you do this
arr.filter(function (val){
you can directly check if arrArg has the element val or not
return arrArg.indexOf()....
aRtoo
@artoodeeto
Jun 03 2017 01:40 UTC
@Manish-Giri what do you mean sir??
Jonathan Tuer
@N3M3SIS20
Jun 03 2017 01:43 UTC
in the twitch.tv api challenge, I seem to be able to get the data from the json object found by the url, howver the logo does not show, only this little pseudo picture. How can I make the actual logo show?
check out the link
frederickalcantara
@frederickalcantara
Jun 03 2017 01:45 UTC
Hey @Manish-Giri can you help me explain why I am having an issue displaying specifics properties on certains objects? I am using a song of ice and fire api
Manish Giri
@Manish-Giri
Jun 03 2017 01:45 UTC
um okay
if you post the code
Ryan Nelson
@iamryandnelson
Jun 03 2017 01:46 UTC
xfGupRf.png
Does anyone have any experience with Isotope (jQuery plugin)?
frederickalcantara
@frederickalcantara
Jun 03 2017 01:47 UTC
I can send a link of the website if you need it
Manish Giri
@Manish-Giri
Jun 03 2017 01:48 UTC
you've got a lot of errors in the console
maybe fix those first
could be the reason
frederickalcantara
@frederickalcantara
Jun 03 2017 01:49 UTC
How?
hold on
try this one
sinsukh
@sinsukh
Jun 03 2017 01:50 UTC
@Manish-Giri @AJ-Brommy Thanks for your help guys!
CamperBot
@camperbot
Jun 03 2017 01:50 UTC
sinsukh sends brownie points to @manish-giri and @aj-brommy :sparkles: :thumbsup: :sparkles:
:cookie: 260 | @aj-brommy |http://www.freecodecamp.com/aj-brommy
:star2: 5804 | @manish-giri |http://www.freecodecamp.com/manish-giri
frederickalcantara
@frederickalcantara
Jun 03 2017 01:50 UTC
@Manish-Giri the link I just sent you should work
AJ Brommy
@AJ-Brommy
Jun 03 2017 01:50 UTC
@sinsukh have you fixed it and got it working then???
Manish Giri
@Manish-Giri
Jun 03 2017 01:53 UTC
Screenshot 2017-06-02 21.53.30.png
@frederickalcantara
try this site
that is really strange
mattr12
@mattr12
Jun 03 2017 01:56 UTC
Is there anyway to ensure a strict comparison === when translating an if-then statement to a switch statement?
frederickalcantara
@frederickalcantara
Jun 03 2017 01:57 UTC
You would have to set it on the intial condition
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:01 UTC
Anyone explain to me why this seems to be an infinite loop. when num == 5....
for(var i = 1; i <= num; i++){
    num *= i;
  }
haha
got it
incase anyone does the same and is confused ...
for(var i = 1; i <= num; i++){
    result *= i;
  }
Mithun reddy
@mithunreddyt
Jun 03 2017 02:11 UTC
I have a question if the property we are trying to access has a space in it we will need to use bracket notation to find the property of the object.
What it mean by space can any one give example to it
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:14 UTC
" "
"property with space"
"first name"
"first name": "AJ"
you couldn't access it via object.first name
so you would access it with the brackets
object["first name"]
because of the space
Mithun reddy
@mithunreddyt
Jun 03 2017 02:16 UTC
Do it mean the space between first and name
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:16 UTC
yes
Jeremy
@JeremyAntonoff
Jun 03 2017 02:16 UTC
can someone help me understand a piece of code
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:16 UTC
because it would break away from the not version, so you have to use brackets
*not = dot
Mithun reddy
@mithunreddyt
Jun 03 2017 02:17 UTC
@Aj Brommy Oh thankyou
CamperBot
@camperbot
Jun 03 2017 02:17 UTC
mithunreddyt sends brownie points to @aj :sparkles: :thumbsup: :sparkles:
:warning: @aj's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:17 UTC
:)
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:18 UTC
can anyone help me?
function isLess(a, b) {
  // Fix this code
   switch(a,b){
     case a,b:
       return true;

     case b,a:
       return false;
   }
}

// Change these values to test
isLess(15, 10);
Jeremy
@JeremyAntonoff
Jun 03 2017 02:19 UTC
you have commas instaed of <>?
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:19 UTC
function isLess(a, b) {
  // Fix this code
  if (a < b) {
    return true;
  } else {
    return false;
  }
}

// Change these values to test
isLess(10, 15);
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:20 UTC
that's true why are you doing switch?
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:20 UTC
@JToddFL Was it to me?
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:21 UTC
i've forgotten the switch format lol, but was meant to be use if multiple if else satements no?
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:21 UTC
@AJ-Brommy Instuction: do this without if/else
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:21 UTC
oh
yeah just return it
lol
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:22 UTC
function isLess(a, b) {
  // Fix this code
   switch(a,b){
     case a,b:
       return true;

     case b,a:
       return false;
   }
}

// Change these values to test
isLess(15, 10);
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:22 UTC
if a is less than b it will return true or false accordinglyy
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:22 UTC
this code is not correct
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:22 UTC
no its not
  return a < b;
it will return the result
Jeremy
@JeremyAntonoff
Jun 03 2017 02:23 UTC
@AJ-Brommy cany you help me understand a piece of code
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:24 UTC
oh, than if I'll write this statement in function I'll get my result..
@AJ-Brommy thank u, I'm first time working with returns))
CamperBot
@camperbot
Jun 03 2017 02:24 UTC
jaxadam sends brownie points to @aj-brommy :sparkles: :thumbsup: :sparkles:
:cookie: 262 | @aj-brommy |http://www.freecodecamp.com/aj-brommy
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:25 UTC
that is all is needed in the function because "return" returns the "result", everything to the right is worked out first, and the result goes into whatever is on the left, so if a is less than b true will be returned, and a is not less than b, false will be returned.
I haven't reached this challenge yet... and you've been working with returns for a long time! :P
@JToddFL I don't know without more info :)
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:26 UTC
function isLess(a, b) {
  // Fix this code
 return a<b;
}
Jeremy
@JeremyAntonoff
Jun 03 2017 02:26 UTC
function findShortestWordAmongMixedElements(arr) {
  var shortest = '';
  if (arr.length > 0) {
    arr.forEach(function (each){
      if (typeof each === 'string') {
        if (shortest) {
          if (each.length < shortest.length) shortest = each;
        } else {
          shortest = each;
        }
      }
    });
  }
  return shortest;
}

var output = findShortestWordAmongMixedElements([[4, 'two', 2, 'three']]);
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:27 UTC
@JaxAdam did it work?
Jeremy
@JeremyAntonoff
Jun 03 2017 02:27 UTC
particuilarly the if (shortest line)
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:27 UTC
@JToddFL to be honest with you, I have only just begun basic algorithms
Jeremy
@JeremyAntonoff
Jun 03 2017 02:28 UTC
aww gotcha
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:28 UTC
how far in is this one?
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:29 UTC
@AJ-Brommy yes,
I did not know that return returns true if the condition written in it is true) And about false accordingly. I ask forgiveness for my English. In my country, few people study it.
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:29 UTC
firstly im unsure, are the number 4 and 2 supposed to be converted to their string equivalent? :O
@JaxAdam it's ok, but it did come up in a previous challenge
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:30 UTC
@AJ-Brommy
I apologize, that long answered. I just need to use an interpreter sometimes to bring thoughts
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:31 UTC
No problems, that's why these challenges are set for us. You've learned it now :)
@JToddFL do we first need to filter out the numbers? and then from what is left count the characters in each word, perhaps by splitting them into an array and then using array.length? and so forth?

@JToddFL I haven't learned these...

arr.forEach(function (each){
      if (typeof each === 'string') {

where are you upto in the map???

Carmine Orientale
@Merinac
Jun 03 2017 02:36 UTC
hey guys, I'm currently stuck on the "Reverse a string" challenge under basic algorithms andddddd I haven't the slightest idea where to start.
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:37 UTC
Damn man, not the slightest?!
the previous few challenges are a big help
.join .reverse .split etc
you need to take the string, pull it apart, re arrange into reverse order, and then join it back together
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:48 UTC
What should I do to make the console display the value: "undefined"?
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:48 UTC
??
it will automatically if something is undefined
if you are using console.log
and you try to use something that is undefined
I think?
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:49 UTC

Instructions
Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.

Hint
Remember that undefined is a keyword, not a string.

AJ Brommy
@AJ-Brommy
Jun 03 2017 02:49 UTC
i've actually only just started using console.log
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:49 UTC
function abTest(a, b) {
  if(a<0){
    console.log("undefined");
  }
  if(b<0){
    console.log("undefined");
  }
  return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2);
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:50 UTC
return undefined;
take out ""
you are making it a string and not a keyword
using " and " makes strings
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:50 UTC
keywords needn't "
sure?
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:51 UTC
100%
var is a keyword
you don't do "var"
return is a keyword
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:51 UTC
Oh, thank u again)
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:51 UTC
you are welcome
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:52 UTC
hmmm
not working
function abTest(a, b) {
  if(a<0){
    console.log(undefined);
  }
  if(b<0){
    console.log(undefined);
  }
  return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2);
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:53 UTC
if(a<0 || b < 0){
return undefined;
}
Mithun reddy
@mithunreddyt
Jun 03 2017 02:54 UTC
Can we write a||b<0
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:54 UTC
it tells you "if a is less than 0 'OR' b is less than 0"
i believe that is how we do OR
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:55 UTC
@AJ-Brommy Точно! Я забыл про "||"! Это означает "и"!
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:55 UTC
? in English? lol
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:55 UTC
@AJ-Brommy
Exactly! I forgot about "||"! It means "and"!
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:55 UTC
no
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:55 UTC
@JaxAdam sorry))
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:55 UTC
&& is and
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:56 UTC
@AJ-Brommy what is ||?
Mithun reddy
@mithunreddyt
Jun 03 2017 02:56 UTC
It works right but when I write in this way a||b < 0 it's not working
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:56 UTC
OR!!!!!
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:56 UTC
that was html?
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:56 UTC
because you have to test each variable seperately
a < 0 OR b <0
Mithun reddy
@mithunreddyt
Jun 03 2017 02:56 UTC
Why can't we do it same time
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:56 UTC
a < 0 || b < 0
ask the inventor :P
Adilzhan Izat
@JaxAdam
Jun 03 2017 02:57 UTC
Got it, thanks again!
Mithun reddy
@mithunreddyt
Jun 03 2017 02:58 UTC
My question is both gives the same right not for this but for general purpose
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:58 UTC
in an english description of how you want it to function maybe
Mithun reddy
@mithunreddyt
Jun 03 2017 02:58 UTC
To make sure It makes me thing those statement is wrong
Joseph
@revisualize
Jun 03 2017 02:58 UTC
Hello!
Mithun reddy
@mithunreddyt
Jun 03 2017 02:59 UTC
@AJ-Brommy thanks
CamperBot
@camperbot
Jun 03 2017 02:59 UTC
mithunreddyt sends brownie points to @aj-brommy :sparkles: :thumbsup: :sparkles:
:cookie: 263 | @aj-brommy |http://www.freecodecamp.com/aj-brommy
AJ Brommy
@AJ-Brommy
Jun 03 2017 02:59 UTC
they gave it to you how they want it done "if a is less than 0 OR b is less than 0" they did not say "if a or b is less than zero".
Manish Giri
@Manish-Giri
Jun 03 2017 03:00 UTC
@mithunreddyt if a will just check if a is truthy
Mithun reddy
@mithunreddyt
Jun 03 2017 03:01 UTC
Got you
JuanDavid31
@JuanDavid31
Jun 03 2017 03:11 UTC
Hello, could someone help me with the Seek and Destroy challenge?
Ken Haduch
@khaduch
Jun 03 2017 03:18 UTC
@JuanDavid31 - I'm sure that someone will - please post your code and questions
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 03:27 UTC
Hey I need some help understanding my code

var count = 0;

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

This is for the "Counting Cards" exercise. Why does it not out put anything after the cc(2); function is called?
Aata-allah
@Atalaa
Jun 03 2017 03:29 UTC
...
dd
...
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 03:29 UTC

...
var count = 0;

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

Sorry this is the first time I used the chat trying to make my code more visible I'm a noob
Aata-allah
@Atalaa
Jun 03 2017 03:30 UTC
Hello somebody help ?
I need to retrieve the value of "joke" but i dont know how to do it
$(document).ready(function(){

  $(".btn").on("click", function(){
   var url = "https://api.icndb.com/jokes/random";
    $.getJSON(url, function(json){
      $(".quotes").html(JSON.stringify(json));

      json.forEach(function(val){


        }

      });


    });
  });
});
what to put in the loop ?
Manish Giri
@Manish-Giri
Jun 03 2017 03:33 UTC
study your api's return
{
  "type": "success",
  "value": {
    "id": 61,
    "joke": "Chuck Norris once ate a whole cake before his friends could tell him there was a stripper in it.",
    "categories": [

    ]
  }
}
this is what it returns
Aata-allah
@Atalaa
Jun 03 2017 03:34 UTC
Screen Shot 2017-06-02 at 10.26.44 PM.png
Manish Giri
@Manish-Giri
Jun 03 2017 03:34 UTC
it doesn't return an array, so why do you need a loop?
Aata-allah
@Atalaa
Jun 03 2017 03:34 UTC
@Manish-Giri i saw that but i want to display the joke value, i dont know how
Manish Giri
@Manish-Giri
Jun 03 2017 03:34 UTC
json.forEach(function(val){


        }
Aata-allah
@Atalaa
Jun 03 2017 03:34 UTC
cuz in the picture its an array objet
Manish Giri
@Manish-Giri
Jun 03 2017 03:34 UTC
this line
function(json){ - the variable json
represents
this object
{
  "type": "success",
  "value": {
    "id": 61,
    "joke": "Chuck Norris once ate a whole cake before his friends could tell him there was a stripper in it.",
    "categories": [

    ]
  }
}
so, json.value.joke
will give you "Chuck Norris once ate a whole cake before his friends could tell him there was a stripper in it."
Aata-allah
@Atalaa
Jun 03 2017 03:35 UTC
wait i dont see the function (json) line
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 03:35 UTC

```
var count = 0;

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



>

{
"type": "success",
"value": {
"id": 61,
"joke": "Chuck Norris once ate a whole cake before his friends could tell him there was a stripper in it.",
"categories": [

]

}
}
```

Manish Giri
@Manish-Giri
Jun 03 2017 03:35 UTC
it's in your code man
Aata-allah
@Atalaa
Jun 03 2017 03:36 UTC
@Manish-Giri i wrote already json.value.joke but nothing happen
Manish Giri
@Manish-Giri
Jun 03 2017 03:36 UTC
it's not in the code you showed here
Aata-allah
@Atalaa
Jun 03 2017 03:37 UTC
yeah i tried it before and didnt work so i change for this one
wait i try again
i dont know how to do
$(document).ready(function(){

  $(".btn").on("click", function(){
   var url = "https://api.icndb.com/jokes/random";
    $.getJSON(url, function(json){
      $(".quotes").html(JSON.stringify(json));

        json.value.joke;

    });
  });
});
Manish Giri
@Manish-Giri
Jun 03 2017 03:40 UTC
json.value.joke;
you wrote this but what are you doing with it?
Aata-allah
@Atalaa
Jun 03 2017 03:41 UTC
thats i try to figure it out, i dont know, i still beginner
Manish Giri
@Manish-Giri
Jun 03 2017 03:41 UTC
it's not being saved in a variable, or printed
Aata-allah
@Atalaa
Jun 03 2017 03:41 UTC
ok
Manish Giri
@Manish-Giri
Jun 03 2017 03:41 UTC
$(".quotes").html(JSON.stringify(json));
what does this line do?
I assume you know since you wrote this code?
Aata-allah
@Atalaa
Jun 03 2017 03:42 UTC
i tried this
$(document).ready(function(){

  $(".btn").on("click", function(){
   var url = "https://api.icndb.com/jokes/random";
    $.getJSON(url, function(json){
      $(".quotes").html(JSON.stringify(json));

        var res = json.value.joke;
        $("h5").html(res);

    });
  });
});
Joseph
@revisualize
Jun 03 2017 03:42 UTC
@Tsukuyomi19 Did you solve your challenge?
Aata-allah
@Atalaa
Jun 03 2017 03:42 UTC
@Manish-Giri this line convert my javascript into json
Manish Giri
@Manish-Giri
Jun 03 2017 03:43 UTC
okay if you have an h5 in your code
that will work
@Atalaa
Aata-allah
@Atalaa
Jun 03 2017 03:43 UTC
@Manish-Giri im sorry to disturb you again but it didnt work the way i showed you
Manish Giri
@Manish-Giri
Jun 03 2017 03:44 UTC
any errors in the console?
Aata-allah
@Atalaa
Jun 03 2017 03:44 UTC
still have a raw Json
@Manish-Giri nope
Jason Luboff
@JLuboff
Jun 03 2017 03:44 UTC
@Manish-Giri Yo
Manish Giri
@Manish-Giri
Jun 03 2017 03:45 UTC
@JLuboff :wave:
howdy
@Atalaa post codepen link
Aata-allah
@Atalaa
Jun 03 2017 03:45 UTC
ok
chaitanya ashtekar
@chaitanyaashtekar
Jun 03 2017 03:45 UTC
@Manish-Giri _/\_
Jason Luboff
@JLuboff
Jun 03 2017 03:45 UTC
@Manish-Giri how's it going?
Manish Giri
@Manish-Giri
Jun 03 2017 03:46 UTC
@JLuboff very zombie-ish :sob:
thesis is killing me
how're things your end
@chaitanyaashtekar hey buddy long time
chaitanya ashtekar
@chaitanyaashtekar
Jun 03 2017 03:46 UTC
yup
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 03:46 UTC
@revisualize
I'm trying to understand it
chaitanya ashtekar
@chaitanyaashtekar
Jun 03 2017 03:47 UTC
@Manish-Giri MS completed ?
Manish Giri
@Manish-Giri
Jun 03 2017 03:47 UTC
@Atalaa $(".quotes").html(JSON.stringify(json));
comment out this line
your h5 is being overwritten
@chaitanyaashtekar almost there, another few weeks
Aata-allah
@Atalaa
Jun 03 2017 03:48 UTC
@Manish-Giri will try
chaitanya ashtekar
@chaitanyaashtekar
Jun 03 2017 03:48 UTC
good
Jason Luboff
@JLuboff
Jun 03 2017 03:48 UTC
@Manish-Giri doing alright. Just relaxing right now. Started the MongoDB 101 course this week. Looks promising. Has you build an e-commerce page by the end
Manish Giri
@Manish-Giri
Jun 03 2017 03:49 UTC
from the mongo website?
@JLuboff
Jason Luboff
@JLuboff
Jun 03 2017 03:49 UTC
Ya mongo university
Aata-allah
@Atalaa
Jun 03 2017 03:50 UTC
@Manish-Giri My savior, it works bro ! But why i must comment out this line ? Because another guy told me to do it, and in the course FCC they do it too
Manish Giri
@Manish-Giri
Jun 03 2017 03:50 UTC
@Atalaa you gotta understand your own code dude
don't bother about what other guys or fcc tells you
look at your html
<div class="quotes">
      <h5>Here the quote</h5>

    </div>
Aata-allah
@Atalaa
Jun 03 2017 03:51 UTC
ok
Manish Giri
@Manish-Giri
Jun 03 2017 03:51 UTC
@JLuboff Im kicking myself for not picking mongo for my thesis
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 03:51 UTC
var count = 0;
function cc(card) {
  // Only change code below this line
  if(card>=2||card<=6){
    count++;
  }
  else if(card==10||card=='J'||card=='Q'||card=='K'||card=='A'){
     count--;
  }
  else if(card>=7||card<=9){
    count+=0;
  }
  else if (count>0){
    return count+" Bet";
  }
  else 
    return count+" Hold";

  // Only change code above this line
}
Manish Giri
@Manish-Giri
Jun 03 2017 03:51 UTC
would've worked out so well
:sob:
@JLuboff
Aata-allah
@Atalaa
Jun 03 2017 03:51 UTC
so the line i comment out is useless ?@Manish-Giri
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 03:52 UTC
Why when I run the cc(2); it outputs nothing. I'm thinking I'm getting screwed up with the else if and if statements somewhere
Manish Giri
@Manish-Giri
Jun 03 2017 03:53 UTC
@Atalaa it's not useless, it's just overwriting your h5
try this
Jason Luboff
@JLuboff
Jun 03 2017 03:53 UTC
@Manish-Giri 😂😂
Manish Giri
@Manish-Giri
Jun 03 2017 03:53 UTC
 <div class="quotes">
    </div>
   <h5>Here the quote</h5>
and
$(".quotes").html(JSON.stringify(json));

        var res = json.value.joke;
        $("h5").html(res);
and see what happens
Aata-allah
@Atalaa
Jun 03 2017 03:53 UTC
ok
Manish Giri
@Manish-Giri
Jun 03 2017 03:53 UTC
@Atalaa
@Tsukuyomi19 this
else if (count>0){
    return count+" Bet";
  }
needs to be if
@JLuboff when's your trip?
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 03:54 UTC
Why is that
Aata-allah
@Atalaa
Jun 03 2017 03:55 UTC
@Manish-Giri oh ok i get it, i have a raw line and a quote line
@Manish-Giri so i will delete the wrong line (stringify one)
Jason Luboff
@JLuboff
Jun 03 2017 03:56 UTC
@Manish-Giri just got back late Wednesday night
Manish Giri
@Manish-Giri
Jun 03 2017 03:56 UTC
oh wow
how was it
Jason Luboff
@JLuboff
Jun 03 2017 03:56 UTC
It was alright. Had it's highlights
Aata-allah
@Atalaa
Jun 03 2017 03:57 UTC
@Manish-Giri Thank you
CamperBot
@camperbot
Jun 03 2017 03:57 UTC
atalaa sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 5805 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jun 03 2017 03:58 UTC
:+1:
Joseph
@revisualize
Jun 03 2017 04:00 UTC
@Tsukuyomi19 Question.
@Tsukuyomi19 Regarding: if(card>=2||card<=6){
Is 10 greaterthan or equal to 2?
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 04:02 UTC
Yes it is
Joseph
@revisualize
Jun 03 2017 04:02 UTC
@Tsukuyomi19 Okay so count++
@Tsukuyomi19 Aren't you supposed to -1 from count if the card is 10?
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 04:03 UTC
I see what you mean I was trying to set boundaries 2-6 count++
Joseph
@revisualize
Jun 03 2017 04:03 UTC
@Tsukuyomi19 You shouldn't or then. You should be doing and
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 04:03 UTC
yeah thats in the first else if statement there
Joseph
@revisualize
Jun 03 2017 04:04 UTC
@Tsukuyomi19 Then it would become if card is greaterthan or equal to 2 and card is lessthan or equal to 6.
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 04:04 UTC
Yeah I screwed up
&& is the right expression
@revisualize Thanks a bunch
CamperBot
@camperbot
Jun 03 2017 04:05 UTC
tsukuyomi19 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4089 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jun 03 2017 04:05 UTC
@Tsukuyomi19 Does it work now?
Tsukuyomi19
@Tsukuyomi19
Jun 03 2017 04:05 UTC
Yep works now
It was easier when I used case statements instead but I was trying to understand why my if/else solution was failing
AT Will
@Atsoamazed
Jun 03 2017 04:08 UTC

I am stuck on the camalcase assignment. I changed the name to so the name is useing cameCase. It is still failing. What is this asking for

2
// Declarations
var studlyCapvar;
var properCamelcase;
var titleCaseover;

// Assignments

studlyCapvar = 10;
properCamelase = "A String";
titleCaseover = 9000;

Joseph
@revisualize
Jun 03 2017 04:09 UTC
@Atsoamazed You're missing some uppercase characters
@Atsoamazed You need to use proper camel case.
varValueLikeThis
thisIsALongValue
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 04:11 UTC
@Atsoamazed You are also missing a "c"
properCamelase = "A String";
AT Will
@Atsoamazed
Jun 03 2017 04:11 UTC
oooooh okay, thanks!
I thought it wanted just camalCase
AT Will
@Atsoamazed
Jun 03 2017 04:16 UTC
thanks @revisualize @ivancsicsmarkus
CamperBot
@camperbot
Jun 03 2017 04:16 UTC
atsoamazed sends brownie points to @revisualize and @ivancsicsmarkus :sparkles: :thumbsup: :sparkles:
:cookie: 566 | @ivancsicsmarkus |http://www.freecodecamp.com/ivancsicsmarkus
:star2: 4090 | @revisualize |http://www.freecodecamp.com/revisualize
Carmine Orientale
@Merinac
Jun 03 2017 04:24 UTC
@AJ-Brommy you still up here aj?
Aata-allah
@Atalaa
Jun 03 2017 04:25 UTC

can somebody explain to me why i dont have the shadow hover effect for my "new quote" button please ?

<div class = "container-fluid">

    <h1>Random Quote Machine</h1>
    <p id = "description">
    Here are some of the best known     cinematographic quotes. Will you succeed in guessing them ?
    </p>
    <div class="text-center w3-container">
      <button type="button" class="btn w3-btn w3-black">New Quote</button>
    </div>    
    <div class="quotes">
      <h5 id="chuck"></h5>
    </div>

https://codepen.io/Atalaa/pen/ZyEEEY

Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 04:27 UTC
@Atalaa Because you are not adding any shadow hover effect.
Aata-allah
@Atalaa
Jun 03 2017 04:28 UTC
@ivancsicsmarkus u mean in css ?
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 04:28 UTC
@Atalaa Yes.
Good starting point:
.btn:hover{
  box-shadow: 1px 1px 3px 1px black;
}
Aata-allah
@Atalaa
Jun 03 2017 04:29 UTC
@ivancsicsmarkus oh sorry thank you i forgot lol
CamperBot
@camperbot
Jun 03 2017 04:29 UTC
atalaa sends brownie points to @ivancsicsmarkus :sparkles: :thumbsup: :sparkles:
:cookie: 567 | @ivancsicsmarkus |http://www.freecodecamp.com/ivancsicsmarkus
Juan
@jfiguer0
Jun 03 2017 04:50 UTC
can't pass .lenght challenge. This is my code:
image.png
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 04:50 UTC
@jfiguer0 Hello!
@jfiguer0 Reload the page!
Juan
@jfiguer0
Jun 03 2017 04:52 UTC
hey @ivancsicsmarkus i checked my code with other forums and it looks correct. I reloaded and cleared it but it still won't take it.
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 04:53 UTC
@jfiguer0 Paste this:
// Example
var firstNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

// Setup
var lastNameLength = 0;
var lastName = "Lovelace";

// Only change code below this line.

lastNameLength = lastName.length;
@jfiguer0 Maybe there is an unnecessary char in your code or I don’t know.
@jfiguer0 There are really weird bugs.
Juan
@jfiguer0
Jun 03 2017 04:54 UTC
@ivancsicsmarkus that worked, but it looks the same as the one I had. So was my code right?
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 04:55 UTC
@jfiguer0 Yes, exactly.
Juan
@jfiguer0
Jun 03 2017 04:55 UTC
@ivancsicsmarkus Thank you for your help.
CamperBot
@camperbot
Jun 03 2017 04:55 UTC
jfiguer0 sends brownie points to @ivancsicsmarkus :sparkles: :thumbsup: :sparkles:
:cookie: 568 | @ivancsicsmarkus |http://www.freecodecamp.com/ivancsicsmarkus
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 04:56 UTC
@jfiguer0 You will use length property a lot. :)
@jfiguer0 Have a nice day!
ThisUserDominates
@ThisUserDominates
Jun 03 2017 04:56 UTC
help plz
Ankit Padia
@InsaneSkull
Jun 03 2017 04:59 UTC
@ThisUserDominates
var firstNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

// Setup
var lastNameLength = 0;
var lastName = "Lovelace";

// Only change code below this line.


lastNameLength = lastName.length;
Ogundele Olumide
@Lumexralph
Jun 03 2017 04:59 UTC
@ThisUserDominates assign the length of lastName variable to lastNameLength
An-mode
@an-mode
Jun 03 2017 05:05 UTC
hello world ! I was creatinga code for reversing a string but am unable to understand why my array variable "temp" was coming out of scope when it is a part of the same funcation and is defined in it:

function reverseString(str) {
var string=[];

string=str.split('');
var strLength=string.length;
for(var i=string.length;i>0;i--)
{
var temp=[];
var change=strLength-i;
temp[change]=string[i-1];
}

temp=((string.reverse()));
str=temp.join("");
return str;

//return string;
}

reverseString("Dhruv");

holland11
@holland11
Jun 03 2017 05:06 UTC
i'm having trouble coming up with an algorithm efficient enough to compute the smallest common multiple of a group of numbers
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:07 UTC
@an-mode every time the loop iterates it resets the value of temp to an empty array
An-mode
@an-mode
Jun 03 2017 05:08 UTC
@Lumexralph thank you mate... that solves it. :). Do i assume this is not a matter of scope?
CamperBot
@camperbot
Jun 03 2017 05:08 UTC
an-mode sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1863 | @lumexralph |http://www.freecodecamp.com/lumexralph
Rick Riggs
@wikiwiggs
Jun 03 2017 05:09 UTC
Anyone familiar with React?
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:09 UTC
@an-mode it's..... temp is local scope to the loop
AJ
@ShinobiDatCodes
Jun 03 2017 05:10 UTC
Hello guys, got a question regarding the hasOwnProperty() method.
Manish Giri
@Manish-Giri
Jun 03 2017 05:10 UTC
@wikiwiggs kinda
@Lumexralph :wave:
good morning
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:10 UTC
@ShinobiDatCodes shoot
An-mode
@an-mode
Jun 03 2017 05:10 UTC
@Lumexralph ohh.. did not know.. Thanks much !
CamperBot
@camperbot
Jun 03 2017 05:10 UTC
an-mode sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:warning: an-mode already gave lumexralph points
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:10 UTC
@Manish-Giri Bro! gggm :smiling_imp:
Manish Giri
@Manish-Giri
Jun 03 2017 05:11 UTC
:smiling_imp:
Rick Riggs
@wikiwiggs
Jun 03 2017 05:11 UTC
@Manish-Giri I'm just picking it up trying to learn it, and I'm not sure what I am doing wrong, you care to look at my code pen? It's super basic but won't do what I expect it to.
https://codepen.io/wikiwiggs/pen/vZBWLj
AJ
@ShinobiDatCodes
Jun 03 2017 05:12 UTC
@Lumexralph so, from the explanation, I have to use the syntax of quoting the property name. For example if my property name is Car, I use variable.hasOwnProperty("Car")
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:12 UTC
@ShinobiDatCodes if variable is an object yes
Manish Giri
@Manish-Giri
Jun 03 2017 05:12 UTC
@wikiwiggs getDefaultState: function () this is the problem
it's called getInitialState
for props it's getDefaultProps
you prolly mixed the two
Rick Riggs
@wikiwiggs
Jun 03 2017 05:13 UTC
Yeah I did, thanks @Manish-Giri
CamperBot
@camperbot
Jun 03 2017 05:13 UTC
wikiwiggs sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 5807 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:13 UTC
@Manish-Giri i need to resume my react, still in python world
Manish Giri
@Manish-Giri
Jun 03 2017 05:13 UTC
np
@Lumexralph teach me python
AJ
@ShinobiDatCodes
Jun 03 2017 05:13 UTC
@Lumexralph Correct. the problem I have is that I want to use hasOwnProperty() inside of a function, and I cannot for the life of me get the property name inside of quotations without turning it into a string. This is what I mean:
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  var CP=checkProp;

  var answer=myObj.hasOwnProperty(CP);

  if (answer===true){
    answer=myObj.checkProp;
  }
  else if (answer===false){
    answer="Not Found";
  }
  return CP;
}

// Test your code by modifying these values
checkObj("gift");
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:14 UTC
@Manish-Giri :smirk:
Manish Giri
@Manish-Giri
Jun 03 2017 05:14 UTC
:smiling_imp:
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:15 UTC
@ShinobiDatCodes checkProp is a parameter, dot notation to access the object myObj won't work
Manish Giri
@Manish-Giri
Jun 03 2017 05:15 UTC
also, you're complicating the code
unnecessarily
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:15 UTC
@Manish-Giri OOP is very direct in python , JS gives you different ways
Manish Giri
@Manish-Giri
Jun 03 2017 05:16 UTC
@Lumexralph like def Child(Parent):
?
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:16 UTC
@Manish-Giri and JS still fools people with class :joy:
AJ
@ShinobiDatCodes
Jun 03 2017 05:16 UTC
@Lumexralph I have tried putting checkProp using "/"checkProp/"", then I replaced checkProp for a second variable name CP, I tried putting it as "/"CP/"" but it keeps turning it into a string. If I put checkProp inside hasOwnProperty directly as is, I get hasOwnProperty(checkProp) no quotations, and the code won't run. I know the answer must be simple but it won't run.
Manish Giri
@Manish-Giri
Jun 03 2017 05:16 UTC
hehe
@Lumexralph how's Osun
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:18 UTC
@Manish-Giri class Child(parent):
AJ
@ShinobiDatCodes
Jun 03 2017 05:18 UTC
@Lumexralph ok. so I cannot use the parameter inside myObj?
Manish Giri
@Manish-Giri
Jun 03 2017 05:18 UTC
ooh yes now I remember
Rick Riggs
@wikiwiggs
Jun 03 2017 05:18 UTC
couldn't you check to see: if (typeof myObj[checkProp] == "undefined") { ... } else { ... }
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:19 UTC
@ShinobiDatCodes what parameter? i'm talking about the way you're accessing the object myObj
@Manish-Giri Osun is cool, should be travellling down to Lagos today but not decided
@Manish-Giri Osun is cool, should be travellling down to Lagos today but not decided
Joseph
@revisualize
Jun 03 2017 05:20 UTC
Hi.
Manish Giri
@Manish-Giri
Jun 03 2017 05:20 UTC
@Lumexralph how you wake up so early is beyond me
you must teach me
Joseph
@revisualize
Jun 03 2017 05:20 UTC
@wikiwiggs undefined
AJ
@ShinobiDatCodes
Jun 03 2017 05:20 UTC
@Lumexralph you mean the line inside the If statement? or the myObj right before?
Manish Giri
@Manish-Giri
Jun 03 2017 05:21 UTC
I usually get to bed by 5-6 am
Rick Riggs
@wikiwiggs
Jun 03 2017 05:21 UTC
@revisualize ???
AJ
@ShinobiDatCodes
Jun 03 2017 05:21 UTC
@wikiwiggs let me see.
Joseph
@revisualize
Jun 03 2017 05:21 UTC
@wikiwiggs Nevermind.
@wikiwiggs It is actually a string 'undefined' I thought it was just the valueundefined
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:22 UTC
@ShinobiDatCodes how many ways can you access an object ?
Joseph
@revisualize
Jun 03 2017 05:22 UTC
@wikiwiggs You could. But, the lesson wants you to learn .hasOwnProperty()
AJ
@ShinobiDatCodes
Jun 03 2017 05:26 UTC
@Lumexralph I know you can use brackets as well. I am using a variable right now I think. The problem I think I have is that both dot and bracket require quotation marks, and what I am putting inside is the parameter for the function checkObj.
@Manish-Giri I am gonna keep reading your article. I am so slow at catching on.
Ogundele Olumide
@Lumexralph
Jun 03 2017 05:28 UTC
@ShinobiDatCodes you can use variable with bracket notation
Manish Giri
@Manish-Giri
Jun 03 2017 05:28 UTC
@ShinobiDatCodes okay, well the article has the answer as to why your code won't work.
at least one of the reasons why.
Rick Riggs
@wikiwiggs
Jun 03 2017 05:28 UTC
@ShinobiDatCodes The parameter being passed is a string value in quotation marks, so when used as a variable it is a symbolic substitute for "gift"
Manish Giri
@Manish-Giri
Jun 03 2017 05:28 UTC
the other reason being your return statement.
AJ
@ShinobiDatCodes
Jun 03 2017 05:29 UTC
@wikiwiggs so it is still read as "gift" even though when I test the output of just checkProp it shows gift without quotations?
Manish Giri
@Manish-Giri
Jun 03 2017 05:29 UTC
the other reason being your return statement.
that's because of this
@ShinobiDatCodes
AJ
@ShinobiDatCodes
Jun 03 2017 05:30 UTC
@Manish-Giri yeah don't pay attention to that, I had changed it when I copied the code, I was testing what checkProp was outputting, I changed it back to what it was originally, which was answer.
Manish Giri
@Manish-Giri
Jun 03 2017 05:31 UTC
great
Rick Riggs
@wikiwiggs
Jun 03 2017 05:31 UTC
@ShinobiDatCodes how are you testing the type?
Manish Giri
@Manish-Giri
Jun 03 2017 05:31 UTC
next time maybe don't post code which you know is wrong
AJ
@ShinobiDatCodes
Jun 03 2017 05:31 UTC
@Manish-Giri I was just testing your powers of observation...
@wikiwiggs this is what I got:
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  var CP=checkProp;

  var answer=myObj.hasOwnProperty(CP);

  if (answer===true){
    answer=myObj .checkProp;
  }
  else if (answer===false){
    answer="Not Found";
  }
  return answer;
}

// Test your code by modifying these values
checkObj("gift");
as it is right now, just looking at var answer=myObj.hasOwnProperty(CP); would the program read CP as gift or "gift" ? I know the syntax is not correct but just humor me.
AJ
@ShinobiDatCodes
Jun 03 2017 05:37 UTC
@Manish-Giri alright, got it from the article. Told you I was slow. @Lumexralph Thanks, it was bracket notation. @wikiwiggs Thank you as well.
CamperBot
@camperbot
Jun 03 2017 05:37 UTC
shinobidatcodes sends brownie points to @manish-giri and @lumexralph and @wikiwiggs :sparkles: :thumbsup: :sparkles:
:cookie: 324 | @wikiwiggs |http://www.freecodecamp.com/wikiwiggs
:star2: 1864 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 5808 | @manish-giri |http://www.freecodecamp.com/manish-giri
Sandip Shrestha
@saninmersion
Jun 03 2017 05:38 UTC
@ShinobiDatCodes "gift" is a string. your checkProp is a variable with a string value gift. so again CP will be a variable with a string value gift not a string value "gift"
AJ
@ShinobiDatCodes
Jun 03 2017 05:40 UTC
@saninmersion I see now. Thanks you!
CamperBot
@camperbot
Jun 03 2017 05:40 UTC
shinobidatcodes sends brownie points to @saninmersion :sparkles: :thumbsup: :sparkles:
:cookie: 496 | @saninmersion |http://www.freecodecamp.com/saninmersion
Mohit Nandwani
@mohitnandwani
Jun 03 2017 05:59 UTC
Hey! I'm stuck at stand in line exercise
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.
Mohit Nandwani
@mohitnandwani
Jun 03 2017 06:04 UTC

function nextInLine(arr, item) {
// Your code here
function nextInLine(arr, item){
arr = [2];
item = 1;
}
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));

Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:05 UTC
@mohitnandwani use push() to add the item to the array arr
@mohitnandwani and shift() to remove and return the first element.
Joshua Frias
@Juke-Magic
Jun 03 2017 06:14 UTC
hey guys
can anyone answer my question
on javascript?
is anyone on??
abraham anak agung
@padunk
Jun 03 2017 06:17 UTC
@21-Orange maybe, i am new too :)
Joshua Frias
@Juke-Magic
Jun 03 2017 06:17 UTC
@padunk hey haha
you on javascript??
abraham anak agung
@padunk
Jun 03 2017 06:18 UTC
yes, i am
Joshua Frias
@Juke-Magic
Jun 03 2017 06:18 UTC
you on the last parts??
abraham anak agung
@padunk
Jun 03 2017 06:19 UTC
working on my calculator now
Joshua Frias
@Juke-Magic
Jun 03 2017 06:19 UTC
im on basic javascript :)
did you finish this problem already
Find Numbers with Regular Expressions
CamperBot
@camperbot
Jun 03 2017 06:19 UTC
find numbers with regular expressions
nothing found
abraham anak agung
@padunk
Jun 03 2017 06:20 UTC
where is your code? @21-Orange maybe i can help
Joshua Frias
@Juke-Magic
Jun 03 2017 06:20 UTC
nah its just a clarification
var expression = /\d+/g;
what is + for??
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:21 UTC
@21-Orange for one or more
abraham anak agung
@padunk
Jun 03 2017 06:21 UTC
1 or more number
Joshua Frias
@Juke-Magic
Jun 03 2017 06:21 UTC
can you give an example??
what if i didnt put +?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:21 UTC
@21-Orange then it will only pass for one digit
@21-Orange you can put * for zero or more
abraham anak agung
@padunk
Jun 03 2017 06:22 UTC
try it here https://regex101.com
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:22 UTC
or use {n} where n is the exact number of digits
Joshua Frias
@Juke-Magic
Jun 03 2017 06:22 UTC
ok here
"There are 3 cats but 4 dogs."
if i didnt put +, will it stop at 3?
abraham anak agung
@padunk
Jun 03 2017 06:23 UTC
yes @21-Orange , yup you need to use global for match 3 and 4 like Mr. Saif said
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:23 UTC
@21-Orange use global
Joshua Frias
@Juke-Magic
Jun 03 2017 06:23 UTC
wait wait
var expression = /\d/g;
still outputs 2
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:24 UTC
yes @21-Orange if he puts + he will find nothing
@21-Orange because 2 matches are found
Joshua Frias
@Juke-Magic
Jun 03 2017 06:24 UTC
@saifsmailbox98 i thought it stops at 3?
Manish Giri
@Manish-Giri
Jun 03 2017 06:25 UTC
if i didnt put +, will it stop at 3?
no
Joshua Frias
@Juke-Magic
Jun 03 2017 06:25 UTC
so i should only be 1?
Manish Giri
@Manish-Giri
Jun 03 2017 06:25 UTC
it doesn't work like that
3 and 4 are separate
Joshua Frias
@Juke-Magic
Jun 03 2017 06:25 UTC
sorry im so slow hahaha
Manish Giri
@Manish-Giri
Jun 03 2017 06:25 UTC
so irrespective of + or no +
you'll get 2 matches
Joshua Frias
@Juke-Magic
Jun 03 2017 06:25 UTC
@Manish-Giri what is + for?
Manish Giri
@Manish-Giri
Jun 03 2017 06:25 UTC
+ works if you have multiple numbers grouped together
like 333444
try it out and see the difference yourself
Joshua Frias
@Juke-Magic
Jun 03 2017 06:26 UTC
awwwwww
Manish Giri
@Manish-Giri
Jun 03 2017 06:26 UTC
http://regexr.com/ - this is a good site to test
Joshua Frias
@Juke-Magic
Jun 03 2017 06:26 UTC
@Manish-Giri thank you hahahah
CamperBot
@camperbot
Jun 03 2017 06:26 UTC
21-orange sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 5810 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jun 03 2017 06:26 UTC
np
Joshua Frias
@Juke-Magic
Jun 03 2017 06:26 UTC
@saifsmailbox98 @padunk thank you aswell!!
CamperBot
@camperbot
Jun 03 2017 06:26 UTC
21-orange sends brownie points to @saifsmailbox98 and @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 335 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
:cookie: 333 | @padunk |http://www.freecodecamp.com/padunk
Mohit Nandwani
@mohitnandwani
Jun 03 2017 06:26 UTC
@saifsmailbox98 what needs to be changed here?
return item; // Change this line
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:27 UTC
@mohitnandwani use shift() read the docs
abraham anak agung
@padunk
Jun 03 2017 06:27 UTC
@21-Orange you are welcome. Regex is hard for me :smile:
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:27 UTC
@mohitnandwani arr.shift(); removes the first element and returns it
barry01000010
@barry01000010
Jun 03 2017 06:28 UTC
reverse a string has got me in reverse SOS help please
Manish Giri
@Manish-Giri
Jun 03 2017 06:29 UTC
@barry01000010 what's the problem?
Sandip Shrestha
@saninmersion
Jun 03 2017 06:29 UTC
@barry01000010 did you use Array.reverse()
Mohit Nandwani
@mohitnandwani
Jun 03 2017 06:30 UTC
@saifsmailbox98 okay so i have to return arr.shift(); ?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:30 UTC
@mohitnandwani yes
barry01000010
@barry01000010
Jun 03 2017 06:31 UTC
do i leave the original function there and add others or include it in the function that is already there? I am fully lost here
Manish Giri
@Manish-Giri
Jun 03 2017 06:32 UTC
your code goes in the existing function body
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:32 UTC
@barry01000010 there must be comments in your code that says //Change code below thisline or //Your code here
barry01000010
@barry01000010
Jun 03 2017 06:32 UTC
nope @saifsmailbox98
Mohit Nandwani
@mohitnandwani
Jun 03 2017 06:33 UTC
@saifsmailbox98 Got it! Thanks :+1:
CamperBot
@camperbot
Jun 03 2017 06:33 UTC
mohitnandwani sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:33 UTC
@barry01000010 try reset, you need to only change the code within the function provided
so that the predefined function calls will be valid.
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:34 UTC
@Manish-Giri how do you know I wake early? we're not in same timezone
Manish Giri
@Manish-Giri
Jun 03 2017 06:34 UTC
I assume you wake up about 30-40 mins before you log in here
and I know what time it is in your area at that time
so :smiling_imp:
Varun
@varunzxzx
Jun 03 2017 06:36 UTC
function lookUpProfile(firstName, prop){
// Only change code below this line
var i=0;
while (i<contacts.length)
{
if (contacts[i].firstName === firstName) {
if(contacts[i][prop] === prop) {
return contacts[i][prop];
}
else
return "No such property";
}
}
return "No such contact";
// Only change code above this line
}
what is wrong in this code? It is from Profile Lookup
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:36 UTC
@Manish-Giri :joy:
ggggggggggm :smiling_imp:
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:36 UTC
@varunzxzx put i++;
@varunzxzx in the while loop
Manish Giri
@Manish-Giri
Jun 03 2017 06:37 UTC
:smiling_imp: :smiling_imp:
Varun
@varunzxzx
Jun 03 2017 06:37 UTC
@saifsmailbox98 it is not working
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:37 UTC
@varunzxzx if(contacts[i][prop] === prop) { you need to check if it has a property stored in prop
Joshua Frias
@Juke-Magic
Jun 03 2017 06:37 UTC
hey guys
why use this.wheels
not "wheels"
barry01000010
@barry01000010
Jun 03 2017 06:38 UTC
Thank you
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:38 UTC
@varunzxzx use hasOwnProperty(prop)
Joshua Frias
@Juke-Magic
Jun 03 2017 06:39 UTC
@Manish-Giri can you help me
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:39 UTC
@Manish-Giri just converted a code from JS to PY
Manish Giri
@Manish-Giri
Jun 03 2017 06:39 UTC
@21-Orange this refers to the object
Joshua Frias
@Juke-Magic
Jun 03 2017 06:39 UTC
@Manish-Giri how it diffrent from "wheel"
Manish Giri
@Manish-Giri
Jun 03 2017 06:39 UTC
this.wheels therefore refers to the wheels property ON that object
@Lumexralph OOP code?
Joshua Frias
@Juke-Magic
Jun 03 2017 06:40 UTC
"wheels":4,
"engines":1,
"seats":5
this.wheels = 4;
this.engines = 1;
this.seats = 5;
Varun
@varunzxzx
Jun 03 2017 06:40 UTC
@saifsmailbox98 How I will return the value of that poperty?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:40 UTC
obj[prop]
@varunzxzx
contacts[i][prop]
Varun
@varunzxzx
Jun 03 2017 06:41 UTC
if(hasOwnProperty(prop)) {
return contacts[i][prop];
}
is it correct?
Joshua Frias
@Juke-Magic
Jun 03 2017 06:41 UTC
@Manish-Giri whats so different from the two?
@21-Orange
"wheels":4,
"engines":1,
"seats":5
this.wheels = 4;
this.engines = 1;
this.seats = 5;
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:41 UTC
@varunzxzx if(hasOwnProperty(prop)
this line is still incorrect
Varun
@varunzxzx
Jun 03 2017 06:41 UTC
why?
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:41 UTC
@Manish-Giri just functions
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:41 UTC
if(contacts[i].hasOwnProperty(prop))
@varunzxzx
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:42 UTC
@varunzxzx where's the object you're checking the property from ?
Joshua Frias
@Juke-Magic
Jun 03 2017 06:42 UTC
@Lumexralph its at the top
the contacts :)
Varun
@varunzxzx
Jun 03 2017 06:42 UTC
@saifsmailbox98 thanks it worked
CamperBot
@camperbot
Jun 03 2017 06:42 UTC
varunzxzx sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
Manish Giri
@Manish-Giri
Jun 03 2017 06:42 UTC
@21-Orange did you try writing some code to figure out the difference between the two?
Joshua Frias
@Juke-Magic
Jun 03 2017 06:42 UTC
@Manish-Giri nope
Manish Giri
@Manish-Giri
Jun 03 2017 06:42 UTC
I told you this the last time as well, for the regex challenge
try to run this
var obj = {
  wheels: 4,
  printInfo: function() {
    console.log("Number of wheels = " + this.wheels);
  }
}

console.log(obj.printInfo());


var obj1 = {
  wheels: 4,
  printInfo: function() {
    console.log("Number of wheels = " + wheels);
  }
}

console.log(obj1.printInfo());
see what output you get
@Lumexralph till today I didn't understand why I don't like Python that much
maybe because of the indentation rules, or maybe it feels too lax?
who knows
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:45 UTC
@Manish-Giri the awesomeness of JS and Java ? I had to study python for a company but kind of like the potentials eventually
Manish Giri
@Manish-Giri
Jun 03 2017 06:45 UTC
yeah I guess so
Vikas Saraf
@saraf007
Jun 03 2017 06:45 UTC

// Setup
function abTest(a, b) {
// Only change code below this line

// Only change code above this line

return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2);

plz explain
Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:46 UTC
@saraf007 if a is less than 0 or b is less than 0 return undefined
Joshua Frias
@Juke-Magic
Jun 03 2017 06:47 UTC
@Manish-Giri it just output {}
outputs*
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:47 UTC
@saraf007 why are you using return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:47 UTC
@Manish-Giri i have a feeling it'll be 70% JS and 30% PY for me going forward
Vikas Saraf
@saraf007
Jun 03 2017 06:47 UTC
i know but there cant be 2 return statements in one function
Manish Giri
@Manish-Giri
Jun 03 2017 06:47 UTC
@21-Orange ?
you don't get anything else in the console?
Sandip Shrestha
@saninmersion
Jun 03 2017 06:47 UTC
@saraf007
// Only change code below this line // Only change code above this line this and you still change the line below those
Manish Giri
@Manish-Giri
Jun 03 2017 06:48 UTC
@saifsmailbox98 why are you posting answers?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:48 UTC
@Manish-Giri sorry
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:48 UTC
@saifsmailbox98 it's good if a code is readable :wink: i understand though
Joshua Frias
@Juke-Magic
Jun 03 2017 06:48 UTC
@Manish-Giri yep
Manish Giri
@Manish-Giri
Jun 03 2017 06:49 UTC
@21-Orange okay I don't know how you're running that code
but you're supposed to get values in the console
that's what the console.logs are for
Joshua Frias
@Juke-Magic
Jun 03 2017 06:49 UTC
where do i run it??
Manish Giri
@Manish-Giri
Jun 03 2017 06:49 UTC
Teague Barry
@TeagueRB
Jun 03 2017 06:49 UTC
hello I am in need of help with
"Storing Values with the Assignment Operator"
Joshua Frias
@Juke-Magic
Jun 03 2017 06:49 UTC
im running it in free code camp
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:50 UTC
@21-Orange on which browser?
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:50 UTC
@TeagueRB what do you have?
@21-Orange you need a console environment, FCC is not that just for testing
Teague Barry
@TeagueRB
Jun 03 2017 06:50 UTC
@Lumexralph var a = 7 ;
var b = a ;
Joshua Frias
@Juke-Magic
Jun 03 2017 06:50 UTC
@saifsmailbox98 where should i test it?
@Lumexralph where should i test it?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:50 UTC
@21-Orange you want to see the console?
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:50 UTC
@TeagueRB show the initial code from FCC and the instructions
Manish Giri
@Manish-Giri
Jun 03 2017 06:51 UTC
@21-Orange you can test stuff on jsbin, repl.it, jsfiddle, codepen, and even your browser console(dev tools)
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:51 UTC
@21-Orange i also use node in my CMD
Manish Giri
@Manish-Giri
Jun 03 2017 06:51 UTC
for now go through the code on the link
James Kubik
@slik1011
Jun 03 2017 06:51 UTC
Hello, does anyone know why this instance returns true when it should be false?
function mutation(arr) {
arr = arr.toString();
arr = arr.toLowerCase();
arr = arr.split(',');

    for(var y = 0; y < arr[1].length; y++){
      var a = arr[0].indexOf(arr[1][y]);
      var b = 0;
      while(a !== - 1){
        b++;
        a = arr[0].indexOf(arr[1][y], a + 1);
      }
      if(b > 0){

        return true;
}  

      else{

        return false;
      }}

}
mutation(["hello", "hey"]);
Teague Barry
@TeagueRB
Jun 03 2017 06:51 UTC

@Lumexralph initial code

// Setup
var a;
var b = 2;

// Only change code below this line

@Lumexralph
Assign the value 7 to variable a.

Assign the contents of a to variable b.

Joshua Frias
@Juke-Magic
Jun 03 2017 06:52 UTC
@Lumexralph aye thanks i tested it
CamperBot
@camperbot
Jun 03 2017 06:52 UTC
21-orange sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1865 | @lumexralph |http://www.freecodecamp.com/lumexralph
Teague Barry
@TeagueRB
Jun 03 2017 06:52 UTC
@Lumexralph
Do not change code above the line
a should have a value of 7
b should have a value of 7
a should be assigned to b with =
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:52 UTC
@TeagueRB a and b is already declared, right?
Joshua Frias
@Juke-Magic
Jun 03 2017 06:52 UTC
@Manish-Giri this came out

Native Browser JavaScript

Number of wheels = 4
undefined
Number of wheels = 4
undefined
=> undefined

Teague Barry
@TeagueRB
Jun 03 2017 06:52 UTC
@Lumexralph i think so yes
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:52 UTC
@TeagueRB you don't need to redeclare with var when you want to assign a value
Joshua Frias
@Juke-Magic
Jun 03 2017 06:52 UTC
@Manish-Giri should it be the same?
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:53 UTC
@TeagueRB just assign 7 to a and then assign a to b
@21-Orange do you know why now?
Joshua Frias
@Juke-Magic
Jun 03 2017 06:53 UTC
Anyways thanks @Manish-Giri @Lumexralph i have to go :)
CamperBot
@camperbot
Jun 03 2017 06:53 UTC
21-orange sends brownie points to @manish-giri and @lumexralph :sparkles: :thumbsup: :sparkles:
:warning: 21-orange already gave lumexralph points
:warning: 21-orange already gave manish-giri points
Teague Barry
@TeagueRB
Jun 03 2017 06:54 UTC
@Lumexralph this is what I have now
var a = 7;
var b = a;
the only task im not passing is "Do not change code above this line"
or is there a way to assign it inline
Ogundele Olumide
@Lumexralph
Jun 03 2017 06:54 UTC
@TeagueRB don't use var a and b are already declared
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:54 UTC
@TeagueRB reset code, and don;t use var if its already defined
@TeagueRB you already know how to do it
Do not change code above the line
a should have a value of 7
b should have a value of 7
a should be assigned to b with =
Manish Giri
@Manish-Giri
Jun 03 2017 06:55 UTC
@21-Orange I've no idea how you're getting the same output
Aakriti
@Aakriti94
Jun 03 2017 06:55 UTC
@Manish-Giri hey!
Manish Giri
@Manish-Giri
Jun 03 2017 06:56 UTC
ab.png
@21-Orange this is the output on my end, which tells clearly what the difference is
Teague Barry
@TeagueRB
Jun 03 2017 06:56 UTC
@Lumexralph still confused sorry
Manish Giri
@Manish-Giri
Jun 03 2017 06:56 UTC
@Aakriti94 hello ji!
Teague Barry
@TeagueRB
Jun 03 2017 06:56 UTC
@saifsmailbox98 I appreciate it still confused
Manish Giri
@Manish-Giri
Jun 03 2017 06:56 UTC
good morning :sunny:
Teague Barry
@TeagueRB
Jun 03 2017 06:56 UTC
visual learner
Aakriti
@Aakriti94
Jun 03 2017 06:57 UTC

In the challenge Make Object Properties Private
My solution is:


var Car = function() {
  // this is a private variable
  var speed = 10;

  // these are public methods
  this.accelerate = function(change) {
    speed += change;
  };

  this.decelerate = function() {
    speed -= 5;
  };

  this.getSpeed = function() {
    return speed;
  };
};

var Bike = function() {

  var gear;

  this.getGear = function(g){
    gear = g;
  };

  this.setGear = function(){
    return gear;
  };

};

var myCar = new Car();

var myBike = new Bike();

where exactly am i going wrong?

Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 06:57 UTC
@TeagueRB post your corrected code
Manish Giri
@Manish-Giri
Jun 03 2017 06:58 UTC
@Aakriti94 your functions are reversed
 this.getGear = function(g){
    gear = g;
  };

  this.setGear = function(){
    return gear;
  };
getGear is supposed to return the value
setGear is supposed to set it
Aleksander Gębicki
@Takumar
Jun 03 2017 07:00 UTC
Hi @Manish-Giri :wave: you are still building this car ;-)
Manish Giri
@Manish-Giri
Jun 03 2017 07:00 UTC
@Takumar lol, yeah
ever the mechanic
:wave:
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:00 UTC
@Aakriti94 your setGear method need a parameter to assign to the private variable gear
Aakriti
@Aakriti94
Jun 03 2017 07:01 UTC
@Manish-Giri thank you! i need to concentrate more on the reading part
CamperBot
@camperbot
Jun 03 2017 07:01 UTC
aakriti94 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 5811 | @manish-giri |http://www.freecodecamp.com/manish-giri
Aleksander Gębicki
@Takumar
Jun 03 2017 07:01 UTC
@Manish-Giri it will be worked out it every detail
Aakriti
@Aakriti94
Jun 03 2017 07:01 UTC
@Lumexralph yeah! ty i figured it out
CamperBot
@camperbot
Jun 03 2017 07:01 UTC
aakriti94 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1866 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:01 UTC
@TeagueRB
var a;
var b = 2;
//a and b are already declared above
a = 7;
b = a;
Aakriti
@Aakriti94
Jun 03 2017 07:02 UTC
completed Object Oriented and Functional Programming
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:02 UTC
@Aakriti94 :+1:
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:02 UTC
@Lumexralph it should work
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:03 UTC
@saifsmailbox98 sorry meant @TeagueRB
Manish Giri
@Manish-Giri
Jun 03 2017 07:03 UTC
@Aakriti94 good job
Martialis39
@Martialis39
Jun 03 2017 07:03 UTC
Hi! Wanted to ask about this. I am trying to set height and width with JS, but its not working
Line 30 in JS
Serhii Borovskyi
@serhiicss
Jun 03 2017 07:15 UTC
Hello! In "Increment a Number with JavaScript" challenge my answer is myVar = myVar++;, but it wont accept.
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:16 UTC
@serhiicss to don't need to assign the value to myVar using = operator
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:16 UTC
@serhiicss myVar++;
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:16 UTC
myVar++; this is all you need
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:18 UTC
@jahidbinkibria Hi
Jahid Bin Kibria
@jahidbinkibria
Jun 03 2017 07:18 UTC
how can i start 100days of codeing?
can you help me @Lumexralph
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:18 UTC
@jahidbinkibria code for 100 days
Jahid Bin Kibria
@jahidbinkibria
Jun 03 2017 07:18 UTC
yes
amitavakundu
@amitavakundu
Jun 03 2017 07:19 UTC

Hi , I'm trying to the exercise "Testing Objects for Properties". Here is my code "/ Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here
var value;
if (myObj.hasOwnProperty("checkProp"))
{
value = myObj.checkProp;
return value;
}
else
{return "Not Found";}
}

// Test your code by modifying these values
checkObj("bed");" - not able to figure out where is the bug

Serhii Borovskyi
@serhiicss
Jun 03 2017 07:19 UTC
@saifsmailbox98 @Lumexralph @saifsmailbox98 , thanks!
CamperBot
@camperbot
Jun 03 2017 07:19 UTC
:cookie: 338 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
serhiicss sends brownie points to @saifsmailbox98 and @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1867 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:19 UTC
@jahidbinkibria i really don't understand your question
@amitavakundu check for checkProp parameter not string
Jahid Bin Kibria
@jahidbinkibria
Jun 03 2017 07:20 UTC
what is the process of 100DaysOfCode
amitavakundu
@amitavakundu
Jun 03 2017 07:21 UTC
@Lumexralph I tried " if (myObj.hasOwnProperty(checkProp))" - same result
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:21 UTC
this is all I got
@jahidbinkibria
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:21 UTC
@amitavakunducheckProp is a parameter, using dot notation to access the object myObj will not work
@amitavakundu show your whole code
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:22 UTC
@amitavakundu try myObj[checkProp]
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:22 UTC
@amitavakundu use the bracket notation instead
amitavakundu
@amitavakundu
Jun 03 2017 07:24 UTC
@abhinav-thinktank Thanks - it worked
CamperBot
@camperbot
Jun 03 2017 07:24 UTC
amitavakundu sends brownie points to @abhinav-thinktank :sparkles: :thumbsup: :sparkles:
:cookie: 349 | @abhinav-thinktank |http://www.freecodecamp.com/abhinav-thinktank
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:33 UTC
How to remove multiple occurrence of elements from an array
Like from [1, 1, 2, 3, 3, 5] to [1, 2, 3, 5] ?
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:33 UTC
@saifsmailbox98 i'll use Set
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:34 UTC
@Lumexralph okay, let me try
mitron6
@mitron6
Jun 03 2017 07:34 UTC
@saifsmailbox98 Set is good with ES6. You might need a hint to make it work.
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:35 UTC
@saifsmailbox98 read the link, it should put you through https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
mitron6
@mitron6
Jun 03 2017 07:36 UTC

@saifsmailbox98

FCC does not use a transpiler like Babel, so whether ES6 is supported depends on your browser. You're fine if you have Chrome, Firefox, or Edge. Safari and all versions of IE before Edge will not work.

To suppress the warnings, add this line to the top of your code:

// jshint esversion:6

Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:37 UTC
@mitron6 okay, thank you
CamperBot
@camperbot
Jun 03 2017 07:37 UTC
saifsmailbox98 sends brownie points to @mitron6 :sparkles: :thumbsup: :sparkles:
:cookie: 707 | @mitron6 |http://www.freecodecamp.com/mitron6
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:46 UTC

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

// Only change code below this line
b = a;

It's saying "Do not change code above the line"
I'm confused.
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:46 UTC
@Raidestro it's a comment
@Raidestro to make sure you don't mess with the setup part
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:47 UTC
But what am I supposed to do here ? It's not getting completed
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:48 UTC
@Raidestro if you have changed the code above that comment try Reset Code button
and again read the objectives
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:48 UTC
@Raidestro assign 7 to a before assigning it to b and don't change the code above as leave it as it was
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:49 UTC
@saifsmailbox98 @Lumexralph Oh thanx ! It worked. I did a stupid mistake
CamperBot
@camperbot
Jun 03 2017 07:49 UTC
raidestro sends brownie points to @saifsmailbox98 and @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 340 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
:star2: 1868 | @lumexralph |http://www.freecodecamp.com/lumexralph
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:50 UTC
By the way, what book would you guys suggest for javascript ?
What sources did you all use to learn ?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:50 UTC
@Raidestro internet is a good book
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:50 UTC
@Raidestro Well i would suggest you code, google read up wherever you can MDN is a good resource
Varun
@varunzxzx
Jun 03 2017 07:51 UTC
I get stuck at Palindromes exercise. I want to replace all the non-alphanumeric characters. Th code I am using is str = str.replace(/\W+/g, ''); but it is not working
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:51 UTC
@Raidestro once youre pretty confident with the basics of the language you can go for books and stuff
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:51 UTC
@saifsmailbox98 @abhinav-thinktank I get that but like is there a reference book ? Which is self sufficient. ?
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:51 UTC
@Raidestro there are many books, but seriously they will get you nowhere if you don't do practical stuff everyday
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:51 UTC
@Raidestro no, I haven't read any, I use google search and mdn
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:51 UTC
@abhinav-thinktank Hmm. Nice idea. Can I learn intermediate javascript through codecamp ?
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:52 UTC
@Raidestro fcc will give you the basics. then you are on your own
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:52 UTC
Hmmm. That's nice.
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:52 UTC
@Raidestro i recommend once youre strong on the fundamental concepts go for books and blogs
Varun
@varunzxzx
Jun 03 2017 07:52 UTC
I get stuck at Palindromes exercise. I want to replace all the non-alphanumeric characters. Th code I am using is str = str.replace(/\W+/g, ''); but it is not working. Please help
Raghu Raj Rai
@Raidestro
Jun 03 2017 07:52 UTC
@saifsmailbox98 @abhinav-thinktank Thanx again !
CamperBot
@camperbot
Jun 03 2017 07:52 UTC
raidestro sends brownie points to @saifsmailbox98 and @abhinav-thinktank :sparkles: :thumbsup: :sparkles:
:warning: raidestro already gave saifsmailbox98 points
:cookie: 350 | @abhinav-thinktank |http://www.freecodecamp.com/abhinav-thinktank
Varun
@varunzxzx
Jun 03 2017 07:54 UTC
I get stuck at Palindromes exercise. I want to replace all the non-alphanumeric characters. Th code I am using is str = str.replace(/\W+/g, ''); but it is not working. Please help
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:54 UTC
@varunzxzx please post your link
Ogundele Olumide
@Lumexralph
Jun 03 2017 07:55 UTC
@varunzxzx can you show the code?
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:55 UTC
@varunzxzx copy paste the code
arjav2002
@arjav2002
Jun 03 2017 07:56 UTC
function orbitalPeriod(arr) {
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  // T = 2 pi underoot((earthRadius+avgAlt)^3/GM)
  for(var i = 0; i < arr.length; i++) {
    var ur = Math.pow(earthRadius + arr[i].avgAlt, 3) / GM;
    var T = 2 * 22 / 7 * Math.pow(ur, 0.5);     // rounding off to nearest whole number
    arr[i] = {name: arr[i].name, orbitalPeriod: Math.ceil(T-0.5)};
  }
  return arr;
}

orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:56 UTC
@varunzxzx it will not replace underscore _
Varun
@varunzxzx
Jun 03 2017 07:56 UTC
function palindrome(str) {
// Good luck!
str = str.replace(/\W+/g, '');
return str;
}
palindrome("ey65*bj6e");
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:57 UTC
@saifsmailbox98 that doesn't replace '_'?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:57 UTC
isn't this what you want ey65bj6e
?
@varunzxzx
@abhinav-thinktank yes, that's what I said
arjav2002
@arjav2002
Jun 03 2017 07:58 UTC
Can someone help? This code is returing [{"name":"sputnik","orbitalPeriod":86434}] whereas the orbital period should be 86400

function orbitalPeriod(arr) {
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  // T = 2 pi underoot((earthRadius+avgAlt)^3/GM)
  for(var i = 0; i < arr.length; i++) {
    var ur = Math.pow(earthRadius + arr[i].avgAlt, 3) / GM;
    var T = 2 * 22 / 7 * Math.pow(ur, 0.5);     // rounding off to nearest whole number
    arr[i] = {name: arr[i].name, orbitalPeriod: Math.ceil(T-0.5)};
  }
  return arr;
}

orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:58 UTC
@saifsmailbox98 are you sure.. im asking
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:58 UTC
@abhinav-thinktank try this then
function palindrome(str) {
// Good luck!
str = str.replace(/\W+/g, '');
return str;
}
palindrome("ey65*b_j6e");
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:58 UTC
@saifsmailbox98 neat, i didn't know that
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:58 UTC
@abhinav-thinktank you will get this ey65b_j6e
Varun
@varunzxzx
Jun 03 2017 07:59 UTC
@saifsmailbox98 I want to result to be "eye"
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:59 UTC
@varunzxzx ???
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:59 UTC
@varunzxzx you are using it incorrently then
Abhinav Mishra
@abhinav-m
Jun 03 2017 07:59 UTC
@varunzxzx yea.. b and j are alphabets.. 6 is a number
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 07:59 UTC
@varunzxzx alphanumeric stands for alphabets and numbers
Varun
@varunzxzx
Jun 03 2017 07:59 UTC
ohh ok
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 08:00 UTC
@varunzxzx str = str.replace(/[^a-zA-Z]+/g, '');
@varunzxzx use this
Varun
@varunzxzx
Jun 03 2017 08:02 UTC
thanks i t worked but may I know how it works?
if it's not ^ in [ ] a-z or A-Z ( + one or more) replace it with ''
Varun
@varunzxzx
Jun 03 2017 08:06 UTC
ok thanks @saifsmailbox98
CamperBot
@camperbot
Jun 03 2017 08:06 UTC
varunzxzx sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
:cookie: 341 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 08:06 UTC
@varunzxzx you are welcome
Varun
@varunzxzx
Jun 03 2017 08:07 UTC
how to include numbers also @saifsmailbox98
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 08:07 UTC
@varunzxzx str = str.replace(/[^a-zA-Z0-9]+/g, '');
Varun
@varunzxzx
Jun 03 2017 08:08 UTC
got it
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 08:08 UTC
@varunzxzx :+1:
Conor Murphy
@cmurphy580
Jun 03 2017 08:18 UTC
hey can anyone tell me why you would return the 'curr' value in this function?
function tailAndHead(arr){
  var prod = 1;
  arr.reduce((prev, curr)=>{
    var s1 = prev.toString();
    var s2 = curr.toString();
    prod   *= parseInt(s1[s1.length-1]) + parseInt(s2[0]);
    return curr 
  });
  return prod;
Ogundele Olumide
@Lumexralph
Jun 03 2017 08:30 UTC
@cmurphy580 that'll be used as the accumulator that holds the value of the previous operation for the reduce method callback
@cmurphy580 if i may ask, why using reduce here ?
Conor Murphy
@cmurphy580
Jun 03 2017 08:32 UTC
@Lumexralph isn't the accumulator usually the first value? I was doing this codeWars problem. Told us we had to use reduce. Training JS #30: methods of arrayObject---reduce() and reduceRight()
Ogundele Olumide
@Lumexralph
Jun 03 2017 08:33 UTC
@cmurphy580 accumulator is the result returned but it can be the first element in the array, in cases where it's not provided
Conor Murphy
@cmurphy580
Jun 03 2017 08:47 UTC
@Lumexralph i don't get the correct answer but wouldn't it make more sense to return the 'prod' value
Long Nguyen
@longnt80
Jun 03 2017 08:49 UTC
@cmurphy580 return curr doesn't make sense
Chaitanya Giri
@chaitanyagiri
Jun 03 2017 09:00 UTC
function gcd(a,b){
  if(b===0)
    return a;
  return gcd(b,a%b);
}
function smallestCommons(arr) {
  var ans = arr[0];
  for(var i = Math.min(arr[0],arr[1])+1 ; i <= Math.max(arr[0],arr[1]) ; i++){
    ans = (i*ans)/gcd(i,ans);
  }
  return ans;
}


smallestCommons([23, 18]);
hey can anyone tellme why [23,18] is not giving correct answer here?
Zahir Nabizada
@zahir-nbz
Jun 03 2017 09:08 UTC
how can I use the camelCase in both declaration and assignment sections?
can anyone help please?
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 09:14 UTC
@zahir-nbz Yes.
@zahir-nbz What do you mean use the camelCase?
calistaL
@calistaL
Jun 03 2017 09:15 UTC
var myStr='"FirstLine\"\n"\SecondLine\\"\r"ThirdLine\"';
is there anything wrong with that ^ ?
"FirstLine
\SecondLine\
ThirdLine"
im supposed to return that ^ but its saying that myStr should have encoded text with proper escape sequences and no spacing
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:17 UTC
@calistaL yes, you are doing it wrong
calistaL
@calistaL
Jun 03 2017 09:17 UTC
@saifsmailbox98 oh! whats wrong with it?
Chaitanya Giri
@chaitanyagiri
Jun 03 2017 09:17 UTC
@calistaL use &quot instead
Zahir Nabizada
@zahir-nbz
Jun 03 2017 09:17 UTC
I'm stuck in the challenge "case sensitivity". I'm asked to use camelCase in both sections, the assignment and decalaration
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:18 UTC
image.png
@calistaL
this must be the result, no need to put quotes
Markus Ivancsics
@ivancsicsmarkus
Jun 03 2017 09:18 UTC
@zahir-nbz Yes. Camelcase means that you write every word starting with a capital. So change your variable’s names!
@zahir-nbz and everything.
calistaL
@calistaL
Jun 03 2017 09:19 UTC
@saifsmailbox98 ohh alright, I'll try it out
heroiczero
@heroiczero
Jun 03 2017 09:19 UTC
@zahir-nbz camelCase thats your example for camel case
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:19 UTC
image.png
@calistaL
Zahir Nabizada
@zahir-nbz
Jun 03 2017 09:19 UTC
I'm asked to
calistaL
@calistaL
Jun 03 2017 09:19 UTC
@chaitanyagiri Thank you!
CamperBot
@camperbot
Jun 03 2017 09:19 UTC
calistal sends brownie points to @chaitanyagiri :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @chaitanyagiri |http://www.freecodecamp.com/chaitanyagiri
Zahir Nabizada
@zahir-nbz
Jun 03 2017 09:19 UTC
use it studlyCapVar
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:19 UTC
@saifsmailbox98 use escape sequence for everything mentioned in pink in the last image that I just posted
@calistaL
Zahir Nabizada
@zahir-nbz
Jun 03 2017 09:20 UTC
it says "studylyCapVar should use camelCase in both sections".
and the value should be defined as 10
Chaitanya Giri
@chaitanyagiri
Jun 03 2017 09:21 UTC
studyLyCapVar = 10; must be it @zahir-nbz
calistaL
@calistaL
Jun 03 2017 09:21 UTC
@saifsmailbox98 so do i just type \n to get a newline ?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:21 UTC
@calistaL yes
Zahir Nabizada
@zahir-nbz
Jun 03 2017 09:22 UTC

this is it :
// Declarations
var studylyCapVar;
var properCamelCase;
var titleCaseOver;

// Assignments
studlyCapVar =10;
properCamelCase = "A String";
titleCaseOver = 9000;

Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:22 UTC
studlyCapVar is not as same as studylyCapVar;
@zahir-nbz
Conor Murphy
@cmurphy580
Jun 03 2017 09:22 UTC
@longnt80 thats what i thought but it works for the problem
arjav2002
@arjav2002
Jun 03 2017 09:22 UTC
https://codepen.io/agprg/pen/dRyRem?editors=1100
Can someone help? My bottom radius does not seem to be working
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:23 UTC
@zahir-nbz studly vs studyly
calistaL
@calistaL
Jun 03 2017 09:23 UTC
@saifsmailbox98 Thank you so much!
CamperBot
@camperbot
Jun 03 2017 09:23 UTC
calistal sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
:cookie: 344 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
Zahir Nabizada
@zahir-nbz
Jun 03 2017 09:23 UTC
oh right thanks @saifsmailbox98 hehe
thank you @saifsmailbox98
CamperBot
@camperbot
Jun 03 2017 09:24 UTC
zahir-nbz sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
:cookie: 345 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:25 UTC
@arjav2002 try building your calculator without much css and first add functionality to it using js then prettify it and add more css.

@arjav2002
add

   border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;

to .calc-div

or do you want the bottom of the screen to be rounded?
@arjav2002
Junpanda94
@Junpanda94
Jun 03 2017 09:28 UTC
var a = 5;
var b = 10;
var c = I am a;
guys is there anythign wrong
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:29 UTC
@Junpanda94 what is the objective?
heroiczero
@heroiczero
Jun 03 2017 09:29 UTC
@Junpanda94 is var c a string need "" quotes.
BrunoM24
@BrunoM24
Jun 03 2017 09:29 UTC
@Junpanda94 var c = "I am a";
Junpanda94
@Junpanda94
Jun 03 2017 09:29 UTC
oh it needs quote?
thanks
BrunoM24
@BrunoM24
Jun 03 2017 09:30 UTC
@Junpanda94 to be a string yes, if you want that C be equal to A just do var c = a;
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:33 UTC
Anyone figured out regex for plaindrome question?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:33 UTC
@ashishpatel1992 what do you want to filter?
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:34 UTC
I want to filter out *$:\/ characters
all non-alphanumeric characters
heroiczero
@heroiczero
Jun 03 2017 09:35 UTC
@ashishpatel1992 use regexp
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:35 UTC
but unable to write it
heroiczero
@heroiczero
Jun 03 2017 09:35 UTC
@ashishpatel1992 http://eloquentjavascript.net/09_regexp.html try reading up on it
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:35 UTC
@ashishpatel1992 use str = str.replace(/[^a-zA-Z0-9]/g,"");
BrunoM24
@BrunoM24
Jun 03 2017 09:35 UTC
@ashishpatel1992 try to filter all the alphanumeirc characters, is easier
Will White
@willnwhite
Jun 03 2017 09:35 UTC
@ashishpatel1992 Do you know about regex101.com?
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:36 UTC
Yes
I am using [a-z]+[0-9]
BrunoM24
@BrunoM24
Jun 03 2017 09:36 UTC
@ashishpatel1992 str = str.replace(/[^a-zA-Z0-9]/g, "");
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:36 UTC
@ashishpatel1992 using \W will also filter underscores
Will White
@willnwhite
Jun 03 2017 09:36 UTC
@ashishpatel1992 See the regex that @saifsmailbox98 wrote.
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:36 UTC
Ok Let me try..
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:37 UTC
small little regex reference
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:39 UTC
why /[a-z]star + [0-9] star/g dosnt work
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:40 UTC
@ashishpatel1992 why are you using both * and + ?
@ashishpatel1992 + it's not the same join operator for regex
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:40 UTC
  • means to go infinite a-z and + means to go find infinite 0-9?
I mean plus is for or?
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:41 UTC
@ashishpatel1992 plus is for 1 or more
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:41 UTC
oh.. What is the sign for OR?
THrytsaienko
@THrytsaienko
Jun 03 2017 09:41 UTC

Hello to everyone! Can you help in this challange

function multiplyAll(arr) {
var product = 1;

return product;}

multiplyAll([[1,2],[3,4],[5,6,7]]);

Instructions
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr

result: multiplyAll([[1],[2],[3]]); should return 6
multiplyAll([[1,2],[3,4],[5,6,7]]) should return 5040
multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]);) should return 54

Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:41 UTC
@saifsmailbox98 |
@ashishpatel1992
heroiczero
@heroiczero
Jun 03 2017 09:42 UTC
@THrytsaienko do it similar to to example to the left just make sure you are using product*=
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:42 UTC
Opps.. thanks a lot @saifsmailbox98 I messed up with my Theory of Computation subject from my schooling
CamperBot
@camperbot
Jun 03 2017 09:42 UTC
ashishpatel1992 sends brownie points to @saifsmailbox98 :sparkles: :thumbsup: :sparkles:
:cookie: 346 | @saifsmailbox98 |http://www.freecodecamp.com/saifsmailbox98
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:42 UTC
@THrytsaienko you are calling the function itself from the function multiplyAll([[1,2],[3,4],[5,6,7]]);
BrunoM24
@BrunoM24
Jun 03 2017 09:42 UTC
@THrytsaienko you will need to loop through every subArray and multiply
Ashish Patel
@ashishpatel1992
Jun 03 2017 09:44 UTC
@BrunoM24 I think he is trying to answers someone else question
@saifsmailbox98
THrytsaienko
@THrytsaienko
Jun 03 2017 09:45 UTC
@heroiczero Thank you! Use product instead of what?
CamperBot
@camperbot
Jun 03 2017 09:45 UTC
thrytsaienko sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1341 | @heroiczero |http://www.freecodecamp.com/heroiczero
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 09:45 UTC
@THrytsaienko try using nested for loops to get to every element and then use product*=element
heroiczero
@heroiczero
Jun 03 2017 09:46 UTC
@ashishpatel1992 your trying to access the array within the array so you need for loops similar to the "example" on the left of your page
Keon Samuel
@keonsam
Jun 03 2017 09:47 UTC
anyone uses bitbucket?
Adolphoramirez
@Adolphoramirez
Jun 03 2017 09:56 UTC
Hi guys !
need some help to find a world and not ust a character

function confirmEnding(str, target) {

var firstLetter = str.substring(str.length-1);

if (firstLetter==target){

return true;

}

else {
return false;
}

return str;
}

confirmEnding("Bastian", "n");

codebook92
@codebook92
Jun 03 2017 09:57 UTC
prime number program ?????
Adolphoramirez
@Adolphoramirez
Jun 03 2017 09:57 UTC
what am i missing ?
codebook92
@codebook92
Jun 03 2017 09:57 UTC
can any 1 help
Adolphoramirez
@Adolphoramirez
Jun 03 2017 09:57 UTC
for ?
codebook92
@codebook92
Jun 03 2017 09:57 UTC
how to do that
Varun Arya
@varunarya002
Jun 03 2017 10:00 UTC
try using Array.prototype.slice()
Saif Ur Rahman
@saifsmailbox98
Jun 03 2017 10:01 UTC
but first you need to split the string into characters
Keon Samuel
@keonsam
Jun 03 2017 10:01 UTC
use also need a loop.
Varun Arya
@varunarya002
Jun 03 2017 10:02 UTC
@codebook92 tell me about your prime number code
Keon Samuel
@keonsam
Jun 03 2017 10:02 UTC
or index of
on the array
BrunoM24
@BrunoM24
Jun 03 2017 10:04 UTC
@Adolphoramirez help you in what?
codebook92
@codebook92
Jun 03 2017 10:10 UTC
@varunarya002 no idea how to that
Varun Arya
@varunarya002
Jun 03 2017 10:19 UTC
@codebook92 well you can use brute force method by using nested loop and comparing that number starting from 2 to n . Using condition (n%i == 0) to check whether it is divisible or not.
Gajendra Choudhary
@Gajendra-diaries
Jun 03 2017 10:21 UTC
@Adolphoramirez use target in your substring not the string length . think about it .
Ben said
@BenSaidRachid
Jun 03 2017 10:31 UTC
hi all ,for "Record Collection" challenge,how could i compare,the given id with the collection?

// 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) {


  return collection["5439"];
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Tiago Correia
@tiagocorreiaalmeida
Jun 03 2017 10:34 UTC
what's the best way to convert a argument into a array
Ben said
@BenSaidRachid
Jun 03 2017 10:38 UTC
@varunarya002 thanks i will see
CamperBot
@camperbot
Jun 03 2017 10:38 UTC
abdel974 sends brownie points to @varunarya002 :sparkles: :thumbsup: :sparkles:
:cookie: 294 | @varunarya002 |http://www.freecodecamp.com/varunarya002
Stephen James
@sjames1958gm
Jun 03 2017 10:44 UTC
@tiagocorreiaalmeida The MDN page shows several ways. Array.from seems the most explicit
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:46 UTC

I have 2 arrays eg

var arr = [[1,2],[0,3],[0,5],[6,7]];
var checkArr = [1,2];
arr.indexOf(checkArr) // doesnt work
arr.includes(checkArr)//doesnt work

I want to find out if checkArr is in the array arr How can i do this?

@tiagocorreiaalmeida take the arguments object
Varun Arya
@varunarya002
Jun 03 2017 10:46 UTC
@tiagocorreiaalmeida using split() function and join(' ') afterwards
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:46 UTC
@tiagocorreiaalmeida push it into a new array using a for loop
Pieter Stokkink
@forkerino
Jun 03 2017 10:47 UTC
Hello
Will White
@willnwhite
Jun 03 2017 10:47 UTC
Hi Pieter.
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:47 UTC
@tiagocorreiaalmeida something like
for(i=0;i<args.length;i++)
arr.push(args[i]);

@forkerino Hey, can you help me with this
I have 2 arrays eg

var arr = [[1,2],[0,3],[0,5],[6,7]];
var checkArr = [1,2];
arr.indexOf(checkArr) // doesnt work
arr.includes(checkArr)//doesnt work

I want to find out if checkArr is in the array arr How can i do this?

Stephen James
@sjames1958gm
Jun 03 2017 10:48 UTC
@abhinav-thinktank You will have to loop over arr and compare each number separately. You cannot compare arrays with indexOf or include
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:48 UTC
@sjames1958gm ouch.
@sjames1958gm any in built methods?
Stephen James
@sjames1958gm
Jun 03 2017 10:48 UTC
@abhinav-thinktank You might use find where you can provide a function to make the compare
Pieter Stokkink
@forkerino
Jun 03 2017 10:49 UTC
@abhinav-thinktank yeah, what Stephen says. All arrays are their own object, so you cannot compare them directly.
Will White
@willnwhite
Jun 03 2017 10:49 UTC
@abhinav-thinktank You can't compare arrays using === or == (what indexOf and includes do).
OlaNeat Ayoola
@olaneat
Jun 03 2017 10:49 UTC
hello guyz
Stephen James
@sjames1958gm
Jun 03 2017 10:49 UTC
@forkerino :wave:
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:49 UTC
okay, thanks. So im guessing only primitives arent objects in java
javascript*
Pieter Stokkink
@forkerino
Jun 03 2017 10:49 UTC
@sjames1958gm Hello. How are things?
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:49 UTC
@sjames1958gm @willnwhite @forkerino ty
CamperBot
@camperbot
Jun 03 2017 10:49 UTC
abhinav-thinktank sends brownie points to @sjames1958gm and @willnwhite and @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2406 | @forkerino |http://www.freecodecamp.com/forkerino
:cookie: 333 | @willnwhite |http://www.freecodecamp.com/willnwhite
:star2: 7601 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
OlaNeat Ayoola
@olaneat
Jun 03 2017 10:50 UTC
sowie i need help on this link https://www.freecodecamp.com/challenges/stand-in-line#?solution=%0Afunction nextInLine(arr%2C item) {%0A %2F%2F Your code here%0A %0A return item%3B %2F%2F Change this line%0A}%0AnextInLine([2]%2C 1)%3B%0A%2F%2F Test Setup%0Avar testArr %3D [1%2C2%2C3%2C4%2C5]%3B%0A%0A%2F%2F Display Code%0Aconsole.log("Before%3A " %2B JSON.stringify(testArr))%3B%0Aconsole.log(nextInLine(testArr%2C 6))%3B %2F%2F Modify this line to test%0Aconsole.log("After%3A " %2B JSON.stringify(testArr))%3B%0A
Pieter Stokkink
@forkerino
Jun 03 2017 10:50 UTC
@abhinav-thinktank pretty much
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:50 UTC
allright, thanks for the info
Will White
@willnwhite
Jun 03 2017 10:50 UTC
@abhinav-thinktank It's the difference between value types (like numbers) and reference types (like arrays).
Abhinav Mishra
@abhinav-m
Jun 03 2017 10:50 UTC
ok.
the objects can't be compared directly makes sense.
Pieter Stokkink