These are chat archives for FreeCodeCamp/Help

25th
Jun 2018
Carlos Alfaro
@devbysalas
Jun 25 2018 00:37

Hello guys, I got stuck. Any idea why it's not working?

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/import-a-default-export

"use strict";
import add from "./math_functions";
subtract(7,4);
Kyle Holm
@thekholm80
Jun 25 2018 00:38
you're importing add not subtract
In the following code, please import the default export, subtract, from the file "math_functions", found in the same directory as this file.
Carlos Alfaro
@devbysalas
Jun 25 2018 00:38
@thekholm80 oh god! haha thank you!!!!!
Kyle Holm
@thekholm80
Jun 25 2018 00:39
:+1:
Carlos Alfaro
@devbysalas
Jun 25 2018 00:45
@thekholm80 Quick question. I just finish the ES6 section, but I don't think I got all the knowledge down. Should I go back and go through it again or keep going?
Kyle Holm
@thekholm80
Jun 25 2018 00:45
it won't hurt to go through it again, but if you're anything like me the best way to retain it is to use it in projects
Carlos Alfaro
@devbysalas
Jun 25 2018 00:46
Makes total sense. Thank you!
Makes total sense. Thank you! @thekholm80
Kyle Holm
@thekholm80
Jun 25 2018 00:47
you might check out something like codewars or codefights, get some practice writing algos
lots of fun, too
Bjorn van de Peut
@bjorno43
Jun 25 2018 00:50
@devbysalas It's pretty normal not to remember everything by head. The imporant part is that you have a general idea. Like if someone requests you to make something, you have a general idea on how to realise it. Having to Google around a bit to actually turn it into functional code is perfectly acceptable. Like if someone asks me to create a chatsystem, I know I'm gonna need a websocket, a database, etc etc. But don't believe for a second that I can just take a blank piece of paper and code it all down. And I've got 16+ years of experience in coding ;-)
Kyle Holm
@thekholm80
Jun 25 2018 00:50
i could
get on my level, bob
Bjorn van de Peut
@bjorno43
Jun 25 2018 00:51
You wish :laughing:
Kyle Holm
@thekholm80
Jun 25 2018 00:51
:stuck_out_tongue:
Smootimus
@Smootimus
Jun 25 2018 01:13
xD
Carlos Alfaro
@devbysalas
Jun 25 2018 04:23
Thank you guys! @thekholm80 @bjorno43
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:33
@devbysalas You're welcome
Anyone else still around btw?
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:33
Me
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:34
Ah cool :)
Doing anything interesting?
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:36
Yes actually!
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:37
Awesome, what are you doing?
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:38
Putting together a guide for newbies on where to start depending on what they want to do. I’m putting a team together to work on it. I know there are a few maps out there but when I was new, nothing was explained in “noob” language.
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:39
Nice :)
Claudio Restifo
@Marmiz
Jun 25 2018 04:39
@bjorno43 @DavidJamesAustin :wave:
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:39
@Marmiz :wave:
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:39
Hey!
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:40
I'm building my own codepen project, ghehe
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:40
What are you making?
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:40
I just said that :laughing: Something simular to codepen
Still in Alpha though. It works, but far from finished
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:41
Oh similar I didn’t realize that haha.
Want me to play around and let you know if I find anything?
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:43
Nah. You can play around with it to test it out if you want, but I already know the current issues :smile:
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:43
You know what happens if you do something and then click New? haha
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:43
Ye it empties all the codefields
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:43
Yeah, but not the results area.
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:44
Strange, it does for me
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:44
I’m using Safari.
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:44
Right.. And safari is a bitch when it comes to events, lol
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:44
Ah. If you click “run” with something in there, and then hit new it glitches out. That is what I did.
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:47
That is very strange.. Run basicly checks for syntax errors and displays them if there are any. It completely disables interaction with the website, so clicking on New should not be possible while errors are displayed. If there are no errors, using Run is pretty much pointless as Change events on the code fields already perform a Run event
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:47
Yeah, odd..
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:51
Hmm, Chrome and Firefox were fine, but IE detected an error. Fixed that and uploaded it. See if that helped? @DavidJamesAustin
Karma Drukpa
@coderkarma
Jun 25 2018 04:51
@bjorno43 , help needed
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:51
I can try again.
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:51
@coderkarma Woof! :laughing: What can I do for you?
Karma Drukpa
@coderkarma
Jun 25 2018 04:52
very simple problem but i am running out of idea to do this
let's say there array is given like let array = [ 5, 4,3,2,1];
have to reverse that array but with some conditions 1. have to return same array, 2. no built in function like .reverse
Bjorn van de Peut
@bjorno43
Jun 25 2018 04:55
Wait.. How can you possibly reverse an array but return the same? Or do you mean the same array, just reversed?
Karma Drukpa
@coderkarma
Jun 25 2018 04:56
yes
have to be same array just reversed . we can't create new array and push it.
I Did but my test didn't pass
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 04:58
Now it’s only happening if I click run with say invalid CSS and then try to create something new @bjorno43
Karma Drukpa
@coderkarma
Jun 25 2018 04:59
what is the problem @DavidJamesAustin
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:01
Should be rather easy:
let arr = [5,4,3,2,1];

