3rd
Sep 2015
the assertions are confusing
@ozjohnson
Sep 03 2015 00:01
i'm working on one of the bonfires "title case a sentence" and can solve it, but only through introducing a new function (not taught yet) and using substr, which the class hasn't introduced yet either. should i only be relying on tools that have been taught in a previous lesson?
Rich Churcher
@richchurcher
Sep 03 2015 00:02
@ozjohnson I don't really see why, use whatever works
@TheHexorcist
Sep 03 2015 00:02
@ozjohnson i think you should do whatever works
Some of the bonfires are so poorly defined you have to do whatever works
@ozjohnson
Sep 03 2015 00:03
@richchurcher @HexORSist thanks guys. i really felt like i was making something ugly by trying to stick with only what i've learned so far.
CamperBot
@camperbot
Sep 03 2015 00:03
ozjohnson sends brownie points to @richchurcher and @hexorsist :sparkles: :thumbsup: :sparkles:
:star: 240 | @hexorsist | http://www.freecodecamp.com/hexorsist
raykoff
@raykoff
Sep 03 2015 00:03
i need a little help on bonfire find the largest word in a string.
CamperBot
@camperbot
Sep 03 2015 00:03
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
:star: 297 | @richchurcher | http://www.freecodecamp.com/richchurcher
DTing
@dting
Sep 03 2015 00:04
@raykoff what do you have so far?
Rich Churcher
@richchurcher
Sep 03 2015 00:04
@HexORSist it does read a little bit strange, doesn't it? It's asking you to return a function, which can take some getting your head around
raykoff
@raykoff
Sep 03 2015 00:04
@dting
function findLongestWord(str) {
var strSplited = str.split(/ /g);

return alert(strSplited + '' + strSplited.length + strSplited[0].length);
}
findLongestWord('The quick brown fox jumped over the lazy dog');
@TheHexorcist
Sep 03 2015 00:05
I can return a function object but what is that obect returning?
Rich Churcher
@richchurcher
Sep 03 2015 00:05
"If only one argument is provided, return a function that expects one additional argument and will return the sum."
DTing
@dting
Sep 03 2015 00:06
@raykoff
you want make a variable to track your longest word. then use a loop to loop over your words and compare that variable to the length of the current word. if it is longer then set the variable to the length of that word. then return the variable after you have looked at all the words
bf longest
CamperBot
@camperbot
Sep 03 2015 00:06

## :fire:Bonfire: Find the Longest Word in a String :link:

function findLongestWord(str) {
return str.length;
}

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

Return the length of the longest word in the provided sentence.

more info:  bf details | bf links | hint

DTing
@dting
Sep 03 2015 00:06
CamperBot
@camperbot
Sep 03 2015 00:06
DTing
@dting
Sep 03 2015 00:06
@TheHexorcist
Sep 03 2015 00:06
@richchurcher im still not following
Rich Churcher
@richchurcher
Sep 03 2015 00:06
@HexORSist So basically, if there's only one argument, you need to return a function that takes another argument and adds the two args together.
DTing
@dting
Sep 03 2015 00:07
bf arguments optional
CamperBot
@camperbot
Sep 03 2015 00:07

function add() {
return false;
}

add(2,3);

Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.

more info:  bf details | bf links | hint

@TheHexorcist
Sep 03 2015 00:07
@richchurcher var adder = new Function('a', 'b', 'return a + b');
DTing
@dting
Sep 03 2015 00:08
CamperBot
@camperbot
Sep 03 2015 00:08
Rich Churcher
@richchurcher
Sep 03 2015 00:08
you don't need to new it
try thinking along the lines of return function (foo) { return foo + bar; }
raykoff
@raykoff
Sep 03 2015 00:09
@dting i am really stuck on this lol
Rich Churcher
@richchurcher
Sep 03 2015 00:09
just remember that in JS functions aren't really special, you can have 'em just about anywhere... they can be inside each other, and they get passed around all over the place
Jose E. Pimentel
@jedpimentel
Sep 03 2015 00:10
just like fruit cake
Rich Churcher
@richchurcher
Sep 03 2015 00:11
another piece of the puzzle is that if one function is inside another, it has access to the variables from the containing function... so:
DTing
@dting
Sep 03 2015 00:11
@raykoff
function findLongestWord(str) {
DECLARE VAR longest = 0
DECLARE WORDS = str.split(' ')
FOR LOOP HERE THAT ITERATES OVER WORDS
IF WORDS[i].length > longest
longest = WORDS[i].length
RETURN longest
}
heres the pseudo code for you
Rich Churcher
@richchurcher
Sep 03 2015 00:11
function foo(b) {
function bar() {
console.log(b);
}
}
above, b can be seen in bar
'cause it's in the parent scope. Clear as mud?
BabyKosh
Sep 03 2015 00:12
I'm having a hard time wrapping around my head how to build a count down timer for my pomodoro app....any good pointers out there?
raykoff
@raykoff
Sep 03 2015 00:12
@dting thx
CamperBot
@camperbot
Sep 03 2015 00:12
raykoff sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 955 | @dting | http://www.freecodecamp.com/dting
@TheHexorcist
Sep 03 2015 00:13
yes very lost now
Rich Churcher
@richchurcher
Sep 03 2015 00:14
lol sorry I may be making things worse
@TheHexorcist
Sep 03 2015 00:15
@richchurcher no its just not clicking yet
Rich Churcher
@richchurcher
Sep 03 2015 00:15
Ok, so what do you have so far?
or nothing yet?
for example, do you know how to check to see how many arguments were passed in the first place?
DTing
@dting
Sep 03 2015 00:17
function greeterFunction() {
if (arguments.length == 2) {
console.log(arguments[0], arguments[1]);
}
if (arguments.length == 1) {
var greeting = arguments[0];
return function(name) {
console.log(greeting, name);
}
}
}
greeterFunction("hello", "bob");
// hello bob
var hiGreeter = greeterFunction("hi");
hiGreeter("mike");
// hi mike
hiGreeter("chris");
// hi chris
@TheHexorcist
Sep 03 2015 00:17
I know im returning a function
Im just not sure what im returing
var sum2And = add(2); return sum2And(3); // 5
Rich Churcher
@richchurcher
Sep 03 2015 00:19
lol @dting well that gets him most of the way there :)
DTing
@dting
Sep 03 2015 00:21
in the first usage there were 2 arguments, so it just logged the "hello bob"
in the 3rd line i only called the function with a single argument. so it returns a function. when that function is called it will log the greeting i called the first function with + the argument that i called the function the greeterFunction returned with.
@TheHexorcist
Sep 03 2015 00:22
where did the 3 come from?
Rich Churcher
@richchurcher
Sep 03 2015 00:22
the trick @HexORSist is that you can return an anonymous function (doesn't need a name) instead of a plain old value
@TheHexorcist
Sep 03 2015 00:22
var sum2And = add(2); return sum2And(3); // 5
Where is 3 coming from?
DTing
@dting
Sep 03 2015 00:25
3 is what you called the new function with
it could be 4
then you would return 6
sum2And is assigned to the function that add(2) returns;
so sum2And is waiting for you to call it with another argument
in that example it was called with 3. so it returned 5
@TheHexorcist
Sep 03 2015 00:27
wait? There is no wait with assertions
DTing
@dting
Sep 03 2015 00:28
well it just chained the call
@TheHexorcist
Sep 03 2015 00:29
So it will callback?
Rich Churcher
@richchurcher
Sep 03 2015 00:29
Notice that down in the tests on that bonfire, it does something like this: expect(add(2)(3)).to.equal(5);
that second bracket after add passes 3 to the function you're returning
DTing
@dting
Sep 03 2015 00:29
function outer() {
return function(something) {
console.log(something);
}
}
outer()('hello');
Rich Churcher
@richchurcher
Sep 03 2015 00:29
like that ^ :)
DTing
@dting
Sep 03 2015 00:30
i could have also done:
var a = outer();
a('hello');
// hello
but in the test they just chained the call with out assigning it to an intermediate variable like :point_up: September 2, 2015 5:29 PM
Daniel Drasdo
@danieldrasdo
Sep 03 2015 00:31
Hiya fellow campers, I was wondering if any one of you would be interested in helping me understand how to implement/use .reduce() in my Pairwise bonfire solution? Maybe privately chatting?
CamperBot
@camperbot
Sep 03 2015 00:31
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Daniel Drasdo
@danieldrasdo
Sep 03 2015 00:32
bonfire Pairwise
CamperBot
@camperbot
Sep 03 2015 00:32

function pairwise(arr, arg) {
return arg;
}

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

Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.

more info:  bf details | bf links | hint

@TheHexorcist
Sep 03 2015 00:33
Oh my im just not understanding this
Rich Churcher
@richchurcher
Sep 03 2015 00:33
@HexORSist sometimes walking away and coming back helps a huge amount
raykoff
@raykoff
Sep 03 2015 00:33
i need help with bonfire Find the Longest Word in a String, pls
CamperBot
@camperbot
Sep 03 2015 00:33
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
@TheHexorcist
Sep 03 2015 00:34
@richchurcher yes i think i will look at closures
Thanks @richchurcher @dting
CamperBot
@camperbot
Sep 03 2015 00:35
hexorsist sends brownie points to @richchurcher and @dting :sparkles: :thumbsup: :sparkles:
:star: 298 | @richchurcher | http://www.freecodecamp.com/richchurcher
:star: 957 | @dting | http://www.freecodecamp.com/dting
Mark Williams
@mw8020
Sep 03 2015 00:35
@HexORSist yeah I went through this yesterday with this bonfire - I reread all the docs and looked at various examples of it and it fell into place a bit more today.
Rich Churcher
@richchurcher
Sep 03 2015 00:35
functions within functions within functions... the good news is, when you understand you'll have one of the most fundamental parts of JS programming at your disposal
raykoff
@raykoff
Sep 03 2015 00:35
If anyone want to help me with bonfire check this: https://kobra.io/#/e/-JyFc8oxmII-tmIYozPu
CamperBot
@camperbot
Sep 03 2015 00:35
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
DTing
@dting
Sep 03 2015 00:35
until you try to understand how this works. then you are confused again
Rich Churcher
@richchurcher
Sep 03 2015 00:36
oh god this
don't scare poor @HexORSist
although, dependency injection... ;)
Mark Williams
@mw8020
Sep 03 2015 00:39
anyone recently familiar with bf arguments optional? Can't for the life of me pass the last test.
BabyKosh
Sep 03 2015 00:40
wow @richchurcher nz cool
Rich Churcher
@richchurcher
Sep 03 2015 00:41
:)
@mw8020 we've spent the last few minutes discussing that one, you'll find some examples if you scroll up
Mark Williams
@mw8020
Sep 03 2015 00:42
lol np
DTing
@dting
Sep 03 2015 00:43
@HexORSist @mw8020 http://repl.it/BFQG for the example above
Mark Williams
@mw8020
Sep 03 2015 00:44
@dting thanks
CamperBot
@camperbot
Sep 03 2015 00:44
mw8020 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 959 | @dting | http://www.freecodecamp.com/dting
BabyKosh
Sep 03 2015 00:47
can someone put the hints in the Bonfire: PAirwise wiki
I would but I'm killing brain cells on my pomodoro app
DTing
@dting
Sep 03 2015 00:49
bf pairwise
CamperBot
@camperbot
Sep 03 2015 00:49

function pairwise(arr, arg) {
return arg;
}

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

Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.

more info:  bf details | bf links | hint

Mark Williams
@mw8020
Sep 03 2015 00:49
@dting i just pooped some code here: http://repl.it/BFQJ - line 17-22 should do it I thought - but it won;t pass test 5: i.e. add(2)([3]))
gahhh popped not pooped
DTing
@dting
Sep 03 2015 00:51
look carefully at that test
it isnt calling your function with 2 arguments
its calling the return value of your function when called with 1 argument
it is basically doing this:
var temp = add(2);
temp([3]);
Mark Williams
@mw8020
Sep 03 2015 00:53
ok gears are slowly crunching along over here
@dting thanks man should be able to grind my thru from here
CamperBot
@camperbot
Sep 03 2015 00:55
mw8020 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
raykoff
@raykoff
Sep 03 2015 00:55
what was the method to add numbers in empty array?
CamperBot
@camperbot
Sep 03 2015 00:55
:warning: mw8020 already gave dting points
DTing
@dting
Sep 03 2015 00:58
.push?
Moisés Man
@moigithub
Sep 03 2015 01:09
.unshift
.concat
.splice
myArray[myArray.length] = value
Robert Richey
@0x0936
Sep 03 2015 01:27
myArray.push.apply(null, anotherArray)
DTing
@dting
Sep 03 2015 01:28
that wouldn't work
[].push.apply(myArray, anotherArray);
Robert Richey
@0x0936
Sep 03 2015 01:28
@dting ah yep, that's the syntax
thanks @dting
CamperBot
@camperbot
Sep 03 2015 01:29
0x0936 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 965 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 03 2015 01:29
nps. that stuff is confusing. =( but powerful.
BabyKosh
Sep 03 2015 01:33
I'm going way out here but does any one know how to write test in jasmine? I'm trying to build my pomo app with test...
having trouble trying to test the value of "timePast"
function CountTimer(timelength){
this.timelength = timelength;
this.running    = false;
}

CountTimer.prototype.start = function(length){
this.running    = true;
this.startDate  = Date.now();
this.duration   = length;
var self = this;

//define pulse
this.pulse = function(){
this.timePast = ((Date.now() - self.startDate)/self.startDate)*100;
};

pulse();
};
CountTimer.prototype.stop = function(){
this.running = false;
};
Tim P
@xTimpi
Sep 03 2015 01:36
Is it just me or is the express.js tutorial not really a tutorial but kind of a „here is what you should know how to do, now google it to learn it“ thing?
@SaintPeter
Sep 03 2015 01:36
@xTimpi You are correct. :D
@xTimpi Although they give you many of the pieces.
Tim P
@xTimpi
Sep 03 2015 01:37
@SaintPeter I’m working on the forms section of it, and even though I know how a website handles post request I am absolutely stumped on how to write the code for that lol
BabyKosh
Sep 03 2015 01:37

here is my spec file...

describe("Timer",function() {
var ourTimer;

beforeEach(function() {
ourTimer = new CountTimer;
});

it("should start running ", function() {
ourTimer.start();

expect(ourTimer.running).toEqual(true);

});
it("should stop running",function(){
ourTimer.stop();
expect(ourTimer.running).toEqual(false);
});
it ("should get the date and duration length",function(){
ourTimer.start(25);
var testDate = Date.now();

expect(ourTimer.startDate).toEqual(testDate);
expect(ourTimer.duration).toEqual(25);

});
it("should calculate percent of time past",function(){
ourTimer.start(25);

expect(ourTimer.pulse.timePast).toBeDefined();

});
//it should subtract time past from duration

});

describe("Timer",function() {
var ourTimer;

beforeEach(function() {
ourTimer = new CountTimer;
});

it("should start running ", function() {
ourTimer.start();

expect(ourTimer.running).toEqual(true);
});
it("should stop running",function(){
ourTimer.stop();
expect(ourTimer.running).toEqual(false);
});
it ("should get the date and duration length",function(){
ourTimer.start(25);
var testDate = Date.now();

expect(ourTimer.startDate).toEqual(testDate);
expect(ourTimer.duration).toEqual(25);
});
it("should calculate percent of time past",function(){
ourTimer.start(25);

expect(ourTimer.pulse.timePast).toBeDefined();
});
//it should subtract time past from duration

});
@SaintPeter
Sep 03 2015 01:37
@xTimpi I think the challenge of teaching much of the higher level material is that if you are assumed to already know Javascript, it's really just a matter of "RTFM".
@xTimpi Well, it's going to look something like route.post('/path', function(req, res) {
IIRC
Tim P
@xTimpi
Sep 03 2015 01:40
@SaintPeter yeah I got that from the hints, I still need to learn what middleware really is since I just kinda know whats going on with that
There is this sentence "To parse x-www-form-urlencoded request bodies Express.js can use urlencoded()
middleware from the body-parser module.“ and I just can’t even figure out what that is supposed to mean lol
Absalon Castañon Avila
@absalnC
Sep 03 2015 01:41
Hello everyone. I have a problem when I try to verify JSON me exercise on Expressworks. Can somebody help me?
@SaintPeter
Sep 03 2015 01:41
@xTimpi For the post one, all you need to do is get the posted data and do the reverse string thing on it. req.body.str
@absalnC sure
@absalnC Are you able to read the file into a variable?
Absalon Castañon Avila
@absalnC
Sep 03 2015 01:44
@SaintPeter Yes. When I run verify the outcome is the same but mine is splitted so it doesn't match the answer. I tried already with other people's anser and the same happens
@SaintPeter
Sep 03 2015 01:44
@absalnC "splitted"?
@absalnC You may need to output your format with JSON.stringify()
Absalon Castañon Avila
@absalnC
Sep 03 2015 01:47

@SaintPeter this is my code:var path = require('path');
var fs = require('fs');
var express = require('express');
var app = express();

app.get('/books', function (req, res) {
if (err) {
throw err;
}
object = JSON.parse(data);
res.send(object);
});
});

