These are chat archives for FreeCodeCamp/HelpJavaScript

18th
Sep 2017
Ken Haduch
@khaduch
Sep 18 2017 01:52
@caixeta-paula - Wikipedia project looks good. I think that the ajax error is something gross that happens, such as when the website that you made the request to doesn't respond, or gets some kind of resource error, invalid request, etc. You probably won't see it often. I think that it would be good to just intercept the error, print it to the output screen as you do when you get no results returned. (Perhaps you've already taken care of this, since I've been away from the computer most of the day and just browsing through the chat rooms.) The page looks good!
Gersho
@Gersho
Sep 18 2017 02:17
finished Exact Change algo challenge, never before have i ever been so ashamed of my own code
Joel Y.
@zapcannon99
Sep 18 2017 03:02
@Gersho
But it works right?
Gersho
@Gersho
Sep 18 2017 03:04
yes
had floating errors and since i didn't want to rewrite everything, i end up with a 200 lines godzilla of *100 , /100 and Math.round crap
Joel Y.
@zapcannon99
Sep 18 2017 03:05
godzilla of *100? That's interesting
Gersho
@Gersho
Sep 18 2017 03:06
      change = Math.round(change*100);
      change -= 100*100;
      change /= 100;
      cid[8][1] = Math.round(cid[8][1]*100);
      cid[8][1] -= 100*100;
      cid[8][1] /= 100;
i have 8 of those and a few smaller ones
but i'll try reworking it tomorrow
yoyo
@yoyohey2
Sep 18 2017 03:11
image.png
image.png
Joel Y.
@zapcannon99
Sep 18 2017 03:16
@Gersho oh I see lol
Innocent Tauzeni
@Telthem89
Sep 18 2017 04:21
Hello team coder
heroiczero
@heroiczero
Sep 18 2017 04:22
Hello
Ogundele Olumide
@Lumexralph
Sep 18 2017 04:46
@heroiczero Hi
Kelechi Chinaka
@ke1echi
Sep 18 2017 04:46
:wave: @Lumexralph
Ogundele Olumide
@Lumexralph
Sep 18 2017 04:46
I love it when the creator of any technology or invention takes time to give a good documentation
i sooo much love it!! hope some of them learns
@kelechy Bro! a lil while, good morning
Kelechi Chinaka
@ke1echi
Sep 18 2017 04:47
docs are as important as the tech @Lumexralph
morning bro @Lumexralph
Ogundele Olumide
@Lumexralph
Sep 18 2017 04:49
@kelechy unfortunately not all of them give much effort into it, i was to use an ORM sequelize, i hated the docs, it frustrated and confused me instead of making things clearer
Kelechi Chinaka
@ke1echi
Sep 18 2017 04:49
hows it been @Lumexralph
somethings i wonder how they expect devs to use the tech when they write shabby docs @Lumexralph
Ogundele Olumide
@Lumexralph
Sep 18 2017 04:50
been good, thank God, getting hands dirty with MongoDB and NodeJS
you?
Kelechi Chinaka
@ke1echi
Sep 18 2017 04:53
tryin to learn sort and search algos
Ogundele Olumide
@Lumexralph
Sep 18 2017 04:58
@kelechy yeah... that stuff right, i think JS uses quicksort
@kelechy all the best of today
Kelechi Chinaka
@ke1echi
Sep 18 2017 04:59
yea, prepping for today's work
u too @Lumexralph
Markus Kiili
@Masd925
Sep 18 2017 05:13
Morning
@Lumexralph Algorithm(s) that JS sort method uses depends on the browser.
Markus Kiili
@Masd925
Sep 18 2017 05:24
Quicksort has the stability problem, so it would not make a good general choice here.
Ogundele Olumide
@Lumexralph
Sep 18 2017 05:39
@Masd925 yeah, that's true, Morning always good having you around
Guderian Raborg
@hypercuber
Sep 18 2017 05:42
How do I use Projector.js in codepen?
I am working with three.js
Pieter Stokkink
@forkerino
Sep 18 2017 05:51
:wave:
Markus Kiili
@Masd925
Sep 18 2017 05:51
@forkerino Yo.
Pieter Stokkink
@forkerino
Sep 18 2017 05:52
@Masd925 hello! How's the jiujitsu?
Markus Kiili
@Masd925
Sep 18 2017 05:54
@forkerino It has gone quite well. First sparring was last week and I submitted one guy with the lockdown. It must be the funniest submission there is.
Hurts and bruises all over the place, but I'm over 40. That is what I expected.
Pieter Stokkink
@forkerino
Sep 18 2017 05:59
Nice!
I'll be moving to the Hague in a few weeks, after I'm settled I'll go looking for some martial arts school, perhaps it will also be JJ. But I might end up doing tai chi. :laughing:
Will definitely start swimming in the sea once again!
Markus Kiili
@Masd925
Sep 18 2017 06:04
@forkerino ok, nice.
Pieter Stokkink
@forkerino
Sep 18 2017 06:11
@Masd925 how's work? Any interesting projects?
Markus Kiili
@Masd925
Sep 18 2017 06:15
@forkerino Mostly same as earlier, but had to do work with some virtual machines and do some animations lately. Nice change.
After I finish this pulp simulator, I will most likely do/port flash animations to canvas for some time.
How about you?
Pieter Stokkink
@forkerino
Sep 18 2017 06:22
I'm doing some interesting things nowadays. Did a lot of substituting of the angular store to use Redux instead, but am working on our visual editor now. So lots of graphical stuff with FabricJS and Leaflet. I'm knee deep in trigonometry, for the first time in decades.
Ogundele Olumide
@Lumexralph
Sep 18 2017 06:23
lol.... Trig
Pieter Stokkink
@forkerino
Sep 18 2017 06:24
:wave: @Lumexralph
Apparently things look different when you look at them at an angle. :smile:
Ogundele Olumide
@Lumexralph
Sep 18 2017 06:26
good morning
animations use it mostly, right?
or graphics
Pieter Stokkink
@forkerino
Sep 18 2017 06:29
We use it to show solar panels at an angle on slanted roofs.
Most is baked into Fabric js, but for some things like editor handles, we need to do it ourselves.
My train is at my stop. Talk to you all another time!
Ogundele Olumide
@Lumexralph
Sep 18 2017 06:34
be good man
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 09:06
gm everyone
yofri
@yofriadi
Sep 18 2017 09:38
why my code isnt working?
function serangan(attack1) {
  myArr = attack1.split('');
  console.log(myArr);
}

