These are chat archives for FreeCodeCamp/Help

6th
Oct 2017
Darren
@DarrenfJ
Oct 06 2017 00:00
thanks to all the regulars for hanging out and helping out
thanks @Manish-Giri @Gersho @GitHub-Henry @faraco @sjames1958gm @daddycardona @ericmiller777 @alexanderkopke @thekholm80
CamperBot
@camperbot
Oct 06 2017 00:04
darrenfj sends brownie points to @manish-giri and @gersho and @github-henry and @faraco and @sjames1958gm and @daddycardona and @ericmiller777 and @alexanderkopke and @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1665 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:cookie: 312 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
:cookie: 371 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 6621 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 1499 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:cookie: 520 | @gersho |http://www.freecodecamp.com/gersho
:cookie: 370 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 8517 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 378 | @faraco |http://www.freecodecamp.com/faraco
Kyle Holm
@thekholm80
Oct 06 2017 00:04
@DarrenfJ no, thank you
CamperBot
@camperbot
Oct 06 2017 00:04
thekholm80 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2087 | @darrenfj |http://www.freecodecamp.com/darrenfj
Gersho
@Gersho
Oct 06 2017 00:04

@DarrenfJ no, thank you

i didn't notice the comma at first lol

CamperBot
@camperbot
Oct 06 2017 00:04
gersho sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2088 | @darrenfj |http://www.freecodecamp.com/darrenfj
Kyle Holm
@thekholm80
Oct 06 2017 00:05
lol i had to actually retype it for just that reason
Gersho
@Gersho
Oct 06 2017 00:05
xD
Darren
@DarrenfJ
Oct 06 2017 00:07
@mbmontana a great article about just that (AJAX being too easy in fCC) https://medium.com/p1xts-blog/if-you-are-struggling-with-the-freecodecamp-intermediate-projects-9f7fe943601c funny plus with links to more detailed learnings
nothankyou ;)
Manish Giri
@Manish-Giri
Oct 06 2017 00:08
@DarrenfJ ty
CamperBot
@camperbot
Oct 06 2017 00:08
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2089 | @darrenfj |http://www.freecodecamp.com/darrenfj
Henry
@GitHub-Henry
Oct 06 2017 00:23
@DarrenfJ thanks for the brownies
CamperBot
@camperbot
Oct 06 2017 00:23
github-henry sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2090 | @darrenfj |http://www.freecodecamp.com/darrenfj
Long Nguyen
@longnt80
Oct 06 2017 00:55
:point_up: October 6, 2017 7:07 AM @DarrenfJ ty
CamperBot
@camperbot
Oct 06 2017 00:55
longnt80 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2091 | @darrenfj |http://www.freecodecamp.com/darrenfj
Kingsley
@Kingwindie
Oct 06 2017 01:58
```
ctx.rect(window.innerWidth / 2,window.innerHeight / 2,60,120);
is this the right way to center a canvas rectangle in the middle of the screen?
John Gabriel Simmons
@sosmaniac-FCC
Oct 06 2017 02:06
I do not understand why x.domain is throwing a typeerror in this code. y.domain functions just fine, so I do not get why x.domain is not following suit. I am almost certain it is not a typographical issue: https://codepen.io/sosmaniac/pen/WZZpLJ/?editors=0110
piteto
@piteto
Oct 06 2017 02:08
@Kingwindie center a <canvas> element just like an image. Use text-center on the parent, or make it a block element and use margin-left/right auto
Kingsley
@Kingwindie
Oct 06 2017 02:09
@piteto thanks
CamperBot
@camperbot
Oct 06 2017 02:09
kingwindie sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 206 | @piteto |http://www.freecodecamp.com/piteto
piteto
@piteto
Oct 06 2017 02:10
canvas.parentNode.style.textAlign = "center"
```
{
    "name": "fcc-learn-npm-package-json",
    "dependencies": {
        "express": "^4.14.0"
    },
    "main": "server.js",
    "scripts": {
        "start": "node server.js"
    },
    "engines": {
        "node": "4.4.5"
    },
    "repository": {
        "type": "git",
        "url": "https://idontknow/todo.git"
    },
  "author": "Author"
}
```
repost from 4 hours ago
piteto
@piteto
Oct 06 2017 03:14
@knight2 I haven't done that challenge, but from looking through package.json files on my local computer, properties are listed alphabetically, and "author" has a "name" property
for eslint, for example:
  "author": {
    "name": "Nicholas C. Zakas",
    "email": "nicholas+npm@nczconsulting.com"
  },
According to this, the name field is required, email is optional. https://docs.npmjs.com/files/package.json#people-fields-author-contributors
Darren
@DarrenfJ
Oct 06 2017 04:39
evening fCC
Henry
@GitHub-Henry
Oct 06 2017 04:51
@DarrenfJ hello
Claudio Restifo
@Marmiz
Oct 06 2017 04:57
@DarrenfJ :wave:
heroiczero
@heroiczero
Oct 06 2017 05:40
@Manish-Giri @DarrenfJ @longnt80 @GitHub-Henry TY @piteto @Gersho @faraco :)
CamperBot
@camperbot
Oct 06 2017 05:40
heroiczero sends brownie points to @manish-giri and @darrenfj and @longnt80 and @github-henry and @piteto and @gersho and @faraco :sparkles: :thumbsup: :sparkles:
:cookie: 372 | @github-henry |http://www.freecodecamp.com/github-henry
:cookie: 522 | @gersho |http://www.freecodecamp.com/gersho
:cookie: 379 | @faraco |http://www.freecodecamp.com/faraco
:cookie: 591 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 2092 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 6624 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 208 | @piteto |http://www.freecodecamp.com/piteto
Henry
@GitHub-Henry
Oct 06 2017 05:42
@heroiczero thank you for the brownies
CamperBot
@camperbot
Oct 06 2017 05:42
github-henry sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1827 | @heroiczero |http://www.freecodecamp.com/heroiczero
Long Nguyen
@longnt80
Oct 06 2017 05:42
@heroiczero ty :)
CamperBot
@camperbot
Oct 06 2017 05:42
longnt80 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1828 | @heroiczero |http://www.freecodecamp.com/heroiczero
Seah Eng Chye
@Seahchye
Oct 06 2017 12:17
hello!
anyone done the chunky monkey challenge?
Stephen James
@sjames1958gm
Oct 06 2017 13:18
@Seahchye Yes.
Ken Haduch
@khaduch
Oct 06 2017 13:35
@Seahchye - yes on chunky monkey- are you making progress?
Seah Eng Chye
@Seahchye
Oct 06 2017 13:48
@khaduch yea, i can slice the array
but dont quite understand how to form another array
Stephen James
@sjames1958gm
Oct 06 2017 13:49
@Seahchye push onto an empty array.
var result = [];
result.push(/*Slice from array*/);
@Seahchye You'll need some sort of loop
Ken Haduch
@khaduch
Oct 06 2017 13:59
@Seahchye - yes, exactly what @sjames1958gm said - set up an empty array, and as you divide the input array into sub-arrays, just push those individual arrays onto the result.
Seah Eng Chye
@Seahchye
Oct 06 2017 13:59
@sjames1958gm @khaduch let me try
Ken Haduch
@khaduch
Oct 06 2017 14:01
@Seahchye - the .slice() should return arrays, so you then have those to .push() to the result array - post your code if you have more questions.
Seah Eng Chye
@Seahchye
Oct 06 2017 14:04
blob
something like that or?
blob
@khaduch @sjames1958gm corrected
Ken Haduch
@khaduch
Oct 06 2017 14:08
@Seahchye - you'll need a loop to make sure that you process the entire input array - what you have would be returning the first "chunk"...
Seah Eng Chye
@Seahchye
Oct 06 2017 14:09
@khaduch yea i got the first chunk
@khaduch i try
@khaduch potential infinite loop at line 5
blob
Ken Haduch
@khaduch
Oct 06 2017 14:14
@Seahchye - you need to modify i in your for loop - so you need i = i + size or i += size - otherwise your loop will not end!
Seah Eng Chye
@Seahchye
Oct 06 2017 14:15
@khaduch i see!
blob
@khaduch what i get now
Ken Haduch
@khaduch
Oct 06 2017 14:19
@Seahchye - the end parameter that you pass to .slice() has to be a larger index than the start parameter - size will always be the same. You have to calculate some other value that is larger relative to the i value... that is, if your i is 2, you have a size of 2, you want end to be greater than 2.
Seah Eng Chye
@Seahchye
Oct 06 2017 14:22
@khaduch how can i do that?
Ken Haduch
@khaduch
Oct 06 2017 14:24

@Seahchye - well, you are using i for the begin argument. And the end argument is related to the begin argument combined with size. And the documentation for .slice() says:

The slice() method returns a shallow copy of a portion of an array into a new array object selected from begin to end (end not included). The original array will not be modified.

So you just calculate a value for end based on begin (which you are generating with i) and the size....

Seah Eng Chye
@Seahchye
Oct 06 2017 14:30
i will try again another time
thanks @khaduch @sjames1958gm for guiding me
CamperBot
@camperbot
Oct 06 2017 14:30
seahchye sends brownie points to @khaduch and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 3343 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 8518 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Seah Eng Chye
@Seahchye
Oct 06 2017 14:30
sheers
cheers
Ken Haduch
@khaduch
Oct 06 2017 14:44
@Seahchye - okay - keep those hints and think about that solution later! Good luck!
Stephen James
@sjames1958gm
Oct 06 2017 14:54
@Seahchye :+1:
Mike Batista
@mbmontana
Oct 06 2017 15:31
@DarrenfJ Just read it. Thanks. Is there a way to start at the beginning in Free Code Camp? Could I add an account with a different email address?
CamperBot
@camperbot
Oct 06 2017 15:31
mbmontana sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2093 | @darrenfj |http://www.freecodecamp.com/darrenfj
Momozor
@momozor
Oct 06 2017 16:20
Darren
@DarrenfJ
Oct 06 2017 17:14
morning fCC
my usual thanks to the regulars :D thanks @GitHub-Henry @Marmiz @heroiczero @Manish-Giri @Gersho @faraco @khaduch @sjames1958gm keep coding and keep this place chill :D
CamperBot
@camperbot
Oct 06 2017 17:16
darrenfj sends brownie points to @github-henry and @marmiz and @heroiczero and @manish-giri and @gersho and @faraco and @khaduch and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 374 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 1054 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 1832 | @heroiczero |http://www.freecodecamp.com/heroiczero
:cookie: 380 | @faraco |http://www.freecodecamp.com/faraco
:star2: 3344 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 6625 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 8519 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 523 | @gersho |http://www.freecodecamp.com/gersho
Darren
@DarrenfJ
Oct 06 2017 17:17
@mbmontana I think you can.. but you can also reset.. i can't remember how...
but what I would recommend is goto the map and go through the exercises resetting them before you do them again
or try out the early part of the beat (which doesn't save your progress or let you login but has more detail on each exercise)
Ken Haduch
@khaduch
Oct 06 2017 17:17
@DarrenfJ - thanks to you, too - it's good to keep some life in this place... :)
CamperBot
@camperbot
Oct 06 2017 17:17
khaduch sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2094 | @darrenfj |http://www.freecodecamp.com/darrenfj
Albert Cardona II
@daddycardona
Oct 06 2017 17:18
so I found out that _.flatten(arr) would do what I need it to do for the steam roller exercise , unfortunately I can not use it because I can not use document.write(the site for underscore js) on the stupid fcc challenge dammit lol
thanks @GitHub-Henry @Marmiz @heroiczero @Manish-Giri @Gersho @faraco @khaduch @sjames1958gm
CamperBot
@camperbot
Oct 06 2017 17:18
daddycardona sends brownie points to @github-henry and @marmiz and @heroiczero and @manish-giri and @gersho and @faraco and @khaduch and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1055 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 1833 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 6626 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 8520 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 375 | @github-henry |http://www.freecodecamp.com/github-henry
:cookie: 524 | @gersho |http://www.freecodecamp.com/gersho
:star2: 3345 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 381 | @faraco |http://www.freecodecamp.com/faraco
Albert Cardona II
@daddycardona
Oct 06 2017 17:18
and thanks @DarrenfJ
CamperBot
@camperbot
Oct 06 2017 17:18
daddycardona sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2095 | @darrenfj |http://www.freecodecamp.com/darrenfj
Mike Batista
@mbmontana
Oct 06 2017 17:18
@DarrenfJ So you mean go back to the earlier exercises and clear my code? ... Meanwhile, I'm taking a free Intro to Ajax course on Udacity to get a better understanding.
Albert Cardona II
@daddycardona
Oct 06 2017 17:19
yes @mbmontana Ajax gets confusing before javascript I use to only use it for cleaning bathrooms lol
Darren
@DarrenfJ
Oct 06 2017 17:19
@daddycardona forgot to add you in there too thanks!
CamperBot
@camperbot
Oct 06 2017 17:20
darrenfj sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 371 | @daddycardona |http://www.freecodecamp.com/daddycardona
Albert Cardona II
@daddycardona
Oct 06 2017 17:21
thank you man
Darren
@DarrenfJ
Oct 06 2017 17:21
@mbmontana yah you can go back and reset exercises go get a coffee to let the short term memory of seeing your solution fade away and start in on it from scratch..
Albert Cardona II
@daddycardona
Oct 06 2017 17:21
function steamrollArray(arr) {
    // I'm a steamroller, baby

    var flattened = arr.reduce(function(a, b) {
        return a.concat(b);
    }, []);

    console.log(flattened)
        //return x;
}
Darren
@DarrenfJ
Oct 06 2017 17:21
Ken Haduch
@khaduch
Oct 06 2017 17:22
@daddycardona - hi there neighbor - so where are you on the steamroller exercise?
Albert Cardona II
@daddycardona
Oct 06 2017 17:22
it took me forever to figure that i needed the },[] <--);
Ken Haduch
@khaduch
Oct 06 2017 17:22
is that working?
Albert Cardona II
@daddycardona
Oct 06 2017 17:23
well I am lost getting rid of the extra array on it like the `[[4]]1
Ken Haduch
@khaduch
Oct 06 2017 17:23
so it's not working...
Albert Cardona II
@daddycardona
Oct 06 2017 17:23
well it workes the result is 1 1 : 2 2 : 3 3 : Array(1) 0 : 4
Ken Haduch
@khaduch
Oct 06 2017 17:24
.reduce() is really powerful - but I think that you need a recursive call for this? I haven't thought about using .reduce() for this...
Albert Cardona II
@daddycardona
Oct 06 2017 17:24
well basically it looks like this [1,2,3,[[4]]] still
Darren
@DarrenfJ
Oct 06 2017 17:25
@daddycardona ah gawd you made me go back and look at mine
Albert Cardona II
@daddycardona
Oct 06 2017 17:25
yes I know I have been trying to figure something else out because I was wondering how come it did not work originally telling me that a.concat(b) is not a function and I am like yes it is, but i needed to add the }[]
Darren
@DarrenfJ
Oct 06 2017 17:25
and i left this little note for myself:
// this [recursivity [is [driving [me [nuts]]]]]

  return newArr;
}

