13th
Nov 2016
AudioGen
@AudioGen
Nov 13 2016 00:00
that would space escape from Letme
Joseph
@revisualize
Nov 13 2016 00:00
@tvan082998 You're supposed to escape the words in this string:
"FirstLine newline backslash SecondLine backslash carriage-return ThirdLine"
You're also supposed to remove the spaces.
silver537
@silver537
Nov 13 2016 00:00
that was some good shit :D
AudioGen
@AudioGen
Nov 13 2016 00:00
maybe you aren't using " "
or you can use single quotes as well
just got to be consistent
Joseph
@revisualize
Nov 13 2016 00:01
@AudioGen JS Style Guides state to use "s
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:01
@tvan082998 here is solution (var myStr ="FirstLine\n\SecondLine\\rThirdLine"; // Change this line)
in instructions
Joseph
@revisualize
Nov 13 2016 00:01
And that doesn't work.
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:02
var myStr ="FirstLine\n\SecondLine\\rThirdLine"; // Change this line
lol
when i try to copy this
Joseph
@revisualize
Nov 13 2016 00:02
:|
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:02
in subsracts extra \
look
tvan082998
@tvan082998
Nov 13 2016 00:02
var myStr = "FirstLine\n \SecondLine\ \rThirdLine"; // Change this line
Joseph
@revisualize
Nov 13 2016 00:02
@SviatoslavOhura That is gitter.
tvan082998
@tvan082998
Nov 13 2016 00:02
that what i use and still said it wrong
AudioGen
@AudioGen
Nov 13 2016 00:02
@revisualize Ah Ok but sometimes when you want to use quotes it's easier to read, at least for me having the combination of single and double quotes as opposed to backslashes everywhere
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:02
put \ after \n with no spaces, and triple \ before r
Joseph
@revisualize
Nov 13 2016 00:02

How to do code block format:
js [SHIFT+ENTER]
 [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse s with 's.
Also note that the s need to each be on their own lines
The  key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+ it will give you the ~.
Example:

code

...
Output:

var code = undefined;

...
You can also do inline code formatting:
A string of text with a variable or other bit of code.
Output:
A string of text with a variable or other bit of code.

AudioGen
@AudioGen
Nov 13 2016 00:03
Also with RegExp sometimes it's good to have both ways at your disposable
Joseph
@revisualize
Nov 13 2016 00:03
@AudioGen But, companies usually use the Airbnb or Google JS Style Guide.
silver537
@silver537
Nov 13 2016 00:03
@AudioGen can you even regEX?
AudioGen
@AudioGen
Nov 13 2016 00:03
@revisualize Ok, I will keep that in mind if I apply for a job
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:03
var myStr ="FirstLine(slash)n(slash)(slash)SecondLine(slash)(slash)(slash)rThirdLine"; // Change this line
))
AudioGen
@AudioGen
Nov 13 2016 00:03
@silver537 what do you mean?
tvan082998
@tvan082998
Nov 13 2016 00:04
silver537
@silver537
Nov 13 2016 00:04
@tvan082998 im kidding
tvan082998
@tvan082998
Nov 13 2016 00:04
thanks guys
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:05
@revisualize I still dont get it after reading that thing like 3times
Justin Vernon
@Jvernz
Nov 13 2016 00:05

function mutation(arr) {
var string;

string = arr.join().toLowerCase().split(",");
if (){
return true;
}
else {
return false;
}
}

mutation(["hello", "hey"]);
Can anyone point me in the right direction to solving Mutations? I can't figure out what my if statement should be and if it should be nested in a loop or not.
Joseph
@revisualize
Nov 13 2016 00:05
@SviatoslavOhura You should learn how to format code.
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:05
how do you think guys, after finish lots of these courses, are you getting really strong knowledge in JS?
i mean, developing your own projects and stuff
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:06
where do I even start...

var result = "";
// Your code below this line

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
AudioGen
@AudioGen
Nov 13 2016 00:06
@Jvernz when you shift, you're removing the first character or index from your value
Joseph
@revisualize
Nov 13 2016 00:06

@WhiteLeaf1103 Parameters are variables that represent the values that get passed into your function from the function call.
https://cs.wellesley.edu/~cs110/lectures/L16/images/function-anatomy.png
Notice how the variables level and score in the function definition addScore are called parameters.
However, when we invoke the function like in:
addScore(3, 10) or addScore(6, 20)
the values are called arguments. Here is an important lesson:
You define a function with parameters, you call a function with arguments.

Another example of this:

function hello(fName, uName) {
return "Hello " + fName + " " + uName + ", How is your day?";
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

Other important things to remember:
* A function can have zero parameters. You still have to use the parentheses to define it.
* A function might have no return statements. In this case we say that the function returns undefined.

Justin Vernon
@Jvernz
Nov 13 2016 00:06
@AudioGen Correct, that's what I want
AudioGen
@AudioGen
Nov 13 2016 00:06
It doesn't appear to really be beneficial for that challenge
tvan082998
@tvan082998
Nov 13 2016 00:06
i learn js like 2 years ago now i barely remember
AudioGen
@AudioGen
Nov 13 2016 00:06
why?
Justin Vernon
@Jvernz
Nov 13 2016 00:07
@AudioGen Because I want to take the first 2 values from the array out of the array and compare them to each other
AudioGen
@AudioGen
Nov 13 2016 00:07
are you trying to turn the first argument into the 2nd argument?
oh
Phillip Kelley-Dotson
@pkdotson
Nov 13 2016 00:07
Javascript is such a mind fuck. ugh!
Justin Vernon
@Jvernz
Nov 13 2016 00:07
I'm just not sure how to go through with the comparison
Emily Christensen
@emmalee113
Nov 13 2016 00:08
can someone please help me with the challenge, "Selecting from many options with Switch Statements". i understand the concept i just can't figure out how i need to write this exactly so that it works
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:09
@revisualize im sorry.... but your not helping me. It doesnt make any sense. I appreciate the effort and explanation it's just isn't working for me.
Joseph
@revisualize
Nov 13 2016 00:09
@WhiteLeaf1103 you just need to construct a string with the parameters.
AudioGen
@AudioGen
Nov 13 2016 00:09
@Jvernz when you are using .shift() you are removing the first letter from the string
or if it's an array, the first value
Joseph
@revisualize
Nov 13 2016 00:10
@WhiteLeaf1103 I don't know how to explain it any differently. I basically showed you how to do the lesson with my other example.
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:10
no cause they want me to edit inside the function
Justin Vernon
@Jvernz
Nov 13 2016 00:11
@AudioGen correct. Mutations specifically says to compare the first argument to the second argument in an array. If I do it by shifting the first two arguments out, it doesn't matter how long the array is, I will always be comparing the first two arguments
Joseph
@revisualize
Nov 13 2016 00:11
@WhiteLeaf1103 But, you still need to use the parameters.
zack
@acting2332
Nov 13 2016 00:11
Hey guys for the escape sequenace in string i have this var myStr="\n\ \ \r"; but its saying i need proper escape and no spacing but i have checks on rest
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:11
use the parameters where!?
tvan082998
@tvan082998
Nov 13 2016 00:11
Who have gotten a certificate from here?
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:11
inside the var result?
Joseph
@revisualize
Nov 13 2016 00:11
@acting2332
AudioGen
@AudioGen
Nov 13 2016 00:12
@Jvernz You could just split() which you did
tvan082998
@tvan082998
Nov 13 2016 00:12
the secondline require 2 back from start and end
AudioGen
@AudioGen
Nov 13 2016 00:12
@Jvernz once you do that, it becomes strings, or you could not split it and then do your shift() approach
Joseph
@revisualize
Nov 13 2016 00:12
@WhiteLeaf1103 Your function is returning result .. So, yes.. You need to reassign result
tvan082998
@tvan082998
Nov 13 2016 00:13
so "first\n 2\second2\ \rthird";
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:13
why does it say to change below? i dont understand that...
Justin Vernon
@Jvernz
Nov 13 2016 00:13
@AudioGen I had to shift everything to lower case. I'm fine with how I've gotten the values independent from each other. I just don't know how to use indexOf to compare them to each other and solve the algorithm
Joseph
@revisualize
Nov 13 2016 00:13
@WhiteLeaf1103 Because they want you to specifically reassign a variable.
AudioGen
@AudioGen
Nov 13 2016 00:14
@Jvernz I'll go try it out, I don't think that's correct how you have it
Justin Vernon
@Jvernz
Nov 13 2016 00:14
@AudioGen Alright cool thank you!
CamperBot
@camperbot
Nov 13 2016 00:14
jvernz sends brownie points to @audiogen :sparkles: :thumbsup: :sparkles:
JakeVittoriso
@JakeVittoriso
Nov 13 2016 00:14
Hey guys, I have I am having difficulties trying to figure out this code.
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:14
@revisualize can you please just show me how its suppose to be done. This is just making me despair even more.... I'm not getting it at all.
Joseph
@revisualize
Nov 13 2016 00:14
@WhiteLeaf1103 How do you reassign a variable?
@WhiteLeaf1103 I already showed you how to do it.

@WhiteLeaf1103
Another example of this:

function hello(fName, uName) {
return "Hello " + fName + " " + uName + ", How is your day?";
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:15
@revisualize no how this is suppose to be coded...
Joseph
@revisualize
Nov 13 2016 00:15
Would it be better if I did this.
JakeVittoriso
@JakeVittoriso
Nov 13 2016 00:15
/Users/JakeVittorioso/Library/Mobile Documents/com~apple~Preview/Documents/Stand In Line.png Hey guys, I have I am having difficulties trying to figure out this code.
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:16
your example is not the same as my problem so I'm having a super difficult time connecting it.
Joseph
@revisualize
Nov 13 2016 00:16

@WhiteLeaf1103
Another example of this:

function hello(fName, uName) {
var result = ""
result =  "Hello " + fName + " " + uName + ", How is your day?";
return result;
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:16
that looks more right. @revisualize thank you so much.
CamperBot
@camperbot
Nov 13 2016 00:16
whiteleaf1103 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2298 | @revisualize |http://www.freecodecamp.com/revisualize
zack
@acting2332
Nov 13 2016 00:17
var myStr="firstline\n\ \secondline\ \\rthirdline"; i just dont know
Joseph
@revisualize
Nov 13 2016 00:17
@acting2332 firstline is not the same a s FirstLine
Same for the other two.
@acting2332 You're also supposed to remove the spaces.
Joseph Chu
@ChewyCodes
Nov 13 2016 00:19
need help with Local Scope and functions

function myLocalScope() {
'use strict';

console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);

// Now remove the console log line to pass the test
Instructions
Declare a local variable myVar inside myLocalScope. Run the tests and then follow the instructions commented out in the editor.
zack
@acting2332
Nov 13 2016 00:21
@revisualize AH THANKS SO MUCH
CamperBot
@camperbot
Nov 13 2016 00:21
acting2332 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2299 | @revisualize |http://www.freecodecamp.com/revisualize
zack
@acting2332
Nov 13 2016 00:21
i over look the little stuff alot
AudioGen
@AudioGen
Nov 13 2016 00:21
@Jvernz Well it looks like it just needs to the letters to match from the 2nd to 1st, so indexOf() might not be the best method to use
Gabi
@JJcreated
Nov 13 2016 00:27
hey guys, im doing the ceasars cipher challenge and im a bit confused, i know i have to tell the console how to encode/decode ROT13, but how would i go about telling the computer to do that?
would it be through declaring a new variable?
Diego Mayer
@Chrono79
Nov 13 2016 00:29
@JCDevelop3d any idea on how to do this: Declare a local variable myVar inside myLocalScope ?
Joseph Chu
@ChewyCodes
Nov 13 2016 00:29
umm no i'm trying to figure it out myself
Diego Mayer
@Chrono79
Nov 13 2016 00:30
Gabi
@JJcreated
Nov 13 2016 00:31
@Chrono79 both these are already solved
ust fine
just*
Joseph Chu
@ChewyCodes
Nov 13 2016 00:31
@Chrono79 so baiscally your telling me to figure it out on my own.
Diego Mayer
@Chrono79
Nov 13 2016 00:32
@JCDevelop3d it's not figuring it out, there you have the examples on how to do that
If you don't remember how to do it, a refresh will help
Joseph Chu
@ChewyCodes
Nov 13 2016 00:32
ok got it
Justin Vernon
@Jvernz
Nov 13 2016 00:32
@AudioGen That was my thought. But that's the suggested method
Gabi
@JJcreated
Nov 13 2016 00:32
oh nvm, sorry
hey can anybody help me out with ceasars cipher?
Diego Mayer
@Chrono79
Nov 13 2016 00:34
it's a little more complex that only declaring a new variable, you need to use some if/else structure, a loop of some sort... @JJcreated
AudioGen
@AudioGen
Nov 13 2016 00:36
@Jvernz I don't remember then
Sorry
Got to take off now
Justin Vernon
@Jvernz
Nov 13 2016 00:37
@AudioGen No problem, thanks for your previous help
CamperBot
@camperbot
Nov 13 2016 00:37
:warning: jvernz already gave audiogen points
jvernz sends brownie points to @audiogen :sparkles: :thumbsup: :sparkles:
Justin Vernon
@Jvernz
Nov 13 2016 00:39
Anyone out there who can assist me with the Mutations challenge?
Diego Mayer
@Chrono79
Nov 13 2016 00:39
silver537
@silver537
Nov 13 2016 00:40
@JCDevelop3d yes. the main part of learning is struggling. if you have help, you'll never learn.
Justin Vernon
@Jvernz
Nov 13 2016 00:40
function mutation(arr) {
var string;

string = arr.join().toLowerCase().split(",");

return true;
}
else {
return false;
}
}

mutation(["hello", "hey"]);
I know my if statement is wrong
zack
@acting2332
Nov 13 2016 00:40
var myStr = "This is the start. " + "This is the end. ";
not sure whats wrong with this
Diego Mayer
@Chrono79
Nov 13 2016 00:41
@Jvernz ok, you need to find out is every letter of the second word is in the first one
Justin Vernon
@Jvernz
Nov 13 2016 00:41
I'm not sure how to check the strings for specific letters.
Jeremy P-K
@Jerediablo
Nov 13 2016 00:41

function sumFibs(num) {
var arr = [1,1];
var x;
for ( var i=0; i <= num; i++){
x = x + (arr[i+1] + arr[i]);
arr.push(x);
}
return arr;
}

sumFibs(10);
what am I doing wrong that this is freezing my browser ?
Diego Mayer
@Chrono79
Nov 13 2016 00:41
@acting2332 the space in the second string, is it there in the challenge?
Jeremy P-K
@Jerediablo
Nov 13 2016 00:41
is the loop not stopping or what
Diego Mayer
@Chrono79
Nov 13 2016 00:42
@Jerediablo initialize x as 0
zack
@acting2332
Nov 13 2016 00:42
@Chrono79 yup that was it thank you haha
CamperBot
@camperbot
Nov 13 2016 00:42
acting2332 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2506 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 13 2016 00:43
no problem
Justin Vernon
@Jvernz
Nov 13 2016 00:43
@Chrono79 What can I do to check for the letters in each string?
Diego Mayer
@Chrono79
Nov 13 2016 00:43
@Jvernz use a loop to go through each letter, and check how indexOf is used, it's in this case yourString.indexOf(theLetterYouWantToTest)
Jeremy P-K
@Jerediablo
Nov 13 2016 00:44
@Chrono79 still frozen :worried:
Diego Mayer
@Chrono79
Nov 13 2016 00:46
@Jerediablo x = x + (arr[i+1] + arr[i]); this is wrong
and it doesn't freeze here : https://repl.it/ERbB/1
Fibonacci numbers are 1, 1, 2, 3, 5, 8...
You get with that algorithm 1, 1, 2, 5, 12, 29...
Justin Vernon
@Jvernz
Nov 13 2016 00:47
@Chrono79 Okay I'd thought about doing that. If I want to test a specific letter by order of how they appear in the string, can i just type myString.indexOf(num)?
Jeremy P-K
@Jerediablo
Nov 13 2016 00:48
@Chrono79 ah yes, I see how that line is wrong. Not sure why its freezing in freecodecamp
Johnny
@JohnnyBizzel
Nov 13 2016 00:48
@Jvernz indexOf(letter) letter == character
Diego Mayer
@Chrono79
Nov 13 2016 00:48
@Jvernz num there should be a letter
Justin Vernon
@Jvernz
Nov 13 2016 00:49
@Chrono79 @JohnnyBizzel I get that, but I'm trying to check for a letter in the middle of a word. Suppose I don't know what that letter is. Like I don't want to hard code the letters in
Gabi
@JJcreated
Nov 13 2016 00:49
@Chrono79 yeah im all set if with my loop and new var for storing temporary values but its the method of telling the computer that A === N that im struggling with
Nov 13 2016 00:49
i am making a website, but the directory is "example.com/abcdefgh/ijklmno_pqr/stuv.php" how do i make "example.com"
any suggestions
Johnny
@JohnnyBizzel
Nov 13 2016 00:49
@Jvernz It will return the index in the string array
Justin Vernon
@Jvernz
Nov 13 2016 00:50
@JohnnyBizzel awesome that's what I wanted to know. @Chrono79 thanks guys!
CamperBot
@camperbot
Nov 13 2016 00:50
jvernz sends brownie points to @johnnybizzel and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2507 | @chrono79 |http://www.freecodecamp.com/chrono79
Johnny
@JohnnyBizzel
Nov 13 2016 00:50
@laravelblade Change the web server setting
Patkaa
@Patkaa
Nov 13 2016 00:50
Hey people!
Nov 13 2016 00:50
@JohnnyBizzel how?
Diego Mayer
@Chrono79
Nov 13 2016 00:50
@JJcreated show what you have so we can see how we can point you in the right direction
silver537
@silver537
Nov 13 2016 00:50
@Jvernz well you can do a little math
Patkaa
@Patkaa
Nov 13 2016 00:51

// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
return myObj[checkProp];
}
else{
}
}

