13th
Nov 2016
AudioGen
@AudioGen
Nov 13 2016 00:00 UTC
that would space escape from Letme
Joseph
@revisualize
Nov 13 2016 00:00 UTC
@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 UTC
that was some good shit :D
AudioGen
@AudioGen
Nov 13 2016 00:00 UTC
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 UTC
@AudioGen JS Style Guides state to use "s
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:01 UTC
@tvan082998 here is solution (var myStr ="FirstLine\n\SecondLine\\rThirdLine"; // Change this line)
in instructions
Joseph
@revisualize
Nov 13 2016 00:01 UTC
And that doesn't work.
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:02 UTC
var myStr ="FirstLine\n\SecondLine\\rThirdLine"; // Change this line
lol
when i try to copy this
Joseph
@revisualize
Nov 13 2016 00:02 UTC
:|
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:02 UTC
in subsracts extra \
look
tvan082998
@tvan082998
Nov 13 2016 00:02 UTC
var myStr = "FirstLine\n \SecondLine\ \rThirdLine"; // Change this line
Joseph
@revisualize
Nov 13 2016 00:02 UTC
@SviatoslavOhura That is gitter.
tvan082998
@tvan082998
Nov 13 2016 00:02 UTC
that what i use and still said it wrong
AudioGen
@AudioGen
Nov 13 2016 00:02 UTC
@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 UTC
put \ after \n with no spaces, and triple \ before r
Joseph
@revisualize
Nov 13 2016 00:02 UTC

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

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 UTC
@SviatoslavOhura You should learn how to format code.
SviatoslavOhura
@SviatoslavOhura
Nov 13 2016 00:05 UTC
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 UTC
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 UTC
@Jvernz when you shift, you're removing the first character or index from your value
Joseph
@revisualize
Nov 13 2016 00:06 UTC

@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 UTC
@AudioGen Correct, that's what I want
AudioGen
@AudioGen
Nov 13 2016 00:06 UTC
It doesn't appear to really be beneficial for that challenge
tvan082998
@tvan082998
Nov 13 2016 00:06 UTC
i learn js like 2 years ago now i barely remember
AudioGen
@AudioGen
Nov 13 2016 00:06 UTC
why?
Justin Vernon
@Jvernz
Nov 13 2016 00:07 UTC
@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 UTC
are you trying to turn the first argument into the 2nd argument?
oh
Phillip Kelley-Dotson
@pkdotson
Nov 13 2016 00:07 UTC
Javascript is such a mind fuck. ugh!
Justin Vernon
@Jvernz
Nov 13 2016 00:07 UTC
I'm just not sure how to go through with the comparison
Emily Christensen
@emmalee113
Nov 13 2016 00:08 UTC
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 UTC
@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 UTC
@WhiteLeaf1103 you just need to construct a string with the parameters.
AudioGen
@AudioGen
Nov 13 2016 00:09 UTC
@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 UTC
@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 UTC
no cause they want me to edit inside the function
Justin Vernon
@Jvernz
Nov 13 2016 00:11 UTC
@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 UTC
@WhiteLeaf1103 But, you still need to use the parameters.
zack
@acting2332
Nov 13 2016 00:11 UTC
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 UTC
use the parameters where!?
tvan082998
@tvan082998
Nov 13 2016 00:11 UTC
Who have gotten a certificate from here?
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:11 UTC
inside the var result?
Joseph
@revisualize
Nov 13 2016 00:11 UTC
@acting2332
AudioGen
@AudioGen
Nov 13 2016 00:12 UTC
@Jvernz You could just split() which you did
tvan082998
@tvan082998
Nov 13 2016 00:12 UTC
the secondline require 2 back from start and end
AudioGen
@AudioGen
Nov 13 2016 00:12 UTC
@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 UTC
@WhiteLeaf1103 Your function is returning result .. So, yes.. You need to reassign result
tvan082998
@tvan082998
Nov 13 2016 00:13 UTC
so "first\n 2\second2\ \rthird";
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:13 UTC
why does it say to change below? i dont understand that...
Justin Vernon
@Jvernz
Nov 13 2016 00:13 UTC
@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 UTC
@WhiteLeaf1103 Because they want you to specifically reassign a variable.
AudioGen
@AudioGen
Nov 13 2016 00:14 UTC
@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 UTC
@AudioGen Alright cool thank you!
CamperBot
@camperbot
Nov 13 2016 00:14 UTC
jvernz sends brownie points to @audiogen :sparkles: :thumbsup: :sparkles:
JakeVittoriso
@JakeVittoriso
Nov 13 2016 00:14 UTC
Hey guys, I have I am having difficulties trying to figure out this code.
WhiteLeaf1103
@WhiteLeaf1103
Nov 13 2016 00:14 UTC
@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 UTC
@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 UTC
@revisualize no how this is suppose to be coded...
Joseph
@revisualize
Nov 13 2016 00:15 UTC
Would it be better if I did this.
JakeVittoriso
@JakeVittoriso
Nov 13 2016 00:15 UTC
/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 UTC
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 UTC

@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 UTC
that looks more right. @revisualize thank you so much.
CamperBot
@camperbot
Nov 13 2016 00:16 UTC
whiteleaf1103 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2298 | @revisualize |http://www.freecodecamp.com/revisualize
zack
@acting2332
Nov 13 2016 00:17 UTC
var myStr="firstline\n\ \secondline\ \\rthirdline"; i just dont know
Joseph
@revisualize
Nov 13 2016 00:17 UTC
@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 UTC
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 UTC
@revisualize AH THANKS SO MUCH
CamperBot
@camperbot
Nov 13 2016 00:21 UTC
acting2332 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2299 | @revisualize |http://www.freecodecamp.com/revisualize
zack
@acting2332
Nov 13 2016 00:21 UTC
i over look the little stuff alot
AudioGen
@AudioGen
Nov 13 2016 00:21 UTC
@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 UTC
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 UTC
@JCDevelop3d any idea on how to do this: Declare a local variable myVar inside myLocalScope ?
Joseph Chu
@ChewyCodes
Nov 13 2016 00:29 UTC
umm no i'm trying to figure it out myself
Diego Mayer
@Chrono79
Nov 13 2016 00:30 UTC
Gabi
@JJcreated
Nov 13 2016 00:31 UTC
@Chrono79 both these are already solved
ust fine
just*
Joseph Chu
@ChewyCodes
Nov 13 2016 00:31 UTC
@Chrono79 so baiscally your telling me to figure it out on my own.
Diego Mayer
@Chrono79
Nov 13 2016 00:32 UTC
@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 UTC
ok got it
Justin Vernon
@Jvernz
Nov 13 2016 00:32 UTC
@AudioGen That was my thought. But that's the suggested method
Gabi
@JJcreated
Nov 13 2016 00:32 UTC
oh nvm, sorry
hey can anybody help me out with ceasars cipher?
Diego Mayer
@Chrono79
Nov 13 2016 00:34 UTC
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 UTC
@Jvernz I don't remember then
Sorry
Got to take off now
Justin Vernon
@Jvernz
Nov 13 2016 00:37 UTC
@AudioGen No problem, thanks for your previous help
CamperBot
@camperbot
Nov 13 2016 00:37 UTC
:warning: jvernz already gave audiogen points
jvernz sends brownie points to @audiogen :sparkles: :thumbsup: :sparkles:
Justin Vernon
@Jvernz
Nov 13 2016 00:39 UTC
Anyone out there who can assist me with the Mutations challenge?
Diego Mayer
@Chrono79
Nov 13 2016 00:39 UTC
silver537
@silver537
Nov 13 2016 00:40 UTC
@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 UTC
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 UTC
var myStr = "This is the start. " + "This is the end. ";
not sure whats wrong with this
Diego Mayer
@Chrono79
Nov 13 2016 00:41 UTC
@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 UTC
I'm not sure how to check the strings for specific letters.
Jeremy P-K
@Jerediablo
Nov 13 2016 00:41 UTC

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 UTC
@acting2332 the space in the second string, is it there in the challenge?
Jeremy P-K
@Jerediablo
Nov 13 2016 00:41 UTC
is the loop not stopping or what
Diego Mayer
@Chrono79
Nov 13 2016 00:42 UTC
@Jerediablo initialize x as 0
zack
@acting2332
Nov 13 2016 00:42 UTC
@Chrono79 yup that was it thank you haha
CamperBot
@camperbot
Nov 13 2016 00:42 UTC
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 UTC
no problem
Justin Vernon
@Jvernz
Nov 13 2016 00:43 UTC
@Chrono79 What can I do to check for the letters in each string?
Diego Mayer
@Chrono79
Nov 13 2016 00:43 UTC
@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 UTC
@Chrono79 still frozen :worried:
Diego Mayer
@Chrono79
Nov 13 2016 00:46 UTC
@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 UTC
@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 UTC
@Chrono79 ah yes, I see how that line is wrong. Not sure why its freezing in freecodecamp
Johnny
@JohnnyBizzel
Nov 13 2016 00:48 UTC
@Jvernz indexOf(letter) letter == character
Diego Mayer
@Chrono79
Nov 13 2016 00:48 UTC
@Jvernz num there should be a letter
Justin Vernon
@Jvernz
Nov 13 2016 00:49 UTC
@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 UTC
@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 UTC
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 UTC
@Jvernz It will return the index in the string array
Justin Vernon
@Jvernz
Nov 13 2016 00:50 UTC
@JohnnyBizzel awesome that's what I wanted to know. @Chrono79 thanks guys!
CamperBot
@camperbot
Nov 13 2016 00:50 UTC
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 UTC
@laravelblade Change the web server setting
Patkaa
@Patkaa
Nov 13 2016 00:50 UTC
Hey people!
Nov 13 2016 00:50 UTC
@JohnnyBizzel how?
Diego Mayer
@Chrono79
Nov 13 2016 00:50 UTC
@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 UTC
@Jvernz well you can do a little math
Patkaa
@Patkaa
Nov 13 2016 00:51 UTC

// 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 UTC
"gift" is one of the possible values you can call your function with
Patkaa
@Patkaa
Nov 13 2016 00:51 UTC
@Chrono79 checkProp?
Diego Mayer
@Chrono79
Nov 13 2016 00:51 UTC
yes
Justin Vernon
@Jvernz
Nov 13 2016 00:52 UTC
@silver537 what do you mean?
Jeremy P-K
@Jerediablo
Nov 13 2016 00:52 UTC
CamperBot
@camperbot
Nov 13 2016 00:52 UTC
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 UTC
:+1:
Johnny
@JohnnyBizzel
Nov 13 2016 00:52 UTC
@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 UTC
checkObj("checkProp");
didn't work
@JohnnyBizzel Good evening/night Johnny!
Diego Mayer
@Chrono79
Nov 13 2016 00:52 UTC
@Patkaa that's a string, not the var name
Johnny
@JohnnyBizzel
Nov 13 2016 00:52 UTC
Patkaa
@Patkaa
Nov 13 2016 00:53 UTC
@Chrono79 checkProp didnt work either
Walid Ashri
@walidashri
Nov 13 2016 00:53 UTC
@Patkaa this is a string no quotes
Johnny
@JohnnyBizzel
Nov 13 2016 00:53 UTC
@Patkaa Hey. Morgen
Gabi
@JJcreated
Nov 13 2016 00:53 UTC
// 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 UTC
@JohnnyBizzel Hey there
Diego Mayer
@Chrono79
Nov 13 2016 00:53 UTC
@Patkaa show me how you wrote checkProp without the quotes
Patkaa
@Patkaa
Nov 13 2016 00:53 UTC
// 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 UTC
@Patkaa no quotes needed for (checkProp)
@walidashri Morning ! :D
Patkaa
@Patkaa
Nov 13 2016 00:54 UTC
says it's not defined
Diego Mayer
@Chrono79
Nov 13 2016 00:54 UTC
@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 UTC
  for (var i = 0;i>arr.length;i++){
}
Should I assign answer.indexOf(i); to a variable?
Johnny
@JohnnyBizzel
Nov 13 2016 00:54 UTC
@Patkaa
checkObj(checkProp);
@Jvernz I would
MoNag1
@MoNag1
Nov 13 2016 00:54 UTC
@JJcreated charCodeAt will give you the unicode numeric value of any character you input
Patkaa
@Patkaa
Nov 13 2016 00:54 UTC
where did u write that?
Justin Vernon
@Jvernz
Nov 13 2016 00:54 UTC
@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 UTC
ahh
Walid Ashri
@walidashri
Nov 13 2016 00:55 UTC
@Chrono79 3 His for you :P
Diego Mayer
@Chrono79
Nov 13 2016 00:55 UTC
@Patkaa if (myObj.hasOwnProperty("gift")){<- here you should change "gift"
@walidashri good night?
Patkaa
@Patkaa
Nov 13 2016 00:55 UTC
awesome got it to work guys
thanks for the help, you da best
Johnny
@JohnnyBizzel
Nov 13 2016 00:55 UTC
@Patkaa :+1: Tak
Walid Ashri
@walidashri
Nov 13 2016 00:55 UTC
@Chrono79 no HI HI HI
silver537
@silver537
Nov 13 2016 00:55 UTC
@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 UTC
okay so str.charCodeAt() returns a number?
Johnny
@JohnnyBizzel
Nov 13 2016 00:56 UTC
@Jvernz What is the whole challenge you are on?
Diego Mayer
@Chrono79
Nov 13 2016 00:56 UTC
@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 UTC
@JohnnyBizzel Mutations
Johnny
@JohnnyBizzel
Nov 13 2016 00:56 UTC
00:56 here
Walid Ashri
@walidashri
Nov 13 2016 00:57 UTC
oh do you got why three :) it's 04.57 am
MoNag1
@MoNag1
Nov 13 2016 00:57 UTC
@JJcreated yes, it returns a number which you can match according to this table
Johnny
@JohnnyBizzel
Nov 13 2016 00:58 UTC
@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 UTC
@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 UTC
6:49 here
Walid Ashri
@walidashri
Nov 13 2016 00:58 UTC
@Chrono79 It's *king duty :(
Nov 13 2016 00:59 UTC
How can i set up an additional cpanel user?
Diego Mayer
@Chrono79
Nov 13 2016 00:59 UTC
@walidashri keep it up then ;)
MoNag1
@MoNag1
Nov 13 2016 00:59 UTC
@JJcreated the parameter it accepts between () is the index of the letter within the string
silver537
@silver537
Nov 13 2016 00:59 UTC
@JJcreated it returns the respected ASCII number for that character.
Johnny
@JohnnyBizzel
Nov 13 2016 01:00 UTC
Diego Mayer
@Chrono79
Nov 13 2016 01:00 UTC
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 UTC
@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 UTC
@Jvernz cause you cant divide if it's odd :P
Justin Vernon
@Jvernz
Nov 13 2016 01:00 UTC
@silver537 I get that lol. But what's the point of dividing in the first place?
Johnny
@JohnnyBizzel
Nov 13 2016 01:00 UTC
@Chrono79 So long as you don't drink blood :worried:
silver537
@silver537
Nov 13 2016 01:01 UTC
just kidding. i was responding from your earlier question
Diego Mayer
@Chrono79
Nov 13 2016 01:01 UTC
@JohnnyBizzel Sometimes I feel like I'm the one been drained
silver537
@silver537
Nov 13 2016 01:02 UTC

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 UTC
@Chrono79 For sure! :D
Justin Vernon
@Jvernz
Nov 13 2016 01:02 UTC
@silver537 Ah I see
I'm not a fan of indexOf(). This is way confusing to me
Johnny
@JohnnyBizzel
Nov 13 2016 01:02 UTC
@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 UTC
@Jvernz well become a fan, because it saves you from recreating the wheel
Justin Vernon
@Jvernz
Nov 13 2016 01:03 UTC
@silver537 Lol hopefully this is the case
silver537
@silver537
Nov 13 2016 01:05 UTC
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 UTC
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 UTC
@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 UTC
@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 UTC