function reverse(arr){
    let temp = [];
    for(let i = 0; i < arr.length; i++){
        temp.splice(0, 0, arr[i]);
    }
    arr = temp;
    return arr;
}

console.log(reverse(arr)); // [1,2,3,4,5]
Basicly all you do is take the value from the array and push it in the first position of the temp array @coderkarma
Karma Drukpa
@coderkarma
Jun 25 2018 05:03
oh you used splice for this .
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 05:03
@coderkarma nothing to do with fcc haha, it’s his own codepen sort of thing.
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:04
@DavidJamesAustin Ahhh, I found the issue thanks to that
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 05:04
:smile:
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:06
The code is made not to run when there are syntax errors. Mostly to prevent ppl from getting a bunch of console errors when typing JS. So when there's a syntax error, the event never gets fired when you click new, ghehe
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 05:06
Gotcha
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:10
@DavidJamesAustin I think it's fixed now
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 05:10
Awesome, I’ll look.
Karma Drukpa
@coderkarma
Jun 25 2018 05:11
@bjorno43 thank you man.
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:11
@coderkarma No problem :)
Karma Drukpa
@coderkarma
Jun 25 2018 05:11
I never thought i could use splice in that occasion
so dumb feeling
I just basically struggle with algorithms @bjorno43
I have long way to go.
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:12
Don't worrie too much about it. It takes time and experience to get used to it
My thought process is like: Alright. I need to reverse an array without using a build in function for it. So basicly I need to create a new array where I push each value in front of the last value instead of behind it. A bit of a reversed array push. What allowes me to do that? Ah. splice() allowes me to set the position of where I want to push something into an array. The rest is easy :) @coderkarma
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:20
You could also have used pop() for it. That removes the last value of an array and returns it. In that case all you had to do was use that value and push it into the temp array.
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:27
Anyway, gotta go guys. Cya around! :wave:
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 05:27
Bye!
Jonathan
@skillt3ch
Jun 25 2018 05:36
hey everyone
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 05:37
hey
Jonathan
@skillt3ch
Jun 25 2018 05:38
I’m having an issue with the FCC curriculum page, not sure if anyone else is experiencing it or if it’s expected behaviour
image.png
i’ve completed everything in the Responsive Web Design Certification, including all the projects
Whenever i refresh the page, i would expect it to bring me to the module that I’m up to
yet it always expands the Basic HTML and HTML5 section
which i’ve already completed as you can see
I’m currently up to the JavaScript ES6 section
Karma Drukpa
@coderkarma
Jun 25 2018 05:42
@bjorno43 thanks man.
Jonathan
@skillt3ch
Jun 25 2018 05:43
does this happen to anyone else or just me?
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:43
@skillt3ch It does that for everyone. The page is actually loaded before it fetches what you've completed. After that it fills it in
Jonathan
@skillt3ch
Jun 25 2018 05:44
ahh i see, i remember when i first signed up over a year ago, it would always take me to my current progress
instead of expanding the HTML section
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:46
It still does. Just not on the curriculum list. Just visit https://www.freecodecamp.org and click the big ass green button at the buttom that says "Go to the coding curriculum". It will take you to the last challenge you were at
Jonathan
@skillt3ch
Jun 25 2018 05:47
ohhh i see
@bjorno43 thank you
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:47
@skillt3ch You're welcome :)
Anyway, rly off to bed now. Gn8!
Jonathan
@skillt3ch
Jun 25 2018 05:47
I actually was so close to completing my front end cert a long time ago, and was up to the “Simon Game” (last project) and then i came back to finish the project and noticed FCC had changed quite a lot
ok, take care
Karma Drukpa
@coderkarma
Jun 25 2018 05:47
@ @bjorno43 don't sleep tonight man.
lol
just kidding, goodnight man.
Bjorn van de Peut
@bjorno43
Jun 25 2018 05:48
@coderkarma If only life allowed me such luxuries, ghehe
Gn8!@
Jonathan
@skillt3ch
Jun 25 2018 05:48
anyone having issues claiming their “Responsive Web Design” certification?
I’ve completed all the projects, yet i get the error
it looks like you have not completed the necessary steps. Please complete the required challenges to claim the Responsive Web Design
I can’t see anything I’ve missed, and all my projects are passing tests
Karma Drukpa
@coderkarma
Jun 25 2018 05:49
I haven't completed three of them so no idea sorry.
Jonathan
@skillt3ch
Jun 25 2018 05:49
@coderkarma no problem
DavidJamesAustin
@DavidJamesAustin
Jun 25 2018 05:52
@skillt3ch I made a post on the forums linking to something else that explains what is happen and how it’s being fixed. Want a link?
Jonathan
@skillt3ch
Jun 25 2018 05:54
@DavidJamesAustin yes please
Mehdi Amlal
@mehdiamlal
Jun 25 2018 07:56
Hello guys
How can I get the size of a collection using Mongoose?
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:03
Can anyone explain to me how .apply() works?
Jonathan
@skillt3ch
Jun 25 2018 10:05
i think you’re up to the same challenge as i am :laughing:
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:06
Really, which one?
i could be wrong, but i just thought it was funny that you just literally asked what I was thinking
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:09
Oh, I'm not in that challenge
Jonathan
@skillt3ch
Jun 25 2018 10:09
yeah it was a long shot
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:09
I'm in Steamroller one.
Jonathan
@skillt3ch
Jun 25 2018 10:09
ahh i see
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:10
And to be honest, I don't bother with ES6 in freecodecamp.
Jonathan
@skillt3ch
Jun 25 2018 10:10
why’s that?
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:10
It's pretty much a mess. I rather learn it from other resources.
Most people complains about how it is mess, as you move forward, you will see that there are a lot of stuff are not explained well.
Heck, there are not even promises lessons and it's like the most important thing.
Jonathan
@skillt3ch
Jun 25 2018 10:11
interesting, i’ve heard of “promises” but haven’t read anything about them
i’m just a completionist, liking to do all the challenges in chronological order
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:12
Well, I don't know promises but I see a lot of people talk about it and it seems a very important thing. I wonder why they didn't explain it in ES6 section.
Jonathan
@skillt3ch
Jun 25 2018 10:13
i was reading up about the .apply() method
it seems to be similar to the .call() method, except it takes the arguments as an array
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:15
Yes but what they do?
What is their job?
I don't understand that.
Ramana Kannathasan
@ramanasha
Jun 25 2018 10:15
Really, which one?
Jonathan
@skillt3ch
Jun 25 2018 10:15
basically my understanding is that It can be used to call a method with an owner object as an argument.
i.e. an object can use a method belonging to another object.
var person = {
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}
var person1 = {
    firstName:"John",
    lastName: "Doe",
}
var person2 = {
    firstName:"Mary",
    lastName: "Doe",
}
person.fullName.call(person1);  // Will return "John Doe”
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:18
So you're saying that call transforms "this" to the current object?
Jonathan
@skillt3ch
Jun 25 2018 10:18
yes, the object that you pass as an argument
e.g. “person1” in that example above
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:19
Yes but if that is the case then why we could use it to flatten an array?
Jonathan
@skillt3ch
Jun 25 2018 10:19