// Test your code by modifying these values
checkObj("gift");
Diego Mayer
@Chrono79
Nov 13 2016 00:51
"gift" is one of the possible values you can call your function with
Patkaa
@Patkaa
Nov 13 2016 00:51
@Chrono79 checkProp?
Diego Mayer
@Chrono79
Nov 13 2016 00:51
yes
Justin Vernon
@Jvernz
Nov 13 2016 00:52
@silver537 what do you mean?
Jeremy P-K
@Jerediablo
Nov 13 2016 00:52
CamperBot
@camperbot
Nov 13 2016 00:52
jerediablo sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2508 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 13 2016 00:52
:+1:
Johnny
@JohnnyBizzel
Nov 13 2016 00:52
@laravelblade Most servers look for a default page of /index.php or /index.html. You will have to tell it the home or default page is different. This depends on the apache server setting.
Patkaa
@Patkaa
Nov 13 2016 00:52
checkObj("checkProp");
didn't work
@JohnnyBizzel Good evening/night Johnny!
Diego Mayer
@Chrono79
Nov 13 2016 00:52
@Patkaa that's a string, not the var name
Johnny
@JohnnyBizzel
Nov 13 2016 00:52
Patkaa
@Patkaa
Nov 13 2016 00:53
@Chrono79 checkProp didnt work either
Walid Ashri
@walidashri
Nov 13 2016 00:53
@Patkaa this is a string no quotes
Johnny
@JohnnyBizzel
Nov 13 2016 00:53
@Patkaa Hey. Morgen
Gabi
@JJcreated
Nov 13 2016 00:53
// im not really understanding how to use .charCodeAt and .fromcharCode

function rot13(str) { // LBH QVQ VG!

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

}
return str;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
@Chrono79
Walid Ashri
@walidashri
Nov 13 2016 00:53
@JohnnyBizzel Hey there
Diego Mayer
@Chrono79
Nov 13 2016 00:53
@Patkaa show me how you wrote checkProp without the quotes
Patkaa
@Patkaa
Nov 13 2016 00:53
// Setup
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
return myObj[checkProp];
}
else{
}
}

// Test your code by modifying these values
checkObj(checkProp);
Johnny
@JohnnyBizzel
Nov 13 2016 00:53
@Patkaa no quotes needed for (checkProp)
@walidashri Morning ! :D
Patkaa
@Patkaa
Nov 13 2016 00:54
says it's not defined
Diego Mayer
@Chrono79
Nov 13 2016 00:54
@Patkaa not there, you should use it inside your function, leave the last line as it was
Justin Vernon
@Jvernz
Nov 13 2016 00:54
  for (var i = 0;i>arr.length;i++){
}
Should I assign answer.indexOf(i); to a variable?
Johnny
@JohnnyBizzel
Nov 13 2016 00:54
@Patkaa
checkObj(checkProp);
@Jvernz I would
MoNag1
@MoNag1
Nov 13 2016 00:54
@JJcreated charCodeAt will give you the unicode numeric value of any character you input
Patkaa
@Patkaa
Nov 13 2016 00:54
where did u write that?
Justin Vernon
@Jvernz
Nov 13 2016 00:54
@JohnnyBizzel I'm just not able to process how it's going to look when I assign it
Patkaa
@Patkaa
Nov 13 2016 00:54
ahh
Walid Ashri
@walidashri
Nov 13 2016 00:55
@Chrono79 3 His for you :P
Diego Mayer
@Chrono79
Nov 13 2016 00:55
@Patkaa if (myObj.hasOwnProperty("gift")){<- here you should change "gift"
@walidashri good night?
Patkaa
@Patkaa
Nov 13 2016 00:55
awesome got it to work guys
thanks for the help, you da best
Johnny
@JohnnyBizzel
Nov 13 2016 00:55
@Patkaa :+1: Tak
Walid Ashri
@walidashri
Nov 13 2016 00:55
@Chrono79 no HI HI HI
silver537
@silver537
Nov 13 2016 00:55
@Jvernz like logically you would check the word's length, and if it's even, then you would divide the length of the string by 2. say the word is what which is four letters. divide that length by two and you would get 2. so when you check for the index,
var str = 'what'
var index = str.indexOf(str.length / 2)
console.log(str[index-1]) // 'h'
Gabi
@JJcreated
Nov 13 2016 00:56
okay so str.charCodeAt() returns a number?
Johnny
@JohnnyBizzel
Nov 13 2016 00:56
@Jvernz What is the whole challenge you are on?
Diego Mayer
@Chrono79
Nov 13 2016 00:56
@walidashri yes, I get that, I don't know how to salute you, I don't know what time is there
Justin Vernon
@Jvernz
Nov 13 2016 00:56
@JohnnyBizzel Mutations
Johnny
@JohnnyBizzel
Nov 13 2016 00:56
00:56 here
Walid Ashri
@walidashri
Nov 13 2016 00:57
oh do you got why three :) it's 04.57 am
MoNag1
@MoNag1
Nov 13 2016 00:57
@JJcreated yes, it returns a number which you can match according to this table
Johnny
@JohnnyBizzel
Nov 13 2016 00:58
@Jvernz Easy that. Loop through the second String and as soon as a char does not match anything in the 1st String,return false
Diego Mayer
@Chrono79
Nov 13 2016 00:58
@walidashri are you some kind of vampire? I'll kill myself if I'm at the computer at that hour :P
silver537
@silver537
Nov 13 2016 00:58
6:49 here
Walid Ashri
@walidashri
Nov 13 2016 00:58
@Chrono79 It's *king duty :(
Nov 13 2016 00:59
How can i set up an additional cpanel user?
Diego Mayer
@Chrono79
Nov 13 2016 00:59
@walidashri keep it up then ;)
MoNag1
@MoNag1
Nov 13 2016 00:59
@JJcreated the parameter it accepts between () is the index of the letter within the string
silver537
@silver537
Nov 13 2016 00:59
@JJcreated it returns the respected ASCII number for that character.
Johnny
@JohnnyBizzel
Nov 13 2016 01:00
Diego Mayer
@Chrono79
Nov 13 2016 01:00
I sleep between 4 and 5 hours a day except saturdays and sundays, so I guess I'm half vampyre too
Justin Vernon
@Jvernz
Nov 13 2016 01:00
@silver537 Why would I check if it was even? Sorry if I'm sounding dumb. I just don't get that.
silver537
@silver537
Nov 13 2016 01:00
@Jvernz cause you cant divide if it's odd :P
Justin Vernon
@Jvernz
Nov 13 2016 01:00
@silver537 I get that lol. But what's the point of dividing in the first place?
Johnny
@JohnnyBizzel
Nov 13 2016 01:00
@Chrono79 So long as you don't drink blood :worried:
silver537
@silver537
Nov 13 2016 01:01
just kidding. i was responding from your earlier question
Diego Mayer
@Chrono79
Nov 13 2016 01:01
@JohnnyBizzel Sometimes I feel like I'm the one been drained
silver537
@silver537
Nov 13 2016 01:02