steamrollArray([1, [2], [3, [[4]]]]);
Albert Cardona II
@daddycardona
Oct 06 2017 17:26
},[]
@DarrenfJ lol
Ken Haduch
@khaduch
Oct 06 2017 17:26
@DarrenfJ :smile:
Darren
@DarrenfJ
Oct 06 2017 17:27
i'm no kidding.. i don't even remember leaving myself that.. HA! and now i have to try to figure what i tried and why
thanks for that ;)
Albert Cardona II
@daddycardona
Oct 06 2017 17:27
I am like what else do I need to do now that i have the array for the most part [1,2,3,[[4]] how do i get taht sucker down again so I used another variable and just redid the reduce function again but nope that did not work lol
so I have the job half way done I am trying to see what is next because most of the calls are 3 dimensial arrays I have to fix. I guess somewhere in real life I might need this but then I will just add underscore to my page to make it easer by doing this var na = _.flatten(arr) and it works like a charm
piteto
@piteto
Oct 06 2017 17:33
@daddycardona Maybe you could get some inspiration from underscore on how they build the flatten function? :) https://github.com/jashkenas/underscore/blob/master/underscore.js#L527
Albert Cardona II
@daddycardona
Oct 06 2017 17:34
Oh I will thanks I was looking for that just now thanks @piteto
CamperBot
@camperbot
Oct 06 2017 17:34
:cookie: 212 | @piteto |http://www.freecodecamp.com/piteto
daddycardona sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
piteto
@piteto
Oct 06 2017 17:34
Seems like you're going for a 1-2 liner, and their for loop implementation with multiple if/else's could spark some ideas
It would be cool to figure out how to get underscore loaded in the fcc exercises
var s = document.createElement('script');
s.src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js";
document.body.appendChild(s);
maybe promisify that in your function
Albert Cardona II
@daddycardona
Oct 06 2017 17:38
that didn't work lol
I tried that
Ken Haduch
@khaduch
Oct 06 2017 17:40
yeah, but aren't they trying to cover (more-or-less) "vanilla" JS code in the JS sections? Loading a library of other JS functions defeats the purpose. Although it would make things easier - like loading a math package, etc... :)
Albert Cardona II
@daddycardona
Oct 06 2017 17:41
I know I understand the concepts of some math but however I don't or can't seem to get them into the flow of codes
Ken Haduch
@khaduch
Oct 06 2017 17:47
@daddycardona - someone else was having a discussion about that concept here (in one of the rooms) during the early morning hours. It's tricky - I used to work with someone and tried to spend time helping them with coding tasks and for some reason I never could break through a barrier that seemed to keep them from "getting it"... I know that I have my own roadblocks to understanding things, too. I've just been doing this for a long time (when employed) and sometimes I've gone back and looked at code that I wrote and said to myself "did I write this?" I think that there is "a zone" that you get into where things start to flow and you start to understand and think in ways that make the problems and solutions different. I don't know how to make that happen, though...
Albert Cardona II
@daddycardona
Oct 06 2017 17:49
LOL @khaduch I feel you I was on a flow for like 4 challenges in a row then bam lol
stupid steam roller lol
Ken Haduch
@khaduch
Oct 06 2017 17:50
@daddycardona - recursion is the key to this one, although you might possibly do it without recursion. I'm not going to look at my solution and just throw and idea together and pass it along... give me a few minutes.
Albert Cardona II
@daddycardona
Oct 06 2017 17:50
okay
Ken Haduch
@khaduch
Oct 06 2017 18:00
@daddycardona - okay, here is a code example that illustrates finding the arrays and processing them recursively. It does output stuff to console.log - put it in the environment of your choice, maybe like http://pythontutor.com/javascript.html and see what it does. Maybe I should say: SPOILER ALERT!!!
let count = 0;
function arrayFlatten(arr){
  if (count++ > 200) {
    console.log("looks like a loop");
    return;
  }
  if (Array.isArray(arr)){
    console.log(`Found an array: ${JSON.stringify(arr)}`);
    for (let i=0; i < arr.length; i++){
      arrayFlatten(arr[i]);
    }
  } else {
    console.log(`Not an array: ${JSON.stringify(arr)}`);
    return;
  }

}
arrayFlatten([1,[2,3],4,5,[[6]]]);
I just put a loop catcher in there because I accidentally made a coding error initially. :)
it will print "found an array" if it finds an array as the input. And will walk though the array with a for loop. If it doesn't find an array, it will just print the element.
Albert Cardona II
@daddycardona
Oct 06 2017 18:02
I was just looking up stringify for just javascript not jquery because you would have to use javascript only lol
I was also looking up how to use a for loop like varName.for()
Ken Haduch
@khaduch
Oct 06 2017 18:03
@daddycardona - I only use it because you don't always see the structure properly if you just console.log it... AND it's a javascript feature, at least it's documented on MDN...
Albert Cardona II
@daddycardona
Oct 06 2017 18:05
I was thinking that I know the arr is going to always put it like in a array like [1,etc.. but I just stringify it 1st would it not just be 1 2 3 4? when I document.write it it shows up like 1,2,3,4
Ken Haduch
@khaduch
Oct 06 2017 18:06
I've just gotten to use it as a failsafe in console.log outputs, since I never really figured out when I see the actual text format of the array / object, or it just outputs [Object object] sometimes... :)
Albert Cardona II
@daddycardona
Oct 06 2017 18:06
LOL yes I seen that so many times lol
especially if you put like console.log(arr+'bla')
Ken Haduch
@khaduch
Oct 06 2017 18:10

@daddycardona - this is the output that I get for that example that I put in to call my function:

"Found an array: [1,[2,3],4,5,[[6]]]"
"Not an array: 1"
"Found an array: [2,3]"
"Not an array: 2"
"Not an array: 3"
"Not an array: 4"
"Not an array: 5"
"Found an array: [[6]]"
"Found an array: [6]"
"Not an array: 6"

So when it says "Found an array", then it calls the function again, by assuming that you have an array to loop through. When it says "Not an array", that is something that was "flattened".

Albert Cardona II
@daddycardona
Oct 06 2017 18:12
I originally used is array in a for loop,
for(; ; ){
  if(Array.isArray(arr[i])){
    newArr.push(arr[i]);
}
}
I think I need a new approach lol or new for loop
@DarrenfJ okay dam I need to do something like that then when it is not an array you can .push that sucker to an array I like that thinking
Ken Haduch
@khaduch
Oct 06 2017 18:14
well, you only want to loop on something when it is an array. If the argument that you receive is not an array, then you just have a value that you need to push on your result array....
Albert Cardona II
@daddycardona
Oct 06 2017 18:20
Yeah I need to learn how to do that properly lol
thanks @DarrenfJ and @khaduch
CamperBot
@camperbot
Oct 06 2017 18:20
daddycardona sends brownie points to @darrenfj and @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2096 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 3346 | @khaduch |http://www.freecodecamp.com/khaduch
Albert Cardona II
@daddycardona
Oct 06 2017 18:20
I really need to understand that
Ken Haduch
@khaduch
Oct 06 2017 18:21
@daddycardona - take that code and go to http://pythontutor.com/javascript.html and walk through it - maybe it will be helpful? I don't exactly know what it will show you as far as the recursion? Maybe I'll go and try it myself?
@khaduch - well, pythontutor wouldn't run it - maybe it doesn't like recursive calls? Or maybe just a glitch... LOL...
Albert Cardona II
@daddycardona
Oct 06 2017 18:32
LMAO
Golam Rabbani
@Rabbani007
Oct 06 2017 18:32
ok I am back like after 7 months
where did the help button on freecodecamp?
Ken Haduch
@khaduch
Oct 06 2017 18:33
@Rabbani007 - each exercise has a "Help" button now, I think? It brings you here... if that's what you're asking? WAIT - i might be wrong. They were (or are) trying to shift help requests to the forum and not here to the chat? I haven't visited the forum to see what is going on with that. It has definitely changed the usage model for these chat rooms.
Henry
@GitHub-Henry
Oct 06 2017 18:34
@daddycardona @DarrenfJ Thanks for the brownies. Check this out . I added it to VS Code.
CamperBot
@camperbot
Oct 06 2017 18:34
github-henry sends brownie points to @daddycardona and @darrenfj :sparkles: :thumbsup: :sparkles:
:cookie: 372 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 2097 | @darrenfj |http://www.freecodecamp.com/darrenfj
Albert Cardona II
@daddycardona
Oct 06 2017 18:35
check what out
Golam Rabbani
@Rabbani007
Oct 06 2017 18:35
this chat rooms were the best for helps
now it really sucks
artbohr
@artbohr
Oct 06 2017 18:35
Guys I need help with the "make the app able to edit the recipes" user story.
I'm trying to pop up a Modal after pressing the EDIT button inside the recipe, but I can't figure where I should RENDER the modal in the first place and how to pass him all the props in a good way without repeating code and other bad habits, really confused on how to pop this modal, how to pass it the information (recipe title, ingridients) and how to change the state given the new parametrs, so resuming, the whole editing user story isn't coming my way, can you help me to solve this matter?
here is the project: https://codepen.io/artbohr/pen/GvXxwY
Albert Cardona II
@daddycardona
Oct 06 2017 18:37
I would put the edit button on each desert
or like where it says apple pie on that line it should populate to the right of each recipe
Ken Haduch
@khaduch
Oct 06 2017 18:39
@Rabbani007 - well, there are still a few regular visitors here that help out a lot - it has gotten a lot quieter than it used to be. The forum seems like kind of a good idea - they mention that it is "like a stackoverflow site for campers" - so repetitive questions might be a thing of the past when it catches on....
artbohr
@artbohr
Oct 06 2017 18:39
@daddycardona I'm asking a technical "react " related question not a design question
Albert Cardona II
@daddycardona
Oct 06 2017 18:39
oh okay @artbohr not there yet
Golam Rabbani
@Rabbani007
Oct 06 2017 18:43
these help rooms were the best....I could get instant help and there was a window linked with this room.....now i have to go to the FORUM. that really upsets me..
Albert Cardona II
@daddycardona
Oct 06 2017 18:43
@GitHub-Henry I just loaded it to my vscode as well I don't know how it is doing that lol
Henry
@GitHub-Henry
Oct 06 2017 18:45
i think Quincy sent a note pushing folks to forums
@daddycardona Learn about JS Classes and see Quokka in action.
the guy knows his JS
Albert Cardona II
@daddycardona
Oct 06 2017 18:49
is that you @GitHub-Henry
Ken Haduch
@khaduch
Oct 06 2017 18:49
@Rabbani007 - just save a bookmark to the chat rooms - people have been using it, maybe just "tree huggers" like me... :) They do have a link to the chat rooms, but from the freeCodeCamp "dashboard" for your account, you have to follow the "Update My Settings" link at the top... kind of a non sequitur.... "Chat with other campers in real time" is the button there.
Henry
@GitHub-Henry
Oct 06 2017 18:49
no, that guy is from Europe, his name escapes me for the moment.
Stephen James
@sjames1958gm
Oct 06 2017 18:53
@artbohr I know that modals in react are a bone of contention - React 16 has added something called fragments to alleviate this issue.
This blog post talks about modals, and is not too old (just last Dec.)
Henry
@GitHub-Henry
Oct 06 2017 18:53
@daddycardona I do recommend spending some time watching his channel, cuz he does a covers many JS topics , but he's not for beginners.
Albert Cardona II
@daddycardona
Oct 06 2017 18:54
dammit lol I will watch him he is atleast funny lol @GitHub-Henry
Henry
@GitHub-Henry
Oct 06 2017 18:58
@daddycardona yeah, kinda hard to make programming topics entertaining and educational, he tries to do both
Albert Cardona II
@daddycardona
Oct 06 2017 18:58
yes I know reminds me of bucky just wild lol :)
he is from the The New Boston
Henry
@GitHub-Henry
Oct 06 2017 19:00
Bucky has a large number of videos, amazing
Albert Cardona II
@daddycardona
Oct 06 2017 19:08
yes he was the one I went to for everything
@GitHub-Henry do i have to have node.js in my computer to use this?
quoka.js
Henry
@GitHub-Henry
Oct 06 2017 19:10
@daddycardona yes
Albert Cardona II
@daddycardona
Oct 06 2017 19:11
I guess I have to install it boo lol
Henry
@GitHub-Henry
Oct 06 2017 19:13
@daddycardona once you start using node.js it's uses keeps growing, cuz there's so much you can do with it
Albert Cardona II
@daddycardona
Oct 06 2017 19:13
I have not used it yet lol
Albert Cardona II
@daddycardona
Oct 06 2017 19:22
well I got it working thank God I hate having to console.log everything from vscode
Henry
@GitHub-Henry
Oct 06 2017 19:23
@GitHub-Henry since you are new to NPM. you might want to read this. in short, he suggest avoid global installs. he lists reasons. take away suggestion use '--save-dev' instead of using '-g'.
Albert Cardona II
@daddycardona
Oct 06 2017 19:24
I don't know what i did I just installed it lol
artbohr
@artbohr
Oct 06 2017 19:26
@sjames1958gm hey, what post? Didn't get the link, thank you for referring to this new method.
CamperBot
@camperbot
Oct 06 2017 19:26
artbohr sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8521 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Henry
@GitHub-Henry
Oct 06 2017 19:27
@daddycardona npm can seem overwhelming at first, when you find yourself looking for solutions you'll see some that use node.js and you can check it out and see if it works for you. it's amazing how much is done using node.js
Albert Cardona II
@daddycardona
Oct 06 2017 19:29
@GitHub-Henry How do you save your js file that is using the quoka.js
what extension
Henry
@GitHub-Henry
Oct 06 2017 19:29
js
Albert Cardona II
@daddycardona
Oct 06 2017 19:30
Okay it keeps going straight to babel when I opt to save it
Henry
@GitHub-Henry
Oct 06 2017 19:30
@daddycardona mine just saved as js
artbohr
@artbohr
Oct 06 2017 19:31
@sjames1958gm had a short google search and didn't find anything of use :( (modals/fragments wise) also still not clear how to implement all this information handling to make it edittable
Albert Cardona II
@daddycardona
Oct 06 2017 19:31
Okay I don't know why I don't even see the extension javascript lol
okay so it basically saves as a js file but once you save it , it won't open up as a quoka.js file lol
Henry
@GitHub-Henry
Oct 06 2017 19:35
@daddycardona when you reopen you need to CTRL + K Q to restart Quokka
in vs code in windows environment
leonaaa
@leonaaa
Oct 06 2017 19:40

