5th
Jun 2016
chegnar
@chegnar
Jun 05 2016 00:01
Hey i am stuck with "Understanding uninitialized Variables" I cant seem to initialize c so that it is not undefined? Please help? =)
rphares
@rphares
Jun 05 2016 00:02
@chegnar , could you please paste the code you are trying (formatted) :blush:
chegnar
@chegnar
Jun 05 2016 00:03
I just figured it out :) Thanks
rphares
@rphares
Jun 05 2016 00:03
lol, sure thing-- congrats and happy coding, @chegnar :blush:
Norvin Burrus
@ndburrus
Jun 05 2016 00:15
@eljaygalvez so, is the code resolved?
Joana Loren Felisarta
@eljaygalvez
Jun 05 2016 00:17
@StephenMansfield I tried it that way... but I still get the same error...
Shawn
@maple3011
Jun 05 2016 00:19
good morning guys
Joana Loren Felisarta
@eljaygalvez
Jun 05 2016 00:20
Keenen Garnett
@Wallyw4
Jun 05 2016 00:21
if i do another search the zoom in affect goes away
help plz
Coy Sanders
@coymeetsworld
Jun 05 2016 00:21
@Arkhtor for the push function you don't want to hardcode what its pushing
CamperBot
@camperbot
Jun 05 2016 00:21
no wiki entry for: plz
Coy Sanders
@coymeetsworld
Jun 05 2016 00:21
you want to put item inside the array.
Keenen Garnett
@Wallyw4
Jun 05 2016 00:22
@Wallyw4
if i do another search the zoom in affect goes away
help plz
http://codepen.io/Wallyw4/full/wWByeM/
Coy Sanders
@coymeetsworld
Jun 05 2016 00:22
Also you don't want to return item back
you want to remove the first item of the array and return it. unshift() isn't the right function for that
Norvin Burrus
@ndburrus
Jun 05 2016 00:22
help format @eljaygalvez
CamperBot
@camperbot
Jun 05 2016 00:22

# Multi line Code

js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

 ⇦ Type 3 backticks, then press [enter ⏎]

# Single line Code

This an inline <paste code here> code formatting with a single backtick() at _start_ and _end_ around thecode.

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

Coy Sanders
@coymeetsworld
Jun 05 2016 00:23
Arkhtor
@Arkhtor
Jun 05 2016 00:23
@coymeetsworld i think i got it
Coy Sanders
@coymeetsworld
Jun 05 2016 00:23
ok cool
Arkhtor
@Arkhtor
Jun 05 2016 00:25
@coymeetsworld nope, i'm too tired to understand the instructions :D
Coy Sanders
@coymeetsworld
Jun 05 2016 00:25
maybe not best to push yourself too hard then @Arkhtor :)
Arkhtor
@Arkhtor
Jun 05 2016 00:25
@coymeetsworld but You moved my cogs, thanks
CamperBot
@camperbot
Jun 05 2016 00:25
arkhtor sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1038 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jun 05 2016 00:26
but you're on right track though at least, you just need to fix what you're pushing into the array
and need to call different function to remove what they're asking you to
Luke
@lhovee
Jun 05 2016 00:28
hey everyone, I think I wrote some code in a challenge that keeps freezing the page (infinite loop I assume). I can't get in the challenge to reset the code or delete any portion of it without the page freezing. help?!
@jdtdesigns
Jun 05 2016 00:41
@luke go to freecodecamp.com home page, then go into inspector->resources tab->local storage, then delete the most recent one up top
then you should be able to go back into it and fix your code ;)
Taylor
@tfreeman17
Jun 05 2016 01:08
needing some help on convert celsius to fahrenheit. I'm not getting what I am supposed to write in the middle portion ... and why can I just write celsius *= (9/5) += 32;
Frostyjayy
@Frostyjayy
Jun 05 2016 01:12
@tfreeman17 var Fahrenheit = ???
Tijana Jung
Jun 05 2016 01:14
Why is my code myCar.nickname = "twin"; not a string? I thought Whenever you = "something" it would be a string?
Frostyjayy
@Frostyjayy
Jun 05 2016 01:14
@tfreeman17 there seems to be a small issue with where they commented. i think it should be like this
function convertToF(celsius) {
// Only change code below this line
var fahrenheit =  ???;

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

// Change the inputs below to test your code
convertToF(30);
Stephen Mansfield
@StephenMansfield
Jun 05 2016 01:16
Has anyone messed around with navigator.geolocation.getCurrentPosition??
Taylor
@tfreeman17
Jun 05 2016 01:17
@Frostyjayy var fahrenheit = celsius * (9/5) +32
??
Stephen
@stephepush
Jun 05 2016 01:18
Hi, I'm working on the titlecase algorithm. When I try to run my function it says "cannot read property 'charAt' undefined

string = "I am vulcan";
string = string.split(" ");

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

function firstCap(string) {
for (i=0; i<string.length; i++)
string = string[i].toLowerCase();
string = string[i].charAt(0).toUpperCase() + string[i].slice(1);
return string[i];
}
}

firstCap(string);
the function works string = a single string, but when I split up a string into an array funky things happen
Frostyjayy
@Frostyjayy
Jun 05 2016 01:20
@tfreeman17 yes but also look at it as an order of operations (celsius * (9/5)) +32
parisempress
@parisempress
Jun 05 2016 01:23
has anyone worked with meteor before?
thanks
Coy Sanders
@coymeetsworld
Jun 05 2016 01:28
@Frostyjayy order of operations is fine both ways @tfreeman17
don't need to surround celcius * (9/5), you don't even need the first set of parenthesis
celcius * 9 / 5 + 32 is fine too
Moisés Man
@moigithub
Jun 05 2016 01:29
@stephepush
thats all ur code??
did u changed the original function name ?? (cuz fcc test uses the original name if u change it wont work )
why u have 2 loops??
why u declaring a function inside the loop ?
what do u think is the value of string variable on each line ? (think like if u were the javascript interpreter)
Frostyjayy
@Frostyjayy
Jun 05 2016 01:30
@coymeetsworld okay sweet, i didnt try it
Jun 05 2016 01:32
I'm stuck with escape sequences in strings, can anyone help? what is wrong with this line?
var myStr="\b \t \t \r \n "; // Change this line
Moisés Man
@moigithub
Jun 05 2016 01:34
@clinkzc i think the first encoded character should be backslash.. check the table for the CORRECT character,
also u have an extra space at the end
Coy Sanders
@coymeetsworld
Jun 05 2016 01:34
@clinkzc \b is the escape for backspace
you want backslash
Jun 05 2016 01:35
thank you!
rphares
@rphares
Jun 05 2016 01:45
( ty, @coymeetsworld :blush: )
CamperBot
@camperbot
Jun 05 2016 01:45
rphares sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1039 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jun 05 2016 01:48
lol for what @rphares ?
rphares
@rphares
Jun 05 2016 01:50
you just helped someone...
when i see people not thanked, i try and pass it on...
kinda pro redistributing the wealth, heh :blush:
Michael
@mreider24
Jun 05 2016 01:52
ty @coymeetsworld I just came in here for the same thing and didn't realize I was mixing up backspace and backslash.
CamperBot
@camperbot
Jun 05 2016 01:52
mreider24 sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1040 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jun 05 2016 01:52
np @mreider24
haha well they do even out @rphares sometimes I get thanked for not doing anything
rphares
@rphares
Jun 05 2016 01:55
lol, oh, i know (well, i dont think they even out, personal experience-- but believe me I'm not personally sad about that--
Zamua Nasrawt
@Zamua
Jun 05 2016 01:55
This message was deleted
rphares
@rphares
Jun 05 2016 01:55
i mean that its in my best interest for the rest of you to get all the cookies/stars you earn ;) )
Zamua Nasrawt
@Zamua
Jun 05 2016 01:55
Hello all. Would anyone mind double checking something for me? It seems I'm getting correct output, but I'm still failing test cases? Code is below:

function sym(args) {
var map = {};

//If the passed element is in the map, increment it's value.
//Otherwise initialize it to one.
//This map keeps track of the number of times an element is seen.
if (map.hasOwnProperty(e)) {
map[e] = map[e] + 1;

} else
map[e] = 1;
};

var sets = [];
var result = [];

//Extract the arrays from arguments,
//create the sets,
for (var x in arguments) {
sets.push(new Set(arguments[x]));
}

//Iterate over every set.
//Add every element of every set to the map.
for (var i = 0; i < sets.length; i++) {
}

//Here's the hacky part.
//Check the set for all elements that have an odd count.
//Those with an odd count get added to the results.
//The others are ignored.
//
//Instead of performing an actualy symmetric difference operation,
//I'm just applying a pattern (Odd counts happen to be included).
for (var z in map) {
if (map[z] % 2 === 1) {
result.push(z);
}
}

return result;
}
sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]);
This is for the Symmetric difference algorithm

I'm gonna post some of the test cases, could you all run them and let me know what you get? Cause it's saying I'm getting the correct numbers, but it isn't marking the tests as passing

----tests----

sym([1, 2, 3], [5, 2, 1, 4]) should return [3, 4, 5]
sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) should return [1, 4, 5]
sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]) should return [1, 4, 5]

----end----

Also it seems I'm failing the first test, and then every other test. So the pass/fail for my tests is alternating. I don't know if that's helpful at all
Jun 05 2016 01:58
@StephenMansfield - the geolocation function is no longer functional on Chrome (newest versions) unless you use HTTPS:// as the transport. But if you're doing the weather project with openweather, the free version does not work over HTTPS - only HTTP. You can get by using the http://ip-api.com/json site for your location from the IP address, using http:// and then you can access openweather using http:// (as well as your codepen project.)
Coy Sanders
@coymeetsworld
Jun 05 2016 01:59
@Zamua seems like you're putting strings inside the array, but it should be numbers
Stephen Mansfield
@StephenMansfield
Jun 05 2016 01:59
@khaduch it actually was working , though it was giving me a log error saying it won't be
but I found a better solution, that returns city and country
Jun 05 2016 02:00
@StephenMansfield - was that Chrome or firefox? I think it still works on firefox?
Zamua Nasrawt
@Zamua
Jun 05 2016 02:00
@coymeetsworld Thanks for responding! Where am i adding strings?
CamperBot
@camperbot
Jun 05 2016 02:00
zamua sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1041 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Moisés Man
@moigithub
Jun 05 2016 02:00
@Zamua what do u think.. ur set array will contain?? after this
for (var x in arguments) {
sets.push(new Set(arguments[x]));
}
Zamua Nasrawt
@Zamua
Jun 05 2016 02:00
@moigithub I assumed it would be all the unique values of the array :) is that incorrect?
Stephen Mansfield
@StephenMansfield
Jun 05 2016 02:00
PGD
Jun 05 2016 02:01

function nextInLine(arr, item) {
arr=arr.push(item);
var rem=arr.shift();
return rem; // 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));

Stephen Mansfield
@StephenMansfield
Jun 05 2016 02:02
made me a bit mad, struggled to bang out the code to get it to work, then I looked more into the API I was using, aeris api, and found they could autodetect location for me
Coy Sanders
@coymeetsworld
Jun 05 2016 02:02
@purvikadutt you don't want to assign arr to arr.push,
arr.push will return the length of the array, you don't actually need to assign anything with arr.push
PGD
Jun 05 2016 02:03
@coymeetsworld thanks a lot...that worked right away
CamperBot
@camperbot
Jun 05 2016 02:03
purvikadutt sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1042 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jun 05 2016 02:03
@Zamua im looking, not sure how that's happening don't have too much familiarity with Set
Zamua Nasrawt
@Zamua
Jun 05 2016 02:03
@coymeetsworld all good! thanks for your time, man. I appreciate it.
CamperBot
@camperbot
Jun 05 2016 02:03
zamua sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:warning: zamua already gave coymeetsworld points
Zamua Nasrawt
@Zamua
Jun 05 2016 02:04
Would anyone else like to give it a shot? I'll repost my code if people don't wanna scroll
llamatarianism
@llamatarianism
Jun 05 2016 02:07
@Zamua sure maybe
Zamua Nasrawt
@Zamua
Jun 05 2016 02:08

It seems I'm getting correct output, but I'm still failing test cases? Code is below:

function sym(args) {
var map = {};

//If the passed element is in the map, increment it's value.
//Otherwise initialize it to one.
//This map keeps track of the number of times an element is seen.
if (map.hasOwnProperty(e)) {
map[e] = map[e] + 1;

} else
map[e] = 1;
};

var sets = [];
var result = [];

//Extract the arrays from arguments,
//create the sets,
for (var x in arguments) {
sets.push(new Set(arguments[x]));
}

//Iterate over every set.
//Add every element of every set to the map.
for (var i = 0; i < sets.length; i++) {
}

//Here's the hacky part.
//Check the set for all elements that have an odd count.
//Those with an odd count get added to the results.
//The others are ignored.
//
//Instead of performing an actualy symmetric difference operation,
//I'm just applying a pattern (Odd counts happen to be included).
for (var z in map) {
if (map[z] % 2 === 1) {
result.push(z);
}
}

return result;
}
sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]);