I get that, but I'm trying to check for a letter in the middle of a word. Suppose I don't know what that letter is. Like I don't want to hard code the letters in

@Jvernz that question

Johnny
@JohnnyBizzel
Nov 13 2016 01:02
@Chrono79 For sure! :D
Justin Vernon
@Jvernz
Nov 13 2016 01:02
@silver537 Ah I see
I'm not a fan of indexOf(). This is way confusing to me
Johnny
@JohnnyBizzel
Nov 13 2016 01:02
@Jvernz
function mutation(arr) {
var charsToTest = arr[1].toLowerCase().split('');
var i;
var arrLen = charsToTest.length;
for (i = 0; i < arrLen ; i ++) {
// test for invalid Char Found
// ->>>    some test which returns false
}
return true;
}
silver537
@silver537
Nov 13 2016 01:03
@Jvernz well become a fan, because it saves you from recreating the wheel
Justin Vernon
@Jvernz
Nov 13 2016 01:03
@silver537 Lol hopefully this is the case
silver537
@silver537
Nov 13 2016 01:05
there's gonna be a challenge where you're gonna be comparing a letter in a string. and you would use indexOf() to solve it smoothly.
Justin Vernon
@Jvernz
Nov 13 2016 01:07
I'm just not sure of the functionality. Like, I'm not sure how to go about the comparison between one word and another using indexOf
I know what I want to do, I just don't know how to do it
MoNag1
@MoNag1
Nov 13 2016 01:08
@Jvernz 1 use of index() is to check if a given string exists in an array for example. I'm not a fan as well but it does have its uses lol
silver537
@silver537
Nov 13 2016 01:12
@Jvernz
function doesItHaveIt(test, char){
if(test.indexOf(char) != -1){
return true
}
return false
}

doesItHaveIt("Hello!", 'e') // true
Walid Ashri
@walidashri
Nov 13 2016 01:21

@silver537

function doesItHaveIt(test, char){
return test.indexOf(char) != -1
}
doesItHaveIt("Hello!", 'e')

:P

silver537
@silver537
Nov 13 2016 01:21
@walidashri i spelled it out. :P
Walid Ashri
@walidashri
Nov 13 2016 01:23
@silver537 when was las time I said thanks
CamperBot
@camperbot
Nov 13 2016 01:23
walidashri sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:warning: walidashri already gave silver537 points
silver537
@silver537
Nov 13 2016 01:24
in the help section
Walid Ashri
@walidashri
Nov 13 2016 01:25
@silver537 Oh realy ! am testing when I can give more :brownie:
comaeternal
@comaeternal
Nov 13 2016 01:25
Can anyone check out my code. I want to get "Fries" and "shake" as a solution.
function slasher(arr, howMany) {
if (arr.length > howMany) {

return arr.splice(howMany, arr.slice(-1));

} else {
return [];
}
}

slasher(["burgers", "fries", "shake"], 1);
silver537
@silver537
Nov 13 2016 01:25
@walidashri one brownie per hour
@comaeternal just leave it as (howMany)
comaeternal
@comaeternal
Nov 13 2016 01:27
@silver537 wow thanks
CamperBot
@camperbot
Nov 13 2016 01:27
comaeternal sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
Norman Dela Cruz
@dcnr
Nov 13 2016 01:29
@walidashri Butchered version!
const doesItHaveIt = (test, char) => !!~test.indexOf(char);

doesItHaveIt("Hello!", 'e'); // true
silver537
@silver537
Nov 13 2016 01:30
calm down now
bitwise is soooo overrated
__mifflin__
@cdrainxv
Nov 13 2016 01:31
Heresy!!!
silver537
@silver537
Nov 13 2016 01:31
just kidding
Norman Dela Cruz
@dcnr
Nov 13 2016 01:31
It's an unnecessary evil!
Walid Ashri
@walidashri
Nov 13 2016 01:33
@dcnr what is version :) thanks
CamperBot
@camperbot
Nov 13 2016 01:33
walidashri sends brownie points to @dcnr :sparkles: :thumbsup: :sparkles:
Emily Christensen
@emmalee113
Nov 13 2016 01:34
anyone able to help me with the challenge called Return Early Pattern for Functions?
Kacper
@Fayacre
Nov 13 2016 01:35
Hey, can anyone help me with "Escape Sequences in Strings"? I'm stuck here for hell lot of time and I have not clue how to correctly write this code: FirstLine newline backslash SecondLine backslash carriage-return ThirdLine
no clue*
Walid Ashri
@walidashri
Nov 13 2016 01:36
@Fayacre try read the lesson you'll get some :)
Norman Dela Cruz
@dcnr
Nov 13 2016 01:37
@walidashri just a variation, thanks though :P
CamperBot
@camperbot
Nov 13 2016 01:37
dcnr sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Emily Christensen
@emmalee113
Nov 13 2016 01:37
@Fayacre make sure you cancel out your \
Kacper
@Fayacre
Nov 13 2016 01:37
I've read lessons about it like 5 times and i still don't get it ;_;
Jan
@burning-monk
Nov 13 2016 01:37
@emmalee113 what have you so far?
Emily Christensen
@emmalee113
Nov 13 2016 01:38

@walidashri @burning-monk

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

Kacper
@Fayacre
Nov 13 2016 01:38
Maybe my englando isn't as good as I thought it was :x
Jan
@burning-monk
Nov 13 2016 01:38
yeah ok so you have nothing ;)
@emmalee113 and any ideas what to do?
Emily Christensen
@emmalee113
Nov 13 2016 01:39

i've tried several things...i've tried mimmicking the example they gave me but i don't understand how it is relevant. this is the example:

function myFun() {
console.log("Hello");
return "World";
console.log("byebye")
}
myFun();

silver537
@silver537
Nov 13 2016 01:39
@emmalee113 (a < 0 && b < 0)
Walid Ashri
@walidashri
Nov 13 2016 01:39
@silver537 wrong
Jan
@burning-monk
Nov 13 2016 01:39
why are you showing the complete solution?
Emily Christensen
@emmalee113
Nov 13 2016 01:39

so i have tried...

(a<0) return "undefined"

silver537
@silver537
Nov 13 2016 01:39
you need to check both a and b
Jan
@burning-monk
Nov 13 2016 01:40
but not with and
Walid Ashri
@walidashri
Nov 13 2016 01:40
@silver537 a or b
Emily Christensen
@emmalee113
Nov 13 2016 01:40
the challenge says : 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.
silver537
@silver537
Nov 13 2016 01:40
oh well then ||
Emily Christensen
@emmalee113
Nov 13 2016 01:40
yes i did that with both a and b but it didn't do anything
Jan
@burning-monk
Nov 13 2016 01:40
so you have to prove if a or be is less than zero
how do you do that?
Walid Ashri
@walidashri
Nov 13 2016 01:41
try doing and show ur code please @emmalee113
walidashri @walidashri Brb
Johnny
@JohnnyBizzel
Nov 13 2016 01:41
@emmalee113 if (a<0) return undefined; should work??
Jan
@burning-monk
Nov 13 2016 01:41
no
silver537
@silver537
Nov 13 2016 01:41
if(expression || expression){return undefined} :D
Emily Christensen
@emmalee113
Nov 13 2016 01:42
so i think it would then be..
if (a<0||b<0) {return "undefined"}
ah i think i was just forgetting my brackets...
Johnny
@JohnnyBizzel
Nov 13 2016 01:42
@emmalee113 no quotes around undefined
silver537
@silver537
Nov 13 2016 01:42
and bingo was his name-o! :D
Justin Vernon
@Jvernz
Nov 13 2016 01:42
if(test.indexOf(char) != -1){
return true
}
return false
}
@silver537 Sorry, went to library to focus. So I should plug in the if statement inside of my for loop right?
for mutations
silver537
@silver537
Nov 13 2016 01:43
@Jvernz idk. i would need to check it
Emily Christensen
@emmalee113
Nov 13 2016 01:43
thank you @silver537 thank you @JohnnyBizzel of course it was a silly mistake and i had it the whole time... i keep forgetting little things like brackets and semicolons -_-
CamperBot
@camperbot
Nov 13 2016 01:43
emmalee113 sends brownie points to @silver537 and @johnnybizzel :sparkles: :thumbsup: :sparkles:
silver537
@silver537
Nov 13 2016 01:43
i only did tht to show you how you would use indexOf()
Stephanie
@spennypacker
Nov 13 2016 01:43

How do I declare oopsGlobal without using the var keyword?