function firstRepeatingLetter(str){

  for(var i = 0; i<str.length; i++){
    var remaining = str.slice(i+1);
    if(remaining.indexOf(str[i]) !== -1) {
      return str[i];
   }
  }
  return str;
}

firstRepeatingLetter("Repetition") // => "e"
Albert Cardona II
@daddycardona
Oct 06 2017 19:40
okay that is what it is I don't need to keep making a new one lol
leonaaa
@leonaaa
Oct 06 2017 19:41
can someone explain to me why we’re using ‘str.slice(i+1)’?
noob question here, lol
Albert Cardona II
@daddycardona
Oct 06 2017 19:41
I wouldn't use it at all
I would do str += str
leonaaa
@leonaaa
Oct 06 2017 19:42
hmm, it would return ‘R'
Albert Cardona II
@daddycardona
Oct 06 2017 19:43
oh no I am sorry it would retjrn thewhole word
what you trying to return R a bunch of times I don't understand what you trying to do?
leonaaa
@leonaaa
Oct 06 2017 19:43
I don’t understand how the .slicei+1 works though
Albert Cardona II
@daddycardona
Oct 06 2017 19:43
me either lol
leonaaa
@leonaaa
Oct 06 2017 19:43
Write a function firstRepeatingLetter that finds the first repeating letter in a string (i.e. the character which occurs more than once in a given string). The return value of your function should be a string consisting of only single character which is the first repeated character in the string.
leonaaa
@leonaaa
Oct 06 2017 19:44
trying to find the first repeating letter in the test case, which is e. it is the first letter that appears two times in the word, repetition
i understand how the slice method works, but i’m not sure how it works with ‘+1'
artbohr
@artbohr
Oct 06 2017 19:45
@leonaaa just add one index further
adds*
Albert Cardona II
@daddycardona
Oct 06 2017 19:46
I would of done that differently so I am the worse to ask I am in the same boat you are lol
leonaaa
@leonaaa
Oct 06 2017 19:47
@artbohr do you know why it’s necessary in the problem to do that?
@daddycardona lol haha it’s okay. we’re both learning here i guess
@artbohr if i did i+2 or i+3, it still returns ‘e’, which is the correct answer to the test case
artbohr
@artbohr
Oct 06 2017 19:48
@leonna maybe it can be because the first character can be repeating itself
can't
leonaaa
@leonaaa
Oct 06 2017 19:48
actually, if i did i+3.. it returns the entire word
artbohr
@artbohr
Oct 06 2017 19:50
@leonna you need to use console.log(); to understand what's going on or use python tutor
@leonna
function firstRepeatingLetter(str){

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


    var remaining = str.slice(i+3);
    console.log(remaining);
    if(remaining.indexOf(str[i]) !== -1) {
      return str[i];
   }
  }
  return str;
}