This is for the Symmetric difference algorithm
I'm gonna post some of the test cases, could you all run them and let me know what you get? Cause it's saying I'm getting the correct numbers, but it isn't marking the tests as passing
----tests----
sym([1, 2, 3], [5, 2, 1, 4]) should return [3, 4, 5]
sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) should return [1, 4, 5]
sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]) should return [1, 4, 5]
----end----
Also it seems I'm failing the first test, and then every other test. So the pass/fail for my tests is alternating. I don't know if that's helpful at all

<3
llamatarianism
@llamatarianism
Jun 05 2016 02:08
I had something like that happen once
Coy Sanders
@coymeetsworld
Jun 05 2016 02:09
@Zamua i think its because you're using an object to put the values in, and the name is a String
Zamua Nasrawt
@Zamua
Jun 05 2016 02:09
llamatarianism
@llamatarianism
Jun 05 2016 02:10
your output appears to return strings
just ran it on repl.it
got [ '1', '2', '4', '5', '6', '7', '8', '9' ]
Zamua Nasrawt
@Zamua
Jun 05 2016 02:10
oh fuck me, you're right
llamatarianism
@llamatarianism
Jun 05 2016 02:10
Zamua Nasrawt
@Zamua
Jun 05 2016 02:10
i hate my life
lemme fix that, then i'll get back to you guys. Thanks @llamatarianism and @coymeetsworld MVPs
CamperBot
@camperbot
Jun 05 2016 02:10
zamua sends brownie points to @llamatarianism and @coymeetsworld :sparkles: :thumbsup: :sparkles:
:warning: zamua already gave coymeetsworld points
Coy Sanders
@coymeetsworld
Jun 05 2016 02:10
simple way i woud say to fix is to parse x to an int before pushing it in result
Zamua Nasrawt
@Zamua
Jun 05 2016 02:11
@coymeetsworld yup yup, already on it <3 :)))
Coy Sanders
@coymeetsworld
Jun 05 2016 02:11
but im not exactly sure why its returning a string
wllmc
@wllmc
Jun 05 2016 02:11
This message was deleted
Moisés Man
@moigithub
Jun 05 2016 02:11
or add a plus sign on z push(+z)
Coy Sanders
@coymeetsworld
Jun 05 2016 02:11
this is what the object looks like:
Object {
1: 2,
2: 2,
3: 1,
4: 1,
5: 1
}
Zamua Nasrawt
@Zamua
Jun 05 2016 02:11
fuck me, that was it
that's fixed it, love ya'll
Coy Sanders
@coymeetsworld
Jun 05 2016 02:11
but it's not "1": 2, "2", 2, etc. something im missing
Zamua Nasrawt
@Zamua
Jun 05 2016 02:11
yeah i just did Math.floor(parseInt(z), 10)
Coy Sanders
@coymeetsworld
Jun 05 2016 02:12
don't think you need that, just parseInt shouldve been fine i would think
Zamua Nasrawt
@Zamua
Jun 05 2016 02:12
I know why
wllmc
@wllmc
Jun 05 2016 02:12
Can someone help me with "profile lookup"? all of my if statements work separately, but not together.
 function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i<contacts.length; i++) {

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

}
// Only change code above this line
}
Zamua Nasrawt
@Zamua
Jun 05 2016 02:12
it's because properties of an object
are always strings
Moisés Man
@moigithub
Jun 05 2016 02:12
thats the key name
Zamua Nasrawt
@Zamua
Jun 05 2016 02:12
yeah, basically I'm an idiot
@moigithub thanks to you too <3
CamperBot
@camperbot
Jun 05 2016 02:12
zamua sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1344 | @moigithub |http://www.freecodecamp.com/moigithub
Coy Sanders
@coymeetsworld
Jun 05 2016 02:12
thats what i thought too @Zamua, but wondering why when you print the object it doesn't put they keys in string
Stephen Mansfield
@StephenMansfield
Jun 05 2016 02:12
@llamatarianism https://repl.it/ runs code on my computer, correct?
llamatarianism
@llamatarianism
Jun 05 2016 02:13
yes
pretty sure at least
Stephen Mansfield
@StephenMansfield
Jun 05 2016 02:13
OMG I was just bitching in the other chat
Coy Sanders
@coymeetsworld
Jun 05 2016 02:13
Object {
'1': 2,
'2': 2,
'3': 1,
'4': 1,
'5': 1
}
Why wouldn't it say that?
Zamua Nasrawt
@Zamua
Jun 05 2016 02:13
@coymeetsworld because at print it prints the value, but when displaying the property of an object it treats it as a string. Just a part of the engine i believe
Stephen Mansfield
@StephenMansfield
Jun 05 2016 02:13
about how much codepen is pissig me off
CamperBot
@camperbot
Jun 05 2016 02:13
Coy Sanders
@coymeetsworld
Jun 05 2016 02:13
hmm ok
llamatarianism
@llamatarianism
Jun 05 2016 02:13
looks like it might not
Coy Sanders
@coymeetsworld
Jun 05 2016 02:13
didn't want to say keys were automatically strings but thats what I thought lol
Zamua Nasrawt
@Zamua
Jun 05 2016 02:14
yeah haha
Coy Sanders
@coymeetsworld
Jun 05 2016 02:14
anyways gj @Zamua :thumbsup:
Zamua Nasrawt
@Zamua
Jun 05 2016 02:14
<3
feel free to use my code as reference when you get to that problem btw.
Coy Sanders
@coymeetsworld
Jun 05 2016 02:14
i finished all the problems already :) but thanks
Zamua Nasrawt
@Zamua
Jun 05 2016 02:15
@coymeetsworld serious??? damn, baller lol. How close am I to the end?
Coy Sanders
@coymeetsworld
Jun 05 2016 02:15
thats an adv algorithm im assuming you did everything before that?
Zamua Nasrawt
@Zamua
Jun 05 2016 02:15
@coymeetsworld yup
Coy Sanders
@coymeetsworld
Jun 05 2016 02:15
theres only a few more of those, and keep in mind they're optional even though I did them all
so yeah you're pretty far. just a few more of those and the 4 advanced projects
Zamua Nasrawt
@Zamua
Jun 05 2016 02:16
@coymeetsworld Wait so once I finish these what will I be doing?
Coy Sanders
@coymeetsworld
Jun 05 2016 02:16
if you're going in order, Adv Front End projects
you can check freecodecamp.com/map to see where you're at
Zamua Nasrawt
@Zamua
Jun 05 2016 02:16
@coymeetsworld ohhhhhhhhhhh thanks for the tip!
CamperBot
@camperbot
Jun 05 2016 02:16
zamua sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:warning: zamua already gave coymeetsworld points
Coy Sanders
@coymeetsworld
Jun 05 2016 02:17
no problem :thumbsup:
Zamua Nasrawt
@Zamua
Jun 05 2016 02:17
@coymeetsworld have you done the data visualization and back end and everything as well?
llamatarianism
@llamatarianism
Jun 05 2016 02:18
oh dear
you appear to have exact change next.
Coy Sanders
@coymeetsworld
Jun 05 2016 02:18
no I haven't, still have Simon to do
llamatarianism
@llamatarianism
Jun 05 2016 02:18
good luck
Norvin Burrus
@ndburrus
Jun 05 2016 02:18
I'm experiencing some confusion with the Mutations challenge. I have two (2) code versions. The first version ( https://repl.it/CY3G/0 ) passes all of the requirements, except the first one. The second version ( https://repl.it/CY3F/0 ) passes the first requirement but none of the rest. I'm not really sure why I can't get the first requirement met in the first version...
llamatarianism
@llamatarianism
Jun 05 2016 02:18
I mean that in the nice way
not in the "hahaha good luck pleb" kind of way
Zamua Nasrawt
@Zamua
Jun 05 2016 02:18
@coymeetsworld oh gotcha, and @llamatarianism oh boy, that bad?
Coy Sanders
@coymeetsworld
Jun 05 2016 02:18
but instead of doing that and getting front end cert i decided i need all my projects to be pretty so im going on all these tangents
ALMY91
@ALMY91
Jun 05 2016 02:18
whats the use of serializing objects?
Coy Sanders
@coymeetsworld
Jun 05 2016 02:18
learning web design and now SVG lol
Zamua Nasrawt
@Zamua
Jun 05 2016 02:18
@coymeetsworld sweet haha
llamatarianism
@llamatarianism
Jun 05 2016 02:18
@Zamua you know the one with the roman numerals?
imagine that on roids.
Zamua Nasrawt
@Zamua
Jun 05 2016 02:19
@llamatarianism oh that one wasn't bad! I thought I solved it rather cleverly :)
Coy Sanders
@coymeetsworld
Jun 05 2016 02:19
exact change not too bad, its hard to write it well though lol my code looks bad for that
Zamua Nasrawt
@Zamua
Jun 05 2016 02:19
@llamatarianism not to toot my own horn or anything
llamatarianism
@llamatarianism
Jun 05 2016 02:19
my code is terrible
and I don't want to consider it
daiwik
@daiwik
Jun 05 2016 02:19
This message was deleted
llamatarianism
@llamatarianism
Jun 05 2016 02:19
@daiwik your function doesn't return anything
daiwik
@daiwik
Jun 05 2016 02:20
yea because its not finished yet
llamatarianism
@llamatarianism
Jun 05 2016 02:20
oh right sorry
I misunderstood what you were saying
I also mixed up the past and present tense because I'm apparently that tired. ugh.
@daiwik anyway just click that link. the euclidean algorithm is the generally accepted way of doing it.
well, that'll find the highest common factor
but it's easy enough to work out the LCM using the HCF
daiwik
@daiwik
Jun 05 2016 02:22
is that how you did it?
llamatarianism
@llamatarianism
Jun 05 2016 02:22
yes
bitgrower
@bitgrower
Jun 05 2016 02:23
@daiwik -- what algo are you using to determine LCM ?
Diego Mayer
@Chrono79
Jun 05 2016 02:23
@ndburrus your first version you should return true outside your loop, after you've checked all the letters of arr[1] are in a arr[0], also you should use len2 in that for loop
Another thing, arr1 and arr2 are strings, not arrays, the naming is a little confusing
bitgrower
@bitgrower
Jun 05 2016 02:23
I found an algo on the DUMMIES.com site which I used ... was very effective ...
daiwik
@daiwik
Jun 05 2016 02:23
what do you do after finding HCF
Jessica Dembe
@jmdembe
Jun 05 2016 02:24
Hi, can I have some help with the using objects for lookups lesson?
daiwik
@daiwik
Jun 05 2016 02:24
i am dummie now :worried:
bitgrower
@bitgrower
Jun 05 2016 02:25
no, that's a WEBSITE ... see the dummies.com ... in spite of it's name, it is a VERY helpful website in many ways ...
Jessica Dembe
@jmdembe
Jun 05 2016 02:25

I'm having a difficult time with this set of code and converting it to a lookup table

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

