These are chat archives for FreeCodeCamp/Help

3rd
Sep 2017
Sam Goldberg
@sgoldber61
Sep 03 2017 00:10 UTC
Movement in my dungeon crawler is a bit laggy. For some reason, the lag is proportional to the size of the map, so that a smaller map gives less of a lag. However, I'm not re-updating the map as I move around, so I don't know what the problem is and don't see how it could take O(size of map) time to move. I have in react two components: a map display that displays all the map squares, and a player square that moves on top of the map squares. My pen is here https://codepen.io/sgoldber61/full/MvLaZZ/
Stephen James
@sjames1958gm
Sep 03 2017 00:23 UTC
@Burinson https://api.twitch.tv/kraken/streams/freecodecamp?callback=?&client_id=putyouridhere
Armaan Dhanji
@armaandh
Sep 03 2017 00:27 UTC
does anyone here know how I can use require.js to load a JSON file into a variable I can use in my main.js?
Stephen James
@sjames1958gm
Sep 03 2017 00:29 UTC
@sgoldber61 I don't see anything that would affect lag based on board size (is your board only rendering once)
Sam Goldberg
@sgoldber61
Sep 03 2017 00:31 UTC
that's right, the board is only rendering once.
Uriel Guzmán
@Burinson
Sep 03 2017 00:33 UTC
@sjames1958gm thank you
CamperBot
@camperbot
Sep 03 2017 00:33 UTC
burinson sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8430 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Jan Shah
@JanShah
Sep 03 2017 00:41 UTC
@sgoldber61 keydown fires multiple times and it looks like the dom doesn't update as fast as the event firing, so multiple updates occur, with the paint not happening till the key is not pressed. when I changed the event to keyup the lag is much less apparent
Sam Goldberg
@sgoldber61
Sep 03 2017 00:47 UTC
@JanShah Hmm... even so, the bigger the map, the worse the lag.
Jan Shah
@JanShah
Sep 03 2017 00:48 UTC
@sgoldber61 24000 dom objects is a lot of work
Sam Goldberg
@sgoldber61
Sep 03 2017 00:49 UTC
In what way does it update all the dom objects, even though I'm only moving the yellow square?
Ken Haduch
@khaduch
Sep 03 2017 00:50 UTC
@sgoldber61 - one thing that I wondered about (with a quick examination of part of the code) is the memory usage - there are lots of array structures that are being allocated. I don't know a lot about memory allocation and garbage collection (if any) in javascript - but just a data point (again, I don't understand much about it) in the "array" elements, there were 68303 objects in the "objects count" column for memory snapshot 1 (I'm using Opera, by the way) and after 10 moves, the array objects count is 68833, the memory usage jumped from 36.7 MB to 36.9 MB (for the entire snapshot). But not a significant change after 10 more moves. Not sure if that could be a factor in any performance slowdown? Just something that I'm interested in learning more about...
@sgoldber61 - what made me think about that to start with is in your advanceStep method, you are allocating a new Array and I wondered if that was being handled in a way that might cause memory usage to increase?
Sam Goldberg
@sgoldber61
Sep 03 2017 00:53 UTC
Oh, the advanceStep is just for dungeon generation, where I use an iterative process to massage the map into a cave. Yeah, it does memory-leak. However, I kind of just lazily allowed that in my game of life and it worked fine. Plus, the real issue is once the dungeon generates, there's a lag in movement.... but I will look into memory while I move the player though.
Jan Shah
@JanShah
Sep 03 2017 00:53 UTC
@sgoldber61 https://stackoverflow.com/questions/25724126/chrome-devtools-timeline-update-layer-tree-event when your grid is small, this happens really fast, but when it's large, it slows down to 300ms
image.png
Sam Goldberg
@sgoldber61
Sep 03 2017 00:59 UTC
Okay Jan I see what you're saying. So the issue is what the browser is doing i.e. updating the render layer tree. My guess is that because I have a big bunch of absolutely positioned elements that the browser's algorithm has to re-update all of them in order to resolve issues like what is displayed at front vs what is displayed at back, etc.
Jan Shah
@JanShah
Sep 03 2017 01:01 UTC
possibly.have you considered using canvas? @sgoldber61
Sam Goldberg
@sgoldber61
Sep 03 2017 01:01 UTC
I've heard of it. Will it allow me to easily update in react?
Jan Shah
@JanShah
Sep 03 2017 01:03 UTC
http://fcc.physify.com/rogue/ it's incomplete but have a look
@sgoldber61
Sam Goldberg
@sgoldber61
Sep 03 2017 01:05 UTC
@JanShah Holy mother you could almost sell that. Well okay. Thanks for your help. I'll look into canvas, or at least a way for the browser to not render so much DOM objects at a time, and that appears to be the bottleneck, not react.
CamperBot
@camperbot
Sep 03 2017 01:05 UTC
sgoldber61 sends brownie points to @janshah :sparkles: :thumbsup: :sparkles:
:cookie: 508 | @janshah |http://www.freecodecamp.com/janshah
Jan Shah
@JanShah
Sep 03 2017 01:07 UTC
@sgoldber61 react and canvas only and I can make dungeons of any size without lag
Ginger
@GingerChew
Sep 03 2017 03:11 UTC
hey guys can I get some constructive criticism on this pen?
Gersho
@Gersho
Sep 03 2017 03:17 UTC
looks neat, you should change "streaming" for "online" imo @GingerChew
(in the top menu, not the title)
when i click a link, the background of that link turns white, is that expected behavior ?
Ginger
@GingerChew
Sep 03 2017 03:23 UTC
I'm fidgeting with the css and practicing SCSS so that's a byproduct of that, I think I have it fixed now
Thats a good point though, I'll change that
Gersho
@Gersho
Sep 03 2017 03:35 UTC
still gets white when clicking for me
Ginger
@GingerChew
Sep 03 2017 03:36 UTC
oh i was thinking of a different bug, yeah, I'm not sure how to tackle that one. Is it some sort of pseudo class I can edit
Gersho
@Gersho
Sep 03 2017 03:37 UTC
i was have no idea how you made it that way so sorry can't really help :P
Ginger
@GingerChew
Sep 03 2017 03:41 UTC
it happens cause it's based on the list group from bootstrap, which defaults to white, I just gotta figure out which pseudo class I need to change to get it to change there
Gersho
@Gersho
Sep 03 2017 03:43 UTC
try putting !important on the stuff that might conflict with bootstrap
piteto
@piteto
Sep 03 2017 04:12 UTC
@GingerChew
.list-group-item-action:active {
  background-color: #553693;
  color: white;
}
Ginger
@GingerChew
Sep 03 2017 04:13 UTC
@piteto sweet thanks!
CamperBot
@camperbot
Sep 03 2017 04:13 UTC
gingerchew sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 47 | @piteto |http://www.freecodecamp.com/piteto
Ginger
@GingerChew
Sep 03 2017 04:48 UTC
nvm, that didn't fix it :/
piteto
@piteto
Sep 03 2017 06:26 UTC
@GingerChew Looks like :focus is needed too
.list-group-item-action:hover,
.list-group-item-action:focus,
.list-group-item-action:active {
  background-color: #553693;
  color: white;
}
glitz20
@glitz20
Sep 03 2017 06:59 UTC
hey anyone who can please let me know why I cannot go to product page?https://glitch.com/edit/#!/product-review?path=views/product.ejs:7:8
Trello Whoomer
@Trellowhoomer
Sep 03 2017 07:28 UTC

```<!DOCTYPE html>

<html>

<head>

<title>Bootstrap Basics</title>

<link rel="stylesheet" type="text/css" href="bootstrap.css">
</head>

<body>

<nav class="navbar navbar-default">
sdfds
</nav>
</body>
</html>```

what is wrong in the code? navbar is not showing up
heroiczero
@heroiczero
Sep 03 2017 09:23 UTC
@Trellowhoomer did you download Bootstrap.css https://getbootstrap.com/ and do you have it in your server so you can access it.
Trello Whoomer
@Trellowhoomer
Sep 03 2017 09:33 UTC
@heroiczero actually I was using bootstrap version 4 instead of 3.. Now problem solved : ) Thanx btw
CamperBot
@camperbot
Sep 03 2017 09:33 UTC
trellowhoomer sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1686 | @heroiczero |http://www.freecodecamp.com/heroiczero
heroiczero
@heroiczero
Sep 03 2017 09:34 UTC
:+1:
Emmanuel Akodia
@akodiaemma
Sep 03 2017 09:46 UTC
I have implemented the PHP M ail via smtp, but i only send to one recipient, how can i make it send to various emails. i have a list of three emails
@just1witness oh this is for a project, we are trying to create awareness in Uganda on the applicability of ICT in transport and insurance,
Maybe you could join the expo too :)
just1witness
@just1witness
Sep 03 2017 11:56 UTC
@akodiaemma It sounds interesting. :)
Darren
@DarrenfJ
Sep 03 2017 15:30 UTC
morning fCC
slow day I see
just1witness
@just1witness
Sep 03 2017 15:33 UTC
Yep
@DarrenfJ What are you working on today?
Darren
@DarrenfJ
Sep 03 2017 15:37 UTC
I'm in the middle of the twitch viewer . sorta.. but taking a break from it cause while i get ajax it's still new enough and so i'm focusing on vids on ajax
what are you working on?
just1witness
@just1witness
Sep 03 2017 15:38 UTC
Same thing, haha. I'm done with algo's so working projects now, Twitch is the current one.
I don't really get API's and Ajax well yet. (I had to get on my pc to fix it....)
Darren
@DarrenfJ
Sep 03 2017 15:44 UTC
mine does the worst autocorrects :)
just1witness
@just1witness
Sep 03 2017 15:45 UTC
Seriously, I choose to do the "wrong" spelling and it changes upon send anyways... so annoying, lol
Darren
@DarrenfJ
Sep 03 2017 15:54 UTC
ha!
yah i gotta take a break so i can learn more about it and really get it
leepop7
@leepop7
Sep 03 2017 15:57 UTC
Yo
anyone about that knows about C#
or what happens when you put a switch in a switch
Darren
@DarrenfJ
Sep 03 2017 15:57 UTC
sorry man.. i'm still a relatively newie with it, and haven;t studied it for over a year...
leepop7
@leepop7
Sep 03 2017 15:59 UTC
same
;-;
and this class is so hard my friend who took it before me quit school
becuase of this class
Darren
@DarrenfJ
Sep 03 2017 16:02 UTC
dang.. i feel for you, brutha
i'm off for :coffee: and podcasts.. back in a bit
thanks @just1witness for teh chat
CamperBot
@camperbot
Sep 03 2017 16:04 UTC
darrenfj sends brownie points to @just1witness :sparkles: :thumbsup: :sparkles:
:cookie: 318 | @just1witness |http://www.freecodecamp.com/just1witness
Darren
@DarrenfJ
Sep 03 2017 16:04 UTC
:D
leepop7
@leepop7
Sep 03 2017 16:04 UTC
oh im not daunted
Darren
@DarrenfJ
Sep 03 2017 16:05 UTC
@leepop7 there's nothing more frustrating that hitting a wall though... does fCC still have the 'other languages' rooms? they used to have ones on python tc
koder3
@koder3
Sep 03 2017 16:11 UTC
hi guys! how do i use babel stage 2 preset in an IDE like VS code
i dont understand the instructions provided on their page
Roxroy
@roxroy
Sep 03 2017 16:15 UTC
@akodiaemma , you can sent the email to each person separately. First get the list of recipients and the message template. Then loop through each, changing the TO email address.
just1witness
@just1witness
Sep 03 2017 16:17 UTC
@DarrenfJ enjoy your coffee and podcasts :) thank you
CamperBot
@camperbot
Sep 03 2017 16:17 UTC
just1witness sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2005 | @darrenfj |http://www.freecodecamp.com/darrenfj
leepop7
@leepop7
Sep 03 2017 16:37 UTC
this is the only room I can find that has anykind of relation to hlep in general
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:37 UTC
does anyone know about the fcc beta?
just1witness
@just1witness
Sep 03 2017 17:38 UTC
not launched, you can do challenges but they will be erased when it launches
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:39 UTC
how long until launch? also will progress from the current fcc move to the new one?
just1witness
@just1witness
Sep 03 2017 17:40 UTC
That's not determined yet, and yes
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:41 UTC
My account has been flagged for about 2 months now, and I sent an email about it to the fcc team but have not received a response. If I were to delete my account and recreate it with the same email would the new account still be flagged?
just1witness
@just1witness
Sep 03 2017 17:42 UTC
@LukieID I don't know. I don't know what flagged is, were you naughty?
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:43 UTC
flagged for academic dishonesty
just1witness
@just1witness
Sep 03 2017 17:43 UTC
Ouch
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:43 UTC
I wasnt trying to cheat tho
Thats why im trying to get it unflagged
just1witness
@just1witness
Sep 03 2017 17:43 UTC
I don't know their policy on that
Did you copy and paste code and submit it?
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:45 UTC
Yes, but I only did that because I wanted a dark green square for every day, but I was having trouble doing that since I was spending a lot of time on my projects. So I copied and pasted code for the algorithm challenges, but I intended on going back and doing them myself after I finished the projects. I am very OCD about things...
and I worked really hard on fcc all summer, so I was really sad when I got flagged
just1witness
@just1witness
Sep 03 2017 17:48 UTC
I'm sorry to hear that. I know what you mean. You know only the projects are mandatory? You could have just left the algorithms blank.
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:48 UTC
Oh, I didnt know that...
Maybe I will try restarting my account and just putting my projects in then. I am kinda getting desperate because It has been 2 months
just1witness
@just1witness
Sep 03 2017 17:49 UTC
You could try, I assume they will get back to you eventually.
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 17:49 UTC
hopefully :)
Are all the basics mandatory? Like the html5, css, and jquery sections
just1witness
@just1witness
Sep 03 2017 17:55 UTC
If you look at the map, you'll see asterisks next to the mandatory challenges. If you've done the work, for real, you don't really need a cert though. That isn't the end game, the knowledge and the projects you can use for a portfolio are.
Even someone did copy and paste their way successfully to a cert, they would be screwed if they got a job with it, they would be found out right away.
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 18:01 UTC
Yeah, I get what you mean. I'll just try to delete my account and recreate it, and if its still flagged I'll just continue to work through the course.
Thanks for the advice :)
just1witness
@just1witness
Sep 03 2017 18:03 UTC
no problem :)
If you need help with the algo's pm me
Luke Al-Saba
@LukeAlSaba
Sep 03 2017 18:04 UTC
ok
Jefferson
@jeffersonnnn
Sep 03 2017 18:41 UTC
Oh, me me me. i need help with the Algos. I am stuck on the Seek and Destroy challenge. Here is my code for turning argument objects into arguments that doesn't seem to work; can i get help, please?
function destroyer(arr) {
  var newArray = Array.prototype.slice.call(arguments, 1);
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:42 UTC
you can use arr.slice directly
Jefferson
@jeffersonnnn
Sep 03 2017 18:42 UTC
How would that work?
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:42 UTC
you need to use
destroyer(arr,value1,value2)
or the excercises explicit say that you only need 1 arg?
Waterkid123012
@Waterkid123012
Sep 03 2017 18:43 UTC
can someone help me with java language input and out put
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:43 UTC
java or javascript?
Waterkid123012
@Waterkid123012
Sep 03 2017 18:43 UTC
java
int x = 600; out.println(x); x= 600
x = -80; out.println(x); x =-80
byte b = 5; out.println(b); b=5
short s = 32767; out.println(s); s=32767
double d = 9.9; out.println(d); d= 9.9
d = 5.2; out.println(d); d=5.2
float f = 9.87f; out.println(f); f=9.87
long big = 555845; out.println(big); big = 555845
x = s; out.println(x); x = 32767
x = b + 10; out.println(x); x = 15
int z = ‘A’+ 1; out.println(z); z = 66
char c = ‘A’ + 1; out.println(c); c = B i got one of these answers wrong, and i dont know which one
java
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:44 UTC
wich one is wrong?
Waterkid123012
@Waterkid123012
Sep 03 2017 18:45 UTC
my computer science teacher said that i got one of the out put wrong
all of them are right expect one i think it could be x=s
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:46 UTC
do you executed them?
Waterkid123012
@Waterkid123012
Sep 03 2017 18:47 UTC
yes i tryed it out with blue jay and i got those answers
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:48 UTC
int z = ‘A’+ 1; . not sure the ascii code value for A
others seems fine
Waterkid123012
@Waterkid123012
Sep 03 2017 18:49 UTC
'A' is 65 + 1 = 66?
oh thank you for help. maybe its that problem
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:50 UTC
no, its fine, A is 65
Waterkid123012
@Waterkid123012
Sep 03 2017 18:51 UTC
yea
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:51 UTC
not sure if it's automatically converted when operating when ints tho
Waterkid123012
@Waterkid123012
Sep 03 2017 18:53 UTC
so it will be 65 and not add the 1?
i'll ask someone about it. thanks for the info.
Nahuel Ovejero
@NahuelOvejero
Sep 03 2017 18:54 UTC
No, no
yeah, I don't have java here to help you
sorry
Waterkid123012
@Waterkid123012
Sep 03 2017 18:55 UTC
its ok bro
gishy1
@gishy1
Sep 03 2017 19:04 UTC
Hello world need help
image.png
Moisés Man
@moigithub
Sep 03 2017 19:14 UTC
@Waterkid123012 i guess u need to know how many bytes in memory it takes
ie.. char or byte only ocupy 1 position (byte)
short takes 2
int takes 4
glitz20
@glitz20
Sep 03 2017 19:26 UTC
Can anyone please help me understand embedding in mongo
https://glitch.com/edit/#!/product-review?path=models/comment.js:1:0
Nicol
@NicolNonga
Sep 03 2017 19:26 UTC
@gishy1 what is the problem
gishy1
@gishy1
Sep 03 2017 19:26 UTC
image.png
John Tendik
@JohnTendik
Sep 03 2017 19:32 UTC
what are the errors when you hover over the triangle icon
Tiago Correia
@tiagocorreiaalmeida
Sep 03 2017 19:36 UTC
@gishy1 that looks messy, I started that way aswell on my first times :D
you can write like
c
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
you can write multiple cases and return the same value for all thoses cases
for what I got the 2 3 4 5 6 is equal to plus 1 to the count so for every of thoses values you add plus 1
the 7 8 9 you can ignore cause they ain't gonna change nothing so is like they never existed
now the last part -1
you know those cards 10, 'J', 'Q', 'K', 'A' go to the count or result function where you add 1 and remove 1 for every existent 1 so you can run exactaly what I did above but in the opposite, count--, @gishy1 if you need help let me know
Tiago Correia
@tiagocorreiaalmeida
Sep 03 2017 19:43 UTC
I forgot to told but in the end the only thing you have to return is the count variable + "bet"
tell*
Jake
@JakeDVirus
Sep 03 2017 19:45 UTC

Below is the code from pluralsight tutorial which let me dwell in a confusion.
As far as i know

$(function() { ... }); is equivalent to $(document).ready(function() { ... });

So why in the 2nd line of the code there is another $(function(){});

$(document).ready(function() {
$(function(){
  $('#showPhoneNav').click(function() {
    $("#myNav").slideToggle('normal',function(){ //Shows Nav area
    if ($('#myNav').is(':visible')) {
        $('#showPhoneNav').text('Hide Navigation');
    } else {
        $('#showPhoneNav').text('Show Navigation');
    } //end of if
    }); //end of slidetoggle
  }); //end of myNav
}); //end showPhoneNav
}); //end of ready
RyRojas
@RyRojas
Sep 03 2017 19:46 UTC
Hey, I'm running through the beta at the moment, and I've hit a wall on the part where you implement the native JS map method. Please help.
Waterkid123012
@Waterkid123012
Sep 03 2017 19:50 UTC
@moigithub the incorrect answer was b + 10
Stephen James
@sjames1958gm
Sep 03 2017 19:54 UTC
@RyRojas What code do you have?
@NeelDVirus Looks like a mistake to me.
Jake
@JakeDVirus
Sep 03 2017 19:56 UTC
@sjames1958gm i presumed that too. Still i wanted it to hv cross checked by others
RyRojas
@RyRojas
Sep 03 2017 19:58 UTC
Nevermind, I got it to work. I was using Array instead of the this keyword for my loop.
Waterkid123012
@Waterkid123012
Sep 03 2017 20:05 UTC
guys i know the incorrect output it was x = b + 10. what would be the asnwer tho?
Anders Nicolai Magnussen
@andersnicolaimagnussen
Sep 03 2017 21:16 UTC

https://codepen.io/nicolaimagnussen/pen/YxgVqa

What happened here?
This is why I dont have patience for CSS, what did I do wrong, why is the image making the grey div dissapear?

Albert Cardona II
@daddycardona
Sep 03 2017 21:26 UTC
because your picture is very big for 1, and it is absolute. meaning you making sure it is fixed in that position or section your using
what are you trying to do @nicolaimagnussen
Eric Miller
@ericmiller777
Sep 03 2017 21:30 UTC
hey guys wanna see somthing crazy im doing lol?
i dont like regex
so im trying to do this
i kno wi should just learn regex
Albert Cardona II
@daddycardona
Sep 03 2017 21:30 UTC
oky
Eric Miller
@ericmiller777
Sep 03 2017 21:31 UTC
function translatePigLatin(str) {
  str = str.split("");
  if(str[0] == "A"||str[0] == "E"||str[0] == "I"||str[0] == "O"||str[0] == "U"||str[0] == "a"||str[0] == "e"||str[0] == "i"||str[0] == "o"||str[0] == "u"){
    str.push("w");
    str.push("a");
    str.push("y");
    return str.join("");
  }
  for(let i=0; i < str.length; i++){
    if(str[i] == "A"||str[i] == "E"||str[i] == "I"||str[i] == "O"||str[i] == "U"||str[i] == "a"||str[i] == "e"||str[i] == "i"||str[i] == "o"||str[i] == "u"){
      for(let b = 0; b < i; b++){
        str.push(str[b]);
        str.splice(str[b], 1);
        if(b == i){
          str.push("a");
          str.push("y");
        }
        break;
      }
    }
  }
  return str.join("");
}

translatePigLatin("california");
i feel this should work
but
niacalifor is returned :P
if anything it should mess up and be
liforniacaay
Albert Cardona II
@daddycardona
Sep 03 2017 21:32 UTC
LOL str[0] == a e i o u and sometimes y LOL
Eric Miller
@ericmiller777
Sep 03 2017 21:33 UTC
:P
does pig latin use y?
everything ive tested moved the y to the end
Albert Cardona II
@daddycardona
Sep 03 2017 21:33 UTC
why don't you just push ('way' ) vs push a push w etc..
Eric Miller
@ericmiller777
Sep 03 2017 21:34 UTC
yep
Albert Cardona II
@daddycardona
Sep 03 2017 21:34 UTC
I don't know I was thinking about the song a e i o u LOL
Eric Miller
@ericmiller777
Sep 03 2017 21:35 UTC
any idea why this doesnt work? only issue i see is that its moving the vowel to the end?
but its skipping the first few vowels
Albert Cardona II
@daddycardona
Sep 03 2017 21:36 UTC
because you are pushing everything and I know that push puts things at the end of the string
Adam Bohannon
@abohannon
Sep 03 2017 21:36 UTC
I need some help. I tried to sync atom settings with a friend of mine, but now the project I'm working on is throwing all sorts of errors that I don't have time to go through and pick apart (Been at it all day - need to get to work on some other stuff). I haven't pushed these changes to github yet. What's the best way to restore my project from my last github commit?
Albert Cardona II
@daddycardona
Sep 03 2017 21:37 UTC
if you trying delete something it's pop i think but let me double check that @ericmiller777
Manish Giri
@Manish-Giri
Sep 03 2017 21:38 UTC
if(str[i] == "A"||str[i] == "E"||str[i] == "I"||str[i] == "O"||str[i] == "U"||str[i] == "a"||str[i] == "e"||str[i] == "i"||str[i] == "o"||str[i] == "u"){
Albert Cardona II
@daddycardona
Sep 03 2017 21:38 UTC
what type of errors are you getting @abohannon
Manish Giri
@Manish-Giri
Sep 03 2017 21:38 UTC
this doesn't look very efficient
and that too twice
Eric Miller
@ericmiller777
Sep 03 2017 21:38 UTC
@Manish-Giri i know, i need to go figure out regex
Manish Giri
@Manish-Giri
Sep 03 2017 21:38 UTC
str[0].match(/[aeiou]/gi);
@ericmiller777
Adam Bohannon
@abohannon
Sep 03 2017 21:39 UTC
Screen Shot 2017-09-03 at 11.46.44 AM.png
Eric Miller
@ericmiller777
Sep 03 2017 21:39 UTC
I was just trying to use somthing I understood
@Manish-Giri thanks
CamperBot
@camperbot
Sep 03 2017 21:39 UTC
ericmiller777 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6499 | @manish-giri |http://www.freecodecamp.com/manish-giri
Eric Miller
@ericmiller777
Sep 03 2017 21:39 UTC
@daddycardona thanks
Adam Bohannon
@abohannon
Sep 03 2017 21:39 UTC
@daddycardona all sorts of errors. would be a whole ordeal to go through them all. First I was getting a ton of eslint errors, then I disabled the eslint package, but right now i'm getting this
Albert Cardona II
@daddycardona
Sep 03 2017 21:39 UTC
you welcome bro
Adam Bohannon
@abohannon
Sep 03 2017 21:40 UTC
@daddycardona sorry I thought that image would post with my message
Albert Cardona II
@daddycardona
Sep 03 2017 21:40 UTC
@abohannon I won't lie to you that is node and I don't understand them but try you tube lol
its cool i saw it ;)
Adam Bohannon
@abohannon
Sep 03 2017 21:40 UTC
haha yea, im sorta over it actually
i need to get to work on some stuff and this is sucking all my time
i just need to revert back
and admit defeat
Albert Cardona II
@daddycardona
Sep 03 2017 21:40 UTC
I hardly use github lol
or revert back and try again because sometimes sync and stuff like that messes up I have updated my website with filezilla but it wouldn't take so I had to delete it and upload my index.php file again ;)
@abohannon
@ericmiller777 i really hate this wherefor are thou challenge lmao
Albert Cardona II
@daddycardona
Sep 03 2017 21:49 UTC
 var something = collection.filter(function(e, i, ar) {
        return e + ' yo momma ' + i + ' yo daddy ';
    });
    console.log(something)
if this is my code why does the console.log (something) still equal
(3) [{…}, {…}, {…}]0: {a: 1, b: 2}1: {a: 1}2: {a: 1, b: 2, c: 2}length: 3__proto__: Array(0)
Eric Miller
@ericmiller777
Sep 03 2017 21:52 UTC
@daddycardona i hated it too
Gersho
@Gersho
Sep 03 2017 22:01 UTC
@daddycardona :wave: what's the rest of your code ?
Albert Cardona II
@daddycardona
Sep 03 2017 22:11 UTC

function whatIsInAName(collection, source) {
    // What's in a name?
    var arr = [];
    // Only change code below this line
    var src = Object.keys(source);
    console.log(src)
    var something = collection.filter(function(e, i, ar) {
        return e + ' yo momma ' + i + ' yo daddy ';
    });
    console.log(something)
        // Only change code above this line
    return arr;
}
whatIsInAName([{ "a": 1, "b": 2 }, { "a": 1 },
    { "a": 1, "b": 2, "c": 2 }
], { "a": 1, "c": 2 })
@Gersho I am still playing with this filter method lol
Gersho
@Gersho
Sep 03 2017 22:14 UTC
hmm i don't remember that challenge, what's the objective here ?
Albert Cardona II
@daddycardona
Sep 03 2017 22:16 UTC
to make sure that the collection objects have everything that the src objects have and then pull them out push them into arr
so like a:1 does not come out neither does a:1 , b:2
Gersho
@Gersho
Sep 03 2017 22:17 UTC
oh that rings a bell
Albert Cardona II
@daddycardona
Sep 03 2017 22:17 UTC
regardless is that something should return element yo mama 0 yo daddy
Gersho
@Gersho
Sep 03 2017 22:18 UTC
so you want to make checks based on the number of items in source, and only keep the objects that fulfilled them all ?
Albert Cardona II
@daddycardona
Sep 03 2017 22:21 UTC
yes but I don't care about that right now how come something returned the whole object?
Gersho
@Gersho
Sep 03 2017 22:27 UTC
i'd say it actually return an array of object
Albert Cardona II
@daddycardona
Sep 03 2017 22:28 UTC
and when I change return to return i, shouldn't that return 0, 1 , 1 ?
Gersho
@Gersho
Sep 03 2017 22:29 UTC
but the return value ? i don't know, you're trying to do
return { "a": 1, "b": 2 } + 'yo momma' + 0 ' 'yo daddy';
i have no idea how objects and string are supposed to interact in thgat setting
Albert Cardona II
@daddycardona
Sep 03 2017 22:30 UTC
me either I am pissing myself off. I thought e was element, so like a:1
Gersho
@Gersho
Sep 03 2017 22:31 UTC
collection is an array
so
Albert Cardona II
@daddycardona
Sep 03 2017 22:31 UTC
yes
Gersho
@Gersho
Sep 03 2017 22:31 UTC
collection = [
{ "a": 1, "b": 2 }, 
{ "a": 1 },
 { "a": 1, "b": 2, "c": 2 }
]
Albert Cardona II
@daddycardona
Sep 03 2017 22:31 UTC
so e would or should be the element? a:1 b:2 and the i should be the iteration?
Gersho
@Gersho
Sep 03 2017 22:31 UTC
so collection[0] is { "a": 1, "b": 2 },
to follow your way of thinking, you'd need to have an object loop inside your filter
Albert Cardona II
@daddycardona
Sep 03 2017 22:33 UTC
yeah but function (e == element, i == iteration ) is that correct
so if I say return I it shuold return 0,1,2 I thought
Gersho
@Gersho
Sep 03 2017 22:34 UTC
i is the index
return i should return [0,1,2] yes
Albert Cardona II
@daddycardona
Sep 03 2017 22:38 UTC
@Gersho if I put return i; in the filter function I get 0 : {a: 1} 1 : {a: 1, b: 2, c: 2} length : 2
Gersho
@Gersho
Sep 03 2017 22:39 UTC
oh
that because if the return of the filter function returns true, it will return the element too
Albert Cardona II
@daddycardona
Sep 03 2017 22:40 UTC
so I am confused about filter sog
Oh okay
Gersho
@Gersho
Sep 03 2017 22:40 UTC
try forEach or .map for that kind of usage
i didn't know either, just noticed when rereading .filter doc
Albert Cardona II
@daddycardona
Sep 03 2017 22:46 UTC
according to the challenge they recommended filter hasownproperty I am lost lol
well thanks for the help @Gersho im off :)
CamperBot
@camperbot
Sep 03 2017 22:47 UTC
daddycardona sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 397 | @gersho |http://www.freecodecamp.com/gersho
Gersho
@Gersho
Sep 03 2017 22:47 UTC
cya :)
just1witness
@just1witness
Sep 03 2017 22:48 UTC
Think of filter like a screen, you use a smaller screen to sift out smaller chunks of debris, you use an even smaller screen to filter out dust, the filter is kind of like a funnel, with a screen in the neck that you define. It puts the array through the test(the screen) and only returns what is true(what passed through)
@Gersho @daddycardona
Gersho
@Gersho
Sep 03 2017 22:49 UTC
:wave: @just1witness
just1witness
@just1witness
Sep 03 2017 22:50 UTC
it tests one at a time, so your first parameter is that element, the second is it's index, and you use the third to remove the elements from the array based on the test and their index (second parameter)
@Gersho Hi there :)
Stephen James
@sjames1958gm
Sep 03 2017 23:07 UTC
@daddycardona filter takes each element from the array and gives it to the function, if the function returns true, the value is placed into the output array, if false it is not.
This function is basically what filter is doing (not exactly but essentially)
function myFilter(array, fn) {
   var newArray = [];
   for (var i = 0; i < array.length; i++) {
      if (fn(array[i], i, array)){ 
        newArray.push(array[i]);
     }
   }
  return newArray;
}
fn(array[i], i, array) this is calling your function with the array element, the index and the whole array.
Jake
@JakeDVirus
Sep 03 2017 23:24 UTC