console.log(serangan(21));
Markus Kiili
@Masd925
Sep 18 2017 09:40
@Yofri Do numbers have a split method?
Gersho
@Gersho
Sep 18 2017 09:41
console.log(serangan(21));
would return nothing, since serangan() returns nothing
yofri
@yofriadi
Sep 18 2017 09:41
@Masd925 ow i guess i should use for
Gersho
@Gersho
Sep 18 2017 09:41
also please use var/let/const when declaring something
no, parseInt should do fine to change your number into a string (that you can split like you wanted)
yofri
@yofriadi
Sep 18 2017 09:43
@Gersho ok thanks man. @Masd925 well i found i have to conver it to string first
CamperBot
@camperbot
Sep 18 2017 09:43
yofri sends brownie points to @gersho and @masd925 :sparkles: :thumbsup: :sparkles:
:cookie: 440 | @gersho |http://www.freecodecamp.com/gersho
:star2: 4489 | @masd925 |http://www.freecodecamp.com/masd925
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 10:18
doesnt parseint turns 1 string into an umber?
Markus Kiili
@Masd925
Sep 18 2017 10:20
@tiagocorreiaalmeida Yes, it tries to parse the string into an integer, and returns NaN if it cannot.
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 10:21
im probably doing alot of work around without the need to image you have an umber 123
you need to split it and sum 1+2+3
what would be your fastest way of doing it?
Markus Kiili
@Masd925
Sep 18 2017 10:24
@tiagocorreiaalmeida Turn into a string, split into an array of strings, and use reduce to sum them.
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 10:24
yeah but on reduce they are strings and not numbers
that's my main problem
how would you parse them?
Markus Kiili
@Masd925
Sep 18 2017 10:24
@tiagocorreiaalmeida You can turn them back into numbers inside reduce.
Number(str)
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 10:25
yeah nm had it done and started to write more no idea why sorry and thanks mate
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 10:31
function digital_root(n) {
  // ...
  n = n.toString();
  while(n.length > 1){
    reduceIt(n);
  }
}

function reduceIt(string){
  string = string.split("");
   var result = string.reduce((acc,value)=>{
    return acc + Number(value);
  },0);
  result = result.toString();
    return result;
  }
digital_root(16)
=> 1 + 6
=> 7

digital_root(942)
=> 9 + 4 + 2
=> 15 ...
=> 1 + 5
=> 6

digital_root(132189)
=> 1 + 3 + 2 + 1 + 8 + 9
=> 24 ...
=> 2 + 4
=> 6

digital_root(493193)
=> 4 + 9 + 3 + 1 + 9 + 3
=> 29 ...
=> 2 + 9
=> 11 ...
=> 1 + 1
=> 2
im missing something
the second "code" is the results example
korzo
@korzo
Sep 18 2017 10:51
@tiagocorreiaalmeida you have to assign reduceIt(n);
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 10:51
yeah
solved it now
was sleeping for sure thanks @korzo
CamperBot
@camperbot
Sep 18 2017 10:51
tiagocorreiaalmeida sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 504 | @korzo |http://www.freecodecamp.com/korzo
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 10:52
do you think codewards and codefights are good ways to improve/train js?
korzo
@korzo
Sep 18 2017 11:02
I think so. But challenges there are very specific and I think building real things is better way
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 11:11
can you point me some good ideas of projects or something like that?and I think the same way as you
korzo
@korzo
Sep 18 2017 11:13
@tiagocorreiaalmeida My solution
function digital_root(n) {
  return n < 10 ? n : digital_root(n.toString().split('').reduce((a, e) => a + Number(e), 0));
}
Usually when using while, recursion is better solution
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 11:17
@korzo looks way better
well it takes time to get better at those things I guess, thanks
korzo
@korzo
Sep 18 2017 11:19
when I started learning programming, I used it for everything I did more then once.
I made a lot of bookmarklets, Chrome extensions, scripts for repeating tasks or my internal IS
Or go through startup/crowdsourcing pages to find interesting ideas for project
@tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 11:23
ok thanks @korzo
CamperBot
@camperbot
Sep 18 2017 11:23
tiagocorreiaalmeida sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
api offline
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 11:28
//This is exactly what the real test fixture looks like.
var lucky_number = Math.floor(Math.random() * 100 + 1);
Test.assertEquals(guess, lucky_number, "Sorry. Unlucky this time.");
image.png
confusing think, cna't figure out what should I evne do
the code start is just a var lucky_number = 10;
korzo
@korzo
Sep 18 2017 11:36
@tiagocorreiaalmeida Link to kata?
Abhinav Mishra
@abhinav-m
Sep 18 2017 12:14
Im currently on the dungeon crawler
i have a few ideas on how to actually make the dungeon
but they dont seem very nice
can someone point me towards a good way to do it
WAINGOR
@WAINGOR
Sep 18 2017 12:18
hi all, I am at intermediate algo's: arguments optional:

function addTogether() {

 var args = Array.from(arguments);

  console.log(" This is" +
args.some(function(el){
    return typeof el != 'number';})
);
  if (args.some(function(el){
    return typeof el != 'number';})) 
    {return undefined ;}
  else {
    return args.length > 1 ? args[0] + args[1] : function(a) {
    return args[0] + a;
    };
  }
}

addTogether(2,[3]);
if I run this in the browser it logs: "this is true"
but still it doesnt return undfined?!?! Im really confused here
it says 4 of the 5 answers are correct... but I rlly dont know why this scenario doesnt return undefined....
Abhinav Mishra
@abhinav-m
Sep 18 2017 12:19
oh nvm
任洪飞
@mynameisRHF
Sep 18 2017 12:23
i do not know the Understanding Boolean Values
who can help we get it
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 12:32
@korzo sorry for taking so long will post it now
nm can't find it now lel will start a new kata np xd
korzo
@korzo
Sep 18 2017 12:39
@mynameisRHF What you don't understand about Booleans?
任洪飞
@mynameisRHF
Sep 18 2017 12:40
I'm just the same, thank you, huh
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 12:49
Hey everyone. If I have a state in react thst has 3 value pairs and I will be updating just 2 of them with the this.setState method will I have to pass all 3 value pairs or just the states I want to update?
Alex
@alexandrupintilei
Sep 18 2017 12:55
Can someone give me an hint in how to solve a palindrom problem?Thx
korzo
@korzo
Sep 18 2017 12:59
@alexandrupintilei remove unwanted characters
reverse string and compare it to original string - unwanted characters
return result of comparison
Alex
@alexandrupintilei
Sep 18 2017 13:00
@korzo thx
CamperBot
@camperbot
Sep 18 2017 13:00
alexandrupintilei sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 505 | @korzo |http://www.freecodecamp.com/korzo
WAINGOR
@WAINGOR
Sep 18 2017 13:16
@korzo you seem to know a lot... do you think you can help me here with my issue? I have no idea why this code doesnt return undefined... I mean it literally says that the conditional returns true! But still it doesnt return undefined for addTogether(2,[3]);

function addTogether() {

 var args = Array.from(arguments);

  console.log(" This is" +
args.some(function(el){
    return typeof el != 'number';})
);
  if (args.some(function(el){
    return typeof el != 'number';})) 
    {return undefined ;}
  else {
    return args.length > 1 ? args[0] + args[1] : function(a) {
    return args[0] + a;
    };
  }
}