Diego Mayer
@Chrono79
Jun 05 2016 02:26
@jmdembe that looks ok
bitgrower
@bitgrower
Jun 05 2016 02:26
LOL ... I don't know why referring people to a website, because it's named "dummies" means that I'm calling someone a dummy ...
Jessica Dembe
@jmdembe
Jun 05 2016 02:26
yeah, but its not passing
Diego Mayer
@Chrono79
Jun 05 2016 02:26
you need one line more
Jessica Dembe
@jmdembe
Jun 05 2016 02:26
i changed the table to val lookup
daiwik
@daiwik
Jun 05 2016 02:26
thanks @bitgrower @llamatarianism
CamperBot
@camperbot
Jun 05 2016 02:26
daiwik sends brownie points to @bitgrower and @llamatarianism :sparkles: :thumbsup: :sparkles:
:star2: 1084 | @bitgrower |http://www.freecodecamp.com/bitgrower
daiwik
@daiwik
Jun 05 2016 02:26
and i was jking :)
Jessica Dembe
@jmdembe
Jun 05 2016 02:26
then do I make lookup = result?
Diego Mayer
@Chrono79
Jun 05 2016 02:26
@jmdembe not exactly, you need to assign result some value, assignation goes from right to left
lookup is an object, you need to access some property, use val for that
Jessica Dembe
@jmdembe
Jun 05 2016 02:27
so result = lookup?
llamatarianism
@llamatarianism
Jun 05 2016 02:28
@daiwik the LCM of $a$ and $b$ is equal to $\frac{a \times b}{gcd(a, b)}$
Diego Mayer
@Chrono79
Jun 05 2016 02:28
Jessica Dembe
@jmdembe
Jun 05 2016 02:29
Ok, I'll take a look and see how this goes. These last few challenges have kicked my butt
llamatarianism
@llamatarianism
Jun 05 2016 02:29
LaTeX is so pretty.
bitgrower
@bitgrower
Jun 05 2016 02:31
@daiwik -- smileys help ... you had a frown ... :) ... and previously, someone DID take offense at my suggestion ...
based on the name of the site ...
Isaac Pak
@pak11273
Jun 05 2016 02:32
can someone look at this plz and tell me why i'm getting dupes:
https://codepen.io/pak11273/pen/GqRawZ?editors=0010
Mohammed Khan
@mkhan935
Jun 05 2016 02:32
hi, im on the record collection, i keep getting the erron "cannot read property 'push' of undefined
my code looks like this
else if(value!==""&& prop=="tracks")
collection[id][prop].push(value);
Moisés Man
@moigithub
Jun 05 2016 02:33
@mkhan935 u should check if that prop exist first(in the object).. before pushing..
if not exist.. define it as an array
Mohammed Khan
@mkhan935
Jun 05 2016 02:34
ohhhh, right, thanks
Norvin Burrus
@ndburrus
Jun 05 2016 02:34
@Chrono79 thanks for taking a look. :sparkles: reviewing the comments/ (vs.) code...
CamperBot
@camperbot
Jun 05 2016 02:34
ndburrus sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1020 | @chrono79 |http://www.freecodecamp.com/chrono79
wllmc
@wllmc
Jun 05 2016 02:35
Can someone help me with "profile lookup"? all of my if statements work separately, but not together.
 function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i<contacts.length; i++) {

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

}
// Only change code above this line
}
Norvin Burrus
@ndburrus
Jun 05 2016 02:38
This message was deleted
Diego Mayer
@Chrono79
Jun 05 2016 02:39

@pak11273 I can't see these properties in the console.log:

      } else {
logo = data.stream.channel.logo;
status = data.stream.channel.status;
name = data.stream.channel.name;
}

Ok, that's not it

Norvin Burrus
@ndburrus
Jun 05 2016 02:40
@wllmc ok, go right into an else from the inner if statement, then again, right into an else for the outer if statement... and you should be fine... :sparkles: ...and you won't need a qualifier for the outer else statement, as the true condition has already been checked.. :) clear as mud?
Stephen Mansfield
@StephenMansfield
Jun 05 2016 02:40
Does anybody know javascript well?
chegnar
@chegnar
Jun 05 2016 02:41
My I please get help using "Word Blanks" file:///Users/Calvin/Desktop/Screen%20Shot%202016-06-05%20at%204.41.23%20AM.png
Mohammed Khan
@mkhan935
Jun 05 2016 02:41

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

return collection;
}

this isnt working when there is no track array
chegnar
@chegnar
Jun 05 2016 02:41
How Do I send a screenshot ? =)
Thomas Gerot
@tjgerot
Jun 05 2016 02:41
@chegnar Are you on Windows?
Norvin Burrus
@ndburrus
Jun 05 2016 02:42
@chegnar do you mean for posting code?
Mohammed Khan
@mkhan935
Jun 05 2016 02:42
its the record collection
Greg Duncan
@GregatGit
Jun 05 2016 02:43
@pak11273 you have to declare the variable before you if/else statement - not before
Isaac Pak
@pak11273
Jun 05 2016 02:43
@GregatGit r u sure about that?
Greg Duncan
@GregatGit
Jun 05 2016 02:43
yes
chegnar
@chegnar
Jun 05 2016 02:43
Im on mac @tjgerot
Thomas Gerot
@tjgerot
Jun 05 2016 02:43
Ok, one second.
This message was deleted
@chegnar So press "Apple key ⌘ + Shift + 3"
chegnar
@chegnar
Jun 05 2016 02:45
I've captured the screenshot but I do not know how to attach it to the chat
Diego Mayer
@Chrono79
Jun 05 2016 02:45
@pak11273 why are you using let inside the if?
Try:
      var status = "";
var logo = "";
var name = "";

if (data.stream === null) {
status = "offline";
logo = "http://static-cdn.jtvnw.net/jtv_user_pictures/test_channel-profile_image-94a42b3a13c31c02-300x300.jpeg";
name = "offline";
Greg Duncan
@GregatGit
Jun 05 2016 02:46
@pak11273 Also https://api.twitch.tv/kraken/streams/ does not need a callback at the end of it - if the status is not null everything you need is in the json it downloads - but if it isn't you have to call https://api.twitch.tv/kraken/channels/ to get the icons and other data
wllmc
@wllmc
Jun 05 2016 02:46
@ndburrus
is this what you meant?
for (var i=0; i<contacts.length; i++) {

if (contacts[i].firstName===firstName) {
if (contacts[i].hasOwnProperty(prop)) {
return contacts[i][prop];
}
else { return "No such contact";
}}

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

}
// Only change code above this line
}
Thomas Gerot
@tjgerot
Jun 05 2016 02:46
@chegnar If you drag the file from desktop/explorer to the chat it should upload.
Isaac Pak
@pak11273
Jun 05 2016 02:46
@Chrono79 i was told not to use var anymore, and that let is a better practice...
Jessica Dembe
@jmdembe
Jun 05 2016 02:47
well, after a few minutes, I solved it!
Diego Mayer
@Chrono79
Jun 05 2016 02:47
@pak11273 ok, then declare them outside the if
Isaac Pak
@pak11273
Jun 05 2016 02:47
@Chrono79 couldn't i do this instead:
 var logo, status, name;
Jessica Dembe
@jmdembe
Jun 05 2016 02:47
thanks @Chrono79
CamperBot
@camperbot
Jun 05 2016 02:47
jmdembe sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1021 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jun 05 2016 02:48
no problem :+1:
chegnar
@chegnar
Jun 05 2016 02:48
file:///Users/Calvin/Desktop/Screen%20Shot%202016-06-05%20at%204.41.23%20AM.png
Diego Mayer
@Chrono79
Jun 05 2016 02:48
@pak11273 yes, that would also work
chegnar
@chegnar
Jun 05 2016 02:48
It just oppens the file location in a different tab when I drag the file
opens*
Mohammed Khan
@mkhan935
Jun 05 2016 02:48
@chegnar same here
Thomas Gerot
@tjgerot
Jun 05 2016 02:48
@pak11273 Let is generally better as it limits the scope and memory consumption of that variable. But there are few cases when either let or var would be required
chegnar
@chegnar
Jun 05 2016 02:49
@mkhan935 Bummer
Thomas Gerot
@tjgerot
Jun 05 2016 02:49
@chegnar @mkhan935 Hmmm let me look further into this
Isaac Pak
@pak11273
Jun 05 2016 02:50
@GregatGit so i need to make 2 separate api calls?
chegnar
@chegnar
Jun 05 2016 02:50
Does anyone else understand how to do the "Mad Libs" Word blanks task? :)
Diego Mayer
@Chrono79
Jun 05 2016 02:51
@pak11273 and how do you reach that conclusion? You can't declare a var using var or let inside the if statement if you're using it in the else case too, imagine the first loop enters the else, it would be undeclared
Mohammed Khan
@mkhan935
Jun 05 2016 02:51
anyone can help me with the record collection, i'm sure my code is correct, it doesnt work when the property track isnt there

function updateRecords(id, prop, value) {
if (value === '') {
delete collection[id][prop];
} else if (prop !== 'tracks') {
collection[id][prop] = value;
} else {
collection[id][prop].push(value);
}

return collection;
}

Diego Mayer
@Chrono79
Jun 05 2016 02:52
Thomas Gerot
@tjgerot
Jun 05 2016 02:53
@chegnar @mkhan935 If you try "Control + Command + Shift + 3" and then (in the chatbox) paste, will that work instead?
Isaac Pak
@pak11273
Jun 05 2016 02:54
@Chrono79 yea, that makes sense, i have all declarations outside the if/else. the dupes are gone, but it doesn't list all of the streamers.
Diego Mayer
@Chrono79
Jun 05 2016 02:54
@mkhan935 they've added a test where tracks doesn't exist
Mohammed Khan
@mkhan935
Jun 05 2016 02:54
@tjgerot i'm doing this from windows, i took a screenshot, copied it, but not able to paste, if i drag it opens as a c file on my browser
Diego Mayer
@Chrono79
Jun 05 2016 02:55
@pak11273 for (var i = 0; i < streamers.length - 1; i++) { why the -1?
Mohammed Khan
@mkhan935
Jun 05 2016 02:55
if it doesnt exist
Prayogo Cendra
@yogo-chen
Jun 05 2016 02:55
/help
CamperBot
@camperbot
Jun 05 2016 02:55

# CamperBot

### Basic Commands:

• find TOPIC find all entries about topic. e.g. find js
• wiki TOPIC show contents of topic page
• thanks @username send brownie points to another user
• about @username shows info on that user
• Algorithm BONFIRENAME info on a Algorithm

meet CamperBot in

Diego Mayer
@Chrono79
Jun 05 2016 02:55
Joseph
@revisualize
Jun 05 2016 02:55
Hello.
Thomas Gerot
@tjgerot
Jun 05 2016 02:55
@mkhan935 First things first, try simply pressing the print screen key and pressing "Control + V" in the chatline (and wait a few seconds for it to upload).
Diego Mayer
@Chrono79
Jun 05 2016 02:56
Hi @revisualize
Thomas Gerot
@tjgerot
Jun 05 2016 02:56
This message was deleted
@shusil123
Jun 05 2016 02:56
@mkhan935 , go to #5439 object and add tracks: [] .
Mohammed Khan
@mkhan935
Jun 05 2016 02:56
yea thats what i did @shusil123 thanks
CamperBot
@camperbot
Jun 05 2016 02:56
mkhan935 sends brownie points to @shusil123 :sparkles: :thumbsup: :sparkles:
Diego Mayer
@Chrono79
Jun 05 2016 02:57
@mkhan935 you should test if tracks exists and if it doesn't add the property and the value, otherwise, just push it
Isaac Pak
@pak11273
Jun 05 2016 02:58
@Chrono79 streamers.length - 1 = 8, which is where I want my last [i] to end right?
Mohammed Khan
@mkhan935
Jun 05 2016 02:58
@Chrono79 yep going to go try that right now
chegnar
@chegnar
Jun 05 2016 02:58
@tjgerot nope nothing man, I just have 10 screenshots sending me to a new tab
Diego Mayer
@Chrono79
Jun 05 2016 02:58
@pak11273 if you use < length you don't need the -1
Isaac Pak
@pak11273
Jun 05 2016 02:59
@Chrono79 ah, hahaha yeah i see that now.
Diego Mayer
@Chrono79
Jun 05 2016 03:00
@chegnar I see it empty
Thomas Gerot
@tjgerot
Jun 05 2016 03:00
@chegnar Well if you want a temporary fix, try uploading image to a hosting platform (Google Drive, Dropbox, Picasa, etc.) and paste a link into this forum. I'll keep looking and see if changes need to be made on Glitter's end of the service.
Diego Mayer
@Chrono79
Jun 05 2016 03:01
@chegnar if it's code what you need to show, paste it here following the format that camperbot will show below my post
help format
CamperBot
@camperbot
Jun 05 2016 03:01

# Multi line Code

js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

 ⇦ Type 3 backticks, then press [enter ⏎]

# Single line Code

This an inline <paste code here> code formatting with a single backtick() at _start_ and _end_ around thecode.

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

chegnar
@chegnar
Jun 05 2016 03:01
@tjgerot Thanks a lot. Im gonna take a break maybe my brain is just burnt out
CamperBot
@camperbot
Jun 05 2016 03:01
chegnar sends brownie points to @tjgerot :sparkles: :thumbsup: :sparkles:
Greg Duncan
@GregatGit
Jun 05 2016 03:02
@pak11273 Only if json.status === null
Thomas Gerot
@tjgerot
Jun 05 2016 03:02
@chegnar Sorry I couldn't be of more help. Taking a break might just do the trick.
Isaac Pak
@pak11273
Jun 05 2016 03:04
alright, i'm gonna do some refactoring, thanks for the help! @tjgerot @Chrono79 @GregatGit
CamperBot
@camperbot
Jun 05 2016 03:04
pak11273 sends brownie points to @tjgerot and @chrono79 and @gregatgit :sparkles: :thumbsup: :sparkles:
:star2: 1022 | @chrono79 |http://www.freecodecamp.com/chrono79
Jun 05 2016 03:11
@Otakukami - only change the code below the line, as it says - it looks like you have made changes above the line? Also, they have already declared the variables in the top part of the code with the var keyword. You do not want to use the var keyword below.
Randy Goldsmith
@Dueldrawer8
Jun 05 2016 03:15
in the "Where do I belong" bonfire.. why do you have to return parseInt(i) when arr[i].. the i is a number anyway? its not a string..
wllmc
@wllmc
Jun 05 2016 03:16
sorry, but im still having trouble with "profile lookup"? any help?
all the if statements work alone, but not together.
function lookUpProfile(firstName, prop){
// Only change code below this line

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]!==prop) {
return "No such property";
}

}
// Only change code above this line
}
Kyle W Pilkinton
Jun 05 2016 03:17
hey guys im working on my tictactoe game and im trying to make an easy version ai but i cant figure out how to get it to take its turn. any help??
Diego Mayer
@Chrono79
Jun 05 2016 03:22
@wllmc no such contact should be said after you've checked all the contacts, doesn't it?
this isn't right either: else if (contacts[i]!==prop) {
Jun 05 2016 03:24
@wllmc - if you look at your loop, and think through how it will respond if you have the firstName === "Sherlock" - what would happen? The important thing to think about with "No such contact" is that you have to be able to test all of the contacts in the list before you know that you have "no such contact"... so look at how it works if you have a name other than the first one in the list of contacts.
Stephen Mansfield
@StephenMansfield
Jun 05 2016 03:30
asd
wllmc
@wllmc
Jun 05 2016 03:36
CamperBot
@camperbot
Jun 05 2016 03:36
wllmc sends brownie points to @khaduch and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1023 | @chrono79 |http://www.freecodecamp.com/chrono79
Coy Sanders
@coymeetsworld
Jun 05 2016 03:37
@tadake whenever the user clicks on a cell you can have your click function call an AI program to put their choice in
Nick Ang
@nickangtc
Jun 05 2016 03:39
Hey guys, out of curiosity, for Build a Random Quote Machine challenge, did you guys use an API? Or you built your own JSON database?
Kyle W Pilkinton
Jun 05 2016 03:40
i tried that but my ai ended up going rampant and playing by itself over and over XD (tic tac toe terminator) how can i safeguard this? @coymeetsworld i used my own json @nickangtc
Nick Ang
@nickangtc
Jun 05 2016 03:40
Asking to help me decide which route to go... API definitely more difficult
Puvendran Pillay
@puven12
Jun 05 2016 03:40
I need help with my "factorialize a number" challenge