@silver537

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

:P

silver537
@silver537
Nov 13 2016 01:21 UTC
@walidashri i spelled it out. :P
Walid Ashri
@walidashri
Nov 13 2016 01:23 UTC
@silver537 when was las time I said thanks
CamperBot
@camperbot
Nov 13 2016 01:23 UTC
walidashri sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:warning: walidashri already gave silver537 points
silver537
@silver537
Nov 13 2016 01:24 UTC
in the help section
Walid Ashri
@walidashri
Nov 13 2016 01:25 UTC
@silver537 Oh realy ! am testing when I can give more :brownie:
comaeternal
@comaeternal
Nov 13 2016 01:25 UTC
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 UTC
@walidashri one brownie per hour
@comaeternal just leave it as (howMany)
comaeternal
@comaeternal
Nov 13 2016 01:27 UTC
@silver537 wow thanks
CamperBot
@camperbot
Nov 13 2016 01:27 UTC
comaeternal sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
Norman Dela Cruz
@dcnr
Nov 13 2016 01:29 UTC
@walidashri Butchered version!
const doesItHaveIt = (test, char) => !!~test.indexOf(char);

doesItHaveIt("Hello!", 'e'); // true
silver537
@silver537
Nov 13 2016 01:30 UTC
calm down now
bitwise is soooo overrated
__mifflin__
@cdrainxv
Nov 13 2016 01:31 UTC
Heresy!!!
silver537
@silver537
Nov 13 2016 01:31 UTC
just kidding
Norman Dela Cruz
@dcnr
Nov 13 2016 01:31 UTC
It's an unnecessary evil!
Walid Ashri
@walidashri
Nov 13 2016 01:33 UTC
@dcnr what is version :) thanks
CamperBot
@camperbot
Nov 13 2016 01:33 UTC
walidashri sends brownie points to @dcnr :sparkles: :thumbsup: :sparkles:
Emily Christensen
@emmalee113
Nov 13 2016 01:34 UTC
anyone able to help me with the challenge called Return Early Pattern for Functions?
Kacper
@Fayacre
Nov 13 2016 01:35 UTC
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 UTC
@Fayacre try read the lesson you'll get some :)
Norman Dela Cruz
@dcnr
Nov 13 2016 01:37 UTC
@walidashri just a variation, thanks though :P
CamperBot
@camperbot
Nov 13 2016 01:37 UTC
dcnr sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Emily Christensen
@emmalee113
Nov 13 2016 01:37 UTC
@Fayacre make sure you cancel out your \
Kacper
@Fayacre
Nov 13 2016 01:37 UTC
I've read lessons about it like 5 times and i still don't get it ;_;
Jan
@burning-monk
Nov 13 2016 01:37 UTC
@emmalee113 what have you so far?
Emily Christensen
@emmalee113
Nov 13 2016 01:38 UTC

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

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