firstRepeatingLetter("Repetition") // => "e"
@leonna i+3 outputs this
etition
tition
ition
tion
ion
on
n



=> 'Repetition'
leonaaa
@leonaaa
Oct 06 2017 19:51
oooh
artbohr
@artbohr
Oct 06 2017 19:52
@leonna gotta go, could help more later, after I'm back, if it's still needed, sry
leonaaa
@leonaaa
Oct 06 2017 19:52
no thanks! that explains
no, thanks**
artbohr
@artbohr
Oct 06 2017 19:52
@leonna if you want to give coockies you need to add "@artbohr" to reference to me, you don't have to, just explaining how coockies works in here
leonaaa
@leonaaa
Oct 06 2017 19:52
what’s that?
ohhh the @artbohr
haha thanks :) @artbohr
CamperBot
@camperbot
Oct 06 2017 19:53
leonaaa sends brownie points to @artbohr :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @artbohr |http://www.freecodecamp.com/artbohr
artbohr
@artbohr
Oct 06 2017 19:53
@leonna ye, it's whats used here xD gl, afk
leonaaa
@leonaaa
Oct 06 2017 19:57
@artbohr you definitely spelled my username wrong but that’s okay LOL
@artbohr i’ll give ya a break, you helped me out here haha
artbohr
@artbohr
Oct 06 2017 20:06
@leonaaa sry, the hurry took over :D
@leonaaa so you solved the mystery or still need some help?
leonaaa
@leonaaa
Oct 06 2017 20:07
i’m good! @artbohr it made sense after the console.log
Thanks again @artbohr
CamperBot
@camperbot
Oct 06 2017 20:07
leonaaa sends brownie points to @artbohr :sparkles: :thumbsup: :sparkles:
api offline
artbohr
@artbohr
Oct 06 2017 20:08
@leonaaa sure, glad it helped, keep using that console.log, it makes all the difference to understand what's going on
Nick Cleary
@Hijerboa
Oct 06 2017 22:26
Hey, can someone explain to me why in the symmetric return algorithm (https://www.freecodecamp.org/challenges/symmetric-difference), in the second test case, the correct return includes 5? 5 is in all the arrays provided, so why is it part of the symmetric difference?
perhaps I'm missunderstanding the definition of symmetric difference? Isn't it just any values which appear in one case, but no more than one?
piteto
@piteto
Oct 06 2017 22:28
@Hijerboa This video explains it pretty well - only a 5minute video: https://www.youtube.com/watch?v=PxffSUQRkG4
Nick Cleary
@Hijerboa
Oct 06 2017 22:31
@piteto oohhhhhh so if there are three arrays, and the value appears in three or more, then its ok?
piteto
@piteto
Oct 06 2017 22:31
Yes, exactly @Hijerboa
Nick Cleary
@Hijerboa
Oct 06 2017 22:32
that makes so much more sense. @piteto thank you!
CamperBot
@camperbot
Oct 06 2017 22:32
hijerboa sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 213 | @piteto |http://www.freecodecamp.com/piteto
piteto
@piteto
Oct 06 2017 22:32
Now, if we could figure out when to use it in real life :p
Nick Cleary
@Hijerboa
Oct 06 2017 22:34
@piteto maybe when one goes to get a job and they ask you to do it, but then never ask you to do anything like it again?