Nick Ang
@nickangtc
Jun 05 2016 03:41
Ok cool @tadake thanks for sharing
CamperBot
@camperbot
Jun 05 2016 03:41
nickangtc sends brownie points to @tadake :sparkles: :thumbsup: :sparkles:
Puvendran Pillay
@puven12
Jun 05 2016 03:41
I need help with my "factorialize a number" challenge

function factorialize(num) {

var i;
for (i = 0; i == num; i++){
num = num * i;
}

return num;
}

factorialize(5);
Coy Sanders
@coymeetsworld
Jun 05 2016 03:41
not sure how you did that @tadake, do you still have that code?
Puvendran Pillay
@puven12
Jun 05 2016 03:41
whats my mistake?
Coy Sanders
@coymeetsworld
Jun 05 2016 03:42
your conditional statement in the for loop @puven12
i == num
the loop will execute only if that statement is true
Kyle W Pilkinton
Jun 05 2016 03:42
i dont @coymeetsworld i had the ai function pick a random button after any button had been clicked and the ai kept triggering itself
Puvendran Pillay
@puven12
Jun 05 2016 03:44
@coymeetsworld lemme fix it
Coy Sanders
@coymeetsworld
Jun 05 2016 03:44
@tadake not sure if $(id).click() will work click is used to bind a function to a click, but the AI doesn't click anything only users do instead once you get the cell you want to have the AI enter a mark you can just update the DOM instead directly Puvendran Pillay @puven12 Jun 05 2016 03:46 @coymeetsworld i can't fix it man! i tried changing to <,>,<=,>= not working Coy Sanders @coymeetsworld Jun 05 2016 03:46 well don't do all of them :) which one you think is right to use? there's other problems too not just that Kyle W Pilkinton @tadake Jun 05 2016 03:47 i had it clicking before @coymeetsworld you think if i make the ai only be able to add props to the buttons (like disabled,true) i could do that? i guess the ai couldnt trigger itself that way. Coy Sanders @coymeetsworld Jun 05 2016 03:48 if you're using buttons yeah you should have AI disable them if they decide to put a mark there Puvendran Pillay @puven12 Jun 05 2016 03:48 hel[? help* CamperBot @camperbot Jun 05 2016 03:48 # CamperBot Hi, I'm CamperBot! I can help you in this chatroom :smile: ### Basic Commands: • find TOPIC find all entries about topic. e.g. find js • wiki TOPIC show contents of topic page • thanks @username send brownie points to another user • about @username shows info on that user • Algorithm BONFIRENAME info on a Algorithm meet CamperBot in Coy Sanders @coymeetsworld Jun 05 2016 03:49 but thats just to make sure you don't push it click function isn't doing anything though @tadake,$().click() doesn't click the button
it should be assigning a function when a user clicks
Keenen Garnett
@Wallyw4
Jun 05 2016 03:50
hey guys im trying to get my results to always zoomIn but it will only doit the first time you search any suggestions?
http://codepen.io/Wallyw4/full/wWByeM/
Kyle W Pilkinton
Jun 05 2016 03:50
thanks @coymeetsworld
CamperBot
@camperbot
Jun 05 2016 03:50
tadake sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1047 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jun 05 2016 03:51
Stephen Mansfield
@StephenMansfield
Jun 05 2016 03:51
Hey guys, how would I switch between two states?
I am doing my weather app
Keenen Garnett
@Wallyw4
Jun 05 2016 03:52
@StephenMansfield are you trying to do the Celsius Fahrenheit?
Stephen Mansfield
@StephenMansfield
Jun 05 2016 03:52
yea I am trying to create a button that switchtes between the two
I guess I could do if else to do it, is thier a better solution?
Keenen Garnett
@Wallyw4
Jun 05 2016 03:54
try making a toggle function by creating a variable and declaring it true and in your first if statement make the var false then your else should set it to true @StephenMansfield
Stephen Mansfield
@StephenMansfield
Jun 05 2016 04:06
@Wallyw4 thanks man got it working!
CamperBot
@camperbot
Jun 05 2016 04:06
stephenmansfield sends brownie points to @wallyw4 :sparkles: :thumbsup: :sparkles:
Keenen Garnett
@Wallyw4
Jun 05 2016 04:06
no problem
mevloy
@mevloy
Jun 05 2016 04:10
I'm working on the largest number in array challenge and I'm stumped as to why my code isn't working properly. Any ideas? http://jsbin.com/malubo/edit?js,console,output
Tommy Mertell
@sinithwar
Jun 05 2016 04:11

Waypoint: Record Collection

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

I am getting no errors and I have checked with many solutions websites and they say that my code is correct.

Aryan J
@AryanJ-NYC
Jun 05 2016 04:12
@thedancingslug big[i] = arr[x][i];
You should switch the x and i here
big[i] = arr[i][x]
mevloy
@mevloy
Jun 05 2016 04:13
oops! thanks @AryanJ-NYC !
CamperBot
@camperbot
Jun 05 2016 04:13
thedancingslug sends brownie points to @aryanj-nyc :sparkles: :thumbsup: :sparkles:
Aryan J
@AryanJ-NYC
Jun 05 2016 04:13
No problem. :D
Tommy Mertell
@sinithwar
Jun 05 2016 04:14
Do you guys see anything wrong with my code?
hello?
Isaac Pak
@pak11273
Jun 05 2016 04:17
hi
Tommy Mertell
@sinithwar
Jun 05 2016 04:17
Heya :)
Isaac Pak
@pak11273
Jun 05 2016 04:17
@sinithwar what challenge is that?
Tommy Mertell
@sinithwar
Jun 05 2016 04:17
Record Collection
It's failing the second test for some reason o.0? I can't figure out why because I'm not getting an error and the solutions websites has almost identical code to mine
mevloy
@mevloy
Jun 05 2016 04:20
I'm comparing it to what I did, I'll let you know if I find anything that looks different (we're still here!)
Tommy Mertell
@sinithwar
Jun 05 2016 04:20
K :) I was a little worried I was talking to an empty chat lol
Isaac Pak
@pak11273
Jun 05 2016 04:21
@sinithwar looks like your order needs tweaking
Tommy Mertell
@sinithwar
Jun 05 2016 04:21
ooh?
Isaac Pak
@pak11273
Jun 05 2016 04:22
@sinithwar consider making the if statements following the order the instructions are given.
@sinithwar if statements are usually best set up with the strictest condition met first...
Kwangho Suk
@khseok1060
Jun 05 2016 04:25
@sinithwar In record collection, I solved problem by adding line(, tracks: [ ]) in 5439
Tommy Mertell
@sinithwar
Jun 05 2016 04:26
Thanks @khseok1060 that solved the problem lol
CamperBot
@camperbot
Jun 05 2016 04:26
sinithwar sends brownie points to @khseok1060 :sparkles: :thumbsup: :sparkles:
ALMY91
@ALMY91
Jun 05 2016 04:27
hi guys
if i=2
what does this mean?
a[a[i]]=a[0];
Isaac Pak
@pak11273
Jun 05 2016 04:28
@ALMY91 it returns true; if should be used like this instead if (i==2)
@ALMY91 i=2 is assignment
ALMY91
@ALMY91
Jun 05 2016 04:29
@pak11273 ahh i think i got it alr, it wasn the answer i was looking for but appreciate the help
Isaac Pak
@pak11273
Jun 05 2016 04:30
@ALMY91 np
mevloy
@mevloy
Jun 05 2016 04:32

I've just successfully completed the "Largest Numbers in Arrays" challenge, but I'm wondering if there's a better way to initialize the big var without having to pre-define the four arrays like this

function largestOfFour(arr) {
var big = [0,0,0,0];

for(i=0; i<arr.length; i++) { for(x=0; x < arr[i].length; x++) { if(arr[i][x] > big[i]) {
big[i] = arr[i][x];
}
}
}
return big;
}

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


gah, code markdown didn't work
Isaac Pak
@pak11273
Jun 05 2016 04:32
@thedancingslug var big = [ ];
@thedancingslug use ' instead of for markdown
mevloy
@mevloy
Jun 05 2016 04:33
@pak11273 That returns [] as the result though
@pak11273 gotcha

If I initialize as

var big = [];

then my result is

[]

rather than

[5,27,39,1001]

but setting

var big = [0,0,0,0]

works

not a big problem, just curious
Isaac Pak
@pak11273
Jun 05 2016 04:37
@thedancingslug the code you wrote above returns:
[0,0,0,0]
C. Colton Baier
@coltbaier
Jun 05 2016 04:38

function updateRecords(id, prop, value)