so i have tried...

(a<0) return "undefined"

silver537
@silver537
Nov 13 2016 01:39 UTC
you need to check both a and b
Jan
@burning-monk
Nov 13 2016 01:40 UTC
but not with and
Walid Ashri
@walidashri
Nov 13 2016 01:40 UTC
@silver537 a or b
Emily Christensen
@emmalee113
Nov 13 2016 01:40 UTC
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 UTC
oh well then ||
Emily Christensen
@emmalee113
Nov 13 2016 01:40 UTC
yes i did that with both a and b but it didn't do anything
Jan
@burning-monk
Nov 13 2016 01:40 UTC
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 UTC
try doing and show ur code please @emmalee113
walidashri @walidashri Brb
Johnny
@JohnnyBizzel
Nov 13 2016 01:41 UTC
@emmalee113 if (a<0) return undefined; should work??
Jan
@burning-monk
Nov 13 2016 01:41 UTC
no
silver537
@silver537
Nov 13 2016 01:41 UTC
if(expression || expression){return undefined} :D
Emily Christensen
@emmalee113
Nov 13 2016 01:42 UTC
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 UTC
@emmalee113 no quotes around undefined
silver537
@silver537
Nov 13 2016 01:42 UTC
and bingo was his name-o! :D
Justin Vernon
@Jvernz
Nov 13 2016 01:42 UTC
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 UTC
@Jvernz idk. i would need to check it
Emily Christensen
@emmalee113
Nov 13 2016 01:43 UTC
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 UTC
emmalee113 sends brownie points to @silver537 and @johnnybizzel :sparkles: :thumbsup: :sparkles:
silver537
@silver537
Nov 13 2016 01:43 UTC
i only did tht to show you how you would use indexOf()
Stephanie
@spennypacker
Nov 13 2016 01:43 UTC

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 UTC
@emmalee113 :+1:
Justin Vernon
@Jvernz
Nov 13 2016 01:44 UTC
@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 UTC
jvernz sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 13 2016 01:46 UTC
@spennypacker Why? Is it not a variable?
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 UTC
wth? what is that challenge name? @spennypacker
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 UTC
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 UTC
@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 UTC
@A242 try adding the new element first and then make the remove instruction
Justin Vernon
@Jvernz
Nov 13 2016 01:49 UTC
Just realized I've had i>arr.length instead of i<arr.length for the last hour
Johnny
@JohnnyBizzel
Nov 13 2016 01:49 UTC

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

@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 UTC

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 UTC
wouldn't that just put the second value of the array lower case?
silver537
@silver537
Nov 13 2016 01:51 UTC


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 UTC
@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 UTC
@paulotokimatu yep. @A242 push first, then shift.
@paulotokimatu @silver537 Thank you both for this, I was on this for almost an hour
CamperBot
@camperbot
Nov 13 2016 01:55 UTC
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 UTC
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 UTC
@A242 No problem ^^ Just keep an eye in the tests and why your code failed
silver537
@silver537
Nov 13 2016 01:57 UTC
@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 UTC
@Jvernz arr[1] (second element of the array)
Justin Vernon
@Jvernz
Nov 13 2016 01:57 UTC
Right, it makes sense now
silver537
@silver537
Nov 13 2016 01:58 UTC
which is a good use of indexOf():P
Justin Vernon
@Jvernz
Nov 13 2016 01:58 UTC
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 UTC
@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 UTC
Right
silver537
@silver537
Nov 13 2016 01:58 UTC
@Jvernz you can use indexOf() and every() methods which will reduce your code a whole bunch
Justin Vernon
@Jvernz
Nov 13 2016 01:58 UTC
When I eventually figure this out, can you guys show me how you solved it?
silver537
@silver537
Nov 13 2016 01:59 UTC
i can show you now :P
__mifflin__
@cdrainxv
Nov 13 2016 01:59 UTC
@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 UTC
@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 UTC

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 UTC
why do you have 2 codes up?
delet3e one of them
Johnny
@JohnnyBizzel
Nov 13 2016 02:03 UTC
@umpienoob Which challenge are you on??? :worried:
Walid Ashri
@walidashri
Nov 13 2016 02:03 UTC
@umpienoob ("count" -= 1); count here is a string
umpienoob
@umpienoob
Nov 13 2016 02:03 UTC
"Counting Cards"
Justin Vernon
@Jvernz
Nov 13 2016 02:03 UTC
@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 UTC
@Jvernz he's checking for those that come up false
Justin Vernon
@Jvernz
Nov 13 2016 02:04 UTC
right
Walid Ashri
@walidashri
Nov 13 2016 02:04 UTC
@umpienoob remove quotes around count in ur code
Johnny
@JohnnyBizzel
Nov 13 2016 02:04 UTC
@Jvernz Yes but we want to test all the letters, therefore you need a loop
Justin Vernon
@Jvernz
Nov 13 2016 02:04 UTC
Right I have it inside a loop
silver537
@silver537
Nov 13 2016 02:04 UTC
if none come up false, then it will return true
__mifflin__
@cdrainxv
Nov 13 2016 02:04 UTC
@ @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 UTC
everything checks out except ["hello", "hey"]
Johnny
@JohnnyBizzel
Nov 13 2016 02:05 UTC
@Jvernz i return true outside of the loop
Justin Vernon
@Jvernz
Nov 13 2016 02:05 UTC
Same
silver537
@silver537
Nov 13 2016 02:05 UTC
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 UTC
^ exactly
Johnny
@JohnnyBizzel
Nov 13 2016 02:05 UTC
@Jvernz ...which is what you are asked to do
silver537
@silver537
Nov 13 2016 02:06 UTC
dont return true, until the loop finishes which means use the return outside of the loop
umpienoob
@umpienoob
Nov 13 2016 02:06 UTC
@cdrainxv How do I do that?
Justin Vernon
@Jvernz
Nov 13 2016 02:06 UTC
@JohnnyBizzel @silver537 I see what you guys are saying.
Johnny
@JohnnyBizzel
Nov 13 2016 02:06 UTC
@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 UTC
@JohnnyBizzel thanks!
CamperBot
@camperbot
Nov 13 2016 02:07 UTC
jvernz sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 13 2016 02:07 UTC
@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 UTC