app.listen(process.argv[2]);

DTing
@dting
Sep 03 2015 01:48
res.send(object); should be res.json(object); i believe
@SaintPeter
Sep 03 2015 01:49
@absalnC I did res.end(JSON.stringify(object));
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 01:51
is there a way to array push index?
Absalon Castañon Avila
@absalnC
Sep 03 2015 01:51
@dting right, I didn't notice but it didn't work either
@SaintPeter Thanks, your solution worked, although I don't quite understand why :D
CamperBot
@camperbot
Sep 03 2015 01:52
absalnc sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 458 | @saintpeter | http://www.freecodecamp.com/saintpeter
Moisés Man
@moigithub
Sep 03 2015 01:52
it expect an string
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 01:52

for example:

array = ["hello", "meow", "pow"]
emptyArray = [];
array.push([0], emptyArray);

????

Moisés Man
@moigithub
Sep 03 2015 01:54
@YanKozlovskiy splice ?
@SaintPeter
Sep 03 2015 01:54
@absalnC I think they were looking specifically for formatted JSON output. The function JSON.stringify does that for you. It looks like they say you can also do res.json(object) which is in the instructions specifically.
Moisés Man
@moigithub
Sep 03 2015 01:54
@YanKozlovskiy after u pushed.. how array should looks like ?
@SaintPeter
Sep 03 2015 01:54
@absalnC "Respond with:
res.json(object)"
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 01:54
i would like to remove the first index of that array and move it into the empty array @moigithub
Moisés Man
@moigithub
Sep 03 2015 01:55
emptyArray= array.shift()
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 01:55
thanks @moigithub :)
CamperBot
@camperbot
Sep 03 2015 01:55
yankozlovskiy sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star: 289 | @moigithub | http://www.freecodecamp.com/moigithub
@SaintPeter
Sep 03 2015 01:55
@YanKozlovskiy newArr.push(arr.shift()); - pulls one value off arr and pushes it onto newArr;
Absalon Castañon Avila
@absalnC
Sep 03 2015 01:55
@SaintPeter I see now
DTing
@dting
Sep 03 2015 01:56
ya res.json should work
Mesonite00
@Mesonite00
Sep 03 2015 01:56
So...I feel silly asking this, but could someone tell me where the 'Go to my next challenge' button is located?
@SaintPeter
Sep 03 2015 01:56
@xTimpi Did you make any progress?
DTing
@dting
Sep 03 2015 01:56
@Mesonite00 the green button should be it
Mesonite00
@Mesonite00
Sep 03 2015 01:56
Oh...eh...it still said 'Run Code' Is that normal?
Richard-Frost
@Richard-Frost
Sep 03 2015 01:56
function myFunction() {
//Change the 0 to Math.random()
// Only change code below this line.

return 0;
Math.random()
// Only change code above this line.
}

// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
HI I'm kinda lost with this based off of what they were asking and showing me. Can someone tell me what I'm doing wrong. I assume everything. Thanks
CamperBot
@camperbot
Sep 03 2015 01:56
if you want to thank someone, put an @ before their name!
Mesonite00
@Mesonite00
Sep 03 2015 01:57
Even after I'd successfully tested my code the first time...
Absalon Castañon Avila
@absalnC
Sep 03 2015 01:57
@SaintPeter Any way, I feel those courses aren't deep enough. Do you know of any good tutorial online?
@SaintPeter
Sep 03 2015 01:58
@Richard-Frost Do you see the return 0? Change the 0 to Math.random()
Absalon Castañon Avila
@absalnC
Sep 03 2015 01:58
@SaintPeter (I mean node js and express js)
@dting It should, but it doesn't
@SaintPeter
Sep 03 2015 01:59
@absalnC They are not terribly deep, but there is not that much to learn. You can read the docs for express.js - they're suprisingly simple. One page, just breaking out the req/res params.
Richard-Frost
@Richard-Frost
Sep 03 2015 01:59
thank you @SaintPeter
\
CamperBot
@camperbot
Sep 03 2015 01:59
richard-frost sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 459 | @saintpeter | http://www.freecodecamp.com/saintpeter
DTing
@dting
Sep 03 2015 02:00
oic
hmm works for me. thats weird
Absalon Castañon Avila
@absalnC
Sep 03 2015 02:01
@dting thanks by the way
CamperBot
@camperbot
Sep 03 2015 02:01
absalnc sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 967 | @dting | http://www.freecodecamp.com/dting
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 02:05
can someone help me out here please?
function test(str) {
array = str.split(' ');
longestWord = array.shift[0];

for (i = 0; i <= array.length; i++) {
longestWord = array.shift([0]);

if (longestWord.length > array[0].length) {
longestWord = array.shift([0]);
}else {
return longestWord;
}
}
// console.log(array);
}

test('the longest word is palindrome');
where is my logic wrong?
@SaintPeter
Sep 03 2015 02:06
@YanKozlovskiy I thought you were supposed to return length of the longest word, not the word itself?
keith2237
@keith2237
Sep 03 2015 02:06
Anyone else think this is a silly way to run a help section? Can't find crap on the problem I am having because there is too much chaff.
Jose M Viloria
@josevill
Sep 03 2015 02:07
bf longest word
CamperBot
@camperbot
Sep 03 2015 02:07

## :fire:Bonfire: Find the Longest Word in a String :link:

function findLongestWord(str) {
return str.length;
}

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

Return the length of the longest word in the provided sentence.

more info:  bf details | bf links | hint

@SaintPeter
Sep 03 2015 02:07
@keith2237 Meh - it works well enough. They tried forums before, but the latency is too great.
Richard-Frost
@Richard-Frost
Sep 03 2015 02:07
ok I'm still not doing it correctly I guess. This is what I have now.
function myFunction() {
//Change the 0 to Math.random()
// Only change code below this line.
Math.random()
return "Math.random";

// Only change code above this line.
}

// We use this function to show you the value of your variable in your output box.
(function(){return myFunction();})();
@SaintPeter
Sep 03 2015 02:08
@keith2237 There are actually 3 other help rooms. /HelpBonfires, /HelpZiplines, and /HelpBasejumps
CamperBot
@camperbot
Sep 03 2015 02:08
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
@SaintPeter
Sep 03 2015 02:09
@Richard-Frost You have an extra Math.random() on a line by itself - remove that. And it's not a string, remove the double quotes.
keith2237
@keith2237
Sep 03 2015 02:10
Why is it every time I go back to a challenge I already completed my code is gone? Very frustrating.
Jose M Viloria
@josevill
Sep 03 2015 02:10
@Richard-Frost If you put Math.random within parenthesis it will return it as a String value. We want it to be executed as a function. Whenever you read something that ends in (). p.e: Math.random()
It is a function. So you have to use/return it as it is.
@SaintPeter @Richard-Frost Also, yes. You have an extra Math.random on the 4th line
Richard-Frost
@Richard-Frost
Sep 03 2015 02:11
ah I get it now! you rock! thank you @SaintPeter
CamperBot
@camperbot
Sep 03 2015 02:11
richard-frost sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: richard-frost already gave saintpeter points
Panda48
@Panda48
Sep 03 2015 02:15

CSS has a property called width that controls an element's width. Just like with fonts, we'll use px (pixels) to specify the image's width.

For example, if we wanted to create a CSS class called larger-image that gave HTML elements a width of 500 pixels, we'd use: <style> .larger-image { width: 500px; } </style>.

Create a class called smaller-image and use it to resize the image so that it's only 100 pixels wide.

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster, Monospace;
}

p {
font-size: 16px;
font-family: Monospace;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<img src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe,</p>

@SaintPeter
Sep 03 2015 02:18
@Panda48 "Create a class called smaller-image and use it to resize the image so that it's only 100 pixels wide."
That means you need to create a new class, similar to red-text, but with a width directive instead. Can you see where the definition for red-text is?
Panda48
@Panda48
Sep 03 2015 02:19
@SaintPeter When in the segment do I place it
@SaintPeter
Sep 03 2015 02:20
@Panda48 Between the <style> tags. That is wher classes are defined. You can see that because the other classes are defined there.
Panda48
@Panda48
Sep 03 2015 02:24
ok I am struggling with CSS
@SaintPeter
Sep 03 2015 02:25

@Panda48 I understand. IT can be challenging. There are two parts to CSS:
1) The declaration. This is up between the <style> tags near the top of the doc. Declaring a class looks like this:

.classname {
attribute1: value1;
}

The . before the classname says that it's a class. You could also use # for IDs.

@Panda48
2) To USE your class you need to add it to the class attribute of an HTML element. You can have one or more classes, seperated by spaces. For example:

<tag class="class1 class2 class3">Stuff</tag>

tag is imaginary, don't try to use it.

@Panda48 Does that help?
Panda48
@Panda48
Sep 03 2015 02:26
how can I post mu code like yours on the portins
@SaintPeter
Sep 03 2015 02:26
wiki format
CamperBot
@camperbot
Sep 03 2015 02:26

## :point_right: code formatting [wiki]

### Inline code

This an inline <paste code here> code formatting with a single backtick() at start and end around the code.

### Code Block

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

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

 ⇦ Type 3 backticks, then press [enter ⏎]

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

@SaintPeter
Sep 03 2015 02:27
@Panda48 Like so ^^
Panda48
@Panda48
Sep 03 2015 02:28

<style>
.red-text {color: red;}

img {width: 100px;}

h2 { font-family: Lobster, Monospace;}

p {font-size: 16px;font-family: Monospace;}

</style>