is there something wrong in this code

nav ul:first-child a {
    border-left: 1px solid rgba(255,255,255,0.4);
}

i mean is there any wrong this combination of selector?

Moisés Man
@moigithub
Sep 03 2017 23:28 UTC
<nav>
  <ul>
   <a>this</a>
   <a>this too</a>
  </ul>

  <ul>
   <a>not this</a>
  </ul>
</nav>
soo inside ur nav u have multiples ul u targeting the first.. and all a inside that
@NeelDVirus
Jake
@JakeDVirus
Sep 03 2017 23:38 UTC
@moigithub no no inside my <ul> i have multiple <li>
like this below
<ul>
    <li><a>like this</a><li>
    <li><a>like this</a><li>
    <li><a>like this</a><li>
    <li><a>like this</a><li>
    <li><a>like this</a><li>
</ul>
Moisés Man
@moigithub
Sep 03 2017 23:39 UTC
and what u trying to do ?
cuz the ur selector .. will work for the scenario /example posted above
Jake
@JakeDVirus
Sep 03 2017 23:39 UTC
This message was deleted
@moigithub and i wanted to target the <a> element residing in the first <li> element.
Moisés Man
@moigithub
Sep 03 2017 23:40 UTC
first li ?
then u should not put :first-child on the ul
Jake
@JakeDVirus
Sep 03 2017 23:41 UTC
@moigithub isn't the selector ul:first-child equivalent to "first child of the ul element"??
and the first child of the ul element is the first <li> element
Moisés Man
@moigithub
Sep 03 2017 23:44 UTC
yea "child" term is confusing :)
but it refer to the first element whatever u targeting
Jake
@JakeDVirus
Sep 03 2017 23:46 UTC
@moigithub Oops i was trapped in misunderstanding :D so using that means li:first-child will done the job
@moigithub Thanks btw :D
CamperBot
@camperbot
Sep 03 2017 23:46 UTC
neeldvirus sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3624 | @moigithub |http://www.freecodecamp.com/moigithub