var myGlobal = 10;// Declare your variable here
function fun1() {
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
oopsGlobal = 5;// Assign 5 to oopsGlobal Here

Johnny
@JohnnyBizzel
Nov 13 2016 01:43
@emmalee113 :+1:
Justin Vernon
@Jvernz
Nov 13 2016 01:44
@silver537 Okay I'll work on it for a bit and let you guys know if I need more help. Thanks so far!
CamperBot
@camperbot
Nov 13 2016 01:44
jvernz sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 13 2016 01:46
@spennypacker Why? Is it not a variable?
A242
@A242
Nov 13 2016 01:47
What am I doing wrong in "Stand in Line"?

function nextInLine(arr, item) {
var removed = arr.shift();
arr.push(item);
return removed;  // 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));
silver537
@silver537
Nov 13 2016 01:47
wth? what is that challenge name? @spennypacker
A242
@A242
Nov 13 2016 01:47
It's asking to just remove the first item and add the new one, then return the item I removed.
Justin Vernon
@Jvernz
Nov 13 2016 01:47
function mutation(arr) {
var string;

string = arr.join().toLowerCase().split(",");

for (var i = 0;i>arr.length;i++){
{
return true;
}
else {
return false;
}

}
}

mutation(["hello", "hey"]);
man this Mutations challenge makes me feel so dumb. I can't even get an output now lol
Stephanie
@spennypacker
Nov 13 2016 01:48
@silver537 global scope and functions
i fixed it so it recognizes the global variable but now its saying it doesnt equal 5 like it supposed to
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 01:48
@A242 try adding the new element first and then make the remove instruction
Justin Vernon
@Jvernz
Nov 13 2016 01:49
Just realized I've had i>arr.length instead of i<arr.length for the last hour
Johnny
@JohnnyBizzel
Nov 13 2016 01:49

@Jvernz

function mutation(arr) {
var charsToTest = arr[1].toLowerCase().split('');
var i;
var arrLen = charsToTest.length;
for (i = 0; i < arrLen ; i ++) {
// test for invalid Char Found
// ->>>    some test which returns false
}
return true;
}

My solution ^^

Justin Vernon
@Jvernz
Nov 13 2016 01:49
@JohnnyBizzel Right, I'm trying to figure out the test!
A242
@A242
Nov 13 2016 01:50
@paulotokimatu WOW, thanks a lot!
CamperBot
@camperbot
Nov 13 2016 01:50
a242 sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 13 2016 01:50
@spennypacker if (typeof oopsGlobal != "undefined") { < get rid of quotes around undefined
silver537
@silver537
Nov 13 2016 01:50
@spennypacker ah!! you need to listen to these comments! // Only change code above this line
A242
@A242
Nov 13 2016 01:51
@paulotokimatu Would it still be correct IRL how I had it?
Justin Vernon
@Jvernz
Nov 13 2016 01:51

@JohnnyBizzel What does this line do?

var charsToTest = arr[1].toLowerCase().split('');

I can't figure out what arr[1] does

Kacper
@Fayacre
Nov 13 2016 01:51

Okay... So I somehow did it... That's what I've figured out:

var myStr="FirstLine\n\\SecondLine\\\rThirdLine";

It's literally first time I've been stuck that hard on anything, and I still do not understand what would I need this for :x

Justin Vernon
@Jvernz
Nov 13 2016 01:51
wouldn't that just put the second value of the array lower case?
silver537
@silver537
Nov 13 2016 01:51


function fun1() {
// Assign 5 to oopsGlobal Here

}

// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}
@spennypacker just work with this:
// Declare your variable here

function fun1() {
// Assign 5 to oopsGlobal Here

}
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 01:53
@A242 I think it does not make much sense, because in even if it is an empty array you would still be trying to remove an element
silver537
@silver537
Nov 13 2016 01:54
@paulotokimatu yep. @A242 push first, then shift.
A242
@A242
Nov 13 2016 01:55
@paulotokimatu @silver537 Thank you both for this, I was on this for almost an hour
CamperBot
@camperbot
Nov 13 2016 01:55
a242 sends brownie points to @paulotokimatu and @silver537 :sparkles: :thumbsup: :sparkles:
:warning: a242 already gave paulotokimatu points
Justin Vernon
@Jvernz
Nov 13 2016 01:56
Okay so for mutations, I want to iterate through the second string and make sure every letter in that string appears at least once in the first string
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 01:56
@A242 No problem ^^ Just keep an eye in the tests and why your code failed
silver537
@silver537
Nov 13 2016 01:57
@Jvernz it grabs the first index lower cases the whole word then splits it up into an array of letters
Johnny
@JohnnyBizzel
Nov 13 2016 01:57
@Jvernz arr[1] (second element of the array)
Justin Vernon
@Jvernz
Nov 13 2016 01:57
Right, it makes sense now
silver537
@silver537
Nov 13 2016 01:58
which is a good use of indexOf():P
Justin Vernon
@Jvernz
Nov 13 2016 01:58
Now I'm wondering How do I compare a single letter from the second string to any letter from the first string
Johnny
@JohnnyBizzel
Nov 13 2016 01:58
@Jvernz i used the opposite logic. if it doesn't appear then we can fail the test return false
Justin Vernon
@Jvernz
Nov 13 2016 01:58
Right
silver537
@silver537
Nov 13 2016 01:58
@Jvernz you can use indexOf() and every() methods which will reduce your code a whole bunch
Justin Vernon
@Jvernz
Nov 13 2016 01:58
When I eventually figure this out, can you guys show me how you solved it?
silver537
@silver537
Nov 13 2016 01:59
i can show you now :P
__mifflin__
@cdrainxv
Nov 13 2016 01:59
@Jvernz:
var arr = ["hello", "GoOdbYe"];
var charsToTest = arr[1].toLowerCase().split('');
console.log(charsToTest); // [ 'g', 'o', 'o', 'd', 'b', 'y', 'e' ]
Johnny
@JohnnyBizzel
Nov 13 2016 01:59
@Jvernz I think it's time for the answer....
if (arr[0].toLowerCase().indexOf(charsToTest[i]) < 0) return false;
Full solution: http://coding.citytravelling.me.uk/mutation.html
umpienoob
@umpienoob
Nov 13 2016 02:02

var count = 0;

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

// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Not working,can anyone help?
silver537
@silver537
Nov 13 2016 02:02
why do you have 2 codes up?
delet3e one of them
Johnny
@JohnnyBizzel
Nov 13 2016 02:03
@umpienoob Which challenge are you on??? :worried:
Walid Ashri
@walidashri
Nov 13 2016 02:03
@umpienoob ("count" -= 1); count here is a string
umpienoob
@umpienoob
Nov 13 2016 02:03
"Counting Cards"
Justin Vernon
@Jvernz
Nov 13 2016 02:03
@JohnnyBizzel how does that work for "hello" and "hey" since they both have the same first and second letter? Wouldn't that put indexOf > 0?
silver537
@silver537
Nov 13 2016 02:04
@Jvernz he's checking for those that come up false
Justin Vernon
@Jvernz
Nov 13 2016 02:04
right
Walid Ashri
@walidashri
Nov 13 2016 02:04
@umpienoob remove quotes around count in ur code
Johnny
@JohnnyBizzel
Nov 13 2016 02:04
@Jvernz Yes but we want to test all the letters, therefore you need a loop
Justin Vernon
@Jvernz
Nov 13 2016 02:04
Right I have it inside a loop
silver537
@silver537
Nov 13 2016 02:04
if none come up false, then it will return true
__mifflin__
@cdrainxv
Nov 13 2016 02:04
@ @umpienoob: also for cases 2-6… count should be incremented (increased by 1)… while for cases 10 - "A"… count should be decremented (decreased by 1).
Justin Vernon
@Jvernz
Nov 13 2016 02:05
everything checks out except ["hello", "hey"]
Johnny
@JohnnyBizzel
Nov 13 2016 02:05
@Jvernz i return true outside of the loop
Justin Vernon
@Jvernz
Nov 13 2016 02:05
Same
silver537
@silver537
Nov 13 2016 02:05
but if one of them come up false, it will automatically terminate the function and return false
Justin Vernon
@Jvernz
Nov 13 2016 02:05
^ exactly
Johnny
@JohnnyBizzel
Nov 13 2016 02:05
@Jvernz ...which is what you are asked to do
silver537
@silver537
Nov 13 2016 02:06
dont return true, until the loop finishes which means use the return outside of the loop
umpienoob
@umpienoob
Nov 13 2016 02:06
@cdrainxv How do I do that?
Justin Vernon
@Jvernz
Nov 13 2016 02:06
@JohnnyBizzel @silver537 I see what you guys are saying.
Johnny
@JohnnyBizzel
Nov 13 2016 02:06
@umpienoob Did you get what @walidashri said. count should not be treated as a string.
@Jvernz Man, I have to work hard for a brownie tonight :/
Justin Vernon
@Jvernz
Nov 13 2016 02:07
@JohnnyBizzel thanks!
CamperBot
@camperbot
Nov 13 2016 02:07
jvernz sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 13 2016 02:07
@Jvernz Try putting the code through: http://pythontutor.com/javascript.html#mode=edit
Then you can visualise what is happening
__mifflin__
@cdrainxv
Nov 13 2016 02:08

@umpienoob: Since for case 2-6 you are incrementing you can group them together like so:

case 2:
case 3:
case 4:
case 5:
case 6:
count++;

The same thing can be said of cases 10 - "A".

Johnny
@JohnnyBizzel
Nov 13 2016 02:08
@Jvernz Cheers! Thanks for making me earn it! :D
CamperBot
@camperbot
Nov 13 2016 02:08
johnnybizzel sends brownie points to @jvernz :sparkles: :thumbsup: :sparkles:
Justin Vernon
@Jvernz
Nov 13 2016 02:10
@JohnnyBizzel that link you just sent me is amazing
Johnny
@JohnnyBizzel
Nov 13 2016 02:11
@Jvernz Somebody here on FCC told me about it.
Simon Cordova
@gbsimon87
Nov 13 2016 02:11
Hey oh! Greetings...
Johnny
@JohnnyBizzel
Nov 13 2016 02:11
@gbsimon87 Good morning
Simon Cordova
@gbsimon87
Nov 13 2016 02:12
Aren't you in Leeds? I'm in London Ive got 2:12am lol
Help me out with something quick if you can?
http://codepen.io/gbsimon87/pen/JRgpBV?editors=1111
the api's endpoint is there...I can't seem to get the data to display
CamperBot
@camperbot
Nov 13 2016 02:12
no wiki entry for: me out with something quick if you canhttpcodepeniogbsimon87penjrgpbveditors1111the apis endpoint is therei cant seem to get the data to display
Justin Vernon
@Jvernz
Nov 13 2016 02:12
@JohnnyBizzel @silver537 Finally figured it out. I just had put the wrong variables in my for loop. Thanks for sticking it through with me guys. You have been a tremendous help. Even though I didn't get the answer by myself, I really appreciate it!
CamperBot
@camperbot
Nov 13 2016 02:12
jvernz sends brownie points to @johnnybizzel and @silver537 :sparkles: :thumbsup: :sparkles:
:warning: jvernz already gave johnnybizzel points
:warning: jvernz already gave silver537 points
umpienoob
@umpienoob
Nov 13 2016 02:13
@cdrainxv Hmm,still not working . Always returns 0
Justin Vernon
@Jvernz
Nov 13 2016 02:13
function mutation(arr) {
var string;

string = arr.join().toLowerCase().split(",");

{
return false;
}
/*else {
return false;*/
}
return true;

}

mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]);
My code is ugly, but this is what I ended up with. I never would have landed on that if statement
__mifflin__
@cdrainxv
Nov 13 2016 02:13
@umpienoob: show current code now.
Johnny
@JohnnyBizzel
Nov 13 2016 02:13
@Jvernz Most of the time I am googling for solutions! ;)
umpienoob
@umpienoob
Nov 13 2016 02:14

var count = 0;

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

// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
__mifflin__
@cdrainxv
Nov 13 2016 02:16
@umpienoob: count does not increase or decrease for cases 7 - 9.
umpienoob
@umpienoob
Nov 13 2016 02:16
@cdrainxv It isn't supposed to. Whatever the inputs though it returns 0
Walid Ashri
@walidashri
Nov 13 2016 02:17
@umpienoob and where is ur breaks?
Johnny
@JohnnyBizzel
Nov 13 2016 02:18
@umpienoob Where is your break? check the reference on how to do it: http://www.w3schools.com/js/js_switch.asp
Walid Ashri
@walidashri
Nov 13 2016 02:18
@JohnnyBizzel tthanks
Johnny
@JohnnyBizzel
Nov 13 2016 02:18
@walidashri :+1:
Walid Ashri
@walidashri
Nov 13 2016 02:18
oh
__mifflin__
@cdrainxv
Nov 13 2016 02:18
@umpienoob: Then ungroup it from the cases where count decreases…. currently you have cases 7- "A" all grouped together so that they decrease by one.
Walid Ashri
@walidashri
Nov 13 2016 02:18
@JohnnyBizzel thanks
CamperBot
@camperbot
Nov 13 2016 02:18
walidashri sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
umpienoob
@umpienoob
Nov 13 2016 02:20
@cdrainxv Fixed that and added breaks,still returns 0
__mifflin__
@cdrainxv
Nov 13 2016 02:20
@umpienoob: In fact just remove cases 7 - 9 as it is not even required…
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 02:21
@umpienoob look at your if statement
__mifflin__
@cdrainxv
Nov 13 2016 02:22
@umpienoob: Hold and Bet.
umpienoob
@umpienoob
Nov 13 2016 02:23
@cdrainxv I kid you not,i realized that 5 seconds before that. Other main problem was using js cc as the switch instead of js card
Walid Ashri
@walidashri
Nov 13 2016 02:24
@cdrainxv @umpienoob lol
__mifflin__
@cdrainxv
Nov 13 2016 02:24
@umpienoob: Ahah… I just noticed too…
umpienoob
@umpienoob
Nov 13 2016 02:25
Thanks for all of your guy's help,but yeah in the end it was a stupid problem lol
__mifflin__
@cdrainxv
Nov 13 2016 02:25
No… it was a learning experience for us all.
Johnny
@JohnnyBizzel
Nov 13 2016 02:26
@umpienoob If you think coding is stupid, why are you doing it?
MoNag1
@MoNag1
Nov 13 2016 02:26
does anyone know if it is possible to use .toLowerCase() on an array? like .toLowerCase.apply() or something
umpienoob
@umpienoob
Nov 13 2016 02:27
@JohnnyBizzel I don't think coding is stupid,i think garbage in = garbage out. My code was bad and I made stupid mistakes.
Johnny
@JohnnyBizzel
Nov 13 2016 02:28
@umpienoob As you improve, go back and revisit your solutions. This is called re-factoring.
umpienoob
@umpienoob
Nov 13 2016 02:29
@JohnnyBizzel Thanks for the tip~
CamperBot
@camperbot
Nov 13 2016 02:29
umpienoob sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 13 2016 02:29
@umpienoob If you check my website you will see I have been doing this: http://coding.citytravelling.me.uk/fcc.html
Justin Vernon
@Jvernz
Nov 13 2016 02:31