@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 UTC
@Jvernz Cheers! Thanks for making me earn it! :D
CamperBot
@camperbot
Nov 13 2016 02:08 UTC
johnnybizzel sends brownie points to @jvernz :sparkles: :thumbsup: :sparkles:
Justin Vernon
@Jvernz
Nov 13 2016 02:10 UTC
@JohnnyBizzel that link you just sent me is amazing
Johnny
@JohnnyBizzel
Nov 13 2016 02:11 UTC
@Jvernz Somebody here on FCC told me about it.
Simon Cordova
@gbsimon87
Nov 13 2016 02:11 UTC
Hey oh! Greetings...
Johnny
@JohnnyBizzel
Nov 13 2016 02:11 UTC
@gbsimon87 Good morning
Simon Cordova
@gbsimon87
Nov 13 2016 02:12 UTC
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 UTC
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 UTC
@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 UTC
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 UTC
@cdrainxv Hmm,still not working . Always returns 0
Justin Vernon
@Jvernz
Nov 13 2016 02:13 UTC
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 UTC
@umpienoob: show current code now.
Johnny
@JohnnyBizzel
Nov 13 2016 02:13 UTC
@Jvernz Most of the time I am googling for solutions! ;)
umpienoob
@umpienoob
Nov 13 2016 02:14 UTC

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 UTC
@umpienoob: count does not increase or decrease for cases 7 - 9.
umpienoob
@umpienoob
Nov 13 2016 02:16 UTC
@cdrainxv It isn't supposed to. Whatever the inputs though it returns 0
Walid Ashri
@walidashri
Nov 13 2016 02:17 UTC
@umpienoob and where is ur breaks?
Johnny
@JohnnyBizzel
Nov 13 2016 02:18 UTC
@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 UTC
@JohnnyBizzel tthanks
Johnny
@JohnnyBizzel
Nov 13 2016 02:18 UTC
@walidashri :+1:
Walid Ashri
@walidashri
Nov 13 2016 02:18 UTC
oh
__mifflin__
@cdrainxv
Nov 13 2016 02:18 UTC
@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 UTC
@JohnnyBizzel thanks
CamperBot
@camperbot
Nov 13 2016 02:18 UTC
walidashri sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
umpienoob
@umpienoob
Nov 13 2016 02:20 UTC
@cdrainxv Fixed that and added breaks,still returns 0
__mifflin__
@cdrainxv
Nov 13 2016 02:20 UTC
@umpienoob: In fact just remove cases 7 - 9 as it is not even required…
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 02:21 UTC
@umpienoob look at your if statement
__mifflin__
@cdrainxv
Nov 13 2016 02:22 UTC
@umpienoob: Hold and Bet.
umpienoob
@umpienoob
Nov 13 2016 02:23 UTC
@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 UTC
@cdrainxv @umpienoob lol
__mifflin__
@cdrainxv
Nov 13 2016 02:24 UTC
@umpienoob: Ahah… I just noticed too…
umpienoob
@umpienoob
Nov 13 2016 02:25 UTC
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 UTC
No… it was a learning experience for us all.
Johnny
@JohnnyBizzel
Nov 13 2016 02:26 UTC
@umpienoob If you think coding is stupid, why are you doing it?
MoNag1
@MoNag1
Nov 13 2016 02:26 UTC
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 UTC
@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 UTC
@umpienoob As you improve, go back and revisit your solutions. This is called re-factoring.
umpienoob
@umpienoob
Nov 13 2016 02:29 UTC
@JohnnyBizzel Thanks for the tip~
CamperBot
@camperbot
Nov 13 2016 02:29 UTC
umpienoob sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Nov 13 2016 02:29 UTC
@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 UTC

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 UTC

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 UTC
@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 UTC
@ordertaker put this var longestChar=0; inside the func
Justin Vernon
@Jvernz
Nov 13 2016 02:34 UTC
@paulotokimatu Oh okay thanks! Is there another way to categorize all falsy statements?
CamperBot
@camperbot
Nov 13 2016 02:34 UTC
jvernz sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 02:35 UTC
@Jvernz you can try converting the variable to boolean
new_val = Boolean(val);
MoNag1
@MoNag1
Nov 13 2016 02:35 UTC
@ordertaker that's pretty strange, I just tried it
Diego Mayer
@Chrono79
Nov 13 2016 02:35 UTC
@MoNag1 you could use map
ordertaker
@ordertaker
Nov 13 2016 02:36 UTC
@MoNag1 was it successful on your side?
Justin Vernon
@Jvernz
Nov 13 2016 02:36 UTC
@paulotokimatu interesting, I'll give it a shot
Diego Mayer
@Chrono79
Nov 13 2016 02:37 UTC
@ordertaker you used a global var, that's the problem
MoNag1
@MoNag1
Nov 13 2016 02:37 UTC
@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 UTC
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 UTC
@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 UTC
@ordertaker no, I mean its returning 5 but not passing the challenege
ordertaker
@ordertaker
Nov 13 2016 02:39 UTC
@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 UTC
@Jvernz Boolean(arr)
Diego Mayer
@Chrono79
Nov 13 2016 02:40 UTC
@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 UTC
filter(Boolean)
DONE!
ordertaker
@ordertaker
Nov 13 2016 02:43 UTC
@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 UTC
@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 UTC
@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 UTC
@Chrono79 this solved my problem
Diego Mayer
@Chrono79
Nov 13 2016 02:47 UTC
@ordertaker see it here: https://repl.it/ERbB/2
ordertaker
@ordertaker
Nov 13 2016 02:48 UTC

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 UTC
@Jvernz that's cause filter is an array method. only meant for arrays
ordertaker
@ordertaker
Nov 13 2016 02:48 UTC
@Chrono79 thanks for the help!
CamperBot
@camperbot
Nov 13 2016 02:48 UTC
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 UTC
@ordertaker avoid using globals, it'll save your hair ;)
Justin Vernon
@Jvernz
Nov 13 2016 02:48 UTC
@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 UTC
jvernz sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
ordertaker
@ordertaker
Nov 13 2016 02:49 UTC
@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 UTC
Why everybody get his brownie except me total $unfair$
Diego Mayer
@Chrono79
Nov 13 2016 02:50 UTC
@walidashri thanks
CamperBot
@camperbot
Nov 13 2016 02:50 UTC
chrono79 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 02:50 UTC
@walidashri thx
CamperBot
@camperbot
Nov 13 2016 02:50 UTC
zooll8 sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 02:50 UTC
Guys, can you pass me some brownie points, Om-nom-nom, thanks
silver537
@silver537
Nov 13 2016 02:50 UTC
no
Charles
@charlessmith259
Nov 13 2016 02:51 UTC
MoNag1
@MoNag1
Nov 13 2016 02:51 UTC
@Zooll8 no thanks I'd rather not
CamperBot
@camperbot
Nov 13 2016 02:51 UTC
monag1 sends brownie points to @zooll8 :sparkles: :thumbsup: :sparkles:
Walid Ashri
@walidashri
Nov 13 2016 02:51 UTC
@Zooll8 thanks never come like this
CamperBot
@camperbot
Nov 13 2016 02:51 UTC
walidashri sends brownie points to @zooll8 :sparkles: :thumbsup: :sparkles:
Walid Ashri
@walidashri
Nov 13 2016 02:52 UTC
@Chrono79 thanks
CamperBot
@camperbot
Nov 13 2016 02:52 UTC
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 UTC

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 UTC
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 UTC
cause this isn't valid syntax lookup(val)
Walid Ashri
@walidashri
Nov 13 2016 03:12 UTC
this is func lookup(val)
umpienoob
@umpienoob
Nov 13 2016 03:13 UTC
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 UTC
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 UTC
@silver537 What is the correct syntax?
silver537
@silver537
Nov 13 2016 03:18 UTC
when you use parenthesis like that, it is considered a function call
umpienoob
@umpienoob
Nov 13 2016 03:20 UTC
@silver537 Yeah,but what would be the correct syntax for this?
silver537
@silver537
Nov 13 2016 03:21 UTC
well objects are just var obj = {}
so that's what you want
Lucas Tormin
@tormink
Nov 13 2016 03:25 UTC
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 UTC
@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 UTC
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 UTC
I need some help, how can I make a fade out/fade in effect using jquery?
silver537
@silver537
Nov 13 2016 03:30 UTC
i think thats what it is
Lucas Tormin
@tormink
Nov 13 2016 03:31 UTC
@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 UTC
thanks man, that worked
Lucas Tormin
@tormink
Nov 13 2016 03:32 UTC
in the first one, there are two special characters dividing the numbers
silver537
@silver537
Nov 13 2016 03:32 UTC
thats where you would use the or |
$$\d{3}$$|\d{3}
Lucas Tormin
@tormink
Nov 13 2016 03:35 UTC
@silver537 ohh okay, that makes it simpler, for sure, thanks!
CamperBot
@camperbot
Nov 13 2016 03:35 UTC
tormink sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
Lucas Tormin
@tormink
Nov 13 2016 03:39 UTC
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 UTC
@tormink just look for a regex cheat sheet its not hard
Lucas Tormin
@tormink
Nov 13 2016 03:42 UTC
@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 UTC
tormink sends brownie points to @jeff-shapiro :sparkles: :thumbsup: :sparkles:
silver537
@silver537
Nov 13 2016 03:43 UTC
@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 UTC
EgeKaya
@EgeKaya
Nov 13 2016 03:49 UTC
    $("#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 UTC
@chunnali it is working fine here
chunnali
@chunnali
Nov 13 2016 03:52 UTC
@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 UTC
chunnali sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
Paulo Tokimatu
@paulotokimatu
Nov 13 2016 03:53 UTC
@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 UTC

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 UTC
@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 UTC
chunnali sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
:warning: chunnali already gave paulotokimatu points
Ari
@arilaverty
Nov 13 2016 04:00 UTC
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 UTC
someone pls help with caesers cipher
tvan082998
@tvan082998
Nov 13 2016 04:10 UTC
Word Blanks
Conor Murphy
@cmurphy580
Nov 13 2016 04:10 UTC
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 UTC

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 UTC

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 UTC
@iceveda06 how did you use join?
iceveda06
@iceveda06
Nov 13 2016 04:14 UTC
silver537
@silver537
Nov 13 2016 04:15 UTC
@JackVizl you are obsessed with coding :P
JackVizl
@JackVizl
Nov 13 2016 04:15 UTC
why do you say that? @silver537
silver537
@silver537
Nov 13 2016 04:16 UTC
cause you've been here all day
JackVizl
@JackVizl
Nov 13 2016 04:17 UTC
school holidays bruh
not much else to do on a sunday
silver537
@silver537
Nov 13 2016 04:17 UTC
it's saturday....
Matt
@Matteoo7
Nov 13 2016 04:18 UTC
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 UTC
any ideas how to stop deciphering the characters?
silver537
@silver537
Nov 13 2016 04:19 UTC
@iceveda06 you're supposed insert an argument in join()
iceveda06
@iceveda06
Nov 13 2016 04:19 UTC
yeah i figured out @silver537
silver537
@silver537
Nov 13 2016 04:19 UTC
like join(" ")
iceveda06
@iceveda06
Nov 13 2016 04:19 UTC


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 UTC
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 UTC

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 UTC
@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 UTC
@walidashri thanks
CamperBot
@camperbot
Nov 13 2016 04:23 UTC
c0d0er sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
Monesul Haque
@mones-cse
Nov 13 2016 04:24 UTC
@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 UTC
That's the only way to change state values, using setState
Oh
tvan082998
@tvan082998
Nov 13 2016 04:25 UTC
can anyone help me with the JS part call Word Blanks #133
Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:26 UTC
Again, console.log this in the function, and check if youre receiving the component
Monesul Haque
@mones-cse
Nov 13 2016 04:26 UTC
@jenkynolasco11 all console.log show output 10 i am expecting 15 after executing that line
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 04:26 UTC
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 UTC
Another thing, use componentDidMount to initialize values, instead of calling a function in the constructor
Zaurbek Zhakupov
@zzhakupov
Nov 13 2016 04:27 UTC
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 UTC
@jenkynolasco11 ok i will do so but still height value should have updated
Lucas Tormin
@tormink
Nov 13 2016 04:28 UTC
yeeeaaah I did the telephone challenge! I feel proud..most complicated regex I ever wrote
Jenky W. Nolasco
@jenkynolasco11
Nov 13 2016 04:28 UTC
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 UTC
@tormink Hi, can you show us your RegExp for this challenge?
Lucas Tormin
@tormink
Nov 13 2016 04:30 UTC
@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 UTC
@tormink I already did that challenge, just wanted to know your way to do this.
Lucas Tormin
@tormink
Nov 13 2016 04:31 UTC
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 UTC
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 UTC
Or regex101
Vishesh Chanana
@Visheshevi
Nov 13 2016 04:39 UTC
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 UTC
@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 UTC
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 UTC
@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 UTC
ohh okayy
mdahmann
@mdahmann
Nov 13 2016 05:24 UTC
Is it possible to call a tooltip from a different link on the page?
andry91959
@andry91959
Nov 13 2016 05:37 UTC
can someone tell me how to do queue excercise
Abhisek Pattnaik
@abhisekp
Nov 13 2016 05:40 UTC
@andry91959 Q: what is a queue?
@mdahmann what do you mean call a tooltip?
mdahmann
@mdahmann
Nov 13 2016 05:43 UTC
@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 UTC
mdahmann sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star2: 3152 | @abhisekp |http://www.freecodecamp.com/abhisekp
mdahmann
@mdahmann
Nov 13 2016 05:43 UTC
@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 UTC
hmm
mdahmann
@mdahmann
Nov 13 2016 05:44 UTC
@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 UTC
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 UTC
@Argestis next time, just post your codepen. that code wall was too big
Alexandro Pequeno
@Argestis
Nov 13 2016 06:12 UTC
oh, alright.
mdahmann
@mdahmann
Nov 13 2016 06:17 UTC
@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 UTC
mdahmann sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:warning: mdahmann already gave abhisekp points
Ruben00alex
@Ruben00alex
Nov 13 2016 06:24 UTC

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 UTC
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 UTC
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 UTC
Hi I am having trouble with the Word Blank problem that's number 153/
Jeff D.
Nov 13 2016 06:29 UTC
var myStr = "FirstLine\n\SecondLine\\rThirdline";
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:29 UTC
@mdahmann I looked into it and found no foolproof way to hack it. :(
Ruben00alex
@Ruben00alex
Nov 13 2016 06:30 UTC
You're missing a backlash:
Jeff D.
Nov 13 2016 06:30 UTC
that second \ in front of Second line is not showing but it's there
joshandevera
@joshandevera
Nov 13 2016 06:30 UTC
what seem to be the problem with my code 
Ruben00alex
@Ruben00alex
Nov 13 2016 06:30 UTC
it should be
var myStr = "FirstLine\n\SecondLine\rThirdline"
joshandevera
@joshandevera
Nov 13 2016 06:30 UTC
// Only change fahrencode above this line
Jeff D.
Nov 13 2016 06:30 UTC
var myStr = "FirstLine\n\ \SecondLine\\rThirdline";
without the space
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:30 UTC
@Ruben00alex should be no space b/w i and ++
joshandevera
@joshandevera
Nov 13 2016 06:31 UTC

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 UTC
@joshandevera the temperature formula needs celsius value to multiply with
@joshandevera c * 9/5 + 32
Jeff D.
Nov 13 2016 06:32 UTC
var myStr = "FirstLine\n\ \SecondLine\\rThirdline"; // Change this line
Janina Pohorecki
@janepohorecka
Nov 13 2016 06:33 UTC
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 UTC
oh i see thanks @ghulamshabir
CamperBot
@camperbot
Nov 13 2016 06:33 UTC
joshandevera sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:35 UTC
Jeff D.
Nov 13 2016 06:37 UTC
OMG thanks Ghulam....
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:38 UTC
@jeffryadones mention @name while thanking so i get a brownie
Jeff D.
Nov 13 2016 06:38 UTC
how?
thanks @ghulamshabir
CamperBot
@camperbot
Nov 13 2016 06:39 UTC
jeffryadones sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:39 UTC
@jeffryadones just click on my @ghulamshabir it will copied to your chat editor and say thanks
CamperBot
@camperbot
Nov 13 2016 06:39 UTC
ghulamshabir sends brownie points to @jeffryadones :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 06:39 UTC
@jeffryadones :smile: I have sent you one as a bonus
Jeff D.
Nov 13 2016 06:39 UTC
what does it do?
Merryl
@MerrylArok
Nov 13 2016 06:40 UTC
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 UTC
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 UTC
Joseph
@revisualize
Nov 13 2016 06:42 UTC
@AKASH888 demo is not an element of HTML.
Merryl
@MerrylArok
Nov 13 2016 06:43 UTC
@AKASH888 @revisualize so is this referring to an element named "demo" in the document?
Joseph
@revisualize
Nov 13 2016 06:44 UTC
@MerrylArok No.
AKASH GUNJAL
@AKASH888
Nov 13 2016 06:44 UTC
Merryl
@MerrylArok
Nov 13 2016 06:44 UTC
@revisualize oh is this another way to assign an id ?
Joseph
@revisualize
Nov 13 2016 06:44 UTC
@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 UTC
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 UTC
like you can change the .innerHTML of the element that you select by the id.
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:46 UTC
.
Joseph
@revisualize
Nov 13 2016 06:47 UTC
@abhisekp Right?
Merryl
@MerrylArok
Nov 13 2016 06:47 UTC
@AKASH888 @revisualize Thanks! that clears it up
CamperBot
@camperbot
Nov 13 2016 06:47 UTC
merrylarok sends brownie points to @akash888 and @revisualize :sparkles: :thumbsup: :sparkles:
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:48 UTC
@revisualize that's morse code for letter E
Abhisek Pattnaik
@abhisekp
Nov 13 2016 06:49 UTC
OMG! :scream:
it's w3schools
Joseph
@revisualize
Nov 13 2016 06:50 UTC
I know I know.. But, you can just try it and see.
Merryl
@MerrylArok
Nov 13 2016 07:00 UTC
@abhisekp @revisualize does w3schools have a negative rep around here?
Alexandro Pequeno
@Argestis
Nov 13 2016 07:01 UTC
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 UTC
@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 UTC
anybody needs help
Abhisek Pattnaik
@abhisekp
Nov 13 2016 07:04 UTC
@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 UTC

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 UTC
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:05 UTC
@abhisekp who needs help
Abhisek Pattnaik
@abhisekp
Nov 13 2016 07:06 UTC
@aman-kumayu :point_up: November 13, 2016 12:35 PM
Alexandro Pequeno
@Argestis
Nov 13 2016 07:06 UTC
@abhisekp but even when the length is not the same is triggering :C
Abhisek Pattnaik
@abhisekp
Nov 13 2016 07:07 UTC
@Argestis impossible. Use console.log and verify
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:07 UTC
@XRinduDendam hiii you need some help
Alexandro Pequeno
@Argestis
Nov 13 2016 07:07 UTC
@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 UTC
@Argestis what
Alexandro Pequeno
@Argestis
Nov 13 2016 07:07 UTC
@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 UTC
@Argestis can you explain me your problem ?
Alexandro Pequeno
@Argestis
Nov 13 2016 07:09 UTC

@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 UTC
var myStr="FirstLine\n\\SecondLine\\\rThirdline";
what am i doing wrong?
Alexandro Pequeno
@Argestis
Nov 13 2016 07:09 UTC
@aman-kumayu I have an if that is triggering even when the condition is not true
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:09 UTC
@joshandevera line with L
@XRinduDendam
Nov 13 2016 07:09 UTC
Joseph
@revisualize
Nov 13 2016 07:10 UTC
@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 UTC
damn did not see that thanks.
Joseph
@revisualize
Nov 13 2016 07:10 UTC
@joshandevera Thirdline is not the same as ThirdLine
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:10 UTC
@joshandevera mention @name for thanksgivings
joshandevera
@joshandevera
Nov 13 2016 07:11 UTC
@ghulamshabir sure thanks here's your brownie
CamperBot
@camperbot
Nov 13 2016 07:11 UTC
:warning: joshandevera already gave ghulamshabir points
joshandevera sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Nov 13 2016 07:11 UTC
@XRinduDendam I recommend going back to the instructions and looking them over.
joshandevera
@joshandevera
Nov 13 2016 07:11 UTC
@revisualize thanks :)
CamperBot
@camperbot
Nov 13 2016 07:11 UTC
joshandevera sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2300 | @revisualize |http://www.freecodecamp.com/revisualize
@XRinduDendam
Nov 13 2016 07:11 UTC
@revisualize .. ok i try.
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:12 UTC
@Argestis i am not getting what are you trying to do ?
@XRinduDendam hii
Alexandro Pequeno
@Argestis
Nov 13 2016 07:13 UTC
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 UTC
@Argestis you can use an alternative instead of using verify variable
Alexandro Pequeno
@Argestis
Nov 13 2016 07:15 UTC
@aman-kumayu to compare the arrays?
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:15 UTC
@Argestis you can use a variable counter initialise it with zero
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:15 UTC
@Argestis initialize verify with true and remove else part
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:16 UTC
yes to compare arrays
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 07:16 UTC
@aman-kumayu unless you have multiple matches
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:17 UTC
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 UTC
@aman-kumayu @ghulamshabir Alright le tme try, guys. One sec
Aarya Bhorra
@aarya1302
Nov 13 2016 07:19 UTC
Hey guys quick question:
What does [object, Object] mean?
Andre Alayon
@Meseta22
Nov 13 2016 07:20 UTC
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 UTC
Andre Alayon
@Meseta22
Nov 13 2016 07:21 UTC
Aarya what is the context
@XRinduDendam
Nov 13 2016 07:21 UTC
@revisualize the meaning of not set is delete the property ?
Aarya Bhorra
@aarya1302
Nov 13 2016 07:21 UTC
Yes I googled it they gave me explanations on objects not the error
Alexandro Pequeno
@Argestis
Nov 13 2016 07:22 UTC

@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 UTC
var status = {};
console.log(status);
That's what I'm trying to do
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 07:22 UTC
its an empty object
so its trying to to convert the object to a string
Ajay Tanwar
@ajayt365
Nov 13 2016 07:23 UTC
what is the meaning of 'state of variable' in js ?
Aarya Bhorra
@aarya1302
Nov 13 2016 07:23 UTC
ohh ok
thanks @Jeff-Shapiro
CamperBot
@camperbot
Nov 13 2016 07:23 UTC
aarya1302 sends brownie points to @jeff-shapiro :sparkles: :thumbsup: :sparkles:
Aman Kumayu
@aman-kumayu
Nov 13 2016 07:23 UTC
@Argestis atleast mention @name for thankings
Alexandro Pequeno
@Argestis
Nov 13 2016 07:24 UTC
@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 UTC
argestis sends brownie points to @aman-kumayu and @ghulamshabir :sparkles: :thumbsup: :sparkles:
Andre Alayon
@Meseta22
Nov 13 2016 07:25 UTC
@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 UTC

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 UTC
@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 UTC
@XRinduDendam What?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 07:29 UTC
@wutm8 or even one loop and Math.max inside that loop will work also
Joseph
@revisualize
Nov 13 2016 07:29 UTC
@wutm8 Let's see. There are no spaces in your array.
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 07:30 UTC
@Meseta22 try it
Aarya Bhorra
@aarya1302
Nov 13 2016 08:00 UTC
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 UTC
@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 UTC
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 UTC
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 UTC
@EastML you will need to call indexOf for each number you are searching for
zack
@acting2332
Nov 13 2016 08:27 UTC
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 UTC
@acting2332 unless we see your code
Alexandro Pequeno
@Argestis
Nov 13 2016 08:29 UTC
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 UTC
@acting2332 pagetwo vs pageTwo ??
Micah Lewis
@EastML
Nov 13 2016 08:34 UTC
@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 UTC
@abhisekp thanks for the recommendation!
CamperBot
@camperbot
Nov 13 2016 08:37 UTC
merrylarok sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star2: 3153 | @abhisekp |http://www.freecodecamp.com/abhisekp
zack
@acting2332
Nov 13 2016 08:37 UTC
@ghulamshabir i tried both didnt make a difference
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:39 UTC
@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 UTC

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 UTC
@acting2332 you can have only one background per page
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:46 UTC
@ghulamshabir False!
zack
@acting2332
Nov 13 2016 08:46 UTC
@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 UTC
@acting2332 PM me I have it working
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:47 UTC
@Jeff-Shapiro oh I might be wrong
zack
@acting2332
Nov 13 2016 08:47 UTC
sorry i have never privite messaged someone how do you do it?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:47 UTC
@Jeff-Shapiro you can help him here so we can see the solution
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:48 UTC
@acting2332 click on my picture
then private message
Prateek Gogia
@reeversedev
Nov 13 2016 08:49 UTC
Anyone done with Nesting of loops challenge?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:50 UTC
@reeversedev what problem you have ??
zack
@acting2332
Nov 13 2016 08:51 UTC
@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 UTC
whats wrong ?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:57 UTC
@AGalstyanK622 console.log is unreachable after you return from function
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:57 UTC
how can I fix it ?
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:57 UTC
@AGalstyanK622 you need a space between ,I
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:57 UTC
@AGalstyanK622 you could do this console.log("Hi I am " + name);
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:58 UTC
@ghulamshabir instruction is another
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 08:58 UTC
@AGalstyanK622 no look at what you have and what the intstruction says!
Ghulam Shabir
@ghulamshabir
Nov 13 2016 08:58 UTC
@AGalstyanK622 oh which challenge
Arman Galstyan
@AGalstyanK622
Nov 13 2016 08:59 UTC
@Jeff-Shapiro what part is wrong?
Jeff Shapiro
@Jeff-Shapiro
Nov 13 2016 09:01 UTC
@AGalstyanK622 line 2
Philipp Scholz
@philipp32
Nov 13 2016 09:04 UTC

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 UTC
@ghulamshabir I am not able to get the product.
Emerson
@DikoFaji
Nov 13 2016 09:10 UTC
@philipp32 im done with that challenge and what i did is split, map and sort
Ajay Tanwar
@ajayt365
Nov 13 2016 09:15 UTC
@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 UTC
@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 UTC
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 UTC
@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 UTC
@mukulcode you need to remove one element each time in the loop, using count++ remove more elements
chaoz4ngel
@chaoz4ngel
Nov 13 2016 09:58 UTC

"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 UTC
@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 UTC
@ghulamshabir how to remove one element from the loop
chaoz4ngel
@chaoz4ngel
Nov 13 2016 10:04 UTC
@ghulamshabir so 2 loops for (one with i, one with j) and i check 1st subarray...take max number with Math.max.apply and push that value to
a new array
then go on on the others subarrays
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:06 UTC
@chaoz4ngel no single loop will suffice, inside the loop give each element(sub array) to Math.max.apply, you will get largest value from each array push that value into new array
Mukul
@mukulramchandani
Nov 13 2016 10:09 UTC
@ghulamshabir Without counter++ its not executing for for some arguments and for some not.
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:10 UTC
@mukulcode splice needs a number how many elements you want remove, you could give it 1, try it, I am also working on your solution, could you give me the code
chaoz4ngel
@chaoz4ngel
Nov 13 2016 10:12 UTC
@ghulamshabir something like
for (var i = 0; i  < arr.length; i++){
var maxx = Math.max(arr[i]);
newArray.push(maxx);
}
return newArray;
Mukul
@mukulramchandani
Nov 13 2016 10:13 UTC
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]){

value = arr1.splice(j,1);
}
}
}