{

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

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

mevloy
@mevloy
Jun 05 2016 04:38
hmm, not on my end
C. Colton Baier
@coltbaier
Jun 05 2016 04:38
cant find the bug
^^^
Isaac Pak
@pak11273
Jun 05 2016 04:39
@coltbaier this was answered earlier, add tracks : [ ] to the abba album
@thedancingslug nvm. i had to include the var declarations to make it work.
ALMY91
@ALMY91
Jun 05 2016 04:44
Hi guys what happens if i use a string in my array index?
mevloy
@mevloy
Jun 05 2016 04:45
@pak11273 okay, good stuff. If anything comes to mind, let me know. You know, in case I get a job dedicated to sorting largest numbers in infinite # of arrays
piesha
@piesha
Jun 05 2016 04:46
Hey guys, quick question...can I nest a loop within the condition of a while loop?
Tony Gomez
@Tonyboy0521
Jun 05 2016 04:48
hello wolrd
i need help
piesha
@piesha
Jun 05 2016 04:48
Also, I finished the records management challenge yesterday and am now working on Profile Lookup. I noticed alot of people tried to use techniques learned outside FreeCodeCamp to complete the challenge. I completed it only using what I learned within the curriculum. Will I ever be expected to use something from outside the curriculum to complete a challenge?
Isaac Pak
@pak11273
Jun 05 2016 04:50
@piesha most definitely, and you should be doing more outside of FCC
piesha
@piesha
Jun 05 2016 04:52
shamgar, what about within the basic challenges, not including algorithms and projects?
Tony Gomez
@Tonyboy0521
Jun 05 2016 04:53
// setup
var a;
var b = 2;
var a = 7;
var b =7;

a should be assigned to b with =
Isaac Pak
@pak11273
Jun 05 2016 04:53
@piesha yep, you are going to be asked to review a lot of the MDN docs. They are really hard to understand at my level(beginner) so I have had to supplement by doing other things (ie.codecademy.com)
Tony Gomez
@Tonyboy0521
Jun 05 2016 04:53
im confused
piesha
@piesha
Jun 05 2016 04:53
@pak11273 I mean in the 'educational' challenges without a star
Isaac Pak
@pak11273
Jun 05 2016 04:53
@Tonyboy0521 b = a;
Randy Goldsmith
@Dueldrawer8
Jun 05 2016 04:54
whats wrong with this code? It pasts all the test but the last one in "Testing Objects for Properties"
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
myObj.hasOwnProperty('checkProp');
if('checkProp'){
return myObj[checkProp];
}
else{
}

}
// Test your code by modifying these values
checkObj("gift");
Tony Gomez
@Tonyboy0521
Jun 05 2016 04:54
@pak11273 thank you
CamperBot
@camperbot
Jun 05 2016 04:54
tonyboy0521 sends brownie points to @pak11273 :sparkles: :thumbsup: :sparkles:
Isaac Pak
@pak11273
Jun 05 2016 04:55
@piesha i don't know what is star?
Eldar Tinjić
@EldarT90
Jun 05 2016 04:55
http://codepen.io/EldarT/pen/JKdazJ - why do i get undefined error for range
piesha
@piesha
Jun 05 2016 04:55
@pak11273 * indicates required coursework for the certificate
:)
Isaac Pak
@pak11273
Jun 05 2016 04:56
@piesha oh. still you need outside supplementary study, even without cert.
@Tonyboy0521 np
Randy Goldsmith
@Dueldrawer8
Jun 05 2016 04:57
anyone?
piesha
@piesha
Jun 05 2016 04:57
thanks @pak11273
CamperBot
@camperbot
Jun 05 2016 04:57
piesha sends brownie points to @pak11273 :sparkles: :thumbsup: :sparkles:
C. Colton Baier
@coltbaier
Jun 05 2016 04:58

function updateRecords(id, prop, value)

{

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

{collection.prop=[];
collection[id][prop].push(value);
}
else if(value ==="")
{
delete collection[id][prop];
}
return collection;
} cant find bug

Isaac Pak
@pak11273
Jun 05 2016 04:58
@piesha np
piesha
@piesha
Jun 05 2016 04:58
I use treehouse but I was hoping that you would say that the unstarred challenges could be completed within the information found in the instruction.
Thomas Gerot
@tjgerot
Jun 05 2016 04:58
@Dueldrawer8 Is it giving you nay specific error?
Isaac Pak
@pak11273
Jun 05 2016 04:58
@Dueldrawer8 'checkProp' doesn't need to be in quotes
Thomas Gerot
@tjgerot
Jun 05 2016 04:58
Well there you go
Isaac Pak
@pak11273
Jun 05 2016 04:59
@Dueldrawer8 but i don't think that's why your not passing the test
Randy Goldsmith
@Dueldrawer8
Jun 05 2016 04:59
@tjgerot no errors.. its just whenever you put in "house" in the function arguement.. it should return "Not Found" which its not
yeah, it passes the first two but if i put in the arguement a name that doesn't have a property, it doesnt return "not found"
that last test wont pass
UtkarshShukla7
@UtkarshShukla7
Jun 05 2016 05:02
@Dueldrawer8 because your checking 'checkProp' in your if statement which basically runs for all 3 tests because none is null and you aren't really using myObj.hasOwnProperty(checkProp)
Isaac Pak
@pak11273
Jun 05 2016 05:03
@Dueldrawer8 try this:
function checkObj(checkProp) {
if(myObj.hasOwnProperty(checkProp)){
return myObj[checkProp];
} else {
}
}
Randy Goldsmith
@Dueldrawer8
Jun 05 2016 05:03
@pak11273 ah yes, that should worj
work
i just thought for some reason checkProp is assigned values true or false and that they were saved into a variable without declaring one.. lol
thanks @pak11273
CamperBot
@camperbot
Jun 05 2016 05:04
dueldrawer8 sends brownie points to @pak11273 :sparkles: :thumbsup: :sparkles:
Randy Goldsmith
@Dueldrawer8
Jun 05 2016 05:04
thanks @UtkarshShukla7
CamperBot
@camperbot
Jun 05 2016 05:04
dueldrawer8 sends brownie points to @utkarshshukla7 :sparkles: :thumbsup: :sparkles:
Isaac Pak
@pak11273
Jun 05 2016 05:04
@Dueldrawer8 yep np
UtkarshShukla7
@UtkarshShukla7
Jun 05 2016 05:04
@Dueldrawer8 :+1:
Randy Goldsmith
@Dueldrawer8
Jun 05 2016 05:06
@pak11273 wow that doesnt work
@pak11273 nvm.. took out the quotes
Thomas Gerot
@tjgerot
Jun 05 2016 05:12
@Dueldrawer8 Did you end up getting it to work?
alice3217
@alice3217
Jun 05 2016 05:14

// Setup
var a;
var b = 2;

// Only change code below this line
var a = 7;

how do I assign a to b using =

Thomas Gerot
@tjgerot
Jun 05 2016 05:15
@alice3217 Have you tried b = a;?
Coy Sanders
@coymeetsworld
Jun 05 2016 05:16
@alice3217 you don't want to redefine a again, its already defined for you at the top
you can remove the var keyword from your last statement
alice3217
@alice3217
Jun 05 2016 05:16
thanks @coymeetsworld
CamperBot
@camperbot
Jun 05 2016 05:16
alice3217 sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1048 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jun 05 2016 05:17
np @alice3217 :thumbsup:
Eldar Tinjić
@EldarT90
Jun 05 2016 05:18
http://codepen.io/EldarT/pen/JKdazJ - why i get undefined range error
anyone?
Thomas Gerot
@tjgerot
Jun 05 2016 05:22
@EldarT90 Does the error state which line is throwing the error?
Eldar Tinjić
@EldarT90
Jun 05 2016 05:22
@tjgerot yes, var y = d3.scale.linear()
.domain[1,data.length]
.range([height,0]);
that one, it says range is undefined
Isaac Pak
@pak11273
Jun 05 2016 05:26
@EldarT90 where do you get the range function from?
Eldar Tinjić
@EldarT90
Jun 05 2016 05:28
@pak11273 d3
Isaac Pak
@pak11273
Jun 05 2016 05:29
@EldarT90 i don't see where you loaded that library
Eldar Tinjić
@EldarT90
Jun 05 2016 05:30
@pak11273 in js
Jeff
@meankraken
Jun 05 2016 05:31
@EldarT90 The reason is you did domain[1,data.length].. you forgot the parenthesis

also, I just finished the D3 scatterplot project 5 mins ago, any feedback would be appreciated all!

http://codepen.io/meankraken/full/gMpjER/

Kyle W Pilkinton
Jun 05 2016 05:33

hey guys how can I do something similar to this?

"val"+cur= value;

I get a 'incorrect lefthand assignment' error

Isaac Pak
@pak11273
Jun 05 2016 05:33
 value = 'va' + cur;
Eldar Tinjić
@EldarT90
Jun 05 2016 05:33
@meankraken thanks mate, now its time to fix next mistake :D btw your project looks nice but i think you need different color for tooltip, this one is too bright
CamperBot
@camperbot
Jun 05 2016 05:33
eldart90 sends brownie points to @meankraken :sparkles: :thumbsup: :sparkles:
Eldar Tinjić
@EldarT90
Jun 05 2016 05:34
its not easy to read text
Jeff
@meankraken
Jun 05 2016 05:34
@EldarT90 agreed, thanks for lookin man
CamperBot
@camperbot
Jun 05 2016 05:34
meankraken sends brownie points to @eldart90 :sparkles: :thumbsup: :sparkles:
Isaac Pak
@pak11273
Jun 05 2016 05:36
@meankraken looks sweeet dude
Kyle W Pilkinton
Jun 05 2016 05:36
that dosent work @pak11273 i need to assign value to val11 or val12 or whichever value.
Jeff
@meankraken
Jun 05 2016 05:37
@pak11273 thanks!
CamperBot
@camperbot
Jun 05 2016 05:37
meankraken sends brownie points to @pak11273 :sparkles: :thumbsup: :sparkles:
Isaac Pak
@pak11273
Jun 05 2016 05:37
@meankraken is this backend development projects?
Jeff
@meankraken
Jun 05 2016 05:38
@pak11273 this is on the data visualization section
Isaac Pak
@pak11273
Jun 05 2016 05:38
@meankraken nice
@meankraken how are you liking FCC so far?
Jeff
@meankraken
Jun 05 2016 05:40
@pak11273 like it a lot, I like the way they broke down the projects, how about yourself?
Kyle W Pilkinton
Jun 05 2016 05:40
I have buttons val11 through val33 @pak11273 i need to dynamically store the data in value to whichever button is currently activated
Isaac Pak
@pak11273
Jun 05 2016 05:41
@meankraken i went through stuff pretty fast, i like the projects, but I've been having to do a lot more research outside of FCC to really get this stuff
Jeff
@meankraken
Jun 05 2016 05:42
@pak11273 yeah, after frontend all my learning was on my own, lots of good online resources though
Isaac Pak
@pak11273
Jun 05 2016 05:42
@tadake sounds like this pseudo code should work:
if(condition) {
value = val11;
} else {
value = val12;
}
Kyle W Pilkinton
Jun 05 2016 05:43
if i store a string in a variable is there anyway to assign something to the value of the string?
Isaac Pak
@pak11273
Jun 05 2016 05:43
@meankraken i finished codecademy and some others on javascript, but there's still a lot to be desired. what things do you recommend?
Jeff
@meankraken
Jun 05 2016 05:44
@pak11273 hmm honestly google has been my go to when I want to learn something specific, quora has a lot of answers on where you can find good resources on subjects
Isaac Pak
@pak11273
Jun 05 2016 05:46
@meankraken yeah. i find my biggest problem is not recalling stuff i just learned. i think i need more problem sets.
Eldar Tinjić
@EldarT90
Jun 05 2016 05:46
@pak11273 have you solved all front end challenges here?
on fcc?
Isaac Pak
@pak11273
Jun 05 2016 05:46
@EldarT90 no, im on the twitch app.
Jeff
@meankraken
Jun 05 2016 05:47
@pak11273 yep, repetition pretty crucial for really remembering everything
Eldar Tinjić
@EldarT90
Jun 05 2016 05:47
@pak11273 after you do all projects you will have good knowledge of js and its libraries
Islam Abasov
@IslamA
Jun 05 2016 05:48
find Check for Palindromes
CamperBot
@camperbot
Jun 05 2016 05:48

find check for palindromes

Islam Abasov
@IslamA
Jun 05 2016 05:48
find Palindromes
CamperBot
@camperbot
Jun 05 2016 05:48

find palindromes

Isaac Pak
@pak11273
Jun 05 2016 05:48
i'd like to be able to do things on demand rather than having to google all the time. I wouldn't like this scenario too much:
potential employer: "hey can you show me how to find the largest Array in this scenario"
me: "yeah sure. hold on while i google the answer, i forget easy hehe"
Eldar Tinjić
@EldarT90
Jun 05 2016 05:49
@pak11273 after you repeat it several tiems you will memorize it
things like json calls that are crucial for twitch challenge took me hours to complete
now in other challenges it takes me 3 minutes to do proper json call
Isaac Pak
@pak11273
Jun 05 2016 05:50
@EldarT90 yeah, i hope so. I'm finding I have to google all the time now. it's getting worse lol
Eldar Tinjić
@EldarT90
Jun 05 2016 05:50
@pak11273 i felt exactly the same like you ,very frustrating
thats why im telling you this
you wont feel like that for long
Isaac Pak
@pak11273
Jun 05 2016 05:51
@EldarT90 do you do any study outside of FCC?
Eldar Tinjić
@EldarT90
Jun 05 2016 05:51
@pak11273 well i did some other tutorials, but not for purposes of front end challenges
back end and data viz doesnt have any lectures
so i had to certain tutorials to even understand it
Isaac Pak
@pak11273
Jun 05 2016 05:55
@EldarT90 cool. thanks for the pep talk. i'm already determined to finish FCC.
CamperBot
@camperbot
Jun 05 2016 05:55
pak11273 sends brownie points to @eldart90 :sparkles: :thumbsup: :sparkles:
Pragya Chaturvedi
@pragya68
Jun 05 2016 06:04
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr

function multiplyAll(arr) {
var product = 1;
// Only change code below this line

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

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

RITESH KUMAR MOHAPATRA
@RITESHMOHAPATRA
Jun 05 2016 06:07
Return Largest Numbers in Arrays plz help

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

}

return arr[p];
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
not working