function bouncer(arr) {
// Don't show a false ID to this bouncer.
for (var i = 0;i<arr.length;i++) {

if (arr[i] === false, null, 0, "", undefined, NaN) {
arr.splice(i, 1);
}

}

return arr;
}

bouncer([7, "ate", "", false, 9]);
I feel like my code should be working for Falsy Bouncer
ordertaker
@ordertaker
Nov 13 2016 02:31

var longestChar=0;
function findLongestWord(str) {
var strArr = [];
strArr = str.split(" ");
strArr.forEach(getLongestChar);
return longestChar;
}

function getLongestChar(item){
if(item.length>longestChar){
longestChar=item.length;
}
}

findLongestWord("May the force be with you");
can anyone here check my code? it returns 5 on the console yet I am not passing this particular challenge.
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 02:33
@Jvernz This kind of sintax does not work ("arr[i] === false, null, 0, "", undefined, NaN"). If you really want to try solving this way, you should do something like
if (arr[i] === false || arr[i] === 0)
Walid Ashri
@walidashri
Nov 13 2016 02:34
@ordertaker put this var longestChar=0; inside the func
Justin Vernon
@Jvernz
Nov 13 2016 02:34
@paulotokimatu Oh okay thanks! Is there another way to categorize all falsy statements?
CamperBot
@camperbot
Nov 13 2016 02:34
jvernz sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 02:35
@Jvernz you can try converting the variable to boolean
new_val = Boolean(val);
MoNag1
@MoNag1
Nov 13 2016 02:35
@ordertaker that's pretty strange, I just tried it
Diego Mayer
@Chrono79
Nov 13 2016 02:35
@MoNag1 you could use map
ordertaker
@ordertaker
Nov 13 2016 02:36
@MoNag1 was it successful on your side?
Justin Vernon
@Jvernz
Nov 13 2016 02:36
@paulotokimatu interesting, I'll give it a shot
Diego Mayer
@Chrono79
Nov 13 2016 02:37
@ordertaker you used a global var, that's the problem
MoNag1
@MoNag1
Nov 13 2016 02:37
@Chrono79 Thank you but I got around it by turning it into a string, then using .toLowerCase then back into an array. not sure if that's the most convenient way tho
CamperBot
@camperbot
Nov 13 2016 02:37
monag1 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2509 | @chrono79 |http://www.freecodecamp.com/chrono79
Justin Vernon
@Jvernz
Nov 13 2016 02:37
@paulotokimatu I see. Splice won't work in this situation because it reduces the entire array.length by 1 when it takes out an element
MoNag1
@MoNag1
Nov 13 2016 02:38
@ordertaker no, I mean its returning 5 but not passing the challenege
ordertaker
@ordertaker
Nov 13 2016 02:39
@MoNag1 @Chrono79 am I not supposed to do a global var? I mean for this implementation I think I should use it to store the largest value and return it in the main function
silver537
@silver537
Nov 13 2016 02:40
@Jvernz Boolean(arr)
Diego Mayer
@Chrono79
Nov 13 2016 02:40
@ordertaker a global var keeps the value between tests, that's why it works for a single test, but fails on a set
Write both, the var and the other function inside the original one
silver537
@silver537
Nov 13 2016 02:41
filter(Boolean)
DONE!
ordertaker
@ordertaker
Nov 13 2016 02:43
@Chrono79 what's confusing to me is that it only fails at that 3rd test out of the 6, okay, I'll try a different approach
Diego Mayer
@Chrono79
Nov 13 2016 02:44
@ordertaker the firsts two tests are the same and the 3rd one has a longest value less than 6 (that's the longest value of the first 2 tests), that's why it fails
All other tests results are ordered in increasing values, so the longest value is the right one
Does that make sense now?
Justin Vernon
@Jvernz
Nov 13 2016 02:46
@silver537 Didn't really help me at all lol
.filter is awkward, everywhere I look tells me to use it outside the function
when I try to use it outside it says "bouncer.filter is not a function
ordertaker
@ordertaker
Nov 13 2016 02:47
@Chrono79 this solved my problem
Diego Mayer
@Chrono79
Nov 13 2016 02:47
@ordertaker see it here: https://repl.it/ERbB/2
ordertaker
@ordertaker
Nov 13 2016 02:48

function findLongestWord(str) {
var longestChar=0;
var strArr = [];
strArr = str.split(" ");
strArr.forEach(function(item){
if(item.length>longestChar){
longestChar=item.length;
}

});
return longestChar;
}

findLongestWord("May the force be with you");
silver537
@silver537
Nov 13 2016 02:48
@Jvernz that's cause filter is an array method. only meant for arrays
ordertaker
@ordertaker
Nov 13 2016 02:48
@Chrono79 thanks for the help!
CamperBot
@camperbot
Nov 13 2016 02:48
ordertaker sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2510 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Nov 13 2016 02:48
@ordertaker avoid using globals, it'll save your hair ;)
Justin Vernon
@Jvernz
Nov 13 2016 02:48
@silver537 I see. I'm bout to go home so I'll check when I get there
@silver537 thanks for your help in the meantime
CamperBot
@camperbot
Nov 13 2016 02:48
jvernz sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
ordertaker
@ordertaker
Nov 13 2016 02:49
@Chrono79 I learned it the hard way lol, I was under the impression that it will run the tests using fresh instances, but yeah okay :)
Walid Ashri
@walidashri
Nov 13 2016 02:49
Why everybody get his brownie except me total $unfair$
Diego Mayer
@Chrono79
Nov 13 2016 02:50
@walidashri thanks
CamperBot
@camperbot
Nov 13 2016 02:50
chrono79 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 02:50
@walidashri thx
CamperBot
@camperbot
Nov 13 2016 02:50
zooll8 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 02:50
Guys, can you pass me some brownie points, Om-nom-nom, thanks
silver537
@silver537
Nov 13 2016 02:50
no
Charles
@charlessmith259
Nov 13 2016 02:51
MoNag1
@MoNag1
Nov 13 2016 02:51
@Zooll8 no thanks I'd rather not
CamperBot
@camperbot
Nov 13 2016 02:51
monag1 sends brownie points to @zooll8 :sparkles: :thumbsup: :sparkles:
Walid Ashri
@walidashri
Nov 13 2016 02:51
@Zooll8 thanks never come like this
CamperBot
@camperbot
Nov 13 2016 02:51
walidashri sends brownie points to @zooll8 :sparkles: :thumbsup: :sparkles:
Walid Ashri
@walidashri
Nov 13 2016 02:52
@Chrono79 thanks
CamperBot
@camperbot
Nov 13 2016 02:52
walidashri sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2511 | @chrono79 |http://www.freecodecamp.com/chrono79
Eko Odinta
@Kodin24
Nov 13 2016 03:06

need help please Modify the existing declarations and assignments so their names use camelCase. my code
// Declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;

// Assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;

var studlyCapVar;
var properCamelCase;
var titleCaseOver;

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

umpienoob
@umpienoob
Nov 13 2016 03:09
Hey,it's telling me i'm missing a semicolon but I don't know where.

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

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

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

// Change this value to test
phoneticLookup("charlie");
Anyone help me?
silver537
@silver537
Nov 13 2016 03:11
cause this isn't valid syntax lookup(val)
Walid Ashri
@walidashri
Nov 13 2016 03:12
this is func lookup(val)
umpienoob
@umpienoob
Nov 13 2016 03:13
Hmmm,then how do I fix it?Instructions below
Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
Rye
@maverick235
Nov 13 2016 03:13
hey guys, struggling with chunk monkey - can anyone help?

function chunkArrayInGroups(arr, size) {
// Break it up.
var newArr = [];

function axe(arr, size){
var test = [];
for (var i = 0; i < size; i++){

  if (arr[i]) {
test.push(arr.shift(i));
}

}
console.log(test);
return test;

}

for (var i = 0; i < arr.length+i; i++){
newArr.push(axe(arr,size));
}

console.log( newArr );
return newArr;
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4);

sorry about the paste...I dont know why it did that
umpienoob
@umpienoob
Nov 13 2016 03:17
@silver537 What is the correct syntax?
silver537
@silver537
Nov 13 2016 03:18
when you use parenthesis like that, it is considered a function call
umpienoob
@umpienoob
Nov 13 2016 03:20
@silver537 Yeah,but what would be the correct syntax for this?
silver537
@silver537
Nov 13 2016 03:21
well objects are just var obj = {}
so that's what you want
Lucas Tormin
@tormink
Nov 13 2016 03:25
so guys, I'm making the regex to test for telephone numbers(for the advanced javascript algorithms practices)
I'm not quite done yet but how am I supposed to check if 1 555)555-5555 is false? because I'm checking for the special characters sequentially as of now
My current regex for part of the phone number is
/(1[$$\-\s]{1,2})?\d{3}([$$\-]{1,2})?/
sorry if that's a long regex but I'm still a newbie on it.
idk if it's supposed to be like this yet
so basically, I match for the first parenthesis, then 3 numbers, then the second closing parenthesis
both parenthesis individually optional
silver537
@silver537
Nov 13 2016 03:27
@tormink too keep things simple, in your quantizer, keep it at a fixed number. instead of a range. {3} {4} etc...
Lucas Tormin
@tormink
Nov 13 2016 03:29
the solution I thought for that would probably make the regex waay too long so maybe it isn't right. I thought of matching for a possible (555) entirely, non optional, but then put an or ( | ) to match without those parenthesis
@silver537 alright, I'll do that
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 03:30
I need some help, how can I make a fade out/fade in effect using jquery?
silver537
@silver537
Nov 13 2016 03:30
i think thats what it is
Lucas Tormin
@tormink
Nov 13 2016 03:31
@silver537 hmm I've been thinking, I think I need the range, because a person may type in either (555) 555 5555 or 555-555-5555
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 03:31
thanks man, that worked
Lucas Tormin
@tormink
Nov 13 2016 03:32
in the first one, there are two special characters dividing the numbers
silver537
@silver537
Nov 13 2016 03:32
thats where you would use the or |
$$\d{3}$$|\d{3}
Lucas Tormin
@tormink
Nov 13 2016 03:35
@silver537 ohh okay, that makes it simpler, for sure, thanks!
CamperBot
@camperbot
Nov 13 2016 03:35
tormink sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
Lucas Tormin
@tormink
Nov 13 2016 03:39
So...regex really does save a lot of lines of code once you're used to it, but doesn't it get hard to maintain because it is kinda hard to read on its own? like if you need to update a regex
sure, if you know your way around regex it shouldn't be a problem..I think..or does it? I don't know honestly if reading regex could become second nature to me
like if you have a really big regex for some kind of input, not just simple regex, I mean
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 03:41
@tormink just look for a regex cheat sheet its not hard
Lucas Tormin
@tormink
Nov 13 2016 03:42
@Jeff-Shapiro well I'm using something way better than a cheat sheet, I'm making it entirely with regexr, it sure is a life saver..well I guess I just answered my own question, as well as you, thanks
CamperBot
@camperbot
Nov 13 2016 03:42
tormink sends brownie points to @jeff-shapiro :sparkles: :thumbsup: :sparkles:
silver537
@silver537
Nov 13 2016 03:43
@tormink the more you practice with it the better it gets to read it.
it's no difference than when a computer reads it.
we're just.... slower
chunnali
@chunnali
Nov 13 2016 03:49
EgeKaya
@EgeKaya
Nov 13 2016 03:49
    $("#goButton").click(function(){$('#logo').animate({
opacity: 0.25,
bottom: '+=500',
height: 'toggle',}, 2000 );
});
});
I am having problems with this animation. Here is the link: http://codepen.io/Ege_Kaya/pen/bBpRWz
I want the logo part to fade out completely leaving the search part at the top of the website. However, it fades out partially, then disappears very fast.
So basically my question is how can I make the animation complete and more smooth. Thank you
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 03:52
@chunnali it is working fine here
chunnali
@chunnali
Nov 13 2016 03:52
@paulotokimatu thanks! It works fine for some people but for others, the location they are getting is 30 minutes away haha...
CamperBot
@camperbot
Nov 13 2016 03:52
chunnali sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 03:53
@EgeKaya I just did something similar. Search for .fadeTo of Jquery
@chunnali That happens even in apple apps haha
Ari
@arilaverty
Nov 13 2016 03:56