return arr1;
}

destroyer([3, 5, 1, 2, 2], 2, 3, 5);
here's the code , i tried with 1 but for this parameters its not executing and for previous its executing. @ghulamshabir
Suraj
@Mac03
Nov 13 2016 10:19 UTC
hello
i have problem with word bank challenge help please
HELP
@ghulamshabir
Yixuan Li
@YixuanFranco
Nov 13 2016 10:21 UTC

function findLongestWord(str) {
array = str.split(" ");

var array2=0;
for(i=0; i < array.length; i++){
if(array[i].length >array2){
array2=array[i].length;}
}
return array2;

//get length of each item in array;
// compare each item's length with sort function

//arrL.sort(function(a, b){
// return a-b;
//});

}

findLongestWord("The quick brown fox jumped over the lazy dog");
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:21 UTC
@chaoz4ngel yes but use Math.max.apply(null, arr[i])
Yixuan Li
@YixuanFranco
Nov 13 2016 10:23 UTC
Suraj
@Mac03
Nov 13 2016 10:23 UTC
chaoz4ngel
@chaoz4ngel
Nov 13 2016 10:23 UTC
@ghulamshabir oh, it works. but why .apply(null, arr[i]) ?
why not just Math.max(arr[i])?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:24 UTC
@YixuanFranco this solution is better than sort, sort is slow
Yixuan Li
@YixuanFranco
Nov 13 2016 10:24 UTC
I write my thought in comment, and one could tell me how to tackle with this problem with sort?
@ghulamshabir hmm, the problem is I tried sort method and I failed T_T
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:24 UTC
@chaoz4ngel Math.max needs two values to compare e.g Math.max(4, 6)
Suraj
@Mac03
Nov 13 2016 10:25 UTC
@ghulamshabir help me sir
chaoz4ngel
@chaoz4ngel
Nov 13 2016 10:25 UTC
@ghulamshabir oh, with "null" he take only the "arr[i]" and compare it with his elements?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:25 UTC
@chaoz4ngel Math.max.apply(null, [1, 2, 3]) searches the array for max value
@chaoz4ngel you should not be concerned with null here, its for object context, giving null here means global object context here
@Mac03 yes sure sir
chaoz4ngel
@chaoz4ngel
Nov 13 2016 10:27 UTC
@ghulamshabir ok man! thanks!
CamperBot
@camperbot
Nov 13 2016 10:27 UTC
chaoz4ngel sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Yixuan Li
@YixuanFranco
Nov 13 2016 10:28 UTC