The difference between call() and apply()

The call() method takes arguments separately.

The apply() method takes arguments as an array.

in which case are we using it to flatten an array?
can you provide an example?
oh you mean for example:
var arr = [6, 89, 3, 45];
var maximus = Math.max.apply(null, arr); // returns 89
it’s because Math.max expects separate arguments, not an array, so you cannot run Math.max directly on an array
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:23
I don't want to search for a way to flatten an array by using .apply() that way I will spoiler myself but I know that there are a way. Anyway, thanks for the explaination! It was really helpful
Jonathan
@skillt3ch
Jun 25 2018 10:23
@OGTechnoBoy you’re welcome
Vali
@valimikayilov
Jun 25 2018 10:48
What is up guys ?
Do u know if I can use the same text in documentation page ?
OGTechnoBoy
@OGTechnoBoy
Jun 25 2018 10:49
Well, there are clouds up there.
And the sky too.
Fernando L. Estuesta
@champolot
Jun 25 2018 10:57
does any one here familiar to materialize css
Mehdi Amlal
@mehdiamlal
Jun 25 2018 11:17
Does mongoose support mongodb update operators?
Vali
@valimikayilov
Jun 25 2018 11:57
Guys do u know if I can find a job or earning online on my basic skills of programming( like the ones that are required to get first certificate)
?
khadar dahir adareh
@cadare
Jun 25 2018 12:00
@Geek-Killer Yes you can, but no one here will no the answer for you. Just go out and try, life is about having the will to get what you want :)
Vali
@valimikayilov
Jun 25 2018 12:08
@cadare Thanks, but I just need some suggestions on it, I need money urgently. I have tried to find a work physically, still waiting for the response. And now I will try to find an online job, I will be happy if someone will advice me any websites.
khadar dahir adareh
@cadare
Jun 25 2018 12:10
Just google and Good luck. You will get there :)
Vali
@valimikayilov
Jun 25 2018 12:11
@cadare Okay, Thanks Khadar. I will)
May Kittens Devour Your Soul
@diomed
Jun 25 2018 12:27
I am now a certified idiot, every1 :stuck_out_tongue_closed_eyes:
Aditya
@ezioda004
Jun 25 2018 12:28
Welcome to the club 🎉
Smootimus
@Smootimus
Jun 25 2018 12:36
I wanna be in a club
Jeff Greenlee
@JeffGreenlee42
Jun 25 2018 12:57
Greetings!
Can I ask someone a question about finished projects? It's been a while since I last submitted a project for FCC and I want to make sure I am doing it right...
Jeff Greenlee
@JeffGreenlee42
Jun 25 2018 13:02
hmmm.. I think I am speaking in a vacuum...
Tom
@moT01
Jun 25 2018 13:56
@JeffGreenlee42 whats up
Jeff Greenlee
@JeffGreenlee42
Jun 25 2018 14:05
I'm sure this has been asked before: Is it OK to use Github instead of Codepen?
Kyle Holm
@thekholm80
Jun 25 2018 14:07
you can build your projects wherever you want, you just have to have a live version available, and have the code somewhere public
Jeff Greenlee
@JeffGreenlee42
Jun 25 2018 14:09
Ok.. I feel fenced in when using Codepen.. I like using my own editor... just wanted to make sure.
julien Demarque
@JulienDemarque
Jun 25 2018 14:17
Hello, can someone advise me on some routing? I am building an app that send some data async to the server to store it in a database. I want also to request some data async from the database to the webpage, without refreshing the page. So I am wondering, I used a POST request with the same route as the webpage for putting the data to the database. But to get the data from the database, I would just need to invent a new url? What is the best practices in that case?
Kyle Holm
@thekholm80
Jun 25 2018 14:17
i'd define a new route for GET request
you can make an api request to that route without refreshing your page
julien Demarque
@JulienDemarque
Jun 25 2018 14:23
@thekholm80 thanks, do you think the POST request sending data to the database should be also this new route then?
Kyle Holm
@thekholm80
Jun 25 2018 14:24
personally i like to define routes for a single purpose
julien Demarque
@JulienDemarque
Jun 25 2018 14:25
@thekholm80 Ok get it. res.send(JSON.stringify({key: value})); would not refresh the page, would it?
Kyle Holm
@thekholm80
Jun 25 2018 14:25
you can send json directly with res.json({key:value})
saves a step of stringifying / parsing
julien Demarque
@JulienDemarque
Jun 25 2018 14:26
@thekholm80 Thanks. Awesome!
Mehdi Amlal
@mehdiamlal
Jun 25 2018 14:40
Hey guys! How can I set more than a data type for a document with mongoose?
Kaz Baig
@kbaig
Jun 25 2018 16:32
@mehdiamlal can you provide an example of what you mean
Kelechi Chinaka
@ke1echi
Jun 25 2018 16:52
@ezioda004 how's your cs50 adventure going?
Mehdi Amlal
@mehdiamlal
Jun 25 2018 17:46
@kbaig I have a field inside a mongodb document, and I don't want that field to have a fixed type (string, num, boolean...). Is there a way I can do that?
Brianna
@brisourceful
Jun 25 2018 18:15
Anyone here gifted in JS Regex?
Kyle Holm
@thekholm80
Jun 25 2018 18:16
@brisourceful i use https://regex101.com/ whenever i have to write regex
otherwise i'm useless
Brianna
@brisourceful
Jun 25 2018 18:16
I've been using it
I still can't figure it out
I'm trying to write a regex to capture all characters before a ? but no characters after the ?
Kaz Baig
@kbaig
Jun 25 2018 18:17
I just use regexr
Brianna
@brisourceful
Jun 25 2018 18:17
Kyle Holm
@thekholm80
Jun 25 2018 18:17
i'm sure js has look-aheads
Kaz Baig
@kbaig
Jun 25 2018 18:17
no just lookbehinds
Kyle Holm
@thekholm80
Jun 25 2018 18:17
lame
Brianna
@brisourceful
Jun 25 2018 18:17
only negatives
Kaz Baig
@kbaig
Jun 25 2018 18:18
could just split it at the ? if nothing else seems a good idea
Brianna
@brisourceful
Jun 25 2018 18:18
Oh good point.
Worst case scenario
I was really hoping there was a way to do it with Regex
Kyle Holm
@thekholm80
Jun 25 2018 18:20
/[^\?]*/i? match 0 or more but not ??
Brianna
@brisourceful
Jun 25 2018 18:21
No, I just want all characters before the ?
That regex creates two matches
Kaz Baig
@kbaig
Jun 25 2018 18:21
@brisourceful "www.somewebsite.com/?prefn1".match(/(^.+)\?/)[1] // "www.somewebsite.com/"
Brianna
@brisourceful
Jun 25 2018 18:24
I believe that works but what is the [1] for?
Kaz Baig
@kbaig
Jun 25 2018 18:24
The first item in the array is the match
the second is the captured group
you want the captured group
Brianna
@brisourceful
Jun 25 2018 18:24
correct
Kaz Baig
@kbaig
Jun 25 2018 18:24
which is the second item in the array
hence [1]
Brianna
@brisourceful
Jun 25 2018 18:25
got it! Makes sense now
It looks like that works! Thanks so much!
Kaz Baig
@kbaig
Jun 25 2018 18:25
You're welcome :smile:
Kyle Holm
@thekholm80
Jun 25 2018 18:26
ha mine did work
Brianna
@brisourceful
Jun 25 2018 18:27
For some reason when I popped that into Regex101, the i flag threw it off.
Mehdi Amlal
@mehdiamlal
Jun 25 2018 18:27
Hey guys! I've just finished a course on mongodb/mongoose. I'd like to practice my new skills, could you suggest any idea for an app/api using databases?
Kyle Holm
@thekholm80
Jun 25 2018 18:27
because the i is already there
err .. i mean you have to add it through their flags thingy
Brianna
@brisourceful
Jun 25 2018 18:27
ahh I see
Kyle Holm
@thekholm80
Jun 25 2018 18:28
image.png
Brianna
@brisourceful
Jun 25 2018 18:28
I have mine default to global flag
that's why
Kaz Baig
@kbaig
Jun 25 2018 18:28
@thekholm80 @brisourceful I'd go with kyle's
Brianna
@brisourceful
Jun 25 2018 18:29
Thanks @thekholm80 and @kbaig
Kyle Holm
@thekholm80
Jun 25 2018 18:29
@brisourceful how's the PNW? have you taken over Microsoft yet?
Brianna
@brisourceful
Jun 25 2018 18:29
hahah LOL
nope
Kyle Holm
@thekholm80
Jun 25 2018 18:29
last i heard you were freelancing?
or maybe my memory is garbage
Brianna
@brisourceful
Jun 25 2018 18:30
nope, I've been contracting for the same company for nearly a year now
Kyle Holm
@thekholm80
Jun 25 2018 18:30
contract, not freelance
Brianna
@brisourceful
Jun 25 2018 18:30
why they haven't converted me to FTE is beyond me
Kyle Holm
@thekholm80
Jun 25 2018 18:30
this way you get all that awesome overtime?
Brianna
@brisourceful
Jun 25 2018 18:30
except I never get to work overtime
Kyle Holm
@thekholm80
Jun 25 2018 18:30
lame
Brianna
@brisourceful
Jun 25 2018 18:30
because they don't want to foot the bill
Kyle Holm
@thekholm80
Jun 25 2018 18:30
cheap bastards
Brianna
@brisourceful
Jun 25 2018 18:31
except they aren't!!! lol they are paying the consulting company I'm contracted through an absurd amount of money
Kaz Baig
@kbaig
Jun 25 2018 18:31
@thekholm80 how's it going
Kyle Holm
@thekholm80
Jun 25 2018 18:31
@brisourceful just not money that all goes to you?
Kaz Baig
@kbaig
Jun 25 2018 18:31
@brisourceful and they'll have to pay them way more for OT
Kyle Holm
@thekholm80
Jun 25 2018 18:32
@kbaig pretty good, did you get moved over the pond yet?
Kaz Baig
@kbaig
Jun 25 2018 18:32
If a consultant is making $30/hour, the company is prob billing $100
Brianna
@brisourceful
Jun 25 2018 18:32
Exactly!!
They are getting ripped off
Kaz Baig
@kbaig
Jun 25 2018 18:32
Nah that's fine imo
Brianna
@brisourceful
Jun 25 2018 18:33
it would be cheaper for the company to pay the fee to convert me to FTE than to keep paying the consulting company
Kyle Holm
@thekholm80
Jun 25 2018 18:33
what's the saying? step over a dollar to pick up a dime?
Kaz Baig
@kbaig
Jun 25 2018 18:33
The company is getting compensated for training you, maintaining quality of your delivery, and being liable for you
Kyle Holm
@thekholm80
Jun 25 2018 18:33
or penny-wise, pound poor in jolly ol' england
Kaz Baig
@kbaig
Jun 25 2018 18:33
Now whether yours is doing all that is a diff story :smile:
Brianna
@brisourceful
Jun 25 2018 18:34
uhhh no not at all
Kaz Baig
@kbaig
Jun 25 2018 18:34
@thekholm80 I'm high key considering getting married in the next few weeks and staying
Which would mean being unemployed for 4-6 months :worried:
Kyle Holm
@thekholm80
Jun 25 2018 18:34
@kbaig do it! just remember you can't work on a marriage visa so get your greencard app in asap
what kind of toaster do you want for a gift?
Kaz Baig
@kbaig
Jun 25 2018 18:35
@thekholm80 pfft I don't like toast
@thekholm80 yeah we'd get the app in same week
I'm gonna have to think about what I actually want to do with my career since I've been bound to jobs that sponsor before
Brianna
@brisourceful
Jun 25 2018 18:36
Why not just get a H1-B?
Kaz Baig
@kbaig
Jun 25 2018 18:36
@brisourceful Didn't get it. Tried
Brianna
@brisourceful
Jun 25 2018 18:36
Ah bummer
Kyle Holm
@thekholm80
Jun 25 2018 18:36
i've been trying to make sense of our visa/immigration/etc laws and it makes my head hurt
Brianna
@brisourceful
Jun 25 2018 18:36
there is no sense to it @thekholm80
Kyle Holm
@thekholm80
Jun 25 2018 18:36
with you, Ravi and Manish all in the same boat i was hoping to be helpful in some way
Kaz Baig
@kbaig
Jun 25 2018 18:36
heh
Kyle Holm
@thekholm80
Jun 25 2018 18:37
but i'm not smart enough to figure it out
Kaz Baig
@kbaig
Jun 25 2018 18:37
Manish is on an H1 already no?
Kyle Holm
@thekholm80
Jun 25 2018 18:37
nope, still in school
Kaz Baig
@kbaig
Jun 25 2018 18:37
ahh
Kyle Holm
@thekholm80
Jun 25 2018 18:37
i think he graduates in July
Kaz Baig
@kbaig
Jun 25 2018 18:37
I won't be competing with his company soon if I go through with this ;)
Kyle Holm
@thekholm80
Jun 25 2018 18:37
so his clock will start ticking soon
Kaz Baig
@kbaig
Jun 25 2018 18:38
Presumably he is getting a stem degree so he will have plenty of time to figure it out. I just had a year
Kyle Holm
@thekholm80
Jun 25 2018 18:38
i thought Ravi said he had something like 90 days after graduation to get a work visa or go home
Kaz Baig
@kbaig
Jun 25 2018 18:39
No it's that once he receives his work permit, he has 90 days of unemployment available
Kyle Holm
@thekholm80
Jun 25 2018 18:39
manish will have his masters, so he should qualify for over-cap h1b
Kaz Baig
@kbaig
Jun 25 2018 18:39
He must have received his permit before graduating and also not have gotten an offer yet
This year it was 38% for non-masters and 58% for masters
Brianna
@brisourceful
Jun 25 2018 18:40
Gotta run! thanks you two for helping me out!
Kaz Baig
@kbaig
Jun 25 2018 18:40
Chance of success in the lottery
@brisourceful cya
Kyle Holm
@thekholm80
Jun 25 2018 18:40
@brisourceful :wave: good seeing you again
Brianna
@brisourceful
Jun 25 2018 18:40
same to you!
anthonygallina1
@anthonygallina1
Jun 25 2018 20:06
:wave:
Kyle Holm
@thekholm80
Jun 25 2018 20:08
@anthonygallina1 :wave:
anthonygallina1
@anthonygallina1
Jun 25 2018 20:08
@thekholm80 Hi :smile:
Bjorn van de Peut
@bjorno43
Jun 25 2018 20:15
:wave:
Kyle Holm
@thekholm80
Jun 25 2018 20:15
@bjorno43 hi bob
Bjorn van de Peut
@bjorno43
Jun 25 2018 20:15
@thekholm80 Yo m8
anthonygallina1
@anthonygallina1
Jun 25 2018 20:20
Whats the topic?
Bjorn van de Peut
@bjorno43
Jun 25 2018 20:22
Codechallenge: Re create codepen and improve it
:laughing:
anthonygallina1
@anthonygallina1
Jun 25 2018 20:22
Na I wouldnt do that to Chris.
Bjorn van de Peut
@bjorno43
Jun 25 2018 20:22
lol
anthonygallina1
@anthonygallina1
Jun 25 2018 20:23
Hey we could call it a clone!
Kyle Holm
@thekholm80
Jun 25 2018 20:23
repl.it has guided lessons
Bjorn van de Peut
@bjorno43
Jun 25 2018 20:23
https://icecub.nl/ide/ :stuck_out_tongue:
anthonygallina1
@anthonygallina1
Jun 25 2018 20:25
I just wish I could fix these I worked hard on them https://codepen.io/anthonygallina/pen/evQjWQ
Kyle Holm
@thekholm80
Jun 25 2018 20:27
looks pretty
YA Legacy and the backend killed Man legacy sounds too close to monolithic
Kyle Holm
@thekholm80
Jun 25 2018 20:30
the markdown preview seems to be working fine
anthonygallina1
@anthonygallina1
Jun 25 2018 20:30
I some how lost 6000 cookies too
@thekholm80 Thank you
Kyle Holm
@thekholm80
Jun 25 2018 20:32
i like the animation on the menu in your camper news
anthonygallina1
@anthonygallina1
Jun 25 2018 20:34
@thekholm80 oh it used to look wonder full had storys and usefull links
Wasnt easy at the time getting the alignment right
Kyle Holm
@thekholm80
Jun 25 2018 20:35
css is for masochists
anthonygallina1
@anthonygallina1
Jun 25 2018 20:35
yup lots of time down the tiolet there
@thekholm80 It gets easier
Kyle Holm
@thekholm80
Jun 25 2018 20:40
oh i know, i used to be fairly decent with css. it's just not worth the effort for me anymore
anthonygallina1
@anthonygallina1
Jun 25 2018 20:45
I really wish I knew how to make a backend for those though. So it wouldnt be a complete wash.
Like a solution.
I meen even if it was old data. It still would demo
Kyle Leonard
@kdleonard93
Jun 25 2018 20:55