addTogether(2,[3]);
@Blauelf @forkerino
korzo
@korzo
Sep 18 2017 13:25
@WAINGOR It returns undefined
WAINGOR
@WAINGOR
Sep 18 2017 13:26
it doesnt :(
@korzo if you fill this answer in at the excercise you will see
FCC says its wrong 8*(
korzo
@korzo
Sep 18 2017 13:27
@WAINGOR That's strange, I tried it it console and addTogether(2,[3]); returns undefined
WAINGOR
@WAINGOR
Sep 18 2017 13:27
looool
FCC is broken
maybe call it as an issue?

so weird... @korzo check this out: this proves that the block of code is actually running!! yet according to FCC it does not return undefined...
```
function addTogether() {

var args = Array.from(arguments);

console.log(" This is" +
args.some(function(el){
return typeof el != 'number';})
);
if (args.some(function(el){
return typeof el != 'number';}))
{
console.log('check if codeblock executes');
return undefined;}
else {
return args.length > 1 ? args[0] + args[1] : function(a) {
return args[0] + a;
};
}
}

addTogether(2,[3]);
``

function addTogether() {

 var args = Array.from(arguments);

  console.log(" This is" +
args.some(function(el){
    return typeof el != 'number';})
);
  if (args.some(function(el){
    return typeof el != 'number';})) 
    {
console.log('check if codeblock executes');
return undefined;}
  else {
    return args.length > 1 ? args[0] + args[1] : function(a) {
    return args[0] + a;
    };
  }
}

addTogether(2,[3]);
korzo
@korzo
Sep 18 2017 13:31
@WAINGOR failing test is addTogether(2)([3])
@WAINGOR because you should return function in this case
WAINGOR
@WAINGOR
Sep 18 2017 13:32
loool I misread
U are right
:D
WAINGOR
@WAINGOR
Sep 18 2017 13:38
@korzo just in general, what does this notation mean? Does it mean that the second parameter is for the inside functon? I have no idea
korzo
@korzo
Sep 18 2017 13:40
@WAINGOR It's called currying from functional programming. You create closure for first parameter and return function accepting another parameter
@WAINGOR
function sum(a) {
    return function(b) {
        return a +b;
    }
}

var a = sum(5);
console.log(a(2));
console.log(a(5));
@WAINGOR to make it even more confusing, you can pass function as argument
function sum(a) {
    return function(b) {
        return function(fn) {
            return fn(a, b);
        }
    }
}

var a = sum(5)(2);
console.log(a((i, j) => i + j));
console.log(a((i, j) => i - j));
Antonious Stewart
@Antonious-Stewart
Sep 18 2017 14:00
who here thinks they are good at regex
like is able to teach it kind of good
WAINGOR
@WAINGOR
Sep 18 2017 14:03
thanks @ korzo
thanks @korzo
CamperBot
@camperbot
Sep 18 2017 14:03
waingor sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 506 | @korzo |http://www.freecodecamp.com/korzo
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 14:34
@korzo are you used to css/bootstrap?
korzo
@korzo
Sep 18 2017 14:34
@tiagocorreiaalmeida not v4
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 14:34
its v3
can you give me a little help?
http://tiagoalmeidacorreia.pt/ change the screen size to less than 768px and then watch this tag <div class="navbar-collapse collapse in" id="menu" aria-expanded="true" style="">
it defines height 1px when colsed and changes it to the desire height on toggle
is that a normal boostrap behavior?
cause of that it creates a strange behavior like an animation in this case a bad looking animation
Antonious Stewart
@Antonious-Stewart
Sep 18 2017 14:43
@cowCrazy thanks
CamperBot
@camperbot
Sep 18 2017 14:43
astewart400 sends brownie points to @cowcrazy :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @cowcrazy |http://www.freecodecamp.com/cowcrazy
korzo
@korzo
Sep 18 2017 14:46
@tiagocorreiaalmeida Yes. When collapsed, it has display: none, so height doesn't matter.
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 14:46
so why does that happen that effect?
korzo
@korzo
Sep 18 2017 14:52
@tiagocorreiaalmeida I think it's because of animation
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 14:52
Hey everyone. If I have a state in react thst has 3 value pairs and I will be updating just 2 of them with the this.setState method will I have to pass all 3 value pairs or just the states I want to update?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 14:52
@korzo I think this solves it
on the nav
change the height 80 px
to min-height 80px
and see if works well there probaly changed more things on the web and can't rmeember what was :D
Diego Mayer
@Chrono79
Sep 18 2017 14:54
@RoniqueRicketts just pass the 2 you want to change
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 14:55
@Chrono79 ok so when even if we have 20 items in the object we can just update when we want in setState. Question 2. is there a limit on how many times you can use this.setState method?
Diego Mayer
@Chrono79
Sep 18 2017 14:56
not that I know of, it's like changing the value of a var
it doesn't wear off ;)
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 15:06
@Chrono79 thanks crazy guy :trollface: have a brownie.
CamperBot
@camperbot
Sep 18 2017 15:06
roniquericketts sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4540 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Sep 18 2017 15:08
:+1:
Nathan
@clarken1996
Sep 18 2017 15:17
hey guys, so im making a bookmark website and I'm using createElement to create the bookmark, I was just wondering how I can delete an element? is it just removeElement?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:19
do you have a link @clarken1996 ?
Nathan
@clarken1996
Sep 18 2017 15:20
@tiagocorreiaalmeida just in the middle of moving it over to my codepen 2 ecs
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:20
great
Nathan
@clarken1996
Sep 18 2017 15:24
@tiagocorreiaalmeida please don't mind any bugs, it was just a quick copy and paste
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:26
how you want the user to rmove them?
where's the user suppoed to click to remove?
Nathan
@clarken1996
Sep 18 2017 15:30
@tiagocorreiaalmeida for right now it would just be clicking on the ('a').. later I will add a trash icon
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:32
there's a jquery thing called remove()
wanna use jquery or?
quit simple and direct
Nathan
@clarken1996
Sep 18 2017 15:33
no, already have a grasp on jQuery.. kinda just learning vanilla JS right now
Sandip Shrestha
@saninmersion
Sep 18 2017 15:33

@clarken1996

var x = document.getElementById("mySelect");
x.remove(2);

pure js thing btw

Nathan
@clarken1996
Sep 18 2017 15:33
but trust me I thought about the same thing.. would be so much eaasier
@saninmersion thought of that too...
buttttt
Sandip Shrestha
@saninmersion
Sep 18 2017 15:34
but?
Nathan
@clarken1996
Sep 18 2017 15:34
correct me if im wrong doesn't that only remove things with an ID?
and because there will be multiple bookmarks I cant use IDs
Adit
@adittyagi
Sep 18 2017 15:35
Hey guys. How to use a single button to change bg-color and update the new message in random quote machine ?
_
Garrus Napp
@GarrusNapp
Sep 18 2017 15:36
@adittyagi jquery ?
Sandip Shrestha
@saninmersion
Sep 18 2017 15:36
@clarken1996 modify the selector. JS ES6 even supports document.querySelector('.class'); document.querySelector('#id');
Nathan
@clarken1996
Sep 18 2017 15:36
@saninmersion orrrr am I wrong and need to scratch amateur off and got back to beginner
Adit
@adittyagi
Sep 18 2017 15:36
@GarrusNapp js maybe
Should I show you what I've done ?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:37
@clarken1996
Nathan
@clarken1996
Sep 18 2017 15:37
@saninmersion okay okay im with you
Jason Luboff
@JLuboff
Sep 18 2017 15:37
@adittyagi Create an on click event that modifies that css
Garrus Napp
@GarrusNapp
Sep 18 2017 15:37
@adittyagi yea, why not
Nathan
@clarken1996
Sep 18 2017 15:37
@tiagocorreiaalmeida yes?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:38
sec thinking of something
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:38
yeah got this
there's a way of doing it
Garrus Napp
@GarrusNapp
Sep 18 2017 15:38
@adittyagi you've got stuff mixed up a bit
Nathan
@clarken1996
Sep 18 2017 15:38
@tiagocorreiaalmeida oh please share
Garrus Napp
@GarrusNapp
Sep 18 2017 15:39
@adittyagi <button onClick="changeColor()" that's fine, but you also use $("#getMessage").on("click", function() {...}
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:39
you would set a new attribute to every bookmark you create and increment it the first 0 the second 1 and bla bla like , number = "1" then on click on the .bookmark class you use the $(this).attr("number")
Garrus Napp
@GarrusNapp
Sep 18 2017 15:40
@adittyagi instead you could do $("#getMessage").on("click", function() { changeColor() .... }
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:40
then you would have the number of the tag clicked and the you would remove that I think
hope it wasnt confusing :D
Sandip Shrestha
@saninmersion
Sep 18 2017 15:40
or you just do multiple tasks inside same callback function for click. to get quote and change bg.
Garrus Napp
@GarrusNapp
Sep 18 2017 15:41
@adittyagi basicly in the callback function of .on you call all the functions you need
Margaret Greaney
@greaneym
Sep 18 2017 15:42
@korzo , thanks that is a good suggestion and also I need to learn more about ternary conditions and their array attributes.
CamperBot
@camperbot
Sep 18 2017 15:42
greaneym sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 508 | @korzo |http://www.freecodecamp.com/korzo
Nathan
@clarken1996
Sep 18 2017 15:42
@tiagocorreiaalmeida thanks
CamperBot
@camperbot
Sep 18 2017 15:42
clarken1996 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 353 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:42
did you understood it mate?
Nathan
@clarken1996
Sep 18 2017 15:43
@tiagocorreiaalmeida yesss, it will do for now. I might have to look into a cleaner way of doing it in the future but that will work for now!
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:43
great gl
post your solution in the end eheh
Nathan
@clarken1996
Sep 18 2017 15:44
will do, thanks again @tiagocorreiaalmeida
CamperBot
@camperbot
Sep 18 2017 15:44
clarken1996 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
api offline
Adit
@adittyagi
Sep 18 2017 15:46
@GarrusNapp I am confused! I was on a long holiday and starting again.
Garrus Napp
@GarrusNapp
Sep 18 2017 15:47
$("#btn").on("click",function() {
    changeColor();
    showMsg();
});
Adit
@adittyagi
Sep 18 2017 15:49
aah okay thank you @GarrusNapp
CamperBot
@camperbot
Sep 18 2017 15:49
adittyagi sends brownie points to @garrusnapp :sparkles: :thumbsup: :sparkles:
:cookie: 845 | @garrusnapp |http://www.freecodecamp.com/garrusnapp
Garrus Napp
@GarrusNapp
Sep 18 2017 15:50
@adittyagi also note that you make request to API for quote, so you should call them in getJson success, otherwise you don't have msg to show
Nathan
@clarken1996
Sep 18 2017 15:52
@tiagocorreiaalmeida changing over to .map() method to add bookmarks and using .splice() to remove them. I kinda cheated to ge the answer but thought I would fill you in
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:52
if it works :D
AysunShack
@AysunShack
Sep 18 2017 15:58
anyone here worked with Gulp and JQuery?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 15:59
only jquery
AysunShack
@AysunShack
Sep 18 2017 16:00
is there a conflict issue possible if I merge multiple libraries into one file?
i have jquery.js, bootstrap.js, owl-carousel.js and custom.js
trying to put these inside just one file
owl-carousel doesn't work if I do that
if I request them separately it works
no console errors
Pieter Stokkink
@forkerino
Sep 18 2017 16:19
@AysunShack I don't know owl-carousel, or custom.js, but theoretically you only get a problem if they use identical variable names or class names and don't have proper namespacing
Christopher McCormack
@cmccormack
Sep 18 2017 16:19
@AysunShack it depends on if one of those libraries depends on another. For example, standard bootstrap requires jQuery, so jQuery would need to be at the top
@forkerino :wave:
Pieter Stokkink
@forkerino
Sep 18 2017 16:19
Yo
Jason Luboff
@JLuboff
Sep 18 2017 16:20
Morning all
Christopher McCormack
@cmccormack
Sep 18 2017 16:20
@JLuboff hiya
abraham anak agung
@padunk
Sep 18 2017 16:20
Hi guys, did anyone know the different between function (params) with function ({params}) or function([params])?
AysunShack
@AysunShack
Sep 18 2017 16:20
@forkerino @cmccormack yes they are in the correct order. I'm also minifying these. Would that be the problem?
Christopher McCormack
@cmccormack
Sep 18 2017 16:20
@padunk the latter are destructuring
AysunShack
@AysunShack
Sep 18 2017 16:20
'src/js/jquery.js',
'src/js/bootstrap.js',
'src/js/tether.js',
'src/js/owl.carousel.js',
'src/js/custom.js'
Jason Luboff
@JLuboff
Sep 18 2017 16:20
@cmccormack How's it going?
Christopher McCormack
@cmccormack
Sep 18 2017 16:21
@JLuboff great, had a tech-free weekend at the cabin, nice and refreshed! Yourself?
@AysunShack doesn't bootstrap depend on tether?
abraham anak agung
@padunk
Sep 18 2017 16:21
@cmccormack what is destructuring?
AysunShack
@AysunShack
Sep 18 2017 16:21
ah yes you're right, still, I didn't get errors though
Christopher McCormack
@cmccormack
Sep 18 2017 16:22
@AysunShack let's say you passed an object argument to a function - destructuring would allow you to only use specific properties of that object as variables in your function
Nathan
@clarken1996
Sep 18 2017 16:23
Hey does anyone know where I can find a list of fun vanilla JS projects?
Christopher McCormack
@cmccormack
Sep 18 2017 16:24
@padunk here's a cruddy example:
> var obj = {a: 1, b: 2, c:3}
> var {a:alpha} = obj 
> alpha
1
Jason Luboff
@JLuboff
Sep 18 2017 16:24
@cmccormack Nice. Had a fairly low key weekend myself. Went to dinner with some friends on Friday and did a little go-karting that night. Then not a whole lot for saturday/sunday
Christopher McCormack
@cmccormack
Sep 18 2017 16:25
@JLuboff go karting sounds awesome
We did some ATV riding up on the Mogollon Rim, it was a gorgeous weekend for it, great weather
AysunShack
@AysunShack
Sep 18 2017 16:25
@cmccormack thanks for the help, still can't get this damn thing fixed
CamperBot
@camperbot
Sep 18 2017 16:25
aysunshack sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1213 | @cmccormack |http://www.freecodecamp.com/cmccormack
abraham anak agung
@padunk
Sep 18 2017 16:26
@cmccormack this is little confusing. i'll check that out. Thank you
CamperBot
@camperbot
Sep 18 2017 16:26
padunk sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1214 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Sep 18 2017 16:26
@AysunShack sorry, only used webpack, not gulp so not 100%
AysunShack
@AysunShack
Sep 18 2017 16:26
sometimes I wonder if messing around with gulp is worth it
Pieter Stokkink
@forkerino
Sep 18 2017 16:26
@AysunShack minifying shouldn't be a problem, although maybe it messes up with identically named functions in different files. Maybe try using two different bundles.
Christopher McCormack
@cmccormack
Sep 18 2017 16:26
@padunk it can be pretty confusing so I recommend reading through thoroughly and testing some stuff out yourself. You'll see a ton of destructuring in frameworks like React
Pieter Stokkink
@forkerino
Sep 18 2017 16:27
@JLuboff :wave:
abraham anak agung
@padunk
Sep 18 2017 16:27
@cmccormack yes, i starting learning React now and i think i need to understand this new ES6 syntax
Christopher McCormack
@cmccormack
Sep 18 2017 16:28
Think of destructuring exactly how it sounds, you're breaking down an object or array into a smaller piece for use, without having to create a temporary variable to store it or using the entire object when you only need one piece
Jason Luboff
@JLuboff
Sep 18 2017 16:29
@forkerino How's it going?
Christopher McCormack
@cmccormack
Sep 18 2017 16:31
@padunk take special note of this section, trying to get destructuring working in this scenario was really confusing to me until I read this https://mdn.io/Destructuring_assignment#Assignment_without_declaration
AysunShack
@AysunShack
Sep 18 2017 16:32
so while you distruct this and have other functions in your code that could call properties inside that object is what messes it up?
destruct*
Pieter Stokkink
@forkerino
Sep 18 2017 16:32
@JLuboff all good, we get the keys to our house next week!
Jason Luboff
@JLuboff
Sep 18 2017 16:33
@forkerino Awesome! Congrats!
AysunShack
@AysunShack
Sep 18 2017 16:33
so it seems that bootstrap.js is in conflict with owl-carousel.js
and I don't know js enough to fix this
just removed bootstrap and the carousel works -.-
Jason Luboff
@JLuboff
Sep 18 2017 16:33
Perhaps the order in which you require them?
abraham anak agung
@padunk
Sep 18 2017 16:33
@cmccormack yup, i think i got a picture of it now. this is cool :smile:
AysunShack
@AysunShack
Sep 18 2017 16:34
yea, it's 'src/js/jquery.js',
'src/js/bootstrap.js',
'src/js/tether.js',
'src/js/owl.carousel.js',
'src/js/custom.js'
sorry tether before bootstrap I mean
Pieter Stokkink
@forkerino
Sep 18 2017 16:34
@AysunShack I think @cmccormack meant to tag someone else regarding object destructuring
AysunShack
@AysunShack
Sep 18 2017 16:34
yea, I realised that now :D
Pieter Stokkink
@forkerino
Sep 18 2017 16:35
Ok
:smile:
Christopher McCormack
@cmccormack
Sep 18 2017 16:36
sorry :D
@AysunShack did you try changing the order, loading bootstrap after owl?
Also what version of owl are you using?
AysunShack
@AysunShack
Sep 18 2017 16:38
-.-
hit me with the biggest hammer
now it works
owl before bootstrap
officially I hate bootstrap
I'm using the v4 beta of bootstrap
and 2 2 1 of owl
Pieter Stokkink
@forkerino
Sep 18 2017 16:39
Time to stop using it then!
AysunShack
@AysunShack
Sep 18 2017 16:40
seriously, not only this, when I tried using their flexbox classes combined with cols and rows, I never got the same results
time to digg more into flexbox and css grid
plus I'm tired of rewriting nav navbar navbar-nav idiotic classes
Pieter Stokkink
@forkerino
Sep 18 2017 16:41
I am using flexbox exclusively
AysunShack
@AysunShack
Sep 18 2017 16:41
yea, I need to switch too
do you have a good snippet for navigation?
I always struggle at the nav section
Christopher McCormack
@cmccormack
Sep 18 2017 16:42
Bootstrap 4 is great until you need to use it with other tools unfortunately
Pieter Stokkink
@forkerino
Sep 18 2017 16:42
Not on my phone (which I'm on now)
AysunShack
@AysunShack
Sep 18 2017 16:42
yea definitely!
Jason Luboff
@JLuboff
Sep 18 2017 16:43
Bootstrap v4 is built on flexbox now
AysunShack
@AysunShack
Sep 18 2017 16:43
not entirely
put "d-flex" declaration in nav and whole thing blows up
AysunShack
@AysunShack
Sep 18 2017 16:52
thank you both for the assistance @forkerino @cmccormack !
CamperBot
@camperbot
Sep 18 2017 16:52
aysunshack sends brownie points to @forkerino and @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 2934 | @forkerino |http://www.freecodecamp.com/forkerino
api offline
Christopher McCormack
@cmccormack
Sep 18 2017 16:52
np glad you got it working
abraham anak agung
@padunk
Sep 18 2017 16:54
@cmccormack sorry one quick question, if i write function ({params}) i need to pass the parameter with object too right?
Christopher McCormack
@cmccormack
Sep 18 2017 16:55
Parameters are in function declaration. Let's say you have an object passed as an argument with a property of params to your function above, in your function you use params as a variable and it should have the value of object.params
abraham anak agung
@padunk
Sep 18 2017 16:56
yes right, thanks again man @cmccormack i got it now
CamperBot
@camperbot
Sep 18 2017 16:56
padunk sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
api offline
Christopher McCormack
@cmccormack
Sep 18 2017 16:58
> function prnt({params}){console.log(params)}
> var obj = {params: 'cat', other: 'other'}
> prnt(obj)
cat
abraham anak agung
@padunk
Sep 18 2017 17:04
@cmccormack :+1: i'm playing with it in repl.it with object and array, nice example.
George Kech.
@georgemitnick
Sep 18 2017 17:07
Guys, can someone tell me how "Jackson" is passed to theLastName?
function celebrityName (firstName) {
        var nameIntro = "This celebrity is ";
        // this inner function has access to the outer function's variables, including the parameter​
       function lastName (theLastName) {
            return nameIntro + firstName + " " + theLastName;
        }
        return lastName;
    }
    ​
    ​var mjName = celebrityName ("Michael"); // At this juncture, the celebrityName outer function has returned.​
    ​
    ​// The closure (lastName) is called here after the outer function has returned above​// Yet, the closure still has access to the outer function's variables and parameter​
    mjName ("Jackson"); // This celebrity is Michael Jackson
Because it uses the var mjName.
Christopher McCormack
@cmccormack
Sep 18 2017 17:11
@georgemitnick celebrityName returns a function. When you called celebrityName and assigned the response to mjName, you assigned the reference to the function lastName to mjName. When you invoke mjName by passing 'Jackson' you're passing 'Jackson' as an argument to the returned lastName function
George Kech.
@georgemitnick
Sep 18 2017 17:14
@cmccormack Not following exactly. CelebrityName is assiged to variable mjName .
How the variable mjName is turned into a function call
Christopher McCormack
@cmccormack
Sep 18 2017 17:14

@georgemitnick because you invoked the function, you are assigning the return value, not the function iteself:

var mjName = celebrityName;

would assign the function celebrityName to mjName, but that isn't what you're doing

korzo
@korzo
Sep 18 2017 17:15
@greaneym ternary operator is shortcut for if/else useful when code is very short
condition ? expression for true : expression for false;
George Kech.
@georgemitnick
Sep 18 2017 17:15
Oh damn, yeah return lastName
Christopher McCormack
@cmccormack
Sep 18 2017 17:15
@georgemitnick return lastName; returns the location of the lastName function in memory
@georgemitnick yeah :thumbsup:
George Kech.
@georgemitnick
Sep 18 2017 17:16
@cmccormack So damn complicated for a newbie...
Christopher McCormack
@cmccormack
Sep 18 2017 17:16
@georgemitnick yeah lots of invisible threads you have to learn to see in your mind
George Kech.
@georgemitnick
Sep 18 2017 17:18
So, the value Michael is passed to firstName and assigned to the closure but at the same time the value of lastName is returned and at the same time is processed by the closure?
Super complicated for my simple mind...
Christopher McCormack
@cmccormack
Sep 18 2017 17:18
@georgemitnick no the reference to lastName is returned
when you pass a function name without the parenthesis, you are passing a reference of where the function lives in memory.
Nothing is processed until you call the response with a new value, then that inner function is invoked
George Kech.
@georgemitnick
Sep 18 2017 17:20
Oh, I see something like passing a var without an actual value.
ex. var money;
Christopher McCormack
@cmccormack
Sep 18 2017 17:20
but because that inner function is a closure it maintains access to the outer functions variables
George Kech.
@georgemitnick
Sep 18 2017 17:20
and then money = 45;
Christopher McCormack
@cmccormack
Sep 18 2017 17:21
@georgemitnick more like an array, in your example the money variable will actually contain the value of 45 and not a reference to a memory location. That may be a little wrong, I don't recall how Javascript stores everything underneath
George Kech.
@georgemitnick
Sep 18 2017 17:22
Anyone who says that JavaScript is super easy needs a kick in the nuts.
Christopher McCormack
@cmccormack
Sep 18 2017 17:22
it's not that bad :)
Jason Luboff
@JLuboff
Sep 18 2017 17:22
I wouldn't say its super easy...but it's definitely easier than some other programming languages
Christopher McCormack
@cmccormack
Sep 18 2017 17:23
> var money = 50
undefined
> var lessMoney = money
undefined
> money
50
> lessMoney
50
> lessMoney -= 50
> money
50
> lessMoney
0
Notice how in this example money doesn't change even though you assigned the value of money to lessMoney
Now look at this array example, where arrays are references in memory:
> var moneyArr = [10, 20, 50]
undefined
> var lessMoneyArr = moneyArr
undefined
> lessMoneyArr[2] -= 50
> moneyArr
[ 10, 20, 0 ]
> lessMoneyArr
[ 10, 20, 0 ]
See how both variables are changed
George Kech.
@georgemitnick
Sep 18 2017 17:27
Aren't you saying it the other way around. If Arrays are only references in memory why are both array values change and that doesn't happen with variables?
@JLuboff JavaScript can be hard for someone that tries to learn it as a first language. Is PHP harder than JS?
Pavlo Rudyi
@paulcarroty
Sep 18 2017 17:28
hello people, can someone help me with this code:
async function MM() {

   let testObj = {'key1': [val1, val2, val3]};
     fs.writeFile('./ZAbToWriteLater.json', JSON.stringify(testObj), 'utf8');
   console.log(JSON.stringify(testObj));
}
// SyntaxError: ZAbToWriteLater.json: Unexpected end of JSON input
Christopher McCormack
@cmccormack
Sep 18 2017 17:28
@georgemitnick Because both arrays are referencing the same location in memory
George Kech.
@georgemitnick
Sep 18 2017 17:29
@cmccormack Oh.
Jason Luboff
@JLuboff
Sep 18 2017 17:29
@georgemitnick JS is the first true programming language that I've..erm.. not mastered but am okay? at. I've only worked with PHP a touch, but its used to accomplish a different task. It's purpose is backend utilization. You'd be better comapring PHP to NodeJS in which I would say, NodeJS is easier only becuase it's Javascript at its core (well...technically C++ at it's core, but for our purposes, its JS)
Pavlo Rudyi
@paulcarroty
Sep 18 2017 17:31
PHP is much easier than Node, I'm sure about it.
Jason Luboff
@JLuboff
Sep 18 2017 17:32
To each their own :D
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:32
I vote nodejs :)
korzo
@korzo
Sep 18 2017 17:32
@cmccormack it's difference between assigning by reference and value
Christopher McCormack
@cmccormack
Sep 18 2017 17:33
@RoniqueRicketts heya
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:34
Wazzup @cmccormack I got my mac saturday but i haven't set it up as yet.
Pavlo Rudyi
@paulcarroty
Sep 18 2017 17:35
I vote Node too, but if you really need a webdev work - need to work also with Java and Ruby.
Christopher McCormack
@cmccormack
Sep 18 2017 17:35
Should be fun! Why wasn't that the first thing you did when you got it??? I would never be able to hold back haha
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:36
@paulcarroty well I am working my way up to those languages. not Ruby but Maybe Java and Swift
George Kech.
@georgemitnick
Sep 18 2017 17:36
Will node do the same jobs as PHP
for instance if you want to build a wordpress site you can't use node
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:36
@georgemitnick agree
George Kech.
@georgemitnick
Sep 18 2017 17:36
or a social media site
Christopher McCormack
@cmccormack
Sep 18 2017 17:37
I would say only learn those languages when you need them, different companies are going to have different requirements, better to understand how programming works generally so you can pickup those languages if you need them easier later
Pavlo Rudyi
@paulcarroty
Sep 18 2017 17:37
@georgemitnick If you want wordpress you can use ghost.
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:37
So for those cryptographers which is more secure? Nodejs or PHP?
George Kech.
@georgemitnick
Sep 18 2017 17:37
I'm sure if you already are comfortable with one language it's much easier to learn a second that not knowing programming at all
@paulcarroty Why not just use php, it's native language?
Christopher McCormack
@cmccormack
Sep 18 2017 17:38
Agreed. Probably good to start with a typed language as well. It's easier to dive into a language without strong typing when you already know typing than the other way around
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:39
Well I wanna learn Java and Swift for Mobile Apps and Python for its Data Handling. :worried:
Christopher McCormack
@cmccormack
Sep 18 2017 17:39
Maybe learn Kotlin instead of Java :)
it's not too different
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:40
@cmccormack is it simpler? I like simple and effective languages. I am in my "lazy learning" stage
Christopher McCormack
@cmccormack
Sep 18 2017 17:40
Or some Java then jump into Kotlin
from what I've read developers much prefer Kotlin as it relieves several pain points
and once you know Java C# development should be an easy transition
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:42
@cmccormack that maybe 2019 since for 2018 I plan to do that Udacity certificate that guarantee a job for fullstack developers
Christopher McCormack
@cmccormack
Sep 18 2017 17:43
@RoniqueRicketts is that the Android Micro cert or whatever?
Nanodegree
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:43
@cmccormack Nanodegree
Christopher McCormack
@cmccormack
Sep 18 2017 17:43
I heard very good things about that
Not only is it good for development but also learning how to work with a team on a deadline
and using collaboration tools
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:44
Me too that why it grabbed my interest. :) The aim is to get good enough for a job for 2018 then from there I can focus on being the best I can be at this thing. :)
Christopher McCormack
@cmccormack
Sep 18 2017 17:47
Great goals, I'm sure you will achieve them!
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 17:48
hello everyone
Christopher McCormack
@cmccormack
Sep 18 2017 17:48
@tiagocorreiaalmeida hiya
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:48
Lets see how far I can go with this. I also have an app I wanna build and offer it to the education department here in my Country. Its designed already but I haven't started coding it as yet. I have a lot to do and a lot to learn. :)
Christopher McCormack
@cmccormack
Sep 18 2017 17:49
Started any frameworks yet? If not use this as a reason to try one out. That's what I do with every FCC project, try to implement something else I've wanted to try as well
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 17:50
how are you @cmccormack ?
Christopher McCormack
@cmccormack
Sep 18 2017 17:50
@tiagocorreiaalmeida Awesome! Great weekend, ready for a great week
Jason Luboff
@JLuboff
Sep 18 2017 17:50
@cmccormack You're far too refreshed sounding ;)
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:50
@cmccormack Yes I started reactjs
Christopher McCormack
@cmccormack
Sep 18 2017 17:50
@JLuboff the stress of upcoming deadlines hasn't reached my brain just yet
@RoniqueRicketts React is a lot of fun once you get over the learning curve
I just started react-router as well, not as much fun...
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:52
@cmccormack I am still climbing that learning mountain. Still don't know how to use stare and props. Im still at creating basic dom elements lol
Christopher McCormack
@cmccormack
Sep 18 2017 17:53
state = something that changes and potentially invokes a render, props = something passed down from a parent that doesn't change
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:53
@cmccormack I got that part but I am blocking my own self
Christopher McCormack
@cmccormack
Sep 18 2017 17:55
@RoniqueRicketts I know I've linked this probably a dozen times but have you gone through this and tried to implement it yourself? https://facebook.github.io/react/docs/thinking-in-react.html
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:55
@cmccormack i'm gonna be honest I haven't completed it :(
Christopher McCormack
@cmccormack
Sep 18 2017 17:56
It's a really great example of how to use props and state
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:57
@cmccormack ok I am out for the day then Going to go through this article
Christopher McCormack
@cmccormack
Sep 18 2017 17:58
Good :) I'll admit it's a simple app and I've created more complex apps than that, but the article itself still helps me a little more each time I read it
Ronique Ricketts
@RoniqueRicketts
Sep 18 2017 17:59
cool
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:05
guys
image.png
best way to avoid this? on click on the anchor it cuts half of the header because of the nav position
Christopher McCormack
@cmccormack
Sep 18 2017 18:06
@tiagocorreiaalmeida are you adding the header part you want to keep in the badge section?
Yaroslav
@YariPL
Sep 18 2017 18:07
hi.sorry but can somebody explain me this- 'Condense arrays with reduce'. Can't figure out what is it about. Thanks
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:08
hummm @cmccormack got confused with what you were trying to say
if you can explain in some other way sorry and thanks
kumquatfelafel
@kumquatfelafel
Sep 18 2017 18:08
@YariPL I guess you could describe it as condensing, but what are you trying to do here?
Yaroslav
@YariPL
Sep 18 2017 18:10
@kumquatfelafel I am doing this https://www.freecodecamp.org/challenges/condense-arrays-with-reduce task now and really can't understand this
Christopher McCormack
@cmccormack
Sep 18 2017 18:10
@tiagocorreiaalmeida do you have a pen or any code you can share for your header?
Yaroslav
@YariPL
Sep 18 2017 18:10
@kumquatfelafel and thanks for link
CamperBot
@camperbot
Sep 18 2017 18:10
yaripl sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 627 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
kumquatfelafel
@kumquatfelafel
Sep 18 2017 18:16
@YariPL ah, okay... just to clarify does that answer question or you still need help/explanation of some kind?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:17
yes @cmccormack just a sec and sorry for thanking so long
taking
Christopher McCormack
@cmccormack
Sep 18 2017 18:18
No worries got pulled into a call at work anyhow so not sure if I will be able to help right now
kumquatfelafel
@kumquatfelafel
Sep 18 2017 18:18
@tiagocorreiaalmeida it's okay, but you should be more careful about those really long thank you's in the future. ;) :p
CamperBot
@camperbot
Sep 18 2017 18:18
:cookie: 354 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
kumquatfelafel sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
Yaroslav
@YariPL
Sep 18 2017 18:19
@kumquatfelafel I'm reading Mozilla page and I think I understand the main sense. So thanks much)
CamperBot
@camperbot
Sep 18 2017 18:19
yaripl sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
api offline
kumquatfelafel
@kumquatfelafel
Sep 18 2017 18:20
ok. np
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:20
@kumquatfelafel :DDD
@cmccormack http://www.tiagoalmeidacorreia.pt/ this is not the updated page you will have to close manually the navbar after clicking on a linksadly
$('.navbar-collapse ul li a').on('click', function(){
        $('.navbar-toggle').click();
}); or add this to the js
and thanks for point your time into it
Christopher McCormack
@cmccormack
Sep 18 2017 18:22
Looks very nice!
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:24
thanks mate took me 1 week I just freak out about the design
did you saw the problem with the responsive nav?
Christopher McCormack
@cmccormack
Sep 18 2017 18:37
@tiagocorreiaalmeida Can you be more specific on what you're clicking and what isn't working when you click?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:38
everything works
but after the nav closing it covers the header name
like "sobre"
"Portfolio"
"contactos"
Christopher McCormack
@cmccormack
Sep 18 2017 18:40
Can you just adjust your scrolltop a bit in your Javascript?
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:41
this is what I mean
image.png
thinking of a way to solve this with css
Christopher McCormack
@cmccormack
Sep 18 2017 18:48
I'm assuming this is your JS for your scroll right? Can you just subtract a margin top to this value to go scroll slightly less?
if (target.length) {
                $('html, body').animate({
                    scrollTop: target.offset().top
                }, 1000);
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:49
you mean the scroll effect?
got it from css tricks it was the only code I didnt writed on this portfolio
Christopher McCormack
@cmccormack
Sep 18 2017 18:53
@tiagocorreiaalmeida Did the example have a navbar? If not, there's your problem. You'll need to take the height of your navbar into account when scrolling to the section
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 18:56
this is using bs3 I have no js for the scroll but time to set something I guess
nav*
it animates the entire content that has links inside the pag
Christopher McCormack
@cmccormack
Sep 18 2017 18:58
ah so if that's built in then perhaps your implementation is slightly off
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 19:03
its ok will find a way to work around of this :D thanks @cmccormack
CamperBot
@camperbot
Sep 18 2017 19:03
tiagocorreiaalmeida sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1216 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Sep 18 2017 19:04
@tiagocorreiaalmeida gl
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 19:33
@cmccormack
I could just do it light you said
scrollTop: target.offset().top - 80
as example
but im a sleepy guy thanks for your help solved this
Christopher McCormack
@cmccormack
Sep 18 2017 19:33
@tiagocorreiaalmeida Awesome, glad you got it!
Tiago Correia
@tiagocorreiaalmeida
Sep 18 2017 19:35
im not sure where to focus now I feel kinda ok with js same jquery html css still doing some reviews over them all I started a udemy node js course did 50% of time but it feels like a completly different world so not sure to where turn
aRtoo
@artoodeeto
Sep 18 2017 19:47
hi fam. damn this shits hard fam. on the algo challenge NO REPEAT PLEASE
this is my interpretation on the heaps algorithm but i dont really get it. can i pm someone to explain?
function permAlone(str) {
  str = str.split('');
  var check = [];
  var regex = /([a-z])\1+/;
  //console.log(str);

  function swaper(a,b) {
    var holder = str[a];
    str[a] = str[b];
    str[b] = holder;
  }

  function generate(n) {
    if(n===1) {
      check.push(str[n]);
    } else {
      for(var i=0; i<n-1; i++) {
        generate(n-1);
        if(n % 2 === 0 ) {
          swaper(i,n-1);
        } else {
          swaper(0,n-1);
        }
      }
    }
  }
  generate(str.length);

  return check;
}

 permAlone("aab"); //should return 2.
hi fam. damn this shits hard fam. on the algo challenge NO REPEAT PLEASE
this is my interpretation on the heaps algorithm but i dont really get it. can i pm someone to explain?
function permAlone(str) {
  str = str.split('');
  var check = [];
  var regex = /([a-z])\1+/;
  //console.log(str);

  function swaper(a,b) {
    var holder = str[a];
    str[a] = str[b];
    str[b] = holder;
  }

  function generate(n) {
    if(n===1) {
      check.push(str[n]);
    } else {
      for(var i=0; i<n-1; i++) {
        generate(n-1);
        if(n % 2 === 0 ) {
          swaper(i,n-1);
        } else {
          swaper(0,n-1);
        }
      }
    }
  }
  generate(str.length);

  return check;
}

 permAlone("aab"); //should return 2.
Pieter Stokkink
@forkerino
Sep 18 2017 19:48
@artoodeeto does it create the permutations?
ah, just tested, no it doesn't.
aRtoo
@artoodeeto
Sep 18 2017 19:50
@forkerino yea bro. confused on the generate(n-1)
dont know if it will go to the function again or goes to if
tried tracing on paper confuses me
@forkerino
Pieter Stokkink
@forkerino
Sep 18 2017 19:50
@artoodeeto it will run the submethod again at that point, once that one returns it will go on with the next if/else
the for loop should run to i<n
aRtoo
@artoodeeto
Sep 18 2017 19:52
@forkerino wait bro
Pieter Stokkink
@forkerino
Sep 18 2017 19:53
@artoodeeto you are almost there, btw
aRtoo
@artoodeeto
Sep 18 2017 19:54
so after for loop when it enters the inner if it will minus n to 1 then goes to the if? lets say that we invoke generate to 3. goes to for loop then function generate(n-1) so n will be 2. then goees to if?
@forkerino
Alex
@alexandrupintilei
Sep 18 2017 19:55
Can i collapse a specific challenge ? ( I want to solve it again )
aRtoo
@artoodeeto
Sep 18 2017 19:55
@forkerino this part confuses me bro
Diego Mayer
@Chrono79
Sep 18 2017 20:01
@alexandrupintilei isn't there a reset your code button?
Alex
@alexandrupintilei
Sep 18 2017 20:03
@Chrono79 yes,but i want though map,to reset all Basic JavaScript for exemple
Diego Mayer
@Chrono79
Sep 18 2017 20:03
afaik you can't do that
maybe creating another account is an option
korzo
@korzo
Sep 18 2017 20:06
@alexandrupintilei You can solve them again, but you can't Unmark them as solved
Alex
@alexandrupintilei
Sep 18 2017 20:07
@korzo ok,thx
Pieter Stokkink
@forkerino
Sep 18 2017 20:11
@artoodeeto It runs generate with 3 and then recursively calls it with 2, three times in the for loop, each of those call generate with 1 as argument twice. In this case, each will add a permutation to check
because n === 1
(except that now you are just pushing the second character (str[1]), not the whole permutation)
@artoodeeto
Pieter Stokkink
@forkerino
Sep 18 2017 20:23
also: you don't actually need to store all permutations, just have a counter that adds one if there are no two identical consecutive characters.
LiciniusRex
@hashtagyolo1
Sep 18 2017 20:40
Howdy folks. Having trouble with Pig Latin and was looking for some help. For some reason my if statement doesn't seem to be working and I can't work out why

function translatePigLatin(str) {
var consenantStart = str.substring(1) + str.substring(0, 1) +  "ay";
var vowelStart = str + "way";
var vowels = ["a", "e", "i", "o", "u"];
var newstr = "" ;
  for (var i = 0; i < vowels.length; i++){
  if (str[0] !== vowels[i]){
    newstr = vowelStart;
  } else {
    newstr = consenantStart;
  }

    }   
  return newstr;
}

translatePigLatin("eight");
I'm not even looking at how to do the clusters yet. That can wait until this is working
Jason Luboff
@JLuboff
Sep 18 2017 20:49
@hashtagyolo1 What do you mean it's not working? Your loop runs 5 times, each time, you change what newstr is
Diego Mayer
@Chrono79
Sep 18 2017 20:50
@hashtagyolo1 paste your code here: http://www.pythontutor.com/javascript.html#mode=edit
Joel Y.
@zapcannon99
Sep 18 2017 20:50
@hashtagyolo1 Are you trying to check if the first letter is a vowel?
LiciniusRex
@hashtagyolo1
Sep 18 2017 20:52
@zapcannon99 , yeah that's what I'm doing. @JLuboff I know that bit runs, but it doesn't seem able to bring out the correct response after that
Diego Mayer
@Chrono79
Sep 18 2017 20:52
seems like that, but it won't work with consonant clusters
it'll only work with words like "uber" ;)
Joel Y.
@zapcannon99
Sep 18 2017 20:53
If that's the case, then what you're doing is adding consenantStart to newstr every time that if statement is false
LiciniusRex
@hashtagyolo1
Sep 18 2017 20:53
I only noticed they were a thing when I posted this. No idea what I'm going to do for them. Don't want to change everything until I can work out why this doesn't work @Chrono79
Diego Mayer
@Chrono79
Sep 18 2017 20:53
not adding, he's overwriting it
Joel Y.
@zapcannon99
Sep 18 2017 20:54
Right, my bad
Diego Mayer
@Chrono79
Sep 18 2017 20:54
@hashtagyolo1 as @JLuboff told you, you test for each vowel (with the loop) and the result you get is for the last vowel, that is "u"
Joel Y.
@zapcannon99
Sep 18 2017 20:55
how about use use vowels.includes(str[0]) If you want to check if the first letter is a vowel
Jason Luboff
@JLuboff
Sep 18 2017 20:55
What if my word is 'start'
LiciniusRex
@hashtagyolo1
Sep 18 2017 20:55
OK. I think I might have an idea. One that'll work with the clusters as well
Joel Y.
@zapcannon99
Sep 18 2017 20:55
@JLuboff I think he'll get to that later
Diego Mayer
@Chrono79
Sep 18 2017 20:56
if your word starts with "a" for instance, you get "the right" result in the first loop and you overwrite it with the wrong one the next 4 times
good luck :+1:
LiciniusRex
@hashtagyolo1
Sep 18 2017 20:58
thanks all. Think I have to go back to the drawing board. Ideas percolating
Joel Y.
@zapcannon99
Sep 18 2017 21:01
GL
Jason Luboff
@JLuboff
Sep 18 2017 22:23
Hmmm... Is FCC down?
I'm getting a 502 error
Gersho
@Gersho
Sep 18 2017 22:25
yes
Jason Luboff
@JLuboff
Sep 18 2017 22:25
@Gersho Thanks for confirming
CamperBot
@camperbot
Sep 18 2017 22:25
jluboff sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
api offline
Gersho
@Gersho
Sep 18 2017 22:25
and i was like "hey i still have internet during the typhoon maybe i can do some stuff "
Jason Luboff
@JLuboff
Sep 18 2017 22:28
Interesting. In Sql Server 2016, you can create a JSON file (instead of say XML)
Nicholas Losco
@Nicholas11382
Sep 18 2017 23:31
this is the javascript help room correct? ;)
I need some javascript help
Gersho
@Gersho
Sep 18 2017 23:33
yes this is the room
show your code and what you're trying to achieve (challenge link if possible)
Nicholas Losco
@Nicholas11382
Sep 18 2017 23:33
I'm trying to figure out how to add an image as the background in the .box model, javascript sit it pops up when i open the css page
so*
having some issues
Gersho
@Gersho
Sep 18 2017 23:35
i'm not sure i understand what you're trying to do
Nicholas Losco
@Nicholas11382
Sep 18 2017 23:36
ok i linked a .css an html together, in the html I have to create 2 boxes and use a url(https) as the background image and Iv tried a lot of steps but i am not hitting the mark.
background-image{
src:
}
Gersho
@Gersho
Sep 18 2017 23:38
oh
Nicholas Losco
@Nicholas11382
Sep 18 2017 23:38
didn't work
Gersho
@Gersho
Sep 18 2017 23:40
shouldn't it be
body {
    background-image: url("myurl");

}
Nicholas Losco
@Nicholas11382
Sep 18 2017 23:41
well, Im GREEN as a granny smith apple, so Im learning as i go along
but...... I will try that
;)