var arrL= [];
for(i=0; i < array.length; i++){

arrL.push(array[i].length);

}
arrL.sort(function(a, b){
return a-b;
});
return arrL[0];
Suraj
@Mac03
Nov 13 2016 10:28 UTC
@ghulamshabir i dont understand word banks challenge
Yixuan Li
@YixuanFranco
Nov 13 2016 10:28 UTC
@ghulamshabir I tried this...but it doesn't work...
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:29 UTC
@Mac03 you need to build a new string by combining the parameters using + separating each word with a space from next word
Suraj
@Mac03
Nov 13 2016 10:29 UTC
@ghulamshabir thanks
CamperBot
@camperbot
Nov 13 2016 10:29 UTC
mac03 sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:31 UTC
@YixuanFranco try b-a in sort callback
Terryd12345
@Terryd12345
Nov 13 2016 10:31 UTC
Hey guys I'm a bit confused on record collection, can anyone explain why I cant use collection.id.prop = value; ?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:32 UTC
@Terryd12345 because id and prop are variables, using them in dot notation js engine searches for property specifically id and prop
@Terryd12345 but you want it to evaluate the variables into actual keys they store
Yixuan Li
@YixuanFranco
Nov 13 2016 10:33 UTC
@ghulamshabir It works hahahahah thanks...I actually rewrite the one I sent....I've must done sth wrong before...cool, thanks again
CamperBot
@camperbot
Nov 13 2016 10:33 UTC
yixuanfranco sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:34 UTC
@Terryd12345 the bracket notation exactly does that, js engine evaluates the variable into actual keys when use brackets
@YixuanFranco a-b does ascending order and b-a does descening
@YixuanFranco if you use a-b then largest number will be last element in the array, array[array.length-1]
Terryd12345
@Terryd12345
Nov 13 2016 10:37 UTC
@ghulamshabir Okay but I've tried both dot notation and bracket notation, neither are working. Do I need to redefine them as new variables within the function? I am bit confused conceptually.
Yixuan Li
@YixuanFranco
Nov 13 2016 10:37 UTC
yeah, that's one of my mistake. Actually what I did wrong initially is that I embrace the sort function within for loop...
@ghulamshabir
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:38 UTC
@Terryd12345 how would you say that they are not working, you might be doing incorrect logic to solve the challenge
@YixuanFranco oh sort has its own internal loop
Buenny Fry
@monstresticator
Nov 13 2016 10:40 UTC
In the "Escape Sequences in Strings" challenge, my solution is not working. var myStr = "FirstLine\n\\SecondLine\\\rThirdline";What am I missing?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:40 UTC
@monstresticator use L instead of l in the words Line
Buenny Fry
@monstresticator
Nov 13 2016 10:41 UTC
Ahhh, gotcha. I see it now. Thanks, @ghulamshabir!
CamperBot
@camperbot
Nov 13 2016 10:41 UTC
monstresticator sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:41 UTC
@monstresticator :+1:
Dean-Foulds
@Dean-Foulds
Nov 13 2016 10:43 UTC
.
cnrgng
@cnrgng
Nov 13 2016 10:44 UTC
What does he mean here?
myFirstName should be a string with at least one character in it.
myLastName should be a string with at least one character in it.
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:45 UTC
@cnrgng he means firstName and lastName must not empty strings
cnrgng
@cnrgng
Nov 13 2016 10:47 UTC
@ghulamshabir var myFirstName ="Caner"
=
?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:47 UTC
@cnrgng which challenge ? post full code here
cnrgng
@cnrgng
Nov 13 2016 10:49 UTC
// Example
var firstName = "Alan";
var lastName = "Turing";
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:50 UTC
@cnrgng are you solving a fcc challenge ?
@cnrgng you might want to use myFirstName myLastName instead of firstName lastName
@cnrgng I don't know what are you trying to do ?
cnrgng
@cnrgng
Nov 13 2016 10:52 UTC