Sophanarith Sok
@sok213
Jun 05 2016 06:12
wiki format
CamperBot
@camperbot
Jun 05 2016 06:12

# Multi line Code

js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

 ⇦ Type 3 backticks, then press [enter ⏎]

# Single line Code

This an inline <paste code here> code formatting with a single backtick() at _start_ and _end_ around thecode.

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

Sean DiSanti
Jun 05 2016 06:16
hi all, how goes it?
@shusil123
Jun 05 2016 06:28

function largestOfFour(arr) {
var tArray = [];
for (var i=0; i<4; i++) {

arr[i].sort(function(a, b) {
return b-a;
});

tArray.push(arr[i][0]);

}

return tArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
@RITESHMOHAPATRA , as simple as that. After sorting push the first elements of each array to a new array and return that array.
Coy Sanders
@coymeetsworld
Jun 05 2016 06:33
@shusil123 when you're helping someone please don't just give the code out
try to help them through what they have
@shusil123
Jun 05 2016 06:34
@coymeetsworld , sorry there. I feel the same now. I will do that from now on.
Coy Sanders
@coymeetsworld
Jun 05 2016 06:34
no problem :)
Puvendran Pillay
@puven12
Jun 05 2016 06:34
can anyone help me?
Sean DiSanti
Jun 05 2016 06:35
sure, what's up @puven12
Puvendran Pillay
@puven12
Jun 05 2016 06:37
@badc0ded it is my algorithm challenge "factorialize a number"
@shusil123
Jun 05 2016 06:37

@coymeetsworld , I need some ideas about returning the only unique elements(Occuring only once) from an array which has many duplicated elements.

(Challenge: Diff two arrays)

Sean DiSanti
Jun 05 2016 06:37
ok, are you getting an error? one of the tests failing? what is your code and result
Puvendran Pillay
@puven12
Jun 05 2016 06:37
function factorialize(num) {
var numArray=[num];
var i;
for (i=num;i>num;i--){
numArray.unshift(i);}
var endNum= numArray.reduce(numArray[0],numArray[1]);
{ return numArray[0] * numArray[1];
}
return endNum;
}

factorialize(5);
@shusil123
Jun 05 2016 06:38

function diffArray(arr1, arr2) {
var newArr = [];
var dewArr = [];
dewArr = arr1.concat(arr2).sort(function(a,b) {
return b-a;
});

newArr = dewArr.filter(function(v, i) {
return (dewArr.indexOf(v)!==i);
});

return newArr;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
@coymeetsworld , the code i've wriiten
Sean DiSanti
Jun 05 2016 06:38
a few things going on there, the first thing to look at would be the loop @puven12
you're telling it to start at num, and subtract every iteration while i is greater than num, which will be never
so nothing inside your for loop actually happens
you're also not accounting for 0 being passed in
your function called with 0 should return 1
Coy Sanders
@coymeetsworld
Jun 05 2016 06:40
let me take a look @shusil123
Puvendran Pillay
@puven12
Jun 05 2016 06:42
@badc0ded hmm what should i change? i want it to create an array of ascending order finishing at the num
Sean DiSanti
Jun 05 2016 06:43
lets look at that loop first
Puvendran Pillay
@puven12
Jun 05 2016 06:43
Sean DiSanti
Jun 05 2016 06:43
you could start with num - 1, OR initialize the array empty
i think the latter is more readable
then adjust your continue condition, you don't want to continue when num > i, but when num > 0
forget the num > 0 part
that's a decision you can make
Coy Sanders
@coymeetsworld
Jun 05 2016 06:46
yeah problem with that filter function
Sean DiSanti
Jun 05 2016 06:46
does that make sense @puven12 ?
Coy Sanders
@coymeetsworld
Jun 05 2016 06:47
remember when you use filter, you remove items from the array that evaluate to false inside your callback function
@shusil123
so like for 4, which is only listed once, dewArr.indexOf(4) would be 2, which is what i would equal
Puvendran Pillay
@puven12
Jun 05 2016 06:47
@badc0ded yes but i cant get the loop to work
Sean DiSanti
Jun 05 2016 06:47
what do you have now
Coy Sanders
@coymeetsworld
Jun 05 2016 06:48
I didn't use functional programming although I probably should since my code isn't that great for this challenge
but if you sort the array and put it together, one way you can check for duplicates is see if a value is the same as the one next to it, if so remove them both, if not keep it
@shusil123
Jun 05 2016 06:49
@coymeetsworld , I will try to do that . Oh , yes, removing both should work.
Thanks
Coy Sanders
@coymeetsworld
Jun 05 2016 06:50
np
Puvendran Pillay
@puven12
Jun 05 2016 06:56

function factorialize(num) {
var numArray=[num];
var i;
for (i=0;i<num;i++){
numArray.unshift(i);}
var endNum= numArray.reduce(numArray[0],numArray[1]);
{ return numArray[0] * numArray[1];
}
return endNum;
}

factorialize(5);
Coy Sanders
@coymeetsworld
Jun 05 2016 06:57
going in the wrong direction from what you had before @puven12
Puvendran Pillay
@puven12
Jun 05 2016 06:58
@coymeetsworld I'm pretty confused
Coy Sanders
@coymeetsworld
Jun 05 2016 06:58
yeah I can see, you're overcomplicating it
you don't need to use arrays or reduce function for this at all
guess the first thing to ask would be if you how factorials work
Puvendran Pillay
@puven12
Jun 05 2016 06:59
wait lemme change this
@coymeetsworld oh i get it now
Sean DiSanti
Jun 05 2016 07:05
alright well it's midnight here, i'm probably going to crash
have a good one everyone
Puvendran Pillay
@puven12
Jun 05 2016 07:06
CamperBot
@camperbot
Jun 05 2016 07:06
puven12 sends brownie points to @badc0ded :sparkles: :thumbsup: :sparkles:
@shusil123
Jun 05 2016 07:12

function diffArray(arr1, arr2) {
var newArr = [];
var dewArr = [];
dewArr = arr1.concat(arr2).slice().sort();

for (var i=0; i<dewArr.length; i++) {
if(dewArr[i]==dewArr[i+1]) {
delete dewArr[i];
delete dewArr[i+1];
}
}

return dewArr.filter(function(val) {
return val!==null;
});

}

diffArray([1, "calf", 3, "piglet"], [1, "calf", 3, 4]);
@coymeetsworld , I made it working, finally, but is there any simpler method / efficient ??
Kelvin
@loweehahn
Jun 05 2016 07:21
Why is this code returning only [object Object]?
$.getJSON('https://api.twitch.tv/kraken/streams/castro_1021?callback=?', function(data) { document.write(data); }); Rakshan Shetty @rakshans1 Jun 05 2016 07:32 This message was deleted This message was deleted UtkarshShukla7 @UtkarshShukla7 Jun 05 2016 07:39 @loweehahn this maybe caused due to document.write() .See this link Kelvin @loweehahn Jun 05 2016 07:40 @UtkarshShukla7 I get the same output even if I replace document.write() with console.log() Mateusz Szymański @matszym Jun 05 2016 07:40 @loweehahn Or its promise, even if you passed cb Kelvin @loweehahn Jun 05 2016 07:40 @matszym Sorry I don't get you. shivamsonu29 @shivamsonu29 Jun 05 2016 07:41 How to output repeat strings?? Mateusz Szymański @matszym Jun 05 2016 07:42 @loweehahn Promise is object with methods like success and error, that will be executed when promise is fulfiled or rejected. The object you are getting in return might be promise RITESH KUMAR MOHAPATRA @RITESHMOHAPATRA Jun 05 2016 07:43 @shivamsonu29 use concat function Coy Sanders @coymeetsworld Jun 05 2016 07:44 maybe @shusil123 but its better than what I had RITESH KUMAR MOHAPATRA @RITESHMOHAPATRA Jun 05 2016 07:45 Remove all falsy values from an array. Falsy values in JavaScript are false, null, 0, "", undefined, and NaN.?????? Shusil Banjade @shusil123 Jun 05 2016 07:45 @coymeetsworld , :smile: Haha @RITESHMOHAPATRA , can you post your code here? RITESH KUMAR MOHAPATRA @RITESHMOHAPATRA Jun 05 2016 07:46 function bouncer(arr) { // Don't show a false ID to this bouncer. function isBigEnough(value) { return value!==false||value!==null||value!==0||value!==""||value!==undefined||value!=NaN; } arr=arr.filter(isBigEnough); return arr; } bouncer([7, "ate", "", false, 9]); Puvendran Pillay @puven12 Jun 05 2016 07:46 my loop doesnt seem to be iterating function factorialize(num) { var i; for (i=1;num>1;i++){ return num * i; } } factorialize(5); Mateusz Szymański @matszym Jun 05 2016 07:46 @loweehahn Scratch what I said before, jquery doc says its XHR object http://api.jquery.com/Types/#jqXHR @puven12 you are returning num * i, so it doesnt @puven12 return terminates any other actions Shusil Banjade @shusil123 Jun 05 2016 07:49 @RITESHMOHAPATRA , see "Boolean objects" links provided aside in the challenge. That'll make you clear . RITESH KUMAR MOHAPATRA @RITESHMOHAPATRA Jun 05 2016 07:50 @puven12 function factorialize(num) { if(num==0) return 1; else return num*factorialize(num-1); } Mateusz Szymański @matszym Jun 05 2016 07:50 @puven12 Whats worst, your loop is infinite loop num>1 Puvendran Pillay @puven12 Jun 05 2016 07:51 @matszym oh I see. How I make finite? Mateusz Szymański @matszym Jun 05 2016 07:52 @puven12 you are incrementing i, so condition should reflect it i <= n Norberto @nortocode Jun 05 2016 07:56 @Otakukami line 6, you are using c when it's not defined yet shivamsonu29 @shivamsonu29 Jun 05 2016 07:57 @RITESHMOHAPATRA thanks!!,it worked CamperBot @camperbot Jun 05 2016 07:57 shivamsonu29 sends brownie points to @riteshmohapatra :sparkles: :thumbsup: :sparkles: :cookie: 254 | @riteshmohapatra |http://www.freecodecamp.com/riteshmohapatra Otakukami @Otakukami Jun 05 2016 07:57 how do you define it? @nortocode Norberto @nortocode Jun 05 2016 07:57 c= c + " I am a "; simply remove the c + part Puvendran Pillay @puven12 Jun 05 2016 07:58 @matszym thanks I got it CamperBot @camperbot Jun 05 2016 07:58 puven12 sends brownie points to @matszym :sparkles: :thumbsup: :sparkles: :cookie: 77 | @matszym |http://www.freecodecamp.com/matszym Shawn @maple3011 Jun 05 2016 07:58 Mateusz Szymański @matszym Jun 05 2016 07:58 @Otakukami Few things. 1) Spaghetti code. Dont put multiple variabe assigments in one line. 2) When variable is initialized it has value of undefined. If you add string to undefined (c + "I'am a string"), you get "undefinedI'am a string' 3) Too many spaces in " I am a string " Shawn @maple3011 Jun 05 2016 07:58 hello guys why i download the source code it looks like a stack of code Norberto @nortocode Jun 05 2016 08:00 @maple3011 that's the minified version, meant just for use it, not for reading :) Shawn @maple3011 Jun 05 2016 08:01 what.. RITESH KUMAR MOHAPATRA @RITESHMOHAPATRA Jun 05 2016 08:01 Not able to do :Falsy Bouncer Remove all falsy values from an array. Falsy values in JavaScript are false, null, 0, "", undefined, and NaN. Artur Sęp @a-sep Jun 05 2016 08:01 @maple3011 just download it again without .min at the end of the file Tam Nguyen @bankplank Jun 05 2016 08:02 @maple3011 The code is condense to reduce file size Mateusz Szymański @matszym Jun 05 2016 08:02 @RITESHMOHAPATRA What do you have problem with in this task? Shusil Banjade @shusil123 Jun 05 2016 08:02 @RITESHMOHAPATRA , try " return arr.filter(Boolean); " RITESH KUMAR MOHAPATRA @RITESHMOHAPATRA Jun 05 2016 08:05 @shusil123 thanks it worked but how? CamperBot @camperbot Jun 05 2016 08:05 riteshmohapatra sends brownie points to @shusil123 :sparkles: :thumbsup: :sparkles: :cookie: 335 | @shusil123 |http://www.freecodecamp.com/shusil123 Shusil Banjade @shusil123 Jun 05 2016 08:06 @RITESHMOHAPATRA , I was amazed too. , Boolean is supposed to return only true values or something like that. Search about this. slavenoptimus @slavenOptimus Jun 05 2016 08:36 please I am trying to do the Golf function I can not get passed it, but it gives me the returns I need... function golfScore(par, strokes) { // Only change code below this line if (strokes <= par && strokes == 1) { return "Hole-in-one"; } else if (strokes <= par-2) { return "Eagle"; } else if (strokes <= par-1) { return "Birdie"; } else if (strokes == par && par != 1) { return "Par"; } else if (strokes >= par + 3) { return "Go Home"; } else if (strokes >= par + 2) { return "Double Bogey"; } else { return "Bogey"; } // Only change code above this line } Jack Anderson @JackAndersonLee Jun 05 2016 08:41 @slavenOptimus You forgot the "!" at the end of Hole-in-One and Go Home slavenoptimus @slavenOptimus Jun 05 2016 08:45 well... That was frustrating... :) thanks @JackAndersonLee CamperBot @camperbot Jun 05 2016 08:45 slavenoptimus sends brownie points to @jackandersonlee :sparkles: :thumbsup: :sparkles: :cookie: 312 | @jackandersonlee |http://www.freecodecamp.com/jackandersonlee Coy Sanders @coymeetsworld Jun 05 2016 08:46 This message was deleted Jack Anderson @JackAndersonLee Jun 05 2016 08:46 At least you know you had the logic right Coy Sanders @coymeetsworld Jun 05 2016 08:47 you can actually remove some of your logic @slavenOptimus, you just need to check if strokes == 1 for hole in one, doesn't matter what par is also for par you don't have to worry if par is equal to one or not, it never is in golf :) Hasan Misbah @hasanmisbah Jun 05 2016 09:01 can anyone help me on this! function nextInLine(arr, item) { // Your code here arr = testArr; arr.push(item); return arr.shift(); // Change this line } // Test Setup var testArr = [1,2,3,4,5]; // Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr[5],1)); // Modify this line to test console.log("After: " + JSON.stringify(testArr)); it showing error nextInLine([5,6,7,8,9], 1) should return 5 Fernand @Ferdyboy81 Jun 05 2016 09:16 hi guys! how do i make my "comment" button to work? i want it that when you click on it to have a pop-up window where you can leave a comment. <p>I’ve often heard the quote “leap and the net will appear” and honestly, that quote always scared me. I’m not a leaper. I like the idea of leaping..but to actually do it? Nope. No way. Not me. I’m the timid one, the one who makes safe choices…</p><button>Like</button> <button type="button" class="btn btn-default btn-sm"> <span class="glyphicon glyphicon-comment"></span> Comment </button> </article> <script>$("button").on("click",function() {
});