Sep 03 2015 02:29
guys! my bonfire map won't update!
Jose M Viloria
@josevill
Sep 03 2015 02:29
@Panda48 You gotta use 3 of those backticks :) instead of just one to paste code like that :)
@SaintPeter
Sep 03 2015 02:29
@Panda48 The instructions call for you to create a new class (that's one with a dot infront of it) and it needs to be called smaller-image
Sep 03 2015 02:29
I have done this one over a dozen times still shows up unchecked on the map :(
Jose M Viloria
@josevill
Sep 03 2015 02:29
Sep 03 2015 02:29
tired that too @josevill no avail :(
Jose M Viloria
@josevill
Sep 03 2015 02:29
@SaintPeter
Sep 03 2015 02:29
@Panda48 So, what you've done with img is correct in the sense that you've got width right, but wrong because it needs to be a class.
Jose M Viloria
@josevill
Sep 03 2015 02:30
Panda48
@Panda48
Sep 03 2015 02:30
  .red-text {color: red;}

img {width: 100px;}

h2 { font-family: Lobster, Monospace;}

p {font-size: 16px;font-family: Monospace;}

</style>
@SaintPeter
Sep 03 2015 02:30
Panda48
@Panda48
Sep 03 2015 02:30
yes
Sep 03 2015 02:30
it gets updated later like after an hour or so @josevill (
yeah I'm
and all the tests get passed with my code
im on find the largest number in array.
want me to paste my code here?
@SaintPeter
Sep 03 2015 02:31
@Panda48 Do you see what you would need to do to change img to smaller-image?
Panda48
@Panda48
Sep 03 2015 02:32

@SaintPeter <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {color: red;}

img {width: 100px;}

h2 { font-family: Lobster, Monospace;}

p {font-size: 16px;font-family: Monospace;}

</style>

<h2 class="red-text">CatPhotoApp</h2>

<img src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot.</p>

<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe,</p>

Sep 03 2015 02:32
@josevill
function largestOfFour(arr) {
return arr.map((n) => Math.max.apply(this, n) );
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Panda48
@Panda48
Sep 03 2015 02:32

<link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {color: red;}

img {width: 100px;}

h2 { font-family: Lobster, Monospace;}

p {font-size: 16px;font-family: Monospace;}

</style>

<h2 class="red-text">CatPhotoApp</h2>

<img src="https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot.</p>

<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe,</p>

Sep 03 2015 02:33
there is nothing wrong with my code. it gets passed. it's just not being saved on my map :(
bot how to write code
CamperBot
@camperbot
Sep 03 2015 02:33
no wiki entry for: how to write code
:pencil: click here to create one now!after creating your page type update to reload it here
Sep 03 2015 02:33
bot markup
CamperBot
@camperbot
Sep 03 2015 02:33
no wiki entry for: markup
:pencil: click here to create one now!after creating your page type update to reload it here
@SaintPeter
Sep 03 2015 02:34

@Panda48 With this code:

img {width: 100px;}

You are saying "All img should have a width of 100px". What you need to say instead is "All objects with a class of smaller-imageshould have a width of 100px"

Jose M Viloria
@josevill
Sep 03 2015 02:34
help formatting
Sep 03 2015 02:34
bloody hell
CamperBot
@camperbot
Sep 03 2015 02:34

## :point_right: code formatting [wiki]

### Inline code

This an inline <paste code here> code formatting with a single backtick() at start and end around the code.

### Code Block

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

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

 ⇦ Type 3 backticks, then press [enter ⏎]

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

Sep 03 2015 02:34
tx @josevill lol
CamperBot
@camperbot
Sep 03 2015 02:34
alifarhad sends brownie points to @josevill :sparkles: :thumbsup: :sparkles:
:star: 255 | @josevill | http://www.freecodecamp.com/josevill
Jose M Viloria
@josevill
Sep 03 2015 02:34
@alifarhad I've sent you a pm. Check it out
Panda48
@Panda48
Sep 03 2015 02:35

 <link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {color: red;}

.smaller-image {width: 100px;}

h2 { font-family: Lobster, Monospace;}

p {font-size: 16px;font-family: Monospace;}

</style> 

@SaintPeter
Sep 03 2015 02:36
@Panda48 Perfect. Now you need to add a class attribute with smaller-image in it to your actual img tag down in the HTML. Do you know how to do that?
Panda48
@Panda48
Sep 03 2015 02:37
@SaintPeter Let me see If can
@SaintPeter Well no
@SaintPeter
Sep 03 2015 02:38
@Panda48 Show me just your img tag line :D
Panda48
@Panda48
Sep 03 2015 02:39
<img src="https://bit.ly/fcc-relaxing-cat">
@SaintPeter
Sep 03 2015 02:40
@Panda48 Ok, so you can see that an img tag already has a src attribute. You need to add a class attribute. Look at the p tag just below the img tag for what that looks like.
Panda48
@Panda48
Sep 03 2015 02:42
@SaintPeter

<style>
.red-text {color: red;}

.smaller-image {width: 100px;}

h2 { font-family: Lobster, Monospace;}

p {font-size: 16px;font-family: Monospace;}

</style>

<h2 class="red-text">CatPhotoApp</h2>

<img class="smaller-image"https://bit.ly/fcc-relaxing-cat">

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot.</p>
<p class="red-text">Purr jump eat the grass rip the couch scratched sunbathe,</p>

its passed but the image is gone???
@SaintPeter
Sep 03 2015 02:43
@Panda48 Very close - you have the smaller-image class perfect, but it looks like you accientially chopped off the src=" just before the URL.
@Panda48 Like so:
<img class="smaller-image" src="https://bit.ly/fcc-relaxing-cat">
Bruce Young
@mutantspore
Sep 03 2015 02:44
@keith2237 Just scrolling back through all teh help stuff :) Your Bonfire challenges are kept on your profile page. (if that’s what you were asking about?)
CamperBot
@camperbot
Sep 03 2015 02:44
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Panda48
@Panda48
Sep 03 2015 02:46
@SaintPeter Ok I now understand and see where I was making issues. I have to do two parts
@SaintPeter
Sep 03 2015 02:47
@Panda48 Cool - any more questions?
Sep 03 2015 02:50
you are a great helper @SaintPeter
SaintPeter @SaintPeter bows
Panda48
@Panda48
Sep 03 2015 02:56
@SaintPeter Yes
Almost have this one but messing the szing up
@SaintPeter
Sep 03 2015 02:56
@Panda48 I stand ready to assist you :D
Panda48
@Panda48
Sep 03 2015 02:56

.red-text {color: red;}
h2 {font-family: Lobster, Monospace;}
p {font-size: 16px;font-family: Monospace;}
.smaller-image {width: 100px;}
.thick-green-border {border-color: green; border-width: 10px; border-style: solid;}

</style>
<img class="thick-green-border"class="smaller-image" src="https://bit.ly/fcc-relaxing-cat">
@SaintPeter
Sep 03 2015 02:58
@Panda48 Ahh - you can only have one class attribute per tag. HOWEVER, you may have multiple classes per class attribute by seperating them with spaces, like this:
<tag class="class1 class2 class3">
Joseph Miller
@joemillervi
Sep 03 2015 03:03
Hey guys any thoughts about having less of the this keyword? My code is as follows and it seems excessive.
var Person = function(firstAndLast) {
this.firstAndLast = firstAndLast;

this.getFirstName = function() {
this.arrFirstAndLast = this.firstAndLast.split(' ');
console.log(arrFirstAndLast[0]);
return this.arrFirstAndLast[0];
}

this.getLastName = function() {
this.arrFirstAndLast = this.firstAndLast.split(' ');
console.log(this.arrFirstAndLast[1]);
return this.arrFirstAndLast[1];
}

this.getFullName = function() {
console.log(this.firstAndLast);
return this.firstAndLast;
}

this.setFirstName = function(newFirstName){
this.arrFirstAndLast = this.firstAndLast.split(' ');
this.arrNewFirstName = newFirstName.split();
this.arrFirstAndLast.splice(0, 1, this.arrNewFirstName[0]);
this.firstAndLast = this.arrFirstAndLast.join(' ');
}

this.setLastName = function(newLastName) {
this.arrFirstAndLast = this.firstAndLast.split(' ');
this.arrNewLastName = newLastName.split();
this.arrNewLastName.unshift(this.arrFirstAndLast[0]);
this.firstAndLast = this.arrNewLastName.join(' ');
}

this.setFullName = function(newFullName) {
this.firstAndLast = newFullName;
}
};

var bob = new Person('Bob Ross');
Sep 03 2015 03:03
@jobo440 did you just hit this jackpot or what xD
Panda48
@Panda48
Sep 03 2015 03:04
@SaintPeter WHat do you mean? more then one class attributes
Joseph Miller
@joemillervi
Sep 03 2015 03:05
lol I didnt want to leave the scope of a constructed instance so i was this'n it up
Sep 03 2015 03:05
@Panda48 he means, an html element can have more than one classes
<h1 class="color-red animate" > look more than 1 class </h1>
@SaintPeter
Sep 03 2015 03:05

<img class="thick-green-border" class="smaller-image" src="https://bit.ly/fcc-relaxing-cat">

You have one class="thick-green-border" and one class="smaller-image" - you can only have one class=, but it can have multiple classes in it, seperated by spaces.

Sep 03 2015 03:06
im sure there's less thissy solution somewhere around here @jobo440 but if it gets the job done, why not stick with ti xD
Panda48
@Panda48
Sep 03 2015 03:07
@SaintPeter That's the same code I had? it make image full default size and add thick boarder
@SaintPeter
Sep 03 2015 03:07
@jobo440 Ok, couple of things:
1) You can't have any public variables (IE: this.whatever). That's part of the test. Instead define locals like var first and var last
2) You can "build" the full name by concatanating first and last
gouthambeesetty
@gouthambeesetty
Sep 03 2015 03:08
This message was deleted
@SaintPeter
Sep 03 2015 03:08

@Panda48 This code:

<img class="thick-green-border" class="smaller-image"

is wrong. It needs to look like this:

<img class="thick-green-border smaller-image"
Panda48
@Panda48
Sep 03 2015 03:09
oh ok so remove the second class
Joseph Miller
@joemillervi
Sep 03 2015 03:09
@SaintPeter oh yah i forgot about the + operator for strings Lolol
Panda48
@Panda48
Sep 03 2015 03:10
@SaintPeter yess!!!!!!!
@SaintPeter
Sep 03 2015 03:10
@Panda48 :D :D :dancers:
Panda48
@Panda48
Sep 03 2015 03:11
@SaintPeter I wasn't removing the " " from the segment
Joseph Miller
@joemillervi
Sep 03 2015 03:12
@SaintPeter ok so if i define a variable in my constructor function (using var =) it will stay local to the instances it creates?
@SaintPeter
Sep 03 2015 03:12
@jobo440 Local to the functions also defined within that class, yes.
Joseph Miller
@joemillervi
Sep 03 2015 03:13
@SaintPeter so then (when creating a constructor function) i would only have to use 'this' when assigning a local variable to an argument?
@SaintPeter
Sep 03 2015 03:14
@jobo440 You would only use this when creating the functions. The local/private variables can be used without any special reference.
Joseph Miller
@joemillervi
Sep 03 2015 03:18
@SaintPeter thanks i'm doing some reading
CamperBot
@camperbot
Sep 03 2015 03:18
jobo440 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 462 | @saintpeter | http://www.freecodecamp.com/saintpeter
Panda48
@Panda48
Sep 03 2015 03:22
@SaintPeter ugh stuck again
@SaintPeter
Sep 03 2015 03:22
@Panda48 Stuck! Trapped! This accursed code!
@Panda48 Lay it on me :D
Panda48
@Panda48
Sep 03 2015 03:23
Waypoint: Link to External Pages with Anchor Elements
am I suppose to write this in my <p> ?
@SaintPeter
Sep 03 2015 03:23
@Panda48 Anchor elements are <a>
Panda48
@Panda48
Sep 03 2015 03:24
@SaintPeter Create an a element that links to http://freecatphotoapp.com and has "cat photos" as its anchor text.
@SaintPeter
Sep 03 2015 03:24
@Panda48 I think you need to put it in between the <p> tags?
@Panda48 Can you see what an anchor element is supposed to look like, from the instructions? It has an href attribute.
Panda48
@Panda48
Sep 03 2015 03:25
href="
@SaintPeter
Sep 03 2015 03:26
@Panda48 Right - they give you an example in the instructions. Pull that out, just the anchor tag.
Panda48
@Panda48
Sep 03 2015 03:27
Create an a element that links to http://freecatphotoapp.com and has "cat photos" as its anchor text.
@SaintPeter
Sep 03 2015 03:27
@Panda48 Read down to the bottom. It says "Here's an example".
Panda48
@Panda48
Sep 03 2015 03:28
<p class="red-text"> Kitty ipsum dolor sit amet, <a href= "http://freecatphotoapp.com"> cat photo </a> shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
@SaintPeter
Sep 03 2015 03:29
@Panda48 Can you tell what part of that code is the start and end of the anchor tag?
Panda48
@Panda48
Sep 03 2015 03:29
<a href= "http://freecatphotoapp.com"> cat photo </a>
DTing
@dting
Sep 03 2015 03:30
@Panda48 use www
@SaintPeter
Sep 03 2015 03:30
@Panda48 That's exactly right.
DTing
@dting
Sep 03 2015 03:30
oops
wrong waypoint
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 03:31
what is the syntax for not greater than or equal to?
@SaintPeter
Sep 03 2015 03:31
@YanKozlovskiy a < b
Panda48
@Panda48
Sep 03 2015 03:32
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 03:32
is there one using the ! symbol?
@SaintPeter
Sep 03 2015 03:32
@Panda48 What you shared looked correct to me.
@YanKozlovskiy You could also say: !(a >= b) - but that's silly. The "opposite" of >= is < - that's maths.
Yan Kozlovskiy
@YanKozlovskiy
Sep 03 2015 03:33
lol i wanted to write it like out like you'd say it in english
thanks @SaintPeter
CamperBot
@camperbot
Sep 03 2015 03:33
yankozlovskiy sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 463 | @saintpeter | http://www.freecodecamp.com/saintpeter
Panda48
@Panda48
Sep 03 2015 03:33
@SaintPeter the issue is only 2 of the 3 are turning green.
Your a element should have the anchor text of "cat photos"
is the element not lauching correctly with my code
@SaintPeter
Sep 03 2015 03:34
@Panda48 <a href= "http://freecatphotoapp.com"> cat photo </a> You're missing an s
@Panda48 Also, you may need to remove the spaces before and after.
Panda48
@Panda48
Sep 03 2015 03:34
I got it
forgot the s at the end of Photo
passed
@SaintPeter
Sep 03 2015 03:36
Yay
Matt Greenwood
@mjgwood
Sep 03 2015 03:37
Hi all, anyone willing to help me out with the Exact Change bonfire? I've got it mostly working but my code is a little buggy.
@SaintPeter
Sep 03 2015 03:37
@mjgwood Sure, happy to help. Do you know how to post your code?
Matt Greenwood
@mjgwood
Sep 03 2015 03:38
@SaintPeter Can I post it through codepen? Seems a bit long to post here.
@SaintPeter
Sep 03 2015 03:38
@mjgwood Whatever makes you happy :D
Matt Greenwood
@mjgwood
Sep 03 2015 03:39
@SaintPeter Cool. Here it is: http://codepen.io/anon/pen/bVNdzB?editors=001 What I've noticed is that it exits the while loop early for some reason even though the conditions are met, and that is messing up the final array.
@SaintPeter
Sep 03 2015 03:40
@mjgwood oi. ok, gotta get my code goggles on.
Matt Greenwood
@mjgwood
Sep 03 2015 03:40
Haha cheers!
@SaintPeter
Sep 03 2015 03:41
@mjgwood BTW, you could build your CID object with a loop. That may be what is breaking, since some of the drawers have multiple instances of the same denomination.
@mjgwood You are forevermore banned from useing o as a loop variable.
D
@bergsman00
Sep 03 2015 03:43
Hi there all. I'm trying to add a background color to a div element. And, I can't seem to get it right. I've created the background color of gray. But, it's not working as I would expect....Any help? <div>
class='gray-background'p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
</div>
@SaintPeter
Sep 03 2015 03:43
@bergsman00 Where is your class definition for gray-background
Matt Greenwood
@mjgwood
Sep 03 2015 03:43
@SaintPeter I thought it would be alright since it only has to draw the info from the cid argument once. And yeah I'll probably change the var o haha
D
@bergsman00
Sep 03 2015 03:44
@SaintPeter its up in the style element. Like sogray-background {
background-color: gray;
}
@SaintPeter
Sep 03 2015 03:44
@bergsman00 To make it a class, prepend a .: .gray-background
D
@bergsman00
Sep 03 2015 03:45
.gray-background{background-color:gray;} sorry....typo. Yes, like this
@SaintPeter
Sep 03 2015 03:45
@mjgwood ok, your code looks correct to me. It may just be the tests with the duplicate denominations. Let me poke a bit more

@bergsman00

<div>
class='gray-background'

class needs to be inside the div tag:

<div class='gray-background'>
Matt Greenwood
@mjgwood
Sep 03 2015 03:48
@SaintPeter Yeah it works for the simple tests e.g. [["QUARTER", 0.50]], but it is having trouble adding different values together.
D
@bergsman00
Sep 03 2015 03:48
@SaintPeter Thank you. But, I've tried that. And, it still isn't working. When I run the code I just see it as text above the intended target of the div element...
CamperBot
@camperbot
Sep 03 2015 03:48
bergsman00 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 464 | @saintpeter | http://www.freecodecamp.com/saintpeter
@SaintPeter
Sep 03 2015 03:49
@mjgwood I see only one test failing. You've got one more response than you expect for it.
@bergsman00 Which specific waypoint is it?
Panda48
@Panda48
Sep 03 2015 03:50
@SaintPeter Nest an Achor I am somewhat mixed up
D
@bergsman00
Sep 03 2015 03:51
@SaintPeter 37
DTing
@dting
Sep 03 2015 03:51
@bergsman00 post your entire code here. use the formatting
help formatting
CamperBot
@camperbot
Sep 03 2015 03:51

## :point_right: code formatting [wiki]

### Inline code

This an inline <paste code here> code formatting with a single backtick() at start and end around the code.

### Code Block

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

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

 ⇦ Type 3 backticks, then press [enter ⏎]

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

DTing
@dting
Sep 03 2015 03:51
@Panda48 whats your code look like so far?
@SaintPeter
Sep 03 2015 03:52
I'll leave you in the capable hands of @dting - it's story time for my kid.
D
@bergsman00
Sep 03 2015 03:52
Thank you so much @SaintPeter . Appreciate it.
CamperBot
@camperbot
Sep 03 2015 03:52
bergsman00 sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:warning: bergsman00 already gave saintpeter points
Matt Greenwood
@mjgwood
Sep 03 2015 03:53
@SaintPeter Yes and the amount returned in the array is not equal to the change expected. I'll mull over it a bit longer and hopefully I'll see what's breaking, but thanks for your help.
CamperBot
@camperbot
Sep 03 2015 03:53
mjgwood sends brownie points to @saintpeter :sparkles: :thumbsup: :sparkles:
:star: 465 | @saintpeter | http://www.freecodecamp.com/saintpeter
Panda48
@Panda48
Sep 03 2015 03:53
@dting I figured it out! thanks
@SaintPeter
Sep 03 2015 03:53
@mjgwood They give you the expected array - I suggest you compare it with what you're actually generating
Matt Greenwood
@mjgwood
Sep 03 2015 03:55
@SaintPeter Yeah my array is not the same. It's jumping out the while loop early for some reason, so I'm getting ['TWENTY', 40.00] instead of ['TWENTY', 60.00]. I'll try see what's causing that, but the conditions in the while loop are being met... :/
@SaintPeter
Sep 03 2015 03:55
@mjgwood One possibility is that you have rounding errors. Try adding some console.log statements to your loops?
Randy Goldsmith
@Dueldrawer8
Sep 03 2015 03:55
function LongestWord(sen) {

// code goes here
//sen = i love dogs
var word = sen.split(' ');
var longestlength = 0;
for(var i = 0; i < word.length; i++) {
if(word[i].length > longestlength){
longestlength = word[i].length;
}
}

return word[i];
D
@bergsman00
Sep 03 2015 03:55
@dting forgive me. But, I don't understand...Are you asking me to post the code in this format or through another avenue?
DTing
@dting
Sep 03 2015 03:55
ya just post it here
Randy Goldsmith
@Dueldrawer8
Sep 03 2015 03:55
does anyone know how to return the actual word rather than the length in the word?
D
@bergsman00
Sep 03 2015 03:56
<div>
class='gray-background>
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>
Randy Goldsmith
@Dueldrawer8
Sep 03 2015 03:56
tryng to return the longest word rather than the length of the word
@SaintPeter
Sep 03 2015 03:56
@Dueldrawer8 You already have the length - it's stored in longestlength
DTing
@dting
Sep 03 2015 03:56
@Dueldrawer8 you would just track the longest word instead of longest
Randy Goldsmith
@Dueldrawer8
Sep 03 2015 03:56
when i return longestword
it gives me the length of that word
Matt Greenwood
@mjgwood
Sep 03 2015 03:56
@SaintPeter I've been over the code with the debugger using break points and the conditions are definitely met. However, I do know it isn't rounding properly anyway. I guess I'll sort that out first and then go back to the loop issue.
Randy Goldsmith
@Dueldrawer8
Sep 03 2015 03:57
rather than the actual word
DTing
@dting
Sep 03 2015 03:57
  var word = sen.split(' ');
var longest = '';
for(var i = 0; i < word.length; i++) {
if(word[i].length > longest.length){
longest = word[i];
}
}
return longest
gouthambeesetty
@gouthambeesetty
Sep 03 2015 03:57
@Panda48 Yes Sir. I figured it out. thanks for checking
CamperBot
@camperbot
Sep 03 2015 03:57
gouthambeesetty sends brownie points to @panda48 :sparkles: :thumbsup: :sparkles:
:star: 25 | @panda48 | http://www.freecodecamp.com/panda48
DTing
@dting
Sep 03 2015 03:58
@bergsman00 @SaintPeter is right:
<div class="gray-background">
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>
make sure you include that ending quote
you were missing a quote also
Randy Goldsmith
@Dueldrawer8
Sep 03 2015 03:58
@dting what does the var longest hold? the actual word in the string?
DTing
@dting
Sep 03 2015 03:58
@Dueldrawer8 it holds the longest string in the array that you split from sen
D
@bergsman00
Sep 03 2015 03:58
@dting OK. I'll take another look. Thanks!
CamperBot
@camperbot
Sep 03 2015 03:58
bergsman00 sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
DTing
@dting
Sep 03 2015 03:58
ya
CamperBot
@camperbot
Sep 03 2015 03:58
:star: 970 | @dting | http://www.freecodecamp.com/dting
Matt Greenwood
@mjgwood
Sep 03 2015 03:59
@Dueldrawer8 What is it set to?
Jae
@jaestaar
Sep 03 2015 03:59
I'm on the factorialize a number. did anyone use the math.factorial() ?
D
@bergsman00
Sep 03 2015 03:59
@dting one more thing...how are you posting the above format through this chatroom...Is that the initial link that sent me above??
DTing
@dting
Sep 03 2015 04:00
help formatting
CamperBot
@camperbot
Sep 03 2015 04:00

## :point_right: code formatting [wiki]

### Inline code

This an inline <paste code here> code formatting with a single backtick() at start and end around the code.

### Code Block

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

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

 ⇦ Type 3 backticks, then press [enter ⏎]

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

DTing
@dting
Sep 03 2015 04:01
@jaestaar Math.factorial isn't a function
gouthambeesetty
@gouthambeesetty
Sep 03 2015 04:04

what is the correct way of going about creating a smaller image class in CSS? I seem to have to wrong. <img
.smaller-image {width: 100px;}
src="https://bit.ly/fcc-relaxing-cat"

DTing
@dting
Sep 03 2015 04:05
@gouthambeesetty you need to put that .smaller-image {width: 100px;} in the style tag
Matt Greenwood
@mjgwood
Sep 03 2015 04:05
@jaestaar You can do that bonfire with just a loop.
DTing
@dting
Sep 03 2015 04:05
and use class="smaller-image" inside the element you want to have the styling
gouthambeesetty
@gouthambeesetty
Sep 03 2015 04:12
@dting let me try that out
Jae
@jaestaar
Sep 03 2015 04:18
@dting @mjgwood thank you. I got confused.
CamperBot
@camperbot
Sep 03 2015 04:18
jaestaar sends brownie points to @dting and @mjgwood :sparkles: :thumbsup: :sparkles:
:star: 256 | @mjgwood | http://www.freecodecamp.com/mjgwood
:star: 971 | @dting | http://www.freecodecamp.com/dting
Panda48
@Panda48
Sep 03 2015 04:24
stuck
Waypoint: Create a Form Element

<h2 class="red-text">CatPhotoApp</h2>

<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat"></a>

<p>Things cats love:</p>

<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>

<p>Top 3 things cats hate:</p>

<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>

<input type="text" placeholder="cat photo URL">

<form action="sumbit-cat-photo" "form"></form>

DTing
@dting
Sep 03 2015 04:25
@Panda48
help formatting
CamperBot
@camperbot
Sep 03 2015 04:25

## :point_right: code formatting [wiki]

### Inline code

This an inline <paste code here> code formatting with a single backtick() at start and end around the code.

### Code Block

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

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

 ⇦ Type 3 backticks, then press [enter ⏎]

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

Matt Greenwood
@mjgwood
Sep 03 2015 04:26
@Panda48 Your input needs to be in the form.
DTing
@dting
Sep 03 2015 04:27
your "action" should be "/submit-cat-photo" you are missing a /
Panda48
@Panda48
Sep 03 2015 04:27
<form action="sumbit-cat-photo">/submit-cat-photo</form>
DTing
@dting
Sep 03 2015 04:27
your form should be surrounding your <input type="text" placeholder="cat photo URL">
the opening tag before the closing tag after that element
Panda48
@Panda48
Sep 03 2015 04:29
<form action="submit-cat-photo">/submit-cat-photo</form>
cant get the final item to green out
Nest your text input element within a form element.
Matt Greenwood
@mjgwood
Sep 03 2015 04:30
@Panda48 Like dting said, your <input type="text" placeholder="cat photo URL"> needs to be between your form tags.
Panda48
@Panda48
Sep 03 2015 04:31
figured it out
<form action="/submit-cat-photo"><input type="text" placeholder="cat photo URL"></form>
DTing
@dting
Sep 03 2015 04:43
nice work
Ashraful Islam
@iashraful
Sep 03 2015 04:51
hello!
Matt Greenwood
@mjgwood
Sep 03 2015 04:52
@iashraful Hello!
DTing
@dting
Sep 03 2015 04:52
hi
Ashraful Islam
@iashraful
Sep 03 2015 04:52
@mjgwood @dting morning! :D
I can't figure out good visual designs, I think I am not good at this development business :(
people in dribbble make soooo beautiful interfaces, when I'm making things, end result is some sort of "oh its working but not very appealing" :(
Jerry Robles
@jerryrobles
Sep 03 2015 04:59
I thought I knew how but it doesn't seem to be loading, wondering if it's me or something with twitch
Ashraful Islam
@iashraful
Sep 03 2015 04:59
Jerry Robles
@jerryrobles
Sep 03 2015 05:00
I have a two column page, the right main page should load by default FCC's twitch channel page
<div id="main" class="container col-lg-10">
<iframe src="https://twitch.tv/freecodecamp" height=1000 width=100%>
</iframe>
</div>
Matt Greenwood
@mjgwood
Sep 03 2015 05:01
@iashraful If you're just starting out then you've got plenty of time to improve. At the beginning of this year I couldn't do 0.1% of what I can do now.
Ashraful Islam
@iashraful
Sep 03 2015 05:03
@jerryrobles iframes are evil :(
shawnparrotte
@shawnparrotte
Sep 03 2015 05:03
Hey everyone! Hope you all are doing well. I'm having a hard time with the mutation bonfire... does anyone think they could help?
Ashraful Islam
@iashraful
Sep 03 2015 05:03
@mjgwood thanks! I mean I can write some patch together code that gets the work done, but my frontend design talent = -infinit
CamperBot
@camperbot
Sep 03 2015 05:03
iashraful sends brownie points to @mjgwood :sparkles: :thumbsup: :sparkles:
:star: 257 | @mjgwood | http://www.freecodecamp.com/mjgwood
Jerry Robles
@jerryrobles
Sep 03 2015 05:03
@iashraful so I have found out, if you have an alternative method, I'd be happy to give it a go :)
Ashraful Islam
@iashraful
Sep 03 2015 05:04
@shawnparrotte what problem?
@jerryrobles what are you trying to do, I'm not clear of your intentions
Jerry Robles
@jerryrobles
Sep 03 2015 05:05
@iashraful I am doing the twitch zipline right now, and my design is a sidebar on the left and a main page on the right that will display any target link that I click. When I go to a twitch channel, I want it to display in the column on the right
shawnparrotte
@shawnparrotte
Sep 03 2015 05:06
hey @iashraful, here's what I'm working with now. For some reason the first case - the one shown - doesn't work... but all the rest do. I think it has to do with my slice method, but I'm not really sure.
function mutation(arr) {

var lowerCaseZero = arr[0].toLowerCase();
var lowerCaseOne = arr[1].toLowerCase();

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

var test = lowerCaseOne.slice(i, i+1);

if (lowerCaseZero.indexOf(test) === -1) {

return false;

} else {

return true;
}

}

}

mutation(['hello', 'hey']);
Jerry Robles
@jerryrobles
Sep 03 2015 05:06
I've gotten it to work with other websites, but can't seem to do it with any twitch channels
shawnparrotte
@shawnparrotte
Sep 03 2015 05:07
I don't know if I should hammer away with this strategy or come up with something else...
Jerry Robles
@jerryrobles
Sep 03 2015 05:07
@iashraful here's a mockup with w3schools as the test page
DTing
@dting
Sep 03 2015 05:08
@shawnparrotte the code inside your for statement makes it return in the first iteration
@shawnparrotte it ALWAYS returns eitehr true or false
Ashraful Islam
@iashraful
Sep 03 2015 05:08
@shawnparrotte remove that else
shawnparrotte
@shawnparrotte
Sep 03 2015 05:08
oy!
Ashraful Islam
@iashraful
Sep 03 2015 05:08
should solve it
DTing
@dting
Sep 03 2015 05:08
you need to move the return true to after the for statement
shawnparrotte
@shawnparrotte
Sep 03 2015 05:08
@dting you're so right!
Ashraful Islam
@iashraful
Sep 03 2015 05:09
also never return inside a loop :D
shawnparrotte
@shawnparrotte
Sep 03 2015 05:09
@iashraful noted!
Ashraful Islam
@iashraful
Sep 03 2015 05:10
@dting I think removing that else and returning true outside the loop will solve it
that if there is perfect :D it'll exit if finds any char not in test-string
@jerryrobles I click the links on left, it just fires me off to another tab
:(
shawnparrotte
@shawnparrotte
Sep 03 2015 05:13
@iashraful you got it! Thanks. I forget sometimes that the returns can be in different places.
CamperBot
@camperbot
Sep 03 2015 05:13
shawnparrotte sends brownie points to @iashraful :sparkles: :thumbsup: :sparkles:
:star: 338 | @iashraful | http://www.freecodecamp.com/iashraful
Ashraful Islam
@iashraful
Sep 03 2015 05:13
@shawnparrotte actually @dting owns your thankies
am just bluffing
shawnparrotte
@shawnparrotte
Sep 03 2015 05:14
@dting Thanks buddy!
CamperBot
@camperbot
Sep 03 2015 05:14
shawnparrotte sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 976 | @dting | http://www.freecodecamp.com/dting
Ashraful Islam
@iashraful
Sep 03 2015 05:16
@jerryrobles here is what codepen whispers to me
Jerry Robles
@jerryrobles
Sep 03 2015 05:17
@iashraful hmmmm, not sure what that means
Ashraful Islam
@iashraful
Sep 03 2015 05:18
that means you can't just pull up twitch.tv website into frames
not legally allowed
also corrections <iframe name="evilFrame" src="..." height="yy" width="xx"></iframe> note that name="evilFrame"
you need to use that name in anchor like this to load anything into particular iframe like this <a href="..." target="evilFrame">Blah!</a>
DTing
@dting
Sep 03 2015 05:20
@shawnparrotte nps
Jerry Robles
@jerryrobles
Sep 03 2015 05:21
@iashraful ok, so it's something with twitch and not me, ok back to the drawing board
thanks @iashraful
CamperBot
@camperbot
Sep 03 2015 05:21
jerryrobles sends brownie points to @iashraful :sparkles: :thumbsup: :sparkles:
:star: 339 | @iashraful | http://www.freecodecamp.com/iashraful
Noah holley
@noahholley
Sep 03 2015 05:21
goodnight fellow campers!
thanks again for your help @dting !
CamperBot
@camperbot
Sep 03 2015 05:21
noahholley sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 978 | @dting | http://www.freecodecamp.com/dting
DTing
@dting
Sep 03 2015 05:22
@noahholley nps have a good one
Ashraful Islam
@iashraful
Sep 03 2015 05:24
@dting am trying to make an alias in c9, made it like this alias mg="echo 'mongod --bind_ip=$IP --dbpath=~/workspace/bj/data --nojournal --rest "$@"' > mongod && chmod a+x mongod && ./mongod"
however, on running mg, I'm getting this ERROR: dbpath (~/workspace/bj/data) does not exist.
how do I define an absolute path?
DTing
@dting
Sep 03 2015 05:25
does that path exist?
Ashraful Islam
@iashraful
Sep 03 2015 05:26
yes, exactly where it's pointing to
if I type in cd ~/workspace/bj/data
am dropped there, so it does exist
I think I should replace that ~ with /home/ubuntu/ perhaps
DTing
@dting
Sep 03 2015 05:29
that looks right
Ashraful Islam
@iashraful
Sep 03 2015 05:31
@dting ok, using /home/ubuntu/ works now, but can't access the running server
node is serving on port 3000
but c9 browser says can't find stuff and no app running
I went here localhost:3000/
DTing
@dting
Sep 03 2015 05:37
hmm i forget if there is something weird about c9
i think you have to go to a special url

did you try this?

. Now you can open the internal Cloud9 browser. To launch the browser select Preview in the toolbar then select the dropdown option Preview Running Application.

Ashraful Islam
@iashraful
Sep 03 2015 05:37
yes, I initially clicked [Preview]->Preview Running App
but that tells me no app running
then manually entered localhost:3000, still no luck
yay!
its working now, changing port to 8080 solved it, browser loads the app but c9 still says no app running
:D
DTing
@dting
Sep 03 2015 05:43
lol
Ashraful Islam
@iashraful
Sep 03 2015 05:43
now let me try changing port to 80
meh, killed it
ok 8080 it is
oh dang! I don't have a CC
let's see if heroku loves me enough to add the free mongolab addon
:(
Jami Schwarzwalder
@jschwarzwalder
Sep 03 2015 06:00
What is pair programing
DTing
@dting
Sep 03 2015 06:02
wiki pair programming
CamperBot
@camperbot
Sep 03 2015 06:02

## :point_right: pair programming and why it is special [wiki]

Pair Programming is an Agile Development practice that was born out of the Extreme Programming movement.

Working as a team of [exactly] two, at a single computer, the pair will slide the keyboard and mouse back-and-forth throughout a "pairing session". This increases the code quality by providing a "greater than the sum of its parts" effect of two developers working on a single problem domain.

The increase in quality of the code, combined with the effect of knowledge and understanding on the project being spread across multiple developers, can produce a large savings in cost on the project as a whole.

In a Test Driven Development (TDD) shop, it is most common for each member of the pair to take turns a) writing a test and b) writing code to pass the test. This "ping pong" yields a cumulative effect on the overall quality of the final product.

To be most effective it is important that pairs are intermixed; not the same couple of developers always working together.

Pair programming is considered to be very "social". It can be akin to a marriage because you learn to cooperate with a peer in a close, give-and-take relationship. As such it is often very difficult to become comfortable with pair programming. Some developers simply NEVER feel quite at-home. In the end, the willingness to share, be a bit vulnerable and work cooperatively toward a better product will make you a far better developer (and a better person overall).

Justin Crawford
@JCrawford1122
Sep 03 2015 06:27
Wow. I just spent way to long trying to get my collapsed navbar menu to work and it was so obvious!
DTing
@dting
Sep 03 2015 06:28
haha doh
Jami Schwarzwalder
@jschwarzwalder
Sep 03 2015 06:40
how does Object.keys() work?
DTing
@dting
Sep 03 2015 06:41
it returns an array of keys for an object you call the function with
"own properties" keys
Santhosh Devaraj
@santhoshdevaraj
Sep 03 2015 06:59
@Eiseldora returns an array of the object properties
just the keys not val
Rashid Thompson
@RashidT
Sep 03 2015 07:49
hello guys. If anybody can help me on this issue with this waypoint, I'll gladly appreciate it. I having issues with the waypoint : Give your Javascript Slot Machine some stylish images. I seem to get this error : Use the provided code three times. One for each slot. This is what I have , is there something missing from the code that needs to be there in order for the code to be successful, thanks in advance. 'code'
$($('.slot'))[0].html('<img src = "' + images[slotOne-1] + '">');
$($('.slot'))1.html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot'))[2].html('<img src = "' + images[slotThree-1] + '">');
$($('.slot'))1.html('<img src = "' + images[slotOne-1] + '">');
$($('.slot'))[2].html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot'))[0].html('<img src = "' + images[slotThree-1] + '">');
$($('.slot'))[2].html('<img src = "' + images[slotOne-1] + '">');
$($('.slot'))[0].html('<img src = "' + images[slotTwo-1] + '">');
$($('.slot'))1.html('<img src = "' + images[slotThree-1] + '">');
Jepz
@Jepz
Sep 03 2015 07:54
Zipline: Show the Local Weather - I'm just starting of with it and trying to get weather info from different API's. At the moment I'm using jQuery get function to get data from external sources. What isn't working for me is to store the data (like var temp = response.main.temp) and return it. Any suggestion what I should use instead? Read on stackoverflow that get might not be the best solution...
Yusef Habib
@yhabib
Sep 03 2015 07:56
@RashidT I think you have wrong some parenthesis : It should be like this $($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
@RashidT look to my last message, I think that is your problem
Ashraful Islam
@iashraful
Sep 03 2015 07:59
@yhabib hello!
Rashid Thompson
@RashidT
Sep 03 2015 08:01
@yhabib Sorry, I don't know how those brackets went missing . They are present in my code but not on my last message, let me recopy it. Thanks for your help by the way.
CamperBot
@camperbot
Sep 03 2015 08:01
rashidt sends brownie points to @yhabib :sparkles: :thumbsup: :sparkles:
:star: 219 | @yhabib | http://www.freecodecamp.com/yhabib
Yusef Habib
@yhabib
Sep 03 2015 08:02
no problem ;)
hi @iashraful
Abhisek Pattnaik
@abhisekp
Sep 03 2015 08:03

ting...ting.... @dting I've an issue... Bonfire: Arguments Optional
I want to replace this http://repl.it/BFSx

if(!args.every(function (arg) {
return typeof arg === 'number';
})) {
return;
}

with this http://repl.it/BFSx/1

args.every(function (arg) {
return typeof arg === 'number';
}) || return;

But it doesn't work. Smashes an ERROR right into my pretty face. :worried:
Is it because || operator expects an expression and sees a statement as it's operand?

Rashid Thompson
@RashidT
Sep 03 2015 08:04

@yhabib , here is the code again.

$($(".slot"))[0].html('<img src = "' + images[slotOne - 1] + '">');
$($(".slot"))1.html('<img src = "' + images[slotTwo - 1] + '">');
$($(".slot"))[2].html('<img src = "' + images[slotThree - 1] + '">');

Yusef Habib
@yhabib
Sep 03 2015 08:06
@RashidT I think you are getting the same error because the parenthesis look like before
$($(“.slot”)[0]).html…
Ashraful Islam
@iashraful
Sep 03 2015 08:07
@yhabib nice work on random quote machine!
@yhabib how did you get the quote text div to be transparent yet the text to be opaque?
when I set opacity of the div, my text also goes transparent :(
Jepz
@Jepz
Sep 03 2015 08:09
@iashraful not like am an expert, but when I use the opacity on element I set it to the parent instead. So like <div class="div1"><div class="div2">Hello World</div></div> i set opacity to div1. Hope that helped.
Ashraful Islam
@iashraful
Sep 03 2015 08:10
@Jepz lemme try
Rashid Thompson
@RashidT
Sep 03 2015 08:10
@yhabib the parenthesis surrounding ".slot" ? It shows that in the waypoint as this $($('.slot')[0]).html('<img src = "' + images[slotOne-1] + '">');
Yusef Habib
@yhabib
Sep 03 2015 08:14
@RashidT correct, now is what you should write. One $() is for the$(“.slot”) and the outer is for $($(."slot”)[0])
@iashraful Thanks but is really simple my quote machine I need to improve it a lot. I just set the opacity to .9 of the bloquote elemnt
CamperBot
@camperbot
Sep 03 2015 08:15
yhabib sends brownie points to @iashraful :sparkles: :thumbsup: :sparkles:
:star: 340 | @iashraful | http://www.freecodecamp.com/iashraful
Ashraful Islam
@iashraful
Sep 03 2015 08:17
@Jepz nope, like I said, it transperancify the children
I think I need to use some sort of overlay
Rashid Thompson
@RashidT
Sep 03 2015 08:22
@yhabib ok i think that did the trick, again, thanks for your help.
CamperBot
@camperbot
Sep 03 2015 08:22
rashidt sends brownie points to @yhabib :sparkles: :thumbsup: :sparkles:
:warning: rashidt already gave yhabib points
Jepz
@Jepz
Sep 03 2015 08:26
@iashraful Okay, I checked how I did it and i have to go back on what i said :)
what i did was "just" add a class to the div I wanted to style. The class had this styling background-color: rgba(0, 0, 0, 0.7);
The text is not affected by it
Yusef Habib
@yhabib
Sep 03 2015 08:31
@Jepz Better than my solution xD, thanks using it!
CamperBot
@camperbot
Sep 03 2015 08:31
yhabib sends brownie points to @jepz :sparkles: :thumbsup: :sparkles:
:star: 179 | @jepz | http://www.freecodecamp.com/jepz
Jepz
@Jepz
Sep 03 2015 08:32
@yhabib Glad I could help :D
Abhisek Pattnaik
@abhisekp
Sep 03 2015 08:41
@E-Tank
CamperBot
@camperbot
Sep 03 2015 08:41
abhisekp sends brownie points to @e-tank :sparkles: :thumbsup: :sparkles:
:star: 197 | @e-tank | http://www.freecodecamp.com/e-tank
Ashraful Islam
@iashraful
Sep 03 2015 08:43
@Jepz oh! No I was talking about the opacity of the div itself
background-color does the trick as you said :)
Matt Greenwood
@mjgwood
Sep 03 2015 08:43
Hi all, anyone willing to help me out with the Exact Change bonfire? I've done most of it, but something is breaking and I'd appreciate someone trying to help me figure out why.
Jepz
@Jepz
Sep 03 2015 08:43
@iashraful So it worked?
Ashraful Islam
@iashraful
Sep 03 2015 08:44
yep
Jepz
@Jepz
Sep 03 2015 08:44
@iashraful Ah great :) Glad i could help
Matt Greenwood
@mjgwood
Sep 03 2015 08:45
If anyone's happy to take a look, here's my code: http://codepen.io/anon/pen/bVNdzB?editors=001
Somewhere in my while loop the program is adding values on to the 'valueArr' array, which is just meant to hold the values for reference, and that is what is breaking the program. I can't find the line of code that's doing it though..
Thiru
@Thiruppathi
Sep 03 2015 08:59
Thanks @DmytroYarmak
CamperBot
@camperbot
Sep 03 2015 08:59
thiruppathi sends brownie points to @dmytroyarmak :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dmytroyarmak
Thiru
@Thiruppathi
Sep 03 2015 09:00
thanks @dmytroyarmak .. i missed the part that I should return the array which has the largest number..
CamperBot
@camperbot
Sep 03 2015 09:00
thiruppathi sends brownie points to @dmytroyarmak :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for dmytroyarmak
Andy Taylor
Sep 03 2015 09:04
'code'

Hello!
Can anyone help me with the destroy puzzle? I can find each of the values that I need to remove just a little stuck on how I actually get them out of the array.
Thanks :)

'''
function destroyer(arr) {
// Remove all the values
new_array = arguments[0];
argument1 = arguments[1];
argument2 = arguments[2];
console.log(new_array);

for(var i=0; i <new_array.length; i++){
if(new_array[i] == argument1 || new_array[i] == argument2){
console.log("found one");
}else{
console.log("move along");
}
}

return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
'''

CamperBot
@camperbot
Sep 03 2015 09:06
:bulb: to format code use backticks!  more info
Andy Taylor
Sep 03 2015 09:07

Hello!
Can anyone help me with the destroy puzzle? I can find each of the values that I need to remove just a little stuck on how I actually get them out of the array.
Thanks :smile:

function destroyer(arr) {
// Remove all the values
new_array = arguments[0];
argument1 = arguments[1];
argument2 = arguments[2];
console.log(new_array);

for(var i=0; i <new_array.length; i++){
if(new_array[i] == argument1 || new_array[i] == argument2){
console.log("found one");
}else{
console.log("move along");
}
}

return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
'''

CamperBot
@camperbot
Sep 03 2015 09:07
if you want to thank someone, put an @ before their name!
Andy Taylor
Sep 03 2015 09:07
Hello!
Can anyone help me with the destroy puzzle? I can find each of the values that I need to remove just a little stuck on how I actually get them out of the array.
Thanks :smile:
function destroyer(arr) {
// Remove all the values
new_array = arguments[0];
argument1 = arguments[1];
argument2 = arguments[2];
console.log(new_array);

for(var i=0; i <new_array.length; i++){
if(new_array[i] == argument1 || new_array[i] == argument2){
console.log("found one");
}else{
console.log("move along");
}
}

return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Andy Taylor
Sep 03 2015 09:11
@mjgwood thanks will check that out now :smile:
CamperBot
@camperbot
Sep 03 2015 09:11
theador0691 sends brownie points to @mjgwood :sparkles: :thumbsup: :sparkles:
:star: 258 | @mjgwood | http://www.freecodecamp.com/mjgwood
Matt Greenwood
@mjgwood
Sep 03 2015 09:13
@theador0691 No problem. Assuming you can already find the items to remove this should be all you need.
Andy Taylor
Sep 03 2015 09:19
it's still quite tricky using a splice getting the actual ones you want to be removed!
Matt Greenwood
@mjgwood
Sep 03 2015 09:23
@theador0691 Ah I realise now you're searching for specific values within the array. You could use indexOf https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf to find the locations of the items and from there it should be easy enough to delete them with splice.
Or you could try filter, like the bonfire suggests. But I found filter pretty confusing initially.
Andy Taylor
Sep 03 2015 09:25
yer I wanted to use a filter but it was really confusing
did you just use a index of and splice?
Maciej Sartys
@maciejsartys
Sep 03 2015 09:27
is there any function that allows to export project from codepen to github automatically ?
Andy Taylor
Sep 03 2015 09:28
Matt Greenwood
@mjgwood
Sep 03 2015 09:28
@theador0691 Just went back to my code. I actually looped through both the array and the other arguments, then compared them and spliced where necessary.
Probably not how I'd do it now though.. haha
Maciej Sartys
@maciejsartys
Sep 03 2015 09:29
CamperBot
@camperbot
Sep 03 2015 09:29
maciejsartys sends brownie points to @theador0691 :sparkles: :thumbsup: :sparkles:
Andy Taylor
Sep 03 2015 09:30
@maciejsartys no worries
@mjgwood Yer I get the feeling that the way that I am trying to do it is not the best way aha
Matt Greenwood
@mjgwood
Sep 03 2015 09:34
@theador0691 As long as you get it done you're learning. And if you see a better way to do it later on you know your skills have improved since then.
Andy Taylor
Sep 03 2015 09:35
@mjgwood that is a very good point! Motivates me a bit more now actually!
Matt Greenwood
@mjgwood
Sep 03 2015 09:36
Mauro Bonucci
@bonucci
Sep 03 2015 09:42
Hi there guys, hope for some help, the "Bonfire: Seek and Destroy" is confusing me, the exercise says to destroy from the first argument (array), same numbers that are in the second or third argument, but the problem is in the function, there is only one argumen that i can pass (arr), how can i compare or filter inside the function the arguments of only one argument is passed in the function?
Matt Greenwood
@mjgwood
Sep 03 2015 09:43
Try see what happens when you return arguments[2]
Vikrant Negi
@vikrantnegi
Sep 03 2015 09:45
need a pair for: Bonfire: Factorialize a Number
Mateja Trifunovski
@Matko95
Sep 03 2015 09:46
@vikrantnegi007 what is the problem?
Vikrant Negi
@vikrantnegi
Sep 03 2015 09:46
@Matko95 i don't know how to do that
Mateja Trifunovski
@Matko95
Sep 03 2015 09:46
@bonucci there are several arguments passed to the function, you can access them like this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments
Mauro Bonucci
@bonucci
Sep 03 2015 09:47
thanks @mjgwood that was new for me lol
CamperBot
@camperbot
Sep 03 2015 09:47
bonucci sends brownie points to @mjgwood :sparkles: :thumbsup: :sparkles:
:star: 259 | @mjgwood | http://www.freecodecamp.com/mjgwood
Mateja Trifunovski
@Matko95
Sep 03 2015 09:47
wiki factoralize
CamperBot
@camperbot
Sep 03 2015 09:47
no wiki entry for: factoralize
:pencil: click here to create one now!after creating your page type update to reload it here
Matt Greenwood
@mjgwood
Sep 03 2015 09:47
@bonucci No problem. There's always new stuff!
wontoan
@wontoan
Sep 03 2015 09:48
Good morning/afternoon/evening everyone
Mateja Trifunovski
@Matko95
Sep 03 2015 09:48
@vikrantnegi007 Anyways, the idea is this 5!=5x4x3x2x1, so you take a number and multiply it by (n-1) through every iteration until you reach 1
wontoan
@wontoan
Sep 03 2015 09:49
Is anyone available to help me out with Bonfire: Symmetric Difference? I've just completed the solution but I did not use .reduce() and would love some help with that
CamperBot
@camperbot
Sep 03 2015 09:49
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Matt Greenwood
@mjgwood
Sep 03 2015 09:51
@wontoan I just did that one the other day and I didn't use reduce either :/
haha that is not the emoticon I wanted.
wontoan
@wontoan
Sep 03 2015 09:52
haha.
Andy Taylor
Sep 03 2015 09:52
@mjgwood I did it using the filter! But I am guessing there is a much better way!
function destroyer(arr) {
// Remove all the values
array = arguments[0];
arg = arguments[1];
arg2 = arguments[2];
arg3 = arguments[3];
console.log(array);

var newar = array.filter(function(val){
return!(val === arg || val === arg2| val === arg3);
});
console.log(newar);
return newar;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
BIKRAM-MIS
@bikram-mits
Sep 03 2015 09:52
hello guys have you ever integrated echosign before
Matt Greenwood
@mjgwood
Sep 03 2015 09:53
@theador0691 Nice! The only issue would be if you were ever given more than 3 arguments to delete. Other than that that's a nice looking solution.
BIKRAM-MIS
@bikram-mits
Sep 03 2015 09:53
Please guys echosign..i am having problem in viewing the pdf generated by /combinedDocument api
will you come up and help me
Matt Greenwood
@mjgwood
Sep 03 2015 09:54
@bikram-mits Sorry, I don't know what that is.
BIKRAM-MIS
@bikram-mits
Sep 03 2015 09:54
Matt Greenwood
@mjgwood
Sep 03 2015 09:54
Never used it.
Andy Taylor
Sep 03 2015 09:54
@mjgwood Yes that was the only problem. Do you have any thoughts on that? The only thing I did was add another variable arg3, but that was just to pass
BIKRAM-MIS
@bikram-mits
Sep 03 2015 09:54
Matt Greenwood
@mjgwood
Sep 03 2015 09:55
If you wanted to work on improving it you could use a loop to assign each argument to an array.. But you can always do that later if you feel like moving on now.
Andy Taylor
Sep 03 2015 09:56
@mjgwood ahh ok might just try and implement that now :smile:
Matt Greenwood
@mjgwood
Sep 03 2015 09:56
Vikrant Negi
@vikrantnegi
Sep 03 2015 10:01

help in Bonfire: Factorialize a Number:

function factorialize(num) {
num--;
return num*(x);
}
factorialize(5);

what is wrong here?

CamperBot
@camperbot
Sep 03 2015 10:01
no wiki entry for: in bonfire factorialize a number
:pencil: click here to create one now!after creating your page type update to reload it here
Matt Greenwood
@mjgwood
Sep 03 2015 10:03
@vikrantnegi007 is x assigned to anything?
Vikrant Negi
@vikrantnegi
Sep 03 2015 10:04
' @mjgwood no
@mjgwood
function factorialize(num) {
num--;
return num*(num--);
}
factorialize(5);
Mateja Trifunovski
@Matko95
Sep 03 2015 10:05
@vikrantnegi007 num--; will lower it only by 1, once, it will not factoralize a number
Matt Greenwood
@mjgwood
Sep 03 2015 10:05
@vikrantnegi007 What you need is a loop. Otherwise all you're doing is subtracting 1 from num.
Mateja Trifunovski
@Matko95
Sep 03 2015 10:06
Anyone here did the zipline: pommodoro clock? I need some help with it
Emil Aasa
@emilaasa
Sep 03 2015 10:06
@Matko95 sure what do you need
Mateja Trifunovski
@Matko95
Sep 03 2015 10:07
http://codepen.io/Matko95/pen/KdwwBK
@emilaasa
i tried to write something
but the variables scopes are giving me a hard time
How did you write your timer?
Emil Aasa
@emilaasa
Sep 03 2015 10:07
Pretty much like you did there using setinterval
Mateja Trifunovski
@Matko95
Sep 03 2015 10:09
hmm, can you figure out what am i doing wrong then?
Emil Aasa
@emilaasa
Sep 03 2015 10:10
Vikrant Negi
@vikrantnegi
Sep 03 2015 10:10

@mjgwood @Matko95
like this

function factorialize(num) {
for(i=num; i=0; i--){
return i
}
}
factorialize(5);

i don't know what to do next?

Emil Aasa
@emilaasa
Sep 03 2015 10:11
var intervalID = window.setInterval(func, delay[, param1, param2, ...]);
setinterval is a method of the window object i guess
So you need to call it like that
well maybe you are actually doing that
lol xD
Mateja Trifunovski
@Matko95
Sep 03 2015 10:13
I gotta mess around with it for a while, it might start working eventually :D
@vikrantnegi007 in your for loop you set the value of i to num, and then changed it instantly to zero and started decreasing it, so it's basically infinite, try making i=num;i>0;i-- and multiply the value through every iteration, then return it
Emil Aasa
@emilaasa
Sep 03 2015 10:15
@Matko95 Maybe you should have <== instead of === when it checks for 0
Mateja Trifunovski
@Matko95
Sep 03 2015 10:15
@emilaasa that won't be a problem yet, since it won't come down from 1500 :D
Emil Aasa
@emilaasa
Sep 03 2015 10:16
Your function looks pretty much like mine does but I used vanilla JS and specified window.setInterval()
Vikrant Negi
@vikrantnegi
Sep 03 2015 10:16
@Matko95 Okay get it. Now i'm confused at how to multiply the value through every iteration, then return it.
Mateja Trifunovski
@Matko95
Sep 03 2015 10:18

@vikrantnegi007

for()
{
num*=i;
}
return num;

something like that

but make sure that i is 1 number less that num
Thomas Farla
@TFarla
Sep 03 2015 10:19
@Matko95 what is the issue with your pomodoro timer? Your interval seems to be correct
Mateja Trifunovski
@Matko95
Sep 03 2015 10:19
@emilaasa can i take a look at your pen maybe?
Vikrant Negi
@vikrantnegi
Sep 03 2015 10:19
@Matko95 what does this actually do?
num*=i;
Mateja Trifunovski
@Matko95
Sep 03 2015 10:19
@TFarla well console.log only prints 1500
@vikrantnegi007 num*=i is same as num=num*i
Emil Aasa
@emilaasa
Sep 03 2015 10:20
@Matko95 I think I fixed yours just wait a sec
:D
Thomas Farla
@TFarla
Sep 03 2015 10:20
@Matko95 Why wouldn't it? It is being executed once the page is ready and you set it to 1500 right of the bat
Emil Aasa
@emilaasa
Sep 03 2015 10:21
okay @Matko95

Do you just want a solution or some kind of pedagogy here?
xD
Mateja Trifunovski
@Matko95
Sep 03 2015 10:23
@emilaasa It's the same :D
Emil Aasa
@emilaasa
Sep 03 2015 10:23
kk -_-
Mateja Trifunovski
@Matko95
Sep 03 2015 10:23
solution would be nice
Vikrant Negi
@vikrantnegi
Sep 03 2015 10:23
@Matko95
why doesn't this work?
function factorialize(num) {
for(i=num; i>0; i--){
num=num*i
}
return num;
}
factorialize(5);
Mateja Trifunovski
@Matko95
Sep 03 2015 10:23
so i could start making it
Emil Aasa
@emilaasa
Sep 03 2015 10:23
well you pass time into your setInterval function
bit if you put timerLength there instead it will start counting it down
or assign timerlength to time or something
Mateja Trifunovski
@Matko95
Sep 03 2015 10:24
@vikrantnegi007 because you set i=num, so for etc factoralize(5) it would go 5x5x4x3x2x1
Emil Aasa
@emilaasa
Sep 03 2015 10:24
 function timerCount(timerLength) {
interval = setInterval(function() {
timerLength -= 1;
console.log(timerLength);
if (timerLength === 0) {
clearInterval(interval);
}
}, 1000)
};
Thomas Farla
@TFarla
Sep 03 2015 10:24

@Matko95 your interval works fine. change it to this

  function timerCount(time) {
interval = setInterval(function() {
console.log(time);
time -= 1;
if (time === 0) {
clearInterval(interval);
}
}, 1000)
};

You will see that the time updates

Vikrant Negi
@vikrantnegi
Sep 03 2015 10:24
@Matko95 thanks
CamperBot
@camperbot
Sep 03 2015 10:24
vikrantnegi007 sends brownie points to @matko95 :sparkles: :thumbsup: :sparkles:
:star: 205 | @matko95 | http://www.freecodecamp.com/matko95
Mateja Trifunovski
@Matko95
Sep 03 2015 10:25
@TFarla What did you change? :D
Thomas Farla
@TFarla
Sep 03 2015 10:26
@Matko95 only added a console.log
Mateja Trifunovski
@Matko95
Sep 03 2015 10:26
strange
@TFarla @emilaasa thanks guys :)
CamperBot
@camperbot
Sep 03 2015 10:26
matko95 sends brownie points to @tfarla and @emilaasa :sparkles: :thumbsup: :sparkles:
:star: 278 | @emilaasa | http://www.freecodecamp.com/emilaasa
:star: 172 | @tfarla | http://www.freecodecamp.com/tfarla
Emil Aasa
@emilaasa
Sep 03 2015 10:26
hmm dunno if thats something browser related
Soumya Rauth
@soumyaRauth
Sep 03 2015 10:27
Stuck with Pomodoro... Need the basic algorithm....
Thomas Farla
@TFarla
Sep 03 2015 10:27
@Matko95 Open the console and click the button. You will see the countdown c:
Emil Aasa
@emilaasa
Sep 03 2015 10:27
cause It would not decrement for me with just passing timeLength into timeCounter()
Mateja Trifunovski
@Matko95
Sep 03 2015 10:27
@TFarla yes, i did :D
Emil Aasa
@emilaasa
Sep 03 2015 10:27
on chrome
Mateja Trifunovski
@Matko95
Sep 03 2015 10:27
it didn't for me aswell, but now it does for some reason
Thomas Farla
@TFarla
Sep 03 2015 10:28
@Matko95 Now you could update the html in the interval too so that the user knows how much time is left! :D
Emil Aasa
@emilaasa
Sep 03 2015 10:28
Also we had the same ‘feature’ that you have now
if you click the button a few times it will increase speed
:D
Mateja Trifunovski
@Matko95
Sep 03 2015 10:29
yes, feature :D
Emil Aasa
@emilaasa
Sep 03 2015 10:29
that took a while to figure out xD
Mateja Trifunovski
@Matko95
Sep 03 2015 10:29
i might disable it after one click
Emil Aasa
@emilaasa
Sep 03 2015 10:30
yeah something like that
Thomas Farla
@TFarla
Sep 03 2015 10:30
@emilaasa You can enhance that "feature" by having a boolean value that holds if the timer is running
var isRunning = false;
setInterval(function() {
isRunning = true;
...
}, 1000)
Matt Greenwood
@mjgwood
Sep 03 2015 10:32
Can anyone help me out with a loop that seems to be adding something to an array for no reason?
DTing
@dting
Sep 03 2015 10:32
:point_up: September 3, 2015 1:03 AM what are you trying to do again?
Thomas Farla
@TFarla
Sep 03 2015 10:33
@mjgwood ye sure c:
Matt Greenwood
@mjgwood
Sep 03 2015 10:33
@dting I'm working on the Exact Change bonfire. Here's my code: http://codepen.io/anon/pen/bVNdzB?editors=001
Spatz
@Spatzerny
Sep 03 2015 10:33
i fail to see the usefulness of reduce() in any of the bonfires
Mateja Trifunovski
@Matko95
Sep 03 2015 10:34
it's kinda badly explained on MDN
it could be a powerful tool maybe if we knew how to successfully apply it
Emil Aasa
@emilaasa
Sep 03 2015 10:34
@Matko95 btw if you are worried about scope you can always console.log(this) inside your functions
Like what I did after giving you the wrong advice about setinterval >p
DTing
@dting
Sep 03 2015 10:35
@mjgwood you are getting a floating point inaccuracy error
Emil Aasa
@emilaasa
Sep 03 2015 10:35
:panda_face:
Matt Greenwood
@mjgwood
Sep 03 2015 10:35
What I've figured out is that somewhere just before my for loop increments 'j', my valueArr array gets altered, which it shouldn't. It's just mean to be there as a reference.
avatarhzh
@avatarhzh
Sep 03 2015 10:35
Hi how do I remove spaces and punctuations from a string variable?
Mateja Trifunovski
@Matko95
Sep 03 2015 10:35
@emilaasa yeah,sure :D
DTing
@dting
Sep 03 2015 10:35
when i deal with money i multiply by 100 and deal with cents
Emil Aasa
@emilaasa
Sep 03 2015 10:35
@avatarhzh regexp is the best for that imo
avatarhzh
@avatarhzh
Sep 03 2015 10:35
the method String.replace(\s, "") is working for some reason
DTing
@dting
Sep 03 2015 10:36
@Spatzerny it's good for the smallest common multiple one
avatarhzh
@avatarhzh
Sep 03 2015 10:36
is \s the regex for white space?
DTing
@dting
Sep 03 2015 10:36
@avatarhzh /\s/g
avatarhzh
@avatarhzh
Sep 03 2015 10:36
oh ok thanks @dting
CamperBot
@camperbot
Sep 03 2015 10:36
avatarhzh sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 984 | @dting | http://www.freecodecamp.com/dting
Spatz
@Spatzerny
Sep 03 2015 10:36
@dting how come?
Matt Greenwood
@mjgwood
Sep 03 2015 10:37
@dting But why would that cause the program to add 20 to valueArr?
Thomas Farla
@TFarla
Sep 03 2015 10:37
@mjgwood it is a bit overcomplicated. Try to make it less complex by not nesting a while and for loop
DTing
@dting
Sep 03 2015 10:37
@mjgwood oh let me look again
Duncan
@emmrr
Sep 03 2015 10:37
bf Factorialize
CamperBot
@camperbot
Sep 03 2015 10:37

## :fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

Thomas Farla
@TFarla
Sep 03 2015 10:37
@mjgwood complex structures like this make debugging really tough
DTing
@dting
Sep 03 2015 10:37
@Spatzerny
function gcd(a, b) {
while (b !== 0) {
a = [b, b = a % b][0];
}
return a;
}
function lcm(a, b) {
return (a * b) / gcd(a, b);
}
function smallestCommons(arr) {
arr.sort(function(a,b) {return a-b;});
var rng = [];
for (var i = arr[0]; i <= arr[1]; i++) {
rng.push(i);
}
return rng.reduce(lcm);
}
smallestCommons([1,5]);
reduce is great
Duncan
@emmrr
Sep 03 2015 10:37
bf hint
CamperBot
@camperbot
Sep 03 2015 10:38
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Matt Greenwood
@mjgwood
Sep 03 2015 10:38
@TFarla It's working mostly though. I've spent so long on it I just don't want to start over :cry:
Cicero82
@Cicero82
Sep 03 2015 10:39
hi guys
Matt Greenwood
@mjgwood
Sep 03 2015 10:40
@dting It's ignoring the 20 it should add to ["TWENTY"] in the final array, and instead adding 20 to both ["TWENTY"] in valueArr as well as to ["TEN"] (the next value) in the final array. :confused:
Cicero82
@Cicero82
Sep 03 2015 10:40
i'm stuck on a challenge :(
avatarhzh
@avatarhzh
Sep 03 2015 10:42
is there any way to use regexp to include all punctuation marks?
Cicero82
@Cicero82
Sep 03 2015 10:42
// Only change code below this line.
if(flip === 0) {
} else {
return "tails";
}
can't see where i'm going wrong...
Mateja Trifunovski
@Matko95
Sep 03 2015 10:43
@Cicero82 that didn't work for some guy the other day aswell, what was the error?
Cicero82
@Cicero82
Sep 03 2015 10:44

Unexpected end of input

Program Execution FailureNo user tests were run.

Mateja Trifunovski
@Matko95
Sep 03 2015 10:44
Spatz
@Spatzerny
Sep 03 2015 10:45
@dting that while loop is beyond my comprehention :D
Cicero82
@Cicero82
Sep 03 2015 10:45
that seems to have helped somewhat, i now get two tick marks: assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');
assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');
DTing
@dting
Sep 03 2015 10:45
haha ya im looking
Cicero82
@Cicero82
Sep 03 2015 10:45
but still this error: assert((function(){if(myFunction() === "heads" || myFunction() === "tails"){return true;}else{return false;}})(), 'myFunction should either return heads or tails');
Vikrant Negi
@vikrantnegi
Sep 03 2015 10:46

I need help in Bonfire: Check for Palindromes:

function palindrome(str) {
if(str===str.split('').reverse().join('')){
return true;}
}
palindrome("eye");

what is wrong here??????

CamperBot
@camperbot
Sep 03 2015 10:46
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
DTing
@dting
Sep 03 2015 10:46
@Cicero82 that looks right try refreshing your browser
Cicero82
@Cicero82
Sep 03 2015 10:46
ok
DTing
@dting
Sep 03 2015 11:00
@mjgwood i got it
Matt Greenwood
@mjgwood
Sep 03 2015 11:01
@dting Really?? I'm going nuts over this - I was just about to start all over again!
Sep 03 2015 11:05
my map page does't get updated even after passing the test for bonfires
I can see the solution posted on my portfolio page but my map page still shows that specific bonfire unchecked
what's going on? can anyone help?
Matt Greenwood
@mjgwood
Sep 03 2015 11:07
@alifarhad Did you click on the submit button that pops up after all the tests pass?
Sep 03 2015 11:07
yep @mjgwood clicked it for over a dozen times
DTing
@dting
Sep 03 2015 11:07
@mjgwood damn
my computer reboot for an update
let me bring it up again
Mateja Trifunovski
@Matko95
Sep 03 2015 11:08
Does anyone know a website from where i can get notification sounds with an url?
Sep 03 2015 11:08
Matt Greenwood
@mjgwood
Sep 03 2015 11:08
@alifarhad Hmm I'm not sure what it could be then.. sorry
@dting Haha no worries. Is it a big issue or did I just miss something obvious?
Sep 03 2015 11:08
check out the number 8
DTing
@dting
Sep 03 2015 11:09
can you link me the code again
Sep 03 2015 11:09
all the tests get passed with my solution and I have tried clicking submit button afterwards but it still won't get checked on my map
DTing
@dting
Sep 03 2015 11:09
i want to take another look before i say anything i th ink it was minor
i cant find the link and the code in the editor poofed
Romahha
@Romahha
Sep 03 2015 11:09
Diff Two Arrays Difficulty: Hello!!! Maybe somebody knows how to write this code! Please, help me!!!
Matt Greenwood
@mjgwood
Sep 03 2015 11:09
Sep 03 2015 11:10
here's my code for the said bonfire
function end(str, target) {
if (str.substr(-target.length) === target) {
return true;
} else {
return false;
}
}

end('Bastian', 'n');
Matt Greenwood
@mjgwood
Sep 03 2015 11:10
@alifarhad So you click 'Run Code', and then the test pass? And then there should be a popup where you can click submit. If you've done all that then I don't know what it could be.
Sep 03 2015 11:11
yeah been there done that xD @mjgwood
wtf
i checked the map again and it's checked off
now this's weird lol
CamperBot
@camperbot
Sep 03 2015 11:12
alifarhad sends brownie points to @mjgwood :sparkles: :thumbsup: :sparkles:
:star: 260 | @mjgwood | http://www.freecodecamp.com/mjgwood
Matt Greenwood
@mjgwood
Sep 03 2015 11:12
@alifarhad Ah did you maybe just forget to refresh the map page?
Aleksandar B.
@aleksandar-b
Sep 03 2015 11:12
I have a question about Angular and Jquery. If i am using Angular, can I use Jquery the same way as I used it before adding Angular or I must put Jquery code in directive?
Sep 03 2015 11:12
nope had been trying everything for over a dozen time @mjgwood
may be it takes a while for our map page to get updated
IDK
Matt Greenwood
@mjgwood
Sep 03 2015 11:14
As long as it works in the end :)
Cicero82
@Cicero82
Sep 03 2015 11:17
looks like i'm stuck :(
Matt Greenwood
@mjgwood
Sep 03 2015 11:22
What are you stuck on @Cicero82 ?
DTing
@dting
Sep 03 2015 11:24
@mjgwood
array.push(valueArr[j]);
this line right there
damn it
that was hard to find
you are pushing a reference to valueArr[j] into your array
so the next loop around it mutates that value. it changes valueArr[j] to 40 instead of 20
Matt Greenwood
@mjgwood
Sep 03 2015 11:25
@dting How exactly does that affect valueArr though?
I've not told it to do that anywhere.
DTing
@dting
Sep 03 2015 11:26
the second loop around you do array[location][1] += value[j]
or whatever
sorry i changed yor code so i forgot what was there before
function drawer(price, cash, cid) {
var change = cash - price;
var totalCid = 0.00;
var array = [];

for(var i = 0; i < cid.length; i++) {
totalCid += cid[i][1];
totalCid = +(Math.round(totalCid + "e+2")  + "e-2");
}

var valueArr = [['ONE HUNDRED', 100], ['TWENTY', 20], ['TEN', 10], ['FIVE', 5], ['ONE', 1], ['QUARTER', 0.25], ['DIME', 0.10], ['NICKEL', 0.05], ['PENNY', 0.01]];

var cidObj = {
'ONE HUNDRED': cid[8][1],
'TWENTY': cid[7][1],
'TEN': cid[6][1],
'FIVE': cid[5][1],
'ONE': cid[4][1],
'QUARTER': cid[3][1],
'DIME': cid[2][1],
'NICKEL': cid[1][1],
'PENNY': cid[0][1]
};

if(totalCid < change) {
return "Insufficient Funds";
} else if(totalCid === change) {
return "Closed";
} else {
for(var j = 0; j < valueArr.length; j++) {
var key = valueArr[j][0];
var value = valueArr[j][1];
while((cidObj[key] > 0) && (value <= change)) {
change -= value;
change = +(Math.round(change + "e+2")  + "e-2");
cidObj[key] -= value;
var found = false;
var location = 0;
for(var a = 0; a < array.length; a++) {
if(array[a][0] === valueArr[j][0]) {
found = true;
location = a;
}
}
if(found) {
array[location][1] += value;
} else {
array.push([key, value]);
}
}
}
}
return array;
}
i renamed some variables
but thats essentially your code with that line changed
you could also just do
            array.push(valueArr[j].slice());
to create a shallow copy
Matt Greenwood
@mjgwood
Sep 03 2015 11:27
@dting Wow thank you so much for going over all that for so long! I really appreciate it.
CamperBot
@camperbot
Sep 03 2015 11:27
mjgwood sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 985 | @dting | http://www.freecodecamp.com/dting
Matt Greenwood
@mjgwood
Sep 03 2015 11:27
I still don't understand why it would change valueArr though
Wouldn't array[location][1] += value[j] just update array?
Mateja Trifunovski
@Matko95
Sep 03 2015 11:28
http://codepen.io/Matko95/pen/KdwwBK?editors=101
Anyone knows why my minutes are displaying etc. 9 then 09
DTing
@dting
Sep 03 2015 11:29
so i'll give an example:
var a = [];
var b = [];
var c = [];
a.push(1);
b.push(a);
a.push(2);
c.push(a);
a.push(3);
what do you think a b and c are?
Matt Greenwood
@mjgwood
Sep 03 2015 11:30
a - 3, b - 1, c - 2?
Or does that make all of them 3?
DTing
@dting
Sep 03 2015 11:32
a == [1,2,3]
b == [[1,2,3,]]
c == [[1,2,3]]
when you call a.push(1); it pushes 1 into the array
when you call b.push a. it pushing the array that a references into the b array
so at that point you have
a == [1]
b == [<a>] == [[1]]
Matt Greenwood
@mjgwood
Sep 03 2015 11:33
@dting Oops, had a special moment there..
DTing
@dting
Sep 03 2015 11:34
now when you do a.push(2); you push 2 into the a array so you have
a == [1,2]
b == [<a>] == [[1,2]]
Matt Greenwood
@mjgwood
Sep 03 2015 11:34
But I wouldn't have expected it to push a copy to each of them..
DTing
@dting
Sep 03 2015 11:34
it doesnt copy
if you copied then you would have this problem. the problem is because it contains a reference to the array that the other variable pointed to
a and b[0] point to the same memory location
Aniruddh Agarwal
@anrddh
Sep 03 2015 11:35
why is angular-fullstack resetting my index.html after every grunt serve?
DTing
@dting
Sep 03 2015 11:35
so if you change a, b[0] is changed
@awesomeaniruddh it had a lot of stuff that is injected
Aniruddh Agarwal
@anrddh
Sep 03 2015 11:35
@dting I'd like to add a couple of external js files
DTing
@dting
Sep 03 2015 11:35
but if you keep you code outside of the comment areas
you should be fine
Aniruddh Agarwal
@anrddh
Sep 03 2015 11:35
alright
Matt Greenwood
@mjgwood
Sep 03 2015 11:36
@dting Wow I need to read up on references a bit I think.. I mostly understand what you're saying, but I really just didn't know that happened.
Aniruddh Agarwal
@anrddh
Sep 03 2015 11:36
That also explains why one of my external files didn't automatically uninclude itself
Matt Greenwood
@mjgwood
Sep 03 2015 11:39
@dting So if I want to avoid this problem, could I create another variable that would prevent pointing back to valueArr?
DTing
@dting
Sep 03 2015 11:40
no you make a shallow copy
using slice()
actually it depends on the situation
Matt Greenwood
@mjgwood
Sep 03 2015 11:41
Oh wow I see you've actually gone and fixed my code! :) I was busy trying to understand the problem haha
Would you mind explaining how I'd use slice?
Clearly it isn't necessary here.. but it would be great to understand.
Never mind, I see your previous comment explaining it now. Thank you so much @dting ! I am so happy right now haha
CamperBot
@camperbot
Sep 03 2015 11:45
mjgwood sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:warning: mjgwood already gave dting points
Mateja Trifunovski
@Matko95
Sep 03 2015 11:46
Anyone wanna take a quick look at my pommodoro timer, i have 1 issue?
DTing
@dting
Sep 03 2015 11:46
i have a suggestion tho. try to name your variables a little bit better so your code is a little more self documenting. nice work
array isn't descriptive haha
Matt Greenwood
@mjgwood
Sep 03 2015 11:47
Yeah I know I can work on that. I already had about 3 attempts at this bonfire so I got pretty tired of naming vars haha. But I do it properly when it counts! Thanks again!
CamperBot
@camperbot
Sep 03 2015 11:47
if you want to thank someone, put an @ before their name!
Soumya Rauth
@soumyaRauth
Sep 03 2015 11:52
Can anyone help me with pomodoro clock zipline
Spatz
@Spatzerny
Sep 03 2015 11:54
@soumyaRauth what's the problem?
Soumya Rauth
@soumyaRauth
Sep 03 2015 11:56
@Spatzerny I've been trying for hours but, I think i need the basic algorithm now. I have used the setInterval... But...!!
Cicero82
@Cicero82
Sep 03 2015 11:56
@mjgwood
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 11:57
Hello Everybody! Could someone help me with my code? I'm on the Bonfire: Pig Latin.
Spatz
@Spatzerny
Sep 03 2015 11:57
@soumyaRauth but? ;f
@Rolandisimo sure :f show me what you got :F
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 11:58
Hey @Spatzerny Thanks :)
CamperBot
@camperbot
Sep 03 2015 11:58
rolandisimo sends brownie points to @spatzerny :sparkles: :thumbsup: :sparkles:
:star: 317 | @spatzerny | http://www.freecodecamp.com/spatzerny
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 11:58
function translate(str) {
var vow = ["a","e","o","i","u"],
strArr = str.split("");

if (vow.indexOf(strArr[0].toLowerCase()) === -1) {
strArr.push(strArr.shift(),"ay");
} else {
strArr.push("way");
}

strArr = strArr.join("");
return strArr;
}

translate("consonant");
So this is what I have, but the problem is that I check only the 1st character.
Soumya Rauth
@soumyaRauth
Sep 03 2015 11:59
@Spatzerny You take a look at my codepen.io code. It's incomplete. But, i need some suggestion on that. What should I do or should not do. http://codepen.io/soumya_rauth/pen/PPoZMM
Matt Greenwood
@mjgwood
Sep 03 2015 12:00
@Cicero82 Which bonfire/waypoint is that?
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:00
@Spatzerny
If a word starts with 2 consonants, then I do not target the second one. And I wonder should I use for loop instead?
Cicero82
@Cicero82
Sep 03 2015 12:00
DTing
@dting
Sep 03 2015 12:01
@Rolandisimo you can use a while loop
Michel
@MichelZaal85
Sep 03 2015 12:01
Is there anybody who can help me with zipline-show-the-local-weather?
I have a bit of code written, but I'm stuck at the moment.
Spatz
@Spatzerny
Sep 03 2015 12:02
@Rolandisimo I'm not native English speaker but i'm fairly certain that consonants can be even farther than 2-nd character
Matt Greenwood
@mjgwood
Sep 03 2015 12:02
@Cicero82 Switch them around :)
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:02
@dting hmm, yes, already forgot about the existence of such. Haven't used it for a while (pun)
DTing
@dting
Sep 03 2015 12:02
@Rolandisimo
  if (vow.indexOf(strArr[0].toLowerCase()) === -1) {
strArr.push(strArr.shift(),"ay"); // instead of this do a while loop until the first letter is a vowel, then push "ay"
} else {
strArr.push("way");
}
Cicero82
@Cicero82
Sep 03 2015 12:03
@mjgwood thank you!
CamperBot
@camperbot
Sep 03 2015 12:03
cicero82 sends brownie points to @mjgwood :sparkles: :thumbsup: :sparkles:
:star: 262 | @mjgwood | http://www.freecodecamp.com/mjgwood
Spatz
@Spatzerny
Sep 03 2015 12:03
@soumyaRauth I don't think you understand setInterval()
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:03
@Spatzerny Well, there are words with 1 or 2 consonants for the most part. A lot less with 3. Not sure if there are any with more than 3
Matt Greenwood
@mjgwood
Sep 03 2015 12:03
@Cicero82 No problem!
Spatz
@Spatzerny
Sep 03 2015 12:04
how about this
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:04
@dting Obliged. I'll try now and will get back to you
Spatz
@Spatzerny
Sep 03 2015 12:04
unless 'th' is a singular sound
Soumya Rauth
@soumyaRauth
Sep 03 2015 12:04
@Spatzerny setInterval() calls a function after a certain time... 1000ms=1s. right?
Spatz
@Spatzerny
Sep 03 2015 12:04
why does everything has to be U.S. ;P
Soumya Rauth
@soumyaRauth
Sep 03 2015 12:05
@Spatzerny :)
Spatz
@Spatzerny
Sep 03 2015 12:05
@soumyaRauth but why do you call it sixty times with a loop
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:05
@Spatzerny Yeah, I thought of the same :D
Mateja Trifunovski
@Matko95
Sep 03 2015 12:05
Do i have to make a break in pommodoro clock?
Spatz
@Spatzerny
Sep 03 2015 12:05
and no
its setTimeout() that does that
Soumya Rauth
@soumyaRauth
Sep 03 2015 12:06
@Spatzerny ooppS!!!!
DTing
@dting
Sep 03 2015 12:06
@Matko95 setInterval returns an object that you can use to cancel the interval
Spatz
@Spatzerny
Sep 03 2015 12:06
setInterval(x,t) calls x with intervals of t untill stopped :P
Soumya Rauth
@soumyaRauth
Sep 03 2015 12:07
@Spatzerny I am not clear about how do you define the ending?
Mateja Trifunovski
@Matko95
Sep 03 2015 12:07
Yes, i know that :D I made a functional pomodoro clock, but there isn't anything written about a break button or break length in the user stories
Spatz
@Spatzerny
Sep 03 2015 12:08
This message was deleted
DTing
@dting
Sep 03 2015 12:08
var something = setInterval(function() {
// do something
}, 1000);

setTimeout(function() {
clearInterval(something);
}, 20000);
Spatz
@Spatzerny
Sep 03 2015 12:09
@dting b-but.... my imaginary internet points :(
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:09
:D
Spatz
@Spatzerny
Sep 03 2015 12:09
i was about to copy this in :D
Mateja Trifunovski
@Matko95
Sep 03 2015 12:10
doesn't setTimeout call clearInterval only after 20000 milisecs have passed?
Spatz
@Spatzerny
Sep 03 2015 12:10
oh
yeah
right
This message was deleted
no
wait
im confused
DTing
@dting
Sep 03 2015 12:10
yes
Spatz
@Spatzerny
Sep 03 2015 12:10
...why?
DTing
@dting
Sep 03 2015 12:11
it is an example
replace 20000 with something meaninful
Mateja Trifunovski
@Matko95
Sep 03 2015 12:11
like timerLength?
Spatz
@Spatzerny
Sep 03 2015 12:11
i know how it works but why did you put setTimeout in there ? :smile:
Mateja Trifunovski
@Matko95
Sep 03 2015 12:11
so i would need another setTimeout to start it again?
DTing
@dting
Sep 03 2015 12:12
var something = setInterval(function() {
// do something
}, 1000);

setTimeout(function() {
clearInterval(something);
}, 1000 * durationInSeconds);
Spatz
@Spatzerny
Sep 03 2015 12:12
you'd need a new setInterval()
Soumya Rauth
@soumyaRauth
Sep 03 2015 12:12
http://codepen.io/soumya_rauth/pen/PPoZMM @Spatzerny Why it is displaying NaN ??
Spatz
@Spatzerny
Sep 03 2015 12:13
welcome to FCC where everything's made up and the points don't matter
Mateja Trifunovski
@Matko95
Sep 03 2015 12:14
@dting @Spatzerny I'll figure something out, just thought I could skip the break button :D thanks
DTing
@dting
Sep 03 2015 12:15
oh if you want to break just call clearInterval
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:15
@dting I do not understand why "o" is true in the while loop? O_O
function translate(str) {
var vow = ["a","e","o","i","u"],
strArr = str.split(""),
i=0;

if (vow.indexOf(strArr[0].toLowerCase()) === -1) {
while(vow.indexOf(strArr[i].toLowerCase()) === -1) {
strArr.push(strArr.shift());
i++;
}
strArr.push("ay");
} else {
strArr.push("way");
}

strArr = strArr.join("");
return strArr;
}

translate("consonant");
@dting Result: "nsonantcoay"
Not sure what's wrong :/
DTing
@dting
Sep 03 2015 12:18
@Rolandisimo you dont need that i variable
you are shifting and pushing
that mutates the array
so strArr[0] is always your first letter
Costas Chaitas
@CostasChaitas
Sep 03 2015 12:19
any help with my codepen twitch app tv
DTing
@dting
Sep 03 2015 12:19
you already moved what was the first letter to the end
Costas Chaitas
@CostasChaitas
Sep 03 2015 12:19
my online and offline doesnt work correctly
channel.status === null && stream.stream === null
this is my check
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:21
@dting Ok, I get that. Still not sure what's the next step then if not setting up an i variable...
DTing
@dting
Sep 03 2015 12:22
while(vow.indexOf(strArr[i].toLowerCase()) === -1) { just change i to 0
Costas Chaitas
@CostasChaitas
Sep 03 2015 12:22
anyone?
DTing
@dting
Sep 03 2015 12:22
it will loop until the first letter is a vowel
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:24
@dting Ohhh :D Now I got it. Yes, it mutates the array and the [0] becomes different. My bad... :)
@dting Thanks a lot.
CamperBot
@camperbot
Sep 03 2015 12:24
rolandisimo sends brownie points to @dting :sparkles: :thumbsup: :sparkles:
:star: 988 | @dting | http://www.freecodecamp.com/dting
raykoff
@raykoff
Sep 03 2015 12:25
i need some help with bonfire Return Largest Numbers in Arrays
CamperBot
@camperbot
Sep 03 2015 12:25
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:26
@raykoff what is it? :)
raykoff
@raykoff
Sep 03 2015 12:27
@Rolandisimo
function largestOfFour(arr) {

var highNum;

var highNumArray = 0;

for(var x = 0; x < arr.length; x ++){

highNum = arr[x]

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

if(highNum[i] > highNumArray){

highNumArray = highNum[i];

}
}
}

return highNumArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
@raykoff it works but return the largest number off all the subarrays
DTing
@dting
Sep 03 2015 12:28
@raykoff you need to move your highNumArray
oh nm
you need to change what you assign it too
think of what you are assigning it to now
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:29
@raykoff Yeah, assign the highNumArray to an empty, to start
DTing
@dting
Sep 03 2015 12:29
what's the value of highNum
when you start each loop
what is arr[x]? console.log it and check your developer console
raykoff
@raykoff
Sep 03 2015 12:30
@dting an each array
Mateja Trifunovski
@Matko95
Sep 03 2015 12:32
  setTimeout(function() {
interval1 = setInterval(function() {
breakLength -= 1;
document.getElementById("vreme") = secToMin(breakLength);
console.log(breaktime);
if (breakLength <= 0) {
clearInterval(interval1);
document.getElementById('audio').play();
document.getElementById("vreme").innerHTML = breakLength;
}
}, 1000);

}, 1000 * timerLength+1000);
Could this work?
raykoff
@raykoff
Sep 03 2015 12:32
it wants me to return another array with all the largest numbers of each sub arrays
DTing
@dting
Sep 03 2015 12:33
@raykoff okay consider renaming your variables
you want to move your highNumArray somewhere
right now it retains its value between iterations of your loop
raykoff
@raykoff
Sep 03 2015 12:34
@dting so in to the new array each time?
Nnxoxo
@Nnxoxo
Sep 03 2015 12:35
@dting from ur code, could u explain what is going on here?
var args = [].slice.call(arguments);
DTing
@dting
Sep 03 2015 12:36
here lemme rename your variables for you;
function largestOfFour(arr) {
var largest = 0;
for(var x = 0; x < arr.length; x ++){
var subArray = arr[x]
for(var i = 0; i < subArray.length; i++){
if(subArray[i] > largest){
largest = subArray[i];
}
}
}
return highNumArray;
}
@Nnutthowze i'm turning my arguments object into an array
@raykoff so now what you need to do is change some stuff
Nnxoxo
@Nnxoxo
Sep 03 2015 12:37
@dting hm, interesting trick
DTing
@dting
Sep 03 2015 12:38
@raykoff you are going to want an array outside the for loops to store the values of the largest number of each subArray. you are also going to want to move where you declare largest
you are looking for the largest of each subArray so largest should be declared where?
raykoff
@raykoff
Sep 03 2015 12:39
i don't know
let me think
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:41
@raykoff Consider using only 1 for loop and using the power of Math.max
@bravo1c
Sep 03 2015 12:42
hi guys, please can i have some help with the bonfire number 3, factorizing a number.
DTing
@dting
Sep 03 2015 12:42
function largestOfFour(arr) {
// you want to declare an array here for the results. where should you push to the results array later in this code?
var largest = 0; // this needs to be moved some where
for(var x = 0; x < arr.length; x ++){
var subArray = arr[x]
for(var i = 0; i < subArray.length; i++){
if(subArray[i] > largest){
largest = subArray[i];
}
}
}
return highNumArray;
}
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:42
For Math.max to work on arrays you need to add the method .apply, so it can traverse the values. e.g. Math.max.apply(null, arrayName) @raykoff
DTing
@dting
Sep 03 2015 12:43
@Rolandisimo @raykoff this is a good exercise to practice using loops. I would only suggest using Math.max if you can figure this one out imperatively.
@bravo1c what do you have so far?
Cicero82
@Cicero82
Sep 03 2015 12:43
is it just me or is the move to the bonfire lessons a massive leap?
Rolands Jegorovs
@Rolandisimo
Sep 03 2015 12:43
@dting Noted. :)
@bravo1c
Sep 03 2015 12:44
nothing i'm afraid, i've been stuck. i'm drawing a complete blank on this.

function factorialize(num) {
return num;
}

factorialize(5);
factorialize(10);
factorialize(20);

Cicero82
@Cicero82
Sep 03 2015 12:44
I'm on http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number now and I feel like I don't even know where to start even if I follow the link to Arithmetic Operators. Any suggestions on how to approach this without looking at others' solutions?
@bravo1c
Sep 03 2015 12:44
i dont know where to start,
i'm there now @Cicero82
Cicero82
@Cicero82
Sep 03 2015 12:45
so you feel my pain @bravo1c
i feel like whatever came before hasn't really prepared me for this lol
@bravo1c
Sep 03 2015 12:45
yea i do, ' im so confused @Cicero82
i dont think that i just dont know where to start with the code or where to start. i have found that you can use loops but dont know if that wil pass the test
Robert Richey
@0x0936
Sep 03 2015 12:46
@bravo1c mathematically, do you know how factorials work?
@bravo1c
Sep 03 2015 12:47
yea, its just the multiplication table.. right? @0x0936
factors if you will
DTing
@dting
Sep 03 2015 12:48
$n! = 1$ if $n = 0$
$n! = n \times (n - 1)!$ if $n > 0$
$n! = n \times (n - 1) \times (n - 2)!$
...
$n! = n \times (n -1) \times (n - 2) \times ... \times 1$
Robert Richey
@0x0936
Sep 03 2015 12:48
!5 is 5 * 4 * 3 * 2 * 1 = 120
DTing
@dting
Sep 03 2015 12:48
so there are 2 ways to so this either using recursion or using a loop
@bravo1c
Sep 03 2015 12:49
i totaly get the code but dont know how to enter this in java @0x0936 @dting
where to place it and how @dting @0x0936
DTing
@dting
Sep 03 2015 12:49
how would you do a loop to multiple numbers from 1 to n?
is basically the challenge using a loop
Robert Richey
@0x0936
Sep 03 2015 12:49
it's recursively multiplying itself * itself - 1 until reaching 1
DTing
@dting
Sep 03 2015 12:51
@bravo1c do you know how to make a for loop?
@bravo1c
Sep 03 2015 12:51
okay, but where do i place this information as i know the sample is to be placed in the code but dont know where
DTing
@dting
Sep 03 2015 12:51
oh
@bravo1c
Sep 03 2015 12:51
@dting @-
DTing
@dting
Sep 03 2015 12:51
inside the function
bf factorial
CamperBot
@camperbot
Sep 03 2015 12:51

## :fire:Bonfire: Factorialize a Number :link:

function factorialize(num) {
return num;
}

factorialize(5);

Return the factorial of the provided integer.

more info:  bf details | bf links | hint

DTing
@dting
Sep 03 2015 12:51
function factorialize(num) {
}
@bravo1c
Sep 03 2015 12:53
Oh I see now, God I feel stupid.
Cicero82
@Cicero82
Sep 03 2015 12:53
don't cos i'm even more stupid
haha
thanks i'm going to go work on this some more at home
CamperBot
@camperbot
Sep 03 2015 12:53
if you want to thank someone, put an @ before their name!
Cicero82
@Cicero82
Sep 03 2015 12:54
thanks @0x0936 @dting