Hey guys i am at a complete loss on how to solve this exerciser below.

Basic JavaScript: Use the parseInt Function: "Use parseInt() in the convertToInteger function so it converts the input string str into an integer, and returns it."

Kyle Holm
@thekholm80
Jun 25 2018 21:02
@kdleonard93 what did you try? can we see your code?
Kyle Leonard
@kdleonard93
Jun 25 2018 21:05
I've read through Mozilla and W3schools and i just don't understand the initial setup for the question.

function convertToInteger(str) {

}

convertToInteger("56");

^^the original question
Kyle Holm
@thekholm80
Jun 25 2018 21:06
so you have 2 steps here:
  1. convert string to integer
  2. return integer

if you look at the lesson instructions:

The parseInt() function parses a string and returns an integer. Here's an example:

var a = parseInt("007");

in your code, the string is provided as an argument to the function, str
simpleguy747
@simpleguy747
Jun 25 2018 21:22
Suppose I have an entry in my database, which is modified by some other system (or by database itself using job or so), now i want to send a notification to my web page that it is changed, What is the best way to handle this scenario? I donot want to poll the database.
Kyle Holm
@thekholm80
Jun 25 2018 21:23
which db?
simpleguy747
@simpleguy747
Jun 25 2018 21:24
@thekholm80 not sure which, any rdbms
@thekholm80 This is kind of hypothetical scenario
Kyle Leonard
@kdleonard93
Jun 25 2018 21:26