$("spanclass").on("click",function() { alert("Please leave a comment. Thank you!") }); </script> my "button" window works but i can't seem to get the comment button work Mateusz Szymański @matszym Jun 05 2016 09:18 @Ferdyboy81 css sdelectors starts with dot $(".spanclass")
Fernand
@Ferdyboy81
Jun 05 2016 09:19
@matszym how come this works though. $("button").on("click",function() { alert("Thank you!") }); i didn't put a . before the button Mateusz Szymański @matszym Jun 05 2016 09:19 @Ferdyboy81 button isnt css class, is it? Fernand @Ferdyboy81 Jun 05 2016 09:20 oh its a css class Mateusz Szymański @matszym Jun 05 2016 09:21 @Ferdyboy81 oh, and I assumed 'spanclass' is css class, but it isnt Fernand @Ferdyboy81 Jun 05 2016 09:21 but the challenge is adding <script> tags and putting java code Mateusz Szymański @matszym Jun 05 2016 09:21 @Ferdyboy81 tbh, 'spanclass' doesnt reffer to anything in your html Fernand @Ferdyboy81 Jun 05 2016 09:21 oh thats why i can't get the code to work lol Mateusz Szymański @matszym Jun 05 2016 09:22 @Ferdyboy81 meaning, there is not element, no css class, no id Fernand @Ferdyboy81 Jun 05 2016 09:22 so how should i execute a java code that'll make this work? Mateusz Szymański @matszym Jun 05 2016 09:22 @Ferdyboy81 no idea. Java !== Javascript Fernand @Ferdyboy81 Jun 05 2016 09:23 <p>I’ve often heard the quote “leap and the net will appear” and honestly, that quote always scared me. I’m not a leaper. I like the idea of leaping..but to actually do it? Nope. No way. Not me. I’m the timid one, the one who makes safe choices…</p><button>Like</button> <button type="button" class="btn btn-default btn-sm"> <span class="glyphicon glyphicon-comment"></span> Comment </button> </article> <script>$("button").on("click",function() {
});

$(".spanclass").on("click",function() { alert("Please leave a comment. Thank you!") }); </script> Mateusz Szymański @matszym Jun 05 2016 09:23 @Ferdyboy81 $("span").on("click",function() {
});
CamperBot
@camperbot
Jun 05 2016 09:23
matszym sends brownie points to @ferdyboy81 :sparkles: :thumbsup: :sparkles:
Mateusz Szymański
@matszym
Jun 05 2016 09:25
@Ferdyboy81 but you will bind to every button and span class on page. This is bad design. Once you add some other stuff, not related to this implementation (like sign out button, or span in other section of document) you are going to bind click event handlers to this
Fernand
@Ferdyboy81
Jun 05 2016 09:25
@matszym i did that but I'm getting the same code I'm getting for my like button.
Mateusz Szymański
@matszym
Jun 05 2016 09:26
send me link to codepen/jsbin or similar bage with your code then
@Ferdyboy81 if its freecodecamp, you can send it too
Fernand
@Ferdyboy81
Jun 05 2016 09:27
Mateusz Szymański
@matszym
Jun 05 2016 09:27
@Ferdyboy81 oh well, i see it now. Check out my comment about using elements is bad design for what you are doing. This happened right now
you have 2 buttons on page
@Ferdyboy81 you are binding to both of them
Fernand
@Ferdyboy81
Jun 05 2016 09:28
ohhh i c
Mateusz Szymański
@matszym
Jun 05 2016 09:28

@Ferdyboy81 First button:

<button>Like</button>

Second button

<button type="button" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-comment"></span> Comment
</button>
Fernand
@Ferdyboy81
Jun 05 2016 09:30
@matszym how do i fix that coz i want my button comment to be look the same as my like button
Mateusz Szymański
@matszym
Jun 05 2016 09:32
@Ferdyboy81 I would use classes or id as selectors
<button class="like-btn">Like</button>
$('.like-btn').on('click', function(){ alert('Thanks for like!');}); <button type="button" class="btn btn-default btn-sm comment-btn"> <span class="glyphicon glyphicon-comment"></span> Comment </button>$('.comment-btn').on('click', function(){alert('Thanks for comment');});
@Ferdyboy81 Fixed code, hceck now
Fernand
@Ferdyboy81
Jun 05 2016 09:36
@matszym thank brother! it worked!
CamperBot
@camperbot
Jun 05 2016 09:36
ferdyboy81 sends brownie points to @matszym :sparkles: :thumbsup: :sparkles:
wSlitz
@wSlitz
Jun 05 2016 09:36
Hi,
Can someone explain why the string "baa" fails the regex for the first time and passes second time?
var arr = ["aab", "aba", "aab", "aba", "baa", "baa"];
var regex = /(.)\1/g;
var counter = 0;
for (var i = 0; i < arr.length; i++) {
if (!regex.test(arr[i])) {
console.log("passed regex", arr[i]);
} else {
console.log("failed regex", arr[i]);
}
}
Creative Shin
@CreativeShin
Jun 05 2016 09:42
can someone tell me what to do in Stand in Line

function nextInLine(arr, item) {
arr.push(item);
var a= arr.unshift(item);
return a; // 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));

Jun 05 2016 09:43
function updateRecords(id, prop, value) {
if ( value !== "" && prop === "tracks" ) {
console.log(value);
}
what is wrong in those lines ?
Creative Shin
@CreativeShin
Jun 05 2016 09:44
got it ...
I should use shift
wSlitz
@wSlitz
Jun 05 2016 09:47
@walidmahade missing}
Jun 05 2016 09:48
@wSlitz actually I have that in my real code
Mateusz Szymański
@matszym
Jun 05 2016 09:48
@wSlitz Seems like your regex refferences previous value, not the current one. So, first time you check 'baa', you have results of 'aba', but on next 'baa' you are getting results of the first one 'baa'
Jun 05 2016 09:49
can some one help me with the js test " record collection "
Mateusz Szymański
@matszym
Jun 05 2016 09:50
wSlitz
@wSlitz
Jun 05 2016 09:53

@matszym according to MDN:

test() called multiple times on the same global regular expression instance will advance past the previous match.
I think you are right, but how can I force it to refer to second "baa" as a new string?

Jamen Marz
@jamen
Jun 05 2016 09:53
Anyone else use Workspaces/Virtual Desktops? I use Linux, and I essentially have 3 programs I use day to day. Web browser, Atom, and terminal. I have them each full-screened in a workspace, and I hotkey back and forth between them.
Whoops, wrong chat.
Lol
But you can still answer I guess.
Jun 05 2016 09:54
I use Nitrous.io
Mateusz Szymański
@matszym
Jun 05 2016 09:57
@wSlitz remove global flag from regex
@wSlitz And btw, I was wrong at first ;)
wSlitz
@wSlitz
Jun 05 2016 09:59
@matszym Now it works. Why?
Mateusz Szymański
@matszym
Jun 05 2016 09:59
@wSlitz now it doesnt look for second occurence in string 'bba'

@ruinL
Jun 05 2016 09:59
function lookUp(firstName, prop){
// Only change code below this line
var result="";
for(var i=0;i<contacts.length;i++){
if(contacts[i].firstName===firstName&&prop=="lastName","number","likes"){
result=contacts[i][prop];
return result;
}else if (contacts[i].firstName!==firstName){
result= "No such contact";
return result;
}
else if (prop!=="lastName","number","likes"){
result= "No such property";
return result;
}
}
Mateusz Szymański
@matszym
Jun 05 2016 10:00
@wSlitz it would work if you had longer string,like 'bbabb', but you have single instance of duble letters in your string
@wSlitz WIth global flag, regex has 'memory' that you found first instance, and since you are calling it on same string second time, you want another (next one) match
wSlitz
@wSlitz
Jun 05 2016 10:03
@matszym so basically both "baa" strings in the array are pointing to the same object?
Mateusz Szymański
@matszym
Jun 05 2016 10:03
@wSlitz strings are primitives, not objects
@wSlitz when the value of primitive are equals, they are stric equal
@wSlitz with doesnt happen with objects,
{ name: "BOB" } !== { name: "BOB"}
but
"BOB" === "BOB"
So it doesnt matter for regex, that its not he same string. FOr javascript it is, since values are same
wSlitz
@wSlitz
Jun 05 2016 10:05
@matszym it was ruby where everything is an object :)
Mateusz Szymański
@matszym
Jun 05 2016 10:06
@wSlitz Oh, I dont know about ruby :)
wSlitz
@wSlitz
Jun 05 2016 10:07
@matszym so there is one primitive "baa" in js memory and both values of the array references to that primitive?
Mateusz Szymański
@matszym
Jun 05 2016 10:07
@wSlitz But it wouldnt make sens with ruby then. You woudnt be able to compare strings, ever, since they would be different isntances of object
@wSlitz primitives dont refference, they copy values
@wSlitz you dont ever have refference to primitive
wSlitz
@wSlitz
Jun 05 2016 10:09
@matszym I think i'll google some info on primitives in js. thanks
CamperBot
@camperbot
Jun 05 2016 10:09
wslitz sends brownie points to @matszym :sparkles: :thumbsup: :sparkles:
Mateusz Szymański
@matszym
Jun 05 2016 10:10
@wSlitz ofc, that in context of js. In other langs youu can have pointers to what we call primitives in js (numbers, strings, booleans etc)
Brendan Kinahan
@BKinahan
Jun 05 2016 10:37
...Too quiet.
It's quiet.
Y'all are up to something, I know it.
Creative Shin
@CreativeShin
Jun 05 2016 10:43

function golfScore(par, strokes) {
// Only change code below this line
if (strokes >= par+3){
return "Go Home!";
}
else if( strokes === par + 2 ){
return "Double Bogey";
}
else if (strokes === par + 1){
return "Bogey";
}
else if (strokes === par){
return "Par";
}
else if (strokes === par - 1){
return "Birdie";
}
else if (strokes <= par - 2){
return "Eagle";
}
else if (strokes === 1 ){
return "Hole-in-one!";
}
else{
return "not defined";
}
// Only change code above this line

}
// Change these values to test
golfScore(5, 4);