Challenge Declare String Variables has an issue.
User Agent is: <code>Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36</code>.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


// Example
var firstName = "Alan";
var lastName = "Turing";

// Only change code below this line
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:56 UTC
@thodorisanta you did not fill the array with all the values in range, reduce works on arrays, in your solution the arr is still with only two values, you need to all the values in range in the arr to use reduce on it get correct sum
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 10:58 UTC
@ghulamshabir what do you mean? my solution works
chaoz4ngel
@chaoz4ngel
Nov 13 2016 10:59 UTC
@cnrgng have u create the new variables whit your name and lastname?
*created
Ghulam Shabir
@ghulamshabir
Nov 13 2016 10:59 UTC
@cnrgng you need to define two variable myFirstName and myLastName. Assign the firstName to myFirstName and lastName to myLastName
@thodorisanta yes your solution works, but in order to use reduce you need an array with all values in the range e.g from [1, 4] to [1, 2, 3, 4]
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:02 UTC
@ghulamshabir and how am i going to make that?
Saminda
@Saminda1
Nov 13 2016 11:02 UTC
hey guys, cant seem to pass this.

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

function checkObj(checkProp) {
myObj.hasOwnProperty(checkProp);
}

// Test your code by modifying these values

Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:02 UTC
@thodorisanta i mean i can make a for loop and make a new array with the numbers from 1 to 4, but thats a waste of time
Saminda
@Saminda1
Nov 13 2016 11:03 UTC
how to make it return "pony" and "pet"
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:03 UTC
@thodorisanta you can push the values of min of your solution into the arr
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:03 UTC
@ghulamshabir how?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:03 UTC
@thodorisanta you want the solution ?
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:04 UTC
@ghulamshabir if you can. so i can see exactly how it works. but i still think that reduce is a waste of time atleast in this example.
Stefan
@st3fun1
Nov 13 2016 11:04 UTC