function fearNotLetter(str) {
var abc = 'abcdefghijklmnopqrstuvwxyz';
var stringIndex = abc.indexOf(str[0]);

for (var i = 0; i < str.length; i++){
if (str[i] !== abc[stringIndex + i]){
console.log(abc[stringIndex + i]); //<-- missing letter
}
}

}
fearNotLetter("abce");

any idea why it works for me but not on FreeCodeCamp

function fearNotLetter(str) {
var abc = 'abcdefghijklmnopqrstuvwxyz';
var stringIndex = abc.indexOf(str[0]);

for (var i = 0; i < str.length; i++){
if (str[i] !== abc[stringIndex + i]){
console.log(abc[stringIndex + i]); //<-- missing letter
}
}

}
fearNotLetter("abce");

chunnali
@chunnali
Nov 13 2016 04:00
@paulotokimatu lol thanks! that actually made me feel alot better. I spent hours trying different api locations T___T
CamperBot
@camperbot
Nov 13 2016 04:00
chunnali sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
:warning: chunnali already gave paulotokimatu points
Ari
@arilaverty
Nov 13 2016 04:00
function fearNotLetter(str) {
var abc = 'abcdefghijklmnopqrstuvwxyz';
var stringIndex = abc.indexOf(str[0]);

for (var i = 0; i < str.length; i++){
if (str[i] !== abc[stringIndex + i]){
console.log(abc[stringIndex + i]); //<-- missing letter
}
}

}
fearNotLetter("abce");
JackVizl
@JackVizl
Nov 13 2016 04:07
someone pls help with caesers cipher
tvan082998
@tvan082998
Nov 13 2016 04:10
Word Blanks
Conor Murphy
@cmurphy580
Nov 13 2016 04:10
Does anyone know how to make sure the content fits the page? If you look at my pen, do a search, and scroll to the button, you'll will know what i'm talking about. Let me know if you have any ideas.
https://codepen.io/cmurphy580/pen/gLaamJ
Monesul Haque
@mones-cse
Nov 13 2016 04:11

can any one help me with this code

class App extends React.Component{
constructor(props){
super(props);
this.state={
width:10,
height:10,
arrayData:[]
}
this.generateChart();
}
generateChart(){
var width=this.state.width;
var height=this.state.height;
var area =width*height;
var tempArrayData=[];
for(var i=0;i<area;i++){
tempArrayData[i]=Math.floor(Math.random()*2)
}
console.log(tempArrayData);
this.setState({arrayData:tempArrayData})
console.log(this.state.arrayData);

}

render(){
console.log(this.state)
return<div>ola</div>
}
}

here this.state.arrayData is not updating
for any reason this line may not working
this.setState({arrayData:tempArrayData})

iceveda06
@iceveda06
Nov 13 2016 04:12