what am I doing wrong
anyone?
Creative Shin
@CreativeShin
Jun 05 2016 10:50
leave it ..i got the ans
Jason Keenan
@raavin
Jun 05 2016 10:54
Hey :)
Creative Shin
@CreativeShin
Jun 05 2016 10:55
hey
Jason Keenan
@raavin
Jun 05 2016 10:56
Has anyone done Sum All Odd Fibonacci Numbers???
Mateusz Szymański
@matszym
Jun 05 2016 10:58
@raavin Sure, what do you have problem with?
Jason Keenan
@raavin
Jun 05 2016 10:59
@matszym I've put something together but It's failing on one of the tests
I'll post it
Brendan Kinahan
@BKinahan
Jun 05 2016 10:59
maybe an off-by-one error
Jason Keenan
@raavin
Jun 05 2016 10:59
@BKinahan Yeah I think so
Mateusz Szymański
@matszym
Jun 05 2016 11:00
@raavin Post the code here so we can look into it
Jason Keenan
@raavin
Jun 05 2016 11:00

function sumFibs(num) {
var duo = [1,1];
var nextNumber = 0;
var totalOdd = 1;
for (var i = 0; totalOdd < num; i++){
nextNumber = duo[0] + duo[1];
console.log(nextNumber);
if (nextNumber%2 !== 0){
totalOdd = totalOdd + nextNumber;
}
duo.push(nextNumber);
duo.shift();
}
console.log(duo);
console.log(totalOdd);
}

sumFibs(4);
sumFibs(75024);
Brendan Kinahan
@BKinahan
Jun 05 2016 11:00
Dost thou meanest 'post'? ;)
Mateusz Szymański
@matszym
Jun 05 2016 11:01
@BKinahan y, typo :)
Jason Keenan
@raavin
Jun 05 2016 11:01
It's failing on the last one
@matszym where?
@matszym oh you ;P
Why is it so quiet????
This is the slowest I've seen FCC gitter...in all rooms
Brendan Kinahan
@BKinahan
Jun 05 2016 11:03
@raavin just a quiet Sunday morning here
Mateusz Szymański
@matszym
Jun 05 2016 11:03

@raavin
"Return the sum of all odd Fibonacci numbers up to and including"

You have to include the number

@raavin totalOdd < num
Jason Keenan
@raavin
Jun 05 2016 11:04
@matszym <= fails on two????
Mateusz Szymański
@matszym
Jun 05 2016 11:05
@raavin And passes that on, htat was falin before ;) Looking into it,
Jason Keenan
@raavin
Jun 05 2016 11:05
@matszym cheers :)
Norberto
@nortocode
Jun 05 2016 11:06
@raavin ´nextNumber = duo[0] + duo[1]; ´ to me this looks like it's always checking to the same positions
Brendan Kinahan
@BKinahan
Jun 05 2016 11:06
@nortocode it is, but the values at those positions are changed each time.
Jason Keenan
@raavin
Jun 05 2016 11:06
@nortocode Yeah, it is. I'm pushing the new number... what he said @BKinahan
Norberto
@nortocode
Jun 05 2016 11:06
@BKinahan oh the push yes, sorry :)
Brendan Kinahan
@BKinahan
Jun 05 2016 11:07
and the shift
Jason Keenan
@raavin
Jun 05 2016 11:07
@nortocode for some reason it is adding the last one when it shouldn't for this test only
Something obvious I'm sure
Brendan Kinahan
@BKinahan
Jun 05 2016 11:09
@raavin for that case it's probably stopping exactly at num when in the others it doesn't
Jason Keenan
@raavin
Jun 05 2016 11:09
It's a pain because it was the first time I'd had...like a vision...and coded the whole thing without testing
Brendan Kinahan
@BKinahan
Jun 05 2016 11:09
@raavin ie the last one is less than num, and the next is greater than num, but num itself is not reached exactly
Jason Keenan
@raavin
Jun 05 2016 11:10
@BKinahan Like I said above, it's painful because it sort of coded itself, now I'm stuck on this and it's killing me :(
Brendan Kinahan
@BKinahan
Jun 05 2016 11:11
@raavin I'll take another look after breakfast if someone doesn't solve it for you before then :)
Jason Keenan
@raavin
Jun 05 2016 11:11
@BKinahan Thanks :)
CamperBot
@camperbot
Jun 05 2016 11:11
raavin sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:star2: 1577 | @bkinahan |http://www.freecodecamp.com/bkinahan
Jason Keenan
@raavin
Jun 05 2016 11:11
romaisa
@romi012
Jun 05 2016 11:12
hello everyone
Taylor Bostick
@Taylorbostick32
Jun 05 2016 11:12
I know this is probably really simple, but can you explain why i am getting this wrong for assigning contents of a to b? var a = 7; var b = var a;
romaisa
@romi012
Jun 05 2016 11:12
spmeone plz tell me why else my code has error?
Jason Keenan
@raavin
Jun 05 2016 11:12
@Taylorbostick32 should just be var b=a
Taylor Bostick
@Taylorbostick32
Jun 05 2016 11:13
@raavin thank you
CamperBot
@camperbot
Jun 05 2016 11:13
taylorbostick32 sends brownie points to @raavin :sparkles: :thumbsup: :sparkles:
Jason Keenan
@raavin
Jun 05 2016 11:14
@Taylorbostick32 No worries :)
romaisa
@romi012
Jun 05 2016 11:14
?
:worried:
Jason Keenan
@raavin
Jun 05 2016 11:15
@Taylorbostick32 you only need to use var when you first use/declare the variable
@romi012 you have a space at the start ;)
FNGR2911
@FNGR2911
Jun 05 2016 11:17
hey everybody! made the search and replace algo. what do you think about my solution? :)
function myReplace(str, before, after) {
if (before.charAt(0) == before.charAt(0).toUpperCase()) {
var firstChar = after.charAt(0).toUpperCase();
var otherChars = after.substr(1);
after = firstChar.concat(otherChars);
} else {
var firstChar = after.charAt(0).toLowerCase();
var otherChars = after.substr(1);
after = firstChar.concat(otherChars);
}
str = str.split(before).join(after);
return str;
}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
myReplace("Let us get back to more Coding", "Coding", "algorithms");
rouxfeur
@rouxfeur
Jun 05 2016 11:17
Hi, I have a function function func(p1, p2){…}. Is it possible to get all additional arguments, that aren’t specified? For example, if I call func(1, 2, 3, 2), I would get [3, 2].
Jason Keenan
@raavin
Jun 05 2016 11:18
@romi012 did you get my response????
Norberto
@nortocode
Jun 05 2016 11:18
@raavin (totalOdd <= num) changing this and this (nextNumber = duo[1]; )could work ?
romaisa
@romi012
Jun 05 2016 11:18
@raavin i didnt get what u said :worried:
Jason Keenan
@raavin
Jun 05 2016 11:19
@nortocode I'll take a look :)
@romi012 you have a space at the start of your string. Delete the space and you'll be ok :)
Norberto
@nortocode
Jun 05 2016 11:21
(totalOdd <= num) this because you want up to and including (nextNumber = duo[1]; ) and this because you only want the odd ones
romaisa
@romi012
Jun 05 2016 11:21
@raavin pheww it's working :smile: thanks :+1:
CamperBot
@camperbot
Jun 05 2016 11:21
romi012 sends brownie points to @raavin :sparkles: :thumbsup: :sparkles:
Jason Keenan
@raavin
Jun 05 2016 11:24
@romi012 np :)
@rabibsust
Jun 05 2016 11:24
function mutation(arr) {
var str1 = arr[0];
var str2 = arr[1];
if(str1.indexOf(str2) > -1)
return false;
else return true;
}
Jason Keenan
@raavin
Jun 05 2016 11:27
@nortocode Just checked...I'd already tried <=, but it makes 2 fail instead of one. What do you mean by nextNumber = duo1; I'm adding the two array elements to get the new number so this gives me an infinite loop unfortunately. :( no luck
whats wrong in this one
?
Jason Keenan
@raavin
Jun 05 2016 11:30
@sriwithsweetsmile passes for me????
David Lomath-Connis
@Davidlomath
Jun 05 2016 11:32
Hello, I need help with this var myStr= '"\ \r \n';
Its asking me to do myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces and the name of the challange is Escape Sequences in Strings
Jason Keenan
@raavin
Jun 05 2016 11:34
@Davidlomath just do what it says, enter the escape sequences, that are on your left, in the string with a space in between
David Lomath-Connis
@Davidlomath
Jun 05 2016 11:35
I have, hence why I pasted the code that I have @raavin
Norberto
@nortocode
Jun 05 2016 11:35
@raavin I understand you want "numbers up to and including the passed number ", hence the <= , I keep checking the rest , I see the nextNumber = duo1 I said before was wrong
Jason Keenan
@raavin
Jun 05 2016 11:39
@nortocode Ill post the link, make sure you open it in an incognito window so you don't lose yours if you've completed it
Jason Keenan
@raavin
Jun 05 2016 11:40
@nortocode i thought <= should work too but alas it fails on 4 too
@romi012 when you are assigning a value to a variable, the variable is on the left and the new value you are assigning to it is on the right. Look again and think about it and get back to me ;)
@nortocode I think I'm throwing things out by starting with a filled array and adding 1 later. I think I might need to refactor
romaisa
@romi012
Jun 05 2016 11:45
@raavin u r amazing dude :smile: thank u soo much
CamperBot
@camperbot
Jun 05 2016 11:45
romi012 sends brownie points to @raavin :sparkles: :thumbsup: :sparkles:
:warning: romi012 already gave raavin points
Jason Keenan
@raavin
Jun 05 2016 11:45
@romi012 you will be amazing too ;)
@romi012 just take your time, don't move on until you think you understand what you've done
romaisa
@romi012
Jun 05 2016 11:46
@raavin yeah but it ll take time to reach at your level :+1:
romaisa
@romi012
Jun 05 2016 11:46
@raavin yeah sure
Jason Keenan
@raavin
Jun 05 2016 11:47
@romi012 I'd done a little bit of ruby before but I've learned most here in the last few months
Brendan Kinahan
@BKinahan
Jun 05 2016 11:47
@raavin So, what made you decide to loop based on totalOdd < num? I think that's throwing me off when going through your code.
romaisa
@romi012
Jun 05 2016 11:48
@raavin have u done any project on ruby?
Brendan Kinahan
@BKinahan
Jun 05 2016 11:48
@raavin this change makes it work:
 for (var i = 0; duo[0]+duo[1] <= num; i++)
Jason Keenan
@raavin
Jun 05 2016 11:49
@BKinahan Yeah, it seemed weird to me too. Until I tried it it hadn't occurred to me that I could use something other than 'i'
Brendan Kinahan
@BKinahan
Jun 05 2016 11:49
two changes, checking the sum of both duo elements, and the comparison <= rather than <
Creative Shin
@CreativeShin
Jun 05 2016 11:50
has anyone done
Counting Cards
>
?
Brendan Kinahan
@BKinahan
Jun 05 2016 11:50
@raavin I think you just got lucky that most of the test cases worked with that totalOdd<num loop condition :P
@Creative-Shin yup!
Creative Shin
@CreativeShin
Jun 05 2016 11:50

var count = 0;

function cc(card) {
// Only change code below this line
if (card <= 6 && card >=2){
count ++;
return card + " Bet";

}
else if( card === "J" || card === "Q"|| card === "K"|| card === "A" ){
count --;
return card + " Hold";
}
else if (card >=7 ) {

   return card + " Hold";

}
// Only change code above this line
}

// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

Vishesh
@vishesh-shrivastav
Jun 05 2016 11:50
My JS code for Sum All Odd Fibonacci Numbers
Creative Shin
@CreativeShin
Jun 05 2016 11:50
@BKinahan what should I do?
Paolo
@mav1283
Jun 05 2016 11:50

hey guys need help on javascript record collection

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

return collection;
}

i have this error

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

return collection;
}"

Vishesh
@vishesh-shrivastav
Jun 05 2016 11:51
Working on repl.it but not working on FCC
Brendan Kinahan
@BKinahan
Jun 05 2016 11:51
@Creative-Shin what you return (the bet/hold decision) should depend on the current value of count which changes between function calls, and not only on the current card being drawn.
Vivek
@vivek28111992
Jun 05 2016 11:51
@BKinahan @raavin hi I have 1 problem, this is converting roman numerals to string, it gives wrong value for some number
var romanToInt = function(s) {

var sum = 0,sub = s,
v = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
r = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'];

for(var i = 0; i < r.length; i++){
if(sub.indexOf(r[i]) !== -1){
sum += v[i];
sub = sub.replace(r[i],"");
console.log(sub);
i = 0;
}
}
return sum;
};
Jason Keenan
@raavin
Jun 05 2016 11:51
@BKinahan You cracked it!!!! thanks
CamperBot
@camperbot
Jun 05 2016 11:51
raavin sends brownie points to @bkinahan :sparkles: :thumbsup: :sparkles:
:warning: raavin already gave bkinahan points