Hi guys i need some help with ExpressJS Tutorial challenge 7/8


var express = require("express");
var app = express();

app.get("/search",function(req,res){
var params = req.query;
res.send(params);
});
app.listen(process.argv[2] || process.env.PORT);

I get this error when i try to verify my code "Cannot GET /search/?results=recent&type=quote&page=1"
It works with the C9 ports, but i can't complete it with the expressworks app

Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:05 UTC
@thodorisanta you know how reduce works ?
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:06 UTC
@ghulamshabir it takes an array and goes through each of its value and reduces it to a single value
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:06 UTC
@thodorisanta yes
@thodorisanta in this challenge arr has values 1, 4 then reduce will give you sume only 5
@thodorisanta you need to fill the array with missing values in the range using loop
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:08 UTC
@ghulamshabir yes. and i can make a for loop and make a new array with the values. but isnt there an easiest better way to do this?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:08 UTC
@thodorisanta so when arr has values 1, 2, 3, 4 reduce will give you the sum 10
Nikhil Singh
@nikhilmufc7
Nov 13 2016 11:10 UTC
// Setup
var testObj = {
"an entree": "hamburger",
"my side": "veggies",
"the drink": "water"
};

// Only change code below this line

var entreeValue = ["an entree"];   // Change this line
var drinkValue = ["the drink"];    // Change this line
What am I do wrong in this challenge Accessing Objects Properties with Bracket Notation?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:11 UTC
@thodorisanta how will you get missing values in the range using other ways ?? I only know the wayof either using loop or manually filling values one by one into the array
Stefan
@st3fun1
Nov 13 2016 11:12 UTC
testObj["an entree"] that's how you access this kind of property
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:12 UTC
@thodorisanta but manually doing it does not work for different range
Stefan
@st3fun1
Nov 13 2016 11:12 UTC
if you don't have string keys
you can access the property with dot notation
@nikhilmufc7
Nikhil Singh
@nikhilmufc7
Nov 13 2016 11:12 UTC
the challenge is using bracket notations tho
Stefan
@st3fun1
Nov 13 2016 11:12 UTC
ex dot notation: testObj.property
ex bracket notation testObj[property]
Nikhil Singh
@nikhilmufc7
Nov 13 2016 11:13 UTC
alright thanks mate @st3fun1
CamperBot
@camperbot
Nov 13 2016 11:13 UTC
nikhilmufc7 sends brownie points to @st3fun1 :sparkles: :thumbsup: :sparkles:
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:13 UTC
@nikhilmufc7 from what are you accessing the property ??
Stefan
@st3fun1
Nov 13 2016 11:13 UTC
or more general
obj.property or obj[property]
obj is object
Aleksander Gębicki
@Takumar
Nov 13 2016 11:14 UTC
@marioecg I'm sorry I left the room before you showed the code so I couldn't help. I hope you've completed the challenge. Maybe other time :-)
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:24 UTC
@thodorisanta yes, good :+1:
@thodorisanta
function sumAll(arr) {
var max = Math.max(arr[0], arr[1]);
var min = Math.min(arr[0], arr[1]);

for(var i=min+1; i<max; i++) {
arr.push(i);
}
return arr.reduce(function(a, b) {
return a+b;
});
}
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:26 UTC
@ghulamshabir but isnt the way i did it before better, or faster?and simpler atleast for this example?
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:29 UTC
@thodorisanta yes your original should be faster, but the array methods are considered readable code over loops
Ian
@toianw
Nov 13 2016 11:47 UTC
@thodorisanta Just for fun, this should work too:
function sumAll(arr) {
return arr.reduce(function(a, b) {
return (a + b) * (Math.abs(b - a) + 1) / 2;
});
}
Anirban Mukherjee
@bwayne2015
Nov 13 2016 11:55 UTC
hi getting this javascript
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:55 UTC
@ghulamshabir @toianw thanks!
CamperBot
@camperbot
Nov 13 2016 11:55 UTC
thodorisanta sends brownie points to @ghulamshabir and @toianw :sparkles: :thumbsup: :sparkles:
Spyrantis Theodoros
@thodorisanta
Nov 13 2016 11:56 UTC
@toianw can you explain how exactly this works tho?
Anirban Mukherjee
@bwayne2015
Nov 13 2016 11:57 UTC
geting problem on code can anyone help?

var count = 0;
//var i =0;

function cc(card) {
// Only change code below this line

if (card >=2 && card <=6){
console.log(count);
count += 1;
console.log(count);
console.log("LINE executed 1");
}
else if(card >=7 && card <=9){
count += 0;

console.log("LINE executed 2");

}
else{
count -= 1;
console.log("LINE executed 3");
}
}
if(count > 0) {
console.log(fgfcgfchchcgch);
console.log (count + " Bet");
}
else{
console.log(count + " HOLD");
}

// Only change code above this line
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);

Ian
@toianw
Nov 13 2016 11:58 UTC
@thodorisanta it's just basic maths. Find how many numbers are in the range (Math.abs(b - a) + 1) and multiply this by their average ((a + b) / 2).
Ghulam Shabir
@ghulamshabir
Nov 13 2016 11:59 UTC
@bwayne2015 you need to return count + Hold/Bet instead of using them in console.log
Yixuan Li
@YixuanFranco
Nov 13 2016 12:02 UTC

function largestOfFour(arr) {
// You can do this!
for(var i = 0; i < arr.length; i++){
arr[i].sort(function(a, b){
return b-a;
});
}

// arr's already beed sorted here.

for(var j = 0; j < arr.length; j++){
arr[j][0].sort(function(a, b){
return b-a;
});

}

return arr[0];

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
and it shows me the error message that arr[j][0].sort is not a function
nijeshk2011
@nijeshk2011
Nov 13 2016 12:03 UTC
i want help

function testElse(val) {
var result = "";
// Only change code below this line

if (val > 5) {
result = "Bigger than 5";
}

else (val <= 5) {
result = "5 or Smaller";
}
// Only change code above this line
return result;
}

// Change this value to test
testElse(4);

Error here.. testElse(6) should return "Bigger than 5"
testElse(10) should return "Bigger than 5"
Ghulam Shabir
@ghulamshabir
Nov 13 2016 12:04 UTC
@YixuanFranco yes arr[j][0] returns a number not an array
@nijeshk2011 else does take a codition, else part's code is executed when its if evaluates to false
Yixuan Li
@YixuanFranco
Nov 13 2016 12:07 UTC

function largestOfFour(arr) {
// You can do this!
for(var i = 0; i < arr.length; i++){
arr[i].sort(function(a, b){
return b-a;
});
}

// arr's already beed sorted here.

for(var j = 0; j < arr.length; j++){
var arrL;
arrL.push(arr[j][0]);
arrL.sort(function(a, b){
return b-a;
});

}

return arr[0];

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Coy Sanders
@coymeetsworld
Nov 13 2016 12:07 UTC
@nijeshk2011 if you're going to put a condition it needs to be else if
but you really don't need that since if a number is not > 5, it is by definition either less than or equal to it
so just remove the conditional and just have an else
Yixuan Li
@YixuanFranco
Nov 13 2016 12:08 UTC
@ghulamshabir I changed it to this....but there is still typeError shows me that: Cannot read property "push of undefined"
Ghulam Shabir
@ghulamshabir
Nov 13 2016 12:08 UTC
@nijeshk2011
if(codition) {
}
else {
doanotherthing
}
Diane
@106Ch213
Nov 13 2016 12:08 UTC
Hi guys, I've been stuck on the "Record Collection" challenge. I think my problem lies with my logic statement. The function doesn't seem to access the part where I want it to delete the property if the value is empty but I don't understand why. Here is the code I used :
function updateRecords(id, prop, value) {

if (collection[id].hasOwnProperty(prop) === false){
collection[id][prop] = [];
}

collection[id][prop].push(value);

if (collection[id][prop][value] === "") {
delete collection[id][prop];
}

return collection;
}`