function rot13(str) { // LBH QVQ VG!

for (var i=0; i < str.length; i++)  {
var stri = str.charCodeAt(i);
console.log(stri + " stri ");
var converting = stri + 13;
console.log(converting + " converting ");

if (converting > 90) {
var decipher = (converting - 90) + 64;
var decipher2 = String.fromCharCode(decipher);
console.log(decipher2);
} else if (converting < 90) {
var converting2 = String.fromCharCode(converting);
}

}
// Change the inputs below to test
rot13("SERR YBIR!");
anyone can help with above code? i got it showing as "F","R","E","E","-",......
tried using join but "" didn't get removed and i want to avoid deciphering characters
silver537
@silver537
Nov 13 2016 04:14
@iceveda06 how did you use join?
iceveda06
@iceveda06
Nov 13 2016 04:14
silver537
@silver537
Nov 13 2016 04:15
@JackVizl you are obsessed with coding :P
JackVizl
@JackVizl
Nov 13 2016 04:15
why do you say that? @silver537
silver537
@silver537
Nov 13 2016 04:16
cause you've been here all day
JackVizl
@JackVizl
Nov 13 2016 04:17
school holidays bruh
not much else to do on a sunday
silver537
@silver537
Nov 13 2016 04:17
it's saturday....
Matt
@Matteoo7
Nov 13 2016 04:18
Hello, im looking for help with basic introductory AngularJS. I'll show you my code, shouldn't take more than 5 min.
iceveda06
@iceveda06
Nov 13 2016 04:18
any ideas how to stop deciphering the characters?
silver537
@silver537
Nov 13 2016 04:19
@iceveda06 you're supposed insert an argument in join()
iceveda06
@iceveda06
Nov 13 2016 04:19
yeah i figured out @silver537
silver537
@silver537
Nov 13 2016 04:19
like join(" ")
iceveda06
@iceveda06
Nov 13 2016 04:19


function rot13(str) { // LBH QVQ VG!

for (var i=0; i < str.length; i++)  {
var stri = str.charCodeAt(i);
console.log(stri + " stri ");
var converting = stri + 13;
console.log(converting + " converting ");

if (converting > 90) {
var decipher = (converting - 90) + 64;
var decipher2 = String.fromCharCode(decipher);
console.log(decipher2);
} else if (converting < 90) {
var converting2 = String.fromCharCode(converting);
}

}
// Change the inputs below to test
rot13("SERR YBIR!");
but i got a fat dash sitting in the middle which got deciphered a space...so i need to avoid the characters
any ideas?
silver537
@silver537
Nov 13 2016 04:21
at this bit:
var stri = str.charCodeAt(i);
console.log(stri + " stri ");
var converting = stri + 13;
you have to check if the number is within range before adding 13
Monesul Haque
@mones-cse
Nov 13 2016 04:21

need help with react

class App extends React.Component{
constructor(props){
super(props);
this.state={
width:10,
height:10,
arrayData:[]
}
this.generateChart();
console.log(this.state.height);
}
generateChart(){
console.log(this.state.height);
this.setState({height:15})
console.log(this.state.height);
}

render(){
console.log(this.state.height);
return<div>ola</div>
}
}

why height value is not updating from 10 to 15

Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:22
@mones-cse why dont you just put everything inside the constructor instead of using another function? Are you gonna reuse the function? If so, try sending this as an argument
Can you log the temp data?
c0d0er
@c0d0er
Nov 13 2016 04:23
@walidashri thanks
CamperBot
@camperbot
Nov 13 2016 04:23
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Monesul Haque
@mones-cse
Nov 13 2016 04:24
@jenkynolasco11 generateChart() will called multiple time
but i do not uderstand why this.setState({height:15}) this line do not change the value of height
Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:25
That's the only way to change state values, using setState
Oh
tvan082998
@tvan082998
Nov 13 2016 04:25
can anyone help me with the JS part call Word Blanks #133
Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:26
Again, console.log this in the function, and check if youre receiving the component
Monesul Haque
@mones-cse
Nov 13 2016 04:26
@jenkynolasco11 all console.log show output 10 i am expecting 15 after executing that line
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 04:26
Hello, everybody. Can I have some feedback on my weather machine and how to make all text be in the center of that div with class "main". http://codepen.io/Zooll/pen/zoqGMx
Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:26
Another thing, use componentDidMount to initialize values, instead of calling a function in the constructor
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 04:27
OHhh, i forgot. Try this on Firefox or any other browser except Chrome, because it wont work with geoposition without https
Monesul Haque
@mones-cse
Nov 13 2016 04:28
@jenkynolasco11 ok i will do so but still height value should have updated
Lucas Tormin
@tormink
Nov 13 2016 04:28
yeeeaaah I did the telephone challenge! I feel proud..most complicated regex I ever wrote
Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:28
I dont know, maybe that's the job of componentDidMount to initialize those values
@tormink hit yourself in chest, man, that's a hard one to complete
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 04:29
@tormink Hi, can you show us your RegExp for this challenge?
Lucas Tormin
@tormink
Nov 13 2016 04:30
@Zooll8 I could, but..that kinda gives out the answer, doesn't it? Should I do it?
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 04:30
@tormink I already did that challenge, just wanted to know your way to do this.
Lucas Tormin
@tormink
Nov 13 2016 04:31
okay, sure then
/1?[\s\-]?($$\d{3}$$|\d{3})[\-\s]?\d{3}[\-\s]?\d{4}/
@jenkynolasco11 yeah for sure :D that's a good start to the advanced challenges hehe
Lucas Tormin
@tormink
Nov 13 2016 04:36
http://regexr.com/ this website will save anyone trying to do a regex a lot of pain
Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:37
Or regex101
Vishesh Chanana
@Visheshevi
Nov 13 2016 04:39
Hi guys
can you help me out with this
if(contacts.firstName == firstName && contacts.hasOwnProperty(prop))
{
return contacts.prop;
}
else if(contacts.firstName !==firstName)
return "No such contact";
else if(contacts.hasOwnProperty(prop)===false)
return "No such Property";

We have an array of objects representing different people in our contacts lists.

A lookUpProfile function that takes firstName and a property (prop) as arguments has been pre-written for you.

The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

Diego Mayer
@Chrono79
Nov 13 2016 04:41
@Visheshevi contacts is an array, you should access an individual contact before testing its properties
You can't use dot notation with vars either
Vishesh Chanana
@Visheshevi
Nov 13 2016 04:43
for(var i=0;i<contacts.length;i++)
{
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
{
return contacts[i].prop;
}
else if(contacts[i].firstName !==firstName)
return "No such contact";
else if(contacts[i].hasOwnProperty(prop)===false)
return "No such Property";
I tried this
Diego Mayer
@Chrono79
Nov 13 2016 04:44
@Visheshevi contacts[i].prop; this is wrong. Review this challenge: https://www.freecodecamp.com/challenges/accessing-objects-properties-with-variables
and you can't say No such contact until you have checked all the contacts
The way you have it right now, your loop won't run more than once
Vishesh Chanana
@Visheshevi
Nov 13 2016 04:46
ohh okayy
mdahmann
@mdahmann
Nov 13 2016 05:24
Is it possible to call a tooltip from a different link on the page?
andry91959
@andry91959
Nov 13 2016 05:37
can someone tell me how to do queue excercise
Abhisek Pattnaik
@abhisekp
Nov 13 2016 05:40
@andry91959 Q: what is a queue?
@mdahmann what do you mean call a tooltip?
mdahmann
@mdahmann
Nov 13 2016 05:43
@abhisekp Thanks for the reply. I'm using this js library: http://www.inabrains.com/tooltip/guide.html#examples If you follow the link they have an example with an image map using jquery hotspots
CamperBot
@camperbot
Nov 13 2016 05:43
mdahmann sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star2: 3152 | @abhisekp |http://www.freecodecamp.com/abhisekp
mdahmann
@mdahmann
Nov 13 2016 05:43
@abhisekp you can open the hotspot by hovering over it on the image map. I'm trying to open the same hotspot on the image map from a separate link somewhere else on the page.
@abhisekp So you can open the image map by hovering AND by hover over the text link elsewhere on the page.
Abhisek Pattnaik
@abhisekp
Nov 13 2016 05:44
hmm
mdahmann
@mdahmann
Nov 13 2016 05:44
@abhisekp I found this jsfiddle doing something like what I need done, trying to implement with the library that's already being used http://jsfiddle.net/ddru0fg2/
Alexandro Pequeno
@Argestis
Nov 13 2016 05:49
Guys I'm trying to compare the sequence of number between two arrays. And closing everything inside an if that triggers if both arrays have the same length.
var game = {
count : [],
guessWhat : [],
red : $("#red"), blue :$("#blue"),
green : $("#green"), yellow :$("#yellow")
};

if(game.count.length < 1 || game.count.length == undefined){
nextRound();
}

function clearUser(){

console.log("Do it again.")
game.count = [];
game.guessWhat = [];
nextRound();
}

function nextRound(){

game.guessWhat = [];
game.count.push(Math.floor((Math.random() * 4) + 1))
console.log("this is game.count: " + game.count)
gameOn();

}

function verifySequence(){

verify = undefined;

if(game.count.length == game.guessWhat.length){
for(var i = 0; i < game.count.length; i++){
if(game.count[i] !== game.guessWhat[i]){
verify = false;
}
else{verify = true}
}
}

if(verify == true){nextRound(); console.log("this is game.guessWhat: " + game.guessWhat)}
else{clearUser();}
}

function gameOn(){

game.blue.click(function(){

game.guessWhat.push(1);
verifySequence();

});

game.red.click(function(){

game.guessWhat.push(2);
verifySequence();

});

game.green.click(function(){

game.guessWhat.push(3);
verifySequence();
});

game.yellow.click(function(){

game.guessWhat.push(4);
verifySequence();

});
}
By some reason is triggering even when the length is not the same :C
any ideas?
here's the project btw O:
silver537
@silver537
Nov 13 2016 06:11
@Argestis next time, just post your codepen. that code wall was too big
Alexandro Pequeno
@Argestis
Nov 13 2016 06:12
oh, alright.
mdahmann
@mdahmann
Nov 13 2016 06:17
@abhisekp I will probably just be dropping the js tooltip plugin I sent you and using similar code to the jsfiddle. Thanks tho.
CamperBot
@camperbot
Nov 13 2016 06:17
mdahmann sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:warning: mdahmann already gave abhisekp points
Ruben00alex
@Ruben00alex
Nov 13 2016 06:24

Hi guys, i've been stuck for like 30 minutes on this challenge and it's driving me crazy !!!!

It asks me to modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr

Here is my code:

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

}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Jeff D.
Nov 13 2016 06:27
Under Escape Sequences in strings I have the following code var myStr = "FirstLine\n\SecondLine\\rThirdline"; can someone help?
Ruben00alex
@Ruben00alex
Nov 13 2016 06:28
SecondLine must be in backlashes and backlashes require double backlashes, hope that helps
I only see one on your code.
Connor S Lopez
@Cslopez123
Nov 13 2016 06:28
Hi I am having trouble with the Word Blank problem that's number 153/
Jeff D.
Nov 13 2016 06:29
var myStr = "FirstLine\n\SecondLine\\rThirdline";
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:29
@mdahmann I looked into it and found no foolproof way to hack it. :(
Ruben00alex
@Ruben00alex
Nov 13 2016 06:30
You're missing a backlash:
Jeff D.
Nov 13 2016 06:30
that second \ in front of Second line is not showing but it's there
joshandevera
@joshandevera
Nov 13 2016 06:30
what seem to be the problem with my code 
Ruben00alex
@Ruben00alex
Nov 13 2016 06:30
it should be
var myStr = "FirstLine\n\SecondLine\rThirdline"
joshandevera
@joshandevera
Nov 13 2016 06:30
// Only change fahrencode above this line
Jeff D.
Nov 13 2016 06:30
var myStr = "FirstLine\n\ \SecondLine\\rThirdline";
without the space
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:30
@Ruben00alex should be no space b/w i and ++
joshandevera
@joshandevera
Nov 13 2016 06:31

what's seem to be the problem with my code 
function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit = 9/5 + 32;

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

// Change the inputs below to test your code
convertToF(30);



function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit = 9/5 + 32;

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

// Change the inputs below to test your code
convertToF(30);

Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:32
@joshandevera the temperature formula needs celsius value to multiply with
@joshandevera c * 9/5 + 32
Jeff D.
Nov 13 2016 06:32
var myStr = "FirstLine\n\ \SecondLine\\rThirdline"; // Change this line
Janina Pohorecki
@janepohorecka
Nov 13 2016 06:33
I really, really need help… I have this codepen here: https://codepen.io/janepoho/pen/WowOGm and for some strange reason it’s not positioning the navbar as fixed once it hits the uppermost part of the screen.. Anyway, I have that under control in my text editor but what I don’t have is something like this: https://stanhub.com/sticky-header-change-navigation-active-class-on-page-scroll-with-jquery/
joshandevera
@joshandevera
Nov 13 2016 06:33
oh i see thanks @ghulamshabir
CamperBot
@camperbot
Nov 13 2016 06:33
joshandevera sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:35
Jeff D.
Nov 13 2016 06:37
OMG thanks Ghulam....
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:38
@jeffryadones mention @name while thanking so i get a brownie
Jeff D.
Nov 13 2016 06:38
how?
thanks @ghulamshabir
CamperBot
@camperbot
Nov 13 2016 06:39
jeffryadones sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:39
@jeffryadones just click on my @ghulamshabir it will copied to your chat editor and say thanks
CamperBot
@camperbot
Nov 13 2016 06:39
ghulamshabir sends brownie points to @jeffryadones :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:39
@jeffryadones :smile: I have sent you one as a bonus
Jeff D.
Nov 13 2016 06:39
what does it do?
Merryl
@MerrylArok
Nov 13 2016 06:40
Hello
can someone deconstruct this: document.getElementById("demo").innerHTML
is demo here the css properties?
i mean is this the id that refers to a css
AKASH GUNJAL
@AKASH888
Nov 13 2016 06:42
no demo here is an element of HTML
we can change the properties if that using the above code
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:42
Joseph
@revisualize
Nov 13 2016 06:42
@AKASH888 demo is not an element of HTML.
Merryl
@MerrylArok
Nov 13 2016 06:43
@AKASH888 @revisualize so is this referring to an element named "demo" in the document?
Joseph
@revisualize
Nov 13 2016 06:44
@MerrylArok No.
AKASH GUNJAL
@AKASH888
Nov 13 2016 06:44
Merryl
@MerrylArok
Nov 13 2016 06:44
@revisualize oh is this another way to assign an id ?
Joseph
@revisualize
Nov 13 2016 06:44
@MerrylArok In HTML you can have an HTML tag with an id. example: <div id="coolThing">text</div>
you can document.getElementById("coolThing") and change things.
AKASH GUNJAL
@AKASH888
Nov 13 2016 06:46
That's what i wanted to explain that we can change element properties but i forget the id part
Joseph
@revisualize
Nov 13 2016 06:46
like you can change the .innerHTML of the element that you select by the id.
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:46
.
Joseph
@revisualize
Nov 13 2016 06:47
@abhisekp Right?
Merryl
@MerrylArok
Nov 13 2016 06:47
@AKASH888 @revisualize Thanks! that clears it up
CamperBot
@camperbot
Nov 13 2016 06:47
merrylarok sends brownie points to @akash888 and @revisualize :sparkles: :thumbsup: :sparkles:
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:48
@revisualize that's morse code for letter E
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:49
OMG! :scream:
it's w3schools
Joseph
@revisualize
Nov 13 2016 06:50
I know I know.. But, you can just try it and see.
Merryl
@MerrylArok
Nov 13 2016 07:00
@abhisekp @revisualize does w3schools have a negative rep around here?
Alexandro Pequeno
@Argestis
Nov 13 2016 07:01
Guys an ideas on why an if could be triggering when comparing the lengths of two arrays and they are not the same length?
game.blue.click(function(){

game.guessWhat.push(1);

if(game.guessWhat.length === game.count.length){
verifySequence();
}

});
Abhisek Pattnaik
@abhisekp
Nov 13 2016 07:03
@MerrylArok it had a lot of "issues". Still some issues exists. When I started, I used W3Schools. But I recommend and prefer MDN (Mozilla Developer Network) http://devdocs.io
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:04
anybody needs help
Abhisek Pattnaik
@abhisekp
Nov 13 2016 07:04
@Argestis if the condition is falsy, if block won't be executed
@aman-kumayu someone in the world needs
@XRinduDendam
Nov 13 2016 07:05

please help to pass the challenge. i had to test the script on console and seem everything ok. should be passed. but not. try including console.log("set") and result is not set. but the challenge always showing red color.

// 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) {
var o=collectionCopy[id],collection=collectionCopy;
if(value.length > 0){
if(o.hasOwnProperty(prop)){
if(prop == "tracks"){
o[prop].push(value);
}else{
o[prop]=value;
}
}else{
console.log("set");
switch(prop){
case "artist":
o.artist=value;
break;
case "tracks":
o.tracks=[value];
break;
}
}
}
return collection;
}

// Alter values below to test your code
updateRecords(2548, "tracks", "");

what should i do ?

Alexandro Pequeno
@Argestis
Nov 13 2016 07:05
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:05
@abhisekp who needs help
Abhisek Pattnaik
@abhisekp
Nov 13 2016 07:06
@aman-kumayu :point_up: November 13, 2016 12:35 PM
Alexandro Pequeno
@Argestis
Nov 13 2016 07:06
@abhisekp but even when the length is not the same is triggering :C
Abhisek Pattnaik
@abhisekp
Nov 13 2016 07:07
@Argestis impossible. Use console.log and verify
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:07
@XRinduDendam hiii you need some help
Alexandro Pequeno
@Argestis
Nov 13 2016 07:07
@aman-kumayu i do :C
@aman-kumayu I'm actually checking in it, and I swear is triggering
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:07
@Argestis what
Alexandro Pequeno
@Argestis
Nov 13 2016 07:07
@abhisekp 'm actually checking in it, and I swear is triggering
@aman-kumayu got problems with an if on my code pen that is triggering even when the condition is not true
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:08
@Argestis can you explain me your problem ?
Alexandro Pequeno
@Argestis
Nov 13 2016 07:09

@aman-kumayu yes! :D: https://codepen.io/argestis/pen/gLraBq?editors=0012

in this part of my code;


ame.blue.click(function(){

game.guessWhat.push(1);

if(game.guessWhat.length === game.count.length){
verifySequence();
}
}
joshandevera
@joshandevera
Nov 13 2016 07:09
var myStr="FirstLine\n\\SecondLine\\\rThirdline";
what am i doing wrong?
Alexandro Pequeno
@Argestis
Nov 13 2016 07:09
@aman-kumayu I have an if that is triggering even when the condition is not true
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:09
@joshandevera line with L
@XRinduDendam
Nov 13 2016 07:09
Joseph
@revisualize
Nov 13 2016 07:10
@XRinduDendam Let's see.. You're making the challenge hard on yourself by using a switch You should be using collection not collectionCopy.
joshandevera
@joshandevera
Nov 13 2016 07:10
damn did not see that thanks.
Joseph
@revisualize
Nov 13 2016 07:10
@joshandevera Thirdline is not the same as ThirdLine
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:10
@joshandevera mention @name for thanksgivings
joshandevera
@joshandevera
Nov 13 2016 07:11
@ghulamshabir sure thanks here's your brownie
CamperBot
@camperbot
Nov 13 2016 07:11
:warning: joshandevera already gave ghulamshabir points
joshandevera sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Nov 13 2016 07:11
@XRinduDendam I recommend going back to the instructions and looking them over.
joshandevera
@joshandevera
Nov 13 2016 07:11
@revisualize thanks :)
CamperBot
@camperbot
Nov 13 2016 07:11
joshandevera sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2300 | @revisualize |http://www.freecodecamp.com/revisualize
@XRinduDendam
Nov 13 2016 07:11
@revisualize .. ok i try.
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:12
@Argestis i am not getting what are you trying to do ?
@XRinduDendam hii
Alexandro Pequeno
@Argestis
Nov 13 2016 07:13
I want to compare the sequence of to arrays number by number; The arrays are called game.count & game.guessWhat
function verifySequence(){

verify = undefined;

for(var i = 0; i < game.count.length; i++){
if(game.count[i] !== game.guessWhat[i]){
verify = false;
}
else{verify = true}
}

if(verify == true){console.log("this is game.guessWhat: " + game.guessWhat); nextRound(); }
else{clearUser();}
}
@aman-kumayu whoop, the message was for you xD
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:15
@Argestis you can use an alternative instead of using verify variable
Alexandro Pequeno
@Argestis
Nov 13 2016 07:15
@aman-kumayu to compare the arrays?
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:15
@Argestis you can use a variable counter initialise it with zero
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:15
@Argestis initialize verify with true and remove else part
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:16
yes to compare arrays
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 07:16
@aman-kumayu unless you have multiple matches
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:17
var counter =0;
for (var i=0;i<arr.length;i++)
{
if(arr[i]===arr1[i])
{
counter++;
}
else counter=0;
}

# this would do

Alexandro Pequeno
@Argestis
Nov 13 2016 07:18
@aman-kumayu @ghulamshabir Alright le tme try, guys. One sec
Aarya Bhorra
@aarya1302
Nov 13 2016 07:19
Hey guys quick question:
What does [object, Object] mean?
Andre Alayon
@Meseta22
Nov 13 2016 07:20
Hello! Does anyone know of a one-stop site that clearly shows Javascript syntax? Like this http://www.json.org/object.gif
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 07:21
Andre Alayon
@Meseta22
Nov 13 2016 07:21
Aarya what is the context
@XRinduDendam
Nov 13 2016 07:21
@revisualize the meaning of not set is delete the property ?
Aarya Bhorra
@aarya1302
Nov 13 2016 07:21
Yes I googled it they gave me explanations on objects not the error
Alexandro Pequeno
@Argestis
Nov 13 2016 07:22

@ghulamshabir @aman-kumayu, alright I forgot to mention actually this part of the code is working. This is where I have problems;

game.blue.click(function(){

game.guessWhat.push(1);

if(game.guessWhat.length === game.count.length){
verifySequence();
}

});

Where I'm comparing the lengths, even when the lengths are not the same the code is triggering and going to verifySequence function, I want to stop going there until i can push enough numbers so both arrays can have the same length.

Aarya Bhorra
@aarya1302
Nov 13 2016 07:22
var status = {};
console.log(status);
That's what I'm trying to do
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 07:22
its an empty object
so its trying to to convert the object to a string
Ajay Tanwar
@ajayt365
Nov 13 2016 07:23
what is the meaning of 'state of variable' in js ?
Aarya Bhorra
@aarya1302
Nov 13 2016 07:23
ohh ok
thanks @Jeff-Shapiro
CamperBot
@camperbot
Nov 13 2016 07:23
aarya1302 sends brownie points to @jeff-shapiro :sparkles: :thumbsup: :sparkles:
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:23
@Argestis atleast mention @name for thankings
Alexandro Pequeno
@Argestis
Nov 13 2016 07:24
@aman-kumayu @ghulamshabir Yes, I'm sorry guys, my brain is fried. Thank you very much for your help!
CamperBot
@camperbot
Nov 13 2016 07:24
argestis sends brownie points to @aman-kumayu and @ghulamshabir :sparkles: :thumbsup: :sparkles:
Andre Alayon
@Meseta22
Nov 13 2016 07:25
@Jeff-Shapiro is this just because the console has nothing to log? Like if there was any value at all it wouldn't attempt to convert to string?
Erick Munoz
@wutm8
Nov 13 2016 07:26

function largestOfFour(arr) {
arr = arr.split(" ");
if(arr[0] > arr.length[-1]){
return arr.splice(arr.length[-1]);
}
return arr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
whats wrong here?

Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:28
@wutm8 you can use either nested loops to get nested array values, or you can use map and math.mx to solve this challenge
Joseph
@revisualize
Nov 13 2016 07:29
@XRinduDendam What?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:29
@wutm8 or even one loop and Math.max inside that loop will work also
Joseph
@revisualize
Nov 13 2016 07:29
@wutm8 Let's see. There are no spaces in your array.
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 07:30
@Meseta22 try it
Aarya Bhorra
@aarya1302
Nov 13 2016 08:00
var channel = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
var urlStream = channel.map(function(val) {
return "https://crossorigin.me/https://wind-bow.hyperdev.space/twitch-api/streams/" + val;
});
var urlChannel = channel.map(function(val) {
return "https://crossorigin.me/https://wind-bow.hyperdev.space/twitch-api/channels/" + val;
});
var isItWorking = {};
$(document).ready(function() {$.each(urlStream, function(val) {
$.ajax({ type: "GET", dataType: "json", url: urlStream[val], success: function(json) { if (json.stream === null) { isItWorking[String(channel[val])] = "offline" } else { isItWorking[String(channel[val])] = "online"; } } }); });$.each(urlChannel, function(val) {
$.ajax({ type: "GET", dataType: "json", url: urlChannel[val], success: function(json) { //console.log(json);$("#streams").append("<div id='"+json.display_name+"'><a href='"+json.url+"'target='_blank'><img src='"+json.logo+"' >"+json.display_name+"</a><p>"+isItWorking[channel[val]]+"</p></div>");
//console.log(\$("#stream"))
}
});
});
console.log(isItWorking.freecodecamp);
//console.log(offline);
});
Ajay Tanwar
@ajayt365
Nov 13 2016 08:07
@aarya1302 you are required to enter api key to get the object . instead use the gist on github by quincy larson .
Micah Lewis
@EastML
Nov 13 2016 08:15
If I have an array with a group of numbers and I want to search for two numbers together, is it possible to use indexOf to find them?
For example if I want to search an array like [2, 3, 4, 5, 6, 7, 8]
can I do that using indexOf?
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:23
hi all
I am beginner in JS,can you give me experienced site that I can learn JS?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:26
@EastML you will need to call indexOf for each number you are searching for
zack
@acting2332
Nov 13 2016 08:27
Hey guys i am working on my personal page and i am starting to make my page2 with a background and i have written everything like my page one but its not working
is anyone able to help?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:28
@acting2332 unless we see your code
Alexandro Pequeno
@Argestis
Nov 13 2016 08:29
Guys, any ideas on why a click function triggers multiple times, when there's not another click nested?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:33
@acting2332 pagetwo vs pageTwo ??
Micah Lewis
@EastML
Nov 13 2016 08:34
@ghulamshabir what if I'm looking for the same number repeating twice in a row, for example [2, 2]
can I do array.indexOf((2,2))
Merryl
@MerrylArok
Nov 13 2016 08:37
@abhisekp thanks for the recommendation!
CamperBot
@camperbot
Nov 13 2016 08:37
merrylarok sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star2: 3153 | @abhisekp |http://www.freecodecamp.com/abhisekp
zack
@acting2332
Nov 13 2016 08:37
@ghulamshabir i tried both didnt make a difference
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:39
@EastML second argument is for fromIndex, might be you want this array.indexOf(2, array.indexOf(2))
will be right back
bahaa aldin
@bahaa-al-deen
Nov 13 2016 08:45

function uniteUnique(arr) {
var one = [];
var args = Array.prototype.slice.call(arguments);
var two = args.reduce(function lolo (a,b) {
return a.concat(b);
});

for (i=0; i<args[0].length; i++) {
one.push(args[0][i]);
}
/*
for (i=0; i<two.length; i++) {
if (one[0] != two[i] && one[1] != two [i] && one[2] != two [i]) {
one.push(two[i]);
}
}
*/
var three = [];
for (i=0; i<two.length; i++) {
for (j=0; j<one.length; j++) {
if (one[j] != two[i]) {
three.push(two[i]);
}
}

}

return three;
}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
there's something wrong with my nested for loop
what did miss ?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:45
@acting2332 you can have only one background per page
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:46
@ghulamshabir False!
zack
@acting2332
Nov 13 2016 08:46
@ghulamshabir i knoww but i want to give the next page the pagetwo a background also?
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:46
@acting2332 PM me I have it working
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:47
@Jeff-Shapiro oh I might be wrong
zack
@acting2332
Nov 13 2016 08:47
sorry i have never privite messaged someone how do you do it?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:47
@Jeff-Shapiro you can help him here so we can see the solution
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:48
@acting2332 click on my picture
then private message
Prateek Gogia
@reeversedev
Nov 13 2016 08:49
Anyone done with Nesting of loops challenge?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:50
@reeversedev what problem you have ??
zack
@acting2332
Nov 13 2016 08:51
@Jeff-Shapiro i am sorry but i am really not seeing anything that says privite message lol
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:55
whats wrong ?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:57
@AGalstyanK622 console.log is unreachable after you return from function
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:57
how can I fix it ?
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:57
@AGalstyanK622 you need a space between ,I
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:57
@AGalstyanK622 you could do this console.log("Hi I am " + name);
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:58
@ghulamshabir instruction is another
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:58
@AGalstyanK622 no look at what you have and what the intstruction says!
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:58
@AGalstyanK622 oh which challenge
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:59
@Jeff-Shapiro what part is wrong?
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 09:01
@AGalstyanK622 line 2
Philipp Scholz
@philipp32
Nov 13 2016 09:04

Good morning. :) I am working on finding the longest word in an array.


function findLongestWord(str) {
var words = str.split(" ");
for (i=0; i<=words.length; i++)
if (i==words.length){
return words.length;
}
}

findLongestWord("The quick brown fox jumped over the lazy dog");

However, it only gives out the number of words in the var words. What do I need to change for this to work?

Prateek Gogia
@reeversedev
Nov 13 2016 09:05
@ghulamshabir I am not able to get the product.
Emerson
@DikoFaji
Nov 13 2016 09:10
@philipp32 im done with that challenge and what i did is split, map and sort
Ajay Tanwar
@ajayt365
Nov 13 2016 09:15
@AGalstyanK622 add a space before I and . do console.log(nameString('Arman')); or var store= nameString('Arman'); console.log(store);
since u r returning a value you need to store it in a variable before printing it .
and nameString is a function, when you do console.log(nameString) it should print function
Ankit Gaurav
@ankitgaurav
Nov 13 2016 09:26
@philipp32
use this
function findLongestWord(str) {
var maxLength = 0;
var words = str.split(" ");
for (i=0; i<words.length; i++) {//i should be less than length of array
if (maxLength<words[i].length){
maxLength = words[i];
}
}
return maxLength;
Mukul
@mukulramchandani
Nov 13 2016 09:47
function destroyer(arr) {

// Remove all the values

var value = [];
var counter = 0;

var arr1 = arr;

for(var i=1; i<arguments.length; i++){
for(var j =0;j<arr.length; j++){
if(arr[j]===arguments[i]){
counter++;
value = arr1.splice(j,counter);
}
}
}

return arr1;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Ghulam Shabir
@ghulamshabir
Nov 13 2016 09:47
@philipp32 you need a variable initiazlied with zero and compare that with each word's length in the array, replacing the variable's value with longer length. your loop condition should i<words.length without = and return that variable you created instead of return words.length
Ghulam Shabir
@ghulamshabir
Nov 13 2016 09:57
@mukulcode you need to remove one element each time in the loop, using count++ remove more elements
chaoz4ngel
@chaoz4ngel
Nov 13 2016 09:58

"Return largest number in array"
i have this code:

function largestOfFour(arr) {
var item = 0;
var result = [];
// You can do this!
var maxx = arr[i].reduce(function(first, second){
item = Math.max(first, second);
result.push(item);
return result;
});
return result;
}

reduce() method is good?

*this is the code

function largestOfFour(arr) {
var item = 0;
var result = [];
// You can do this!
var maxx = arr.reduce(function(first, second){
item = Math.max(first, second);
result.push(item);
return result;
});
return result;
}
or is bettere something like this?

function largestOfFour(arr) {
var item = 0;
var result = [];
// You can do this!
var maxx = arr.reduce(function(first, second){
if (first > second){
item = first;
result.push(item);
}
else{
item = second;
result.push(item);
}

return result;
});
return result;
}
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:02
@chaoz4ngel first second are sub arrays, Math.max either needs two values or you can use Math.max.apply(null, array)
@chaoz4ngel you can simply use a loop giving each sub aray to Math.max.apply
Mukul
@mukulramchandani
Nov 13 2016 10:04
@ghulamshabir how to remove one element from the loop