function convertToInteger(str) {
var a = parseInt("100", 10);
}

convertToInteger("56");

return (56);

@thekholm80 That's the only thing i can think of, I've looked through multiple forums to try and find a solution( or one that i can understand) but i haven't had any luck
Kyle Holm
@thekholm80
Jun 25 2018 21:28

with mongodb you can use a combination of capped collections and tailable cursors to make kind of event listeners

After clients insert new additional documents into a capped collection, the tailable cursor will continue to retrieve documents.

i don't think this will work for modified db info, but it will alert to new insertions
@kdleonard93 where are you getting "100" from?
parseInt(stringToBeParsed) in this case, the string is stored in the str variable
Kyle Leonard
@kdleonard93
Jun 25 2018 21:30
Im not completely sure. I thought you needed to test certain strings that were numbers inside them.
but 1 sec.....
Kyle Holm
@thekholm80
Jun 25 2018 21:30
nah, they want you to make a reusable function that will take a string (in this case, str) and spit out an integer
simpleguy747
@simpleguy747
Jun 25 2018 21:31
@thekholm80 oh so this would depend on underlying db? Was looking for some kind of pattern or something
Kyle Holm
@thekholm80
Jun 25 2018 21:31
function convertToInteger(str) {
  // do magic to turn the string into an integer using parseInt()
  // return the integer
}
convertToInteger("56");
@simpleguy747 i think so, unless you want an external resource monitoring your db for changes
@kdleonard93 you only need to add the 2 lines i have commented there
simpleguy747
@simpleguy747
Jun 25 2018 21:33
@thekholm80 hmm... was thinking more like queues monitoring and use pub-sub along with it then consume from the queue and display it using websocket, don't know though if this would work or not
Kyle Holm
@thekholm80
Jun 25 2018 21:34
maybe? you'd have to do some research
the difficult part for me is that you said the db could change itself, or the changes could come from other sources. i don't know if i'm smart enough to think of a way to track all of that without polling the db
Kyle Leonard
@kdleonard93
Jun 25 2018 21:36

///
function convertToInteger(str) {
var str = parseInt();
return (str);
}

convertToInteger("56");
///

Kyle Holm
@thekholm80
Jun 25 2018 21:36
@kdleonard93 almost there, but str is already defined in the function definition function convertToInteger(str)
so you'll need to name your variable something else
also, you need to provide that str to parseInt()
AlbertoGiambone
@AlbertoGiambone
Jun 25 2018 21:38

function printManyTimes(str) {
"use strict";

// change code below this line

const sentence = str + " is cool!";
for(let i = 0; i < str.length; i+=2) {
console.log(sentence);
}

// change code above this line

}
printManyTimes("freeCodeCamp");

//this is the result of the test... why?

// running test
SENTENCE should be a constant variable declared with const.
Unexpected token '?'
// tests completed
Kyle Holm
@thekholm80
Jun 25 2018 21:38
@AlbertoGiambone SENTENCE isn't the same as sentence, the instructions ask you to use all-caps
also, the last test is bugged and will not pass until the devs fix it
AlbertoGiambone
@AlbertoGiambone
Jun 25 2018 21:39
ahh ok
Kyle Leonard
@kdleonard93
Jun 25 2018 21:39

@thekholm80 perfect that worked!! Thanks man!

P.S. how do you add code correctly on here

AlbertoGiambone
@AlbertoGiambone
Jun 25 2018 21:39
@thekholm80 thank's
Kyle Holm
@thekholm80
Jun 25 2018 21:40
@kdleonard93 good job
```
code
```
using backticks (usually found to the left of the 1 key)
use shift + enter to jump to a new line
AlbertoGiambone
@AlbertoGiambone
Jun 25 2018 21:41
@thekholm80 whit the all-caps, return this
// running test
Unexpected token '?'
// tests completed
Kyle Holm
@thekholm80
Jun 25 2018 21:41
@AlbertoGiambone right, that test is broken right now
your code is most-likely correct, but until they fix the test it will not pass
Kyle Leonard
@kdleonard93
Jun 25 2018 21:42

\\
function convertToInteger(str) {
var a = parseInt(str);
return a;
}

convertToInteger("56");
\\

\\
function convertToInteger(str) {
var a = parseInt(str);
return a;
}

convertToInteger("56");
\\

Kyle Holm
@thekholm80
Jun 25 2018 21:42
`
not \
Kyle Leonard
@kdleonard93
Jun 25 2018 21:42

ahh haha
`
function convertToInteger(str) {
var a = parseInt(str);
return a;
}

convertToInteger("56");
`

Kyle Holm
@thekholm80
Jun 25 2018 21:42
3 of them
```
Kyle Leonard
@kdleonard93
Jun 25 2018 21:43
Jesus christ ha
```
Kyle Holm
@thekholm80
Jun 25 2018 21:43
lol
Kyle Leonard
@kdleonard93
Jun 25 2018 21:43
function convertToInteger(str) {
 var a = parseInt(str);
 return a;
}

convertToInteger("56");
```
Kyle Holm
@thekholm80
Jun 25 2018 21:43
:tada:
Kyle Leonard
@kdleonard93
Jun 25 2018 21:43
Success!
Kyle Holm
@thekholm80
Jun 25 2018 21:50
@kdleonard93 now to learn the joys of direct return so you can skip a step
function convertToInteger(str) {
  return parseInt(str);
}
then when you learn es6 you can shorten it to
const convertToInteger = str => parseInt(str);
Kyle Leonard
@kdleonard93
Jun 25 2018 21:53
Yea that's much cleaner haha. Appreciate the advice man!
Aita Kane
@aita-kane
Jun 25 2018 22:57
@cmccormack alright thank you for your advice because I'm new to all this .
Greg D
@mosaic-greg
Jun 25 2018 23:54
hi, one of the tests for "finders keepers" is
findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }) should return 8.
but also 10 % 2 === 0 right?
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers/
sorry it should only return the first element that passes the test
Kyle Holm
@thekholm80
Jun 25 2018 23:55
@mosaic-greg it says return the first element that matches the test
you got it
Greg D
@mosaic-greg
Jun 25 2018 23:55
thanks