These are chat archives for FreeCodeCamp/HelpFrontEnd

9th
Apr 2018
Hoang Duc Quan
@BlazingRockStorm
Apr 09 2018 02:27
@moigithub @cmccormack well, I decided to use axios. but anyway. tks
@moigithub @cmccormack thanks
CamperBot
@camperbot
Apr 09 2018 02:27
blazingrockstorm sends brownie points to @moigithub and @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1400 | @cmccormack |http://www.freecodecamp.org/cmccormack
:star2: 3739 | @moigithub |http://www.freecodecamp.org/moigithub
creator0323
@Amasian
Apr 09 2018 02:45
@eeflores thank you for your reply!
CamperBot
@camperbot
Apr 09 2018 02:45
amasian sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:star2: 1065 | @eeflores |http://www.freecodecamp.org/eeflores
creator0323
@Amasian
Apr 09 2018 02:45
@sjames1958gm thank you for your reply!
eeflores
@eeflores
Apr 09 2018 02:46
grrr cbot
unless there's cookie overflow for sjames1958gm
zootechdrum
@zootechdrum
Apr 09 2018 03:37
hey guys I am getting this weid affect
when you click and drag left a white space appears
got to put the little one to bed brb
Claudio Restifo
@Marmiz
Apr 09 2018 04:12
@zootechdrum I cannot reproduce the issue. Can you be more specific please?
zootechdrum
@zootechdrum
Apr 09 2018 04:12
@Marmiz okay do you have a mac?
I am also using chrome
Ken Haduch
@khaduch
Apr 09 2018 04:13
@zootechdrum - I cannot see what you mean, unless you mean narrowing the window... let's check that. I do see a couple places where you misspelled "experience". There are strange things going on when shrinknig the window as far as how things line up.
Claudio Restifo
@Marmiz
Apr 09 2018 04:13
@zootechdrum yep, chrome on mac... evrything up to date
*everything
zootechdrum
@zootechdrum
Apr 09 2018 04:14
okay if you put your mouse over anywhere on section1 i see a white margin
I am using 2 fingers and dragging to the left
@khaduch not a good speller lol. What weird things are you noticing
coderNewby
@coderNewby
Apr 09 2018 04:15
@darrenfj pm for you thanks
CamperBot
@camperbot
Apr 09 2018 04:15
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2456 | @darrenfj |http://www.freecodecamp.org/darrenfj
Ken Haduch
@khaduch
Apr 09 2018 04:15
@zootechdrum - one thing I see is you have a class="containers" in one place for your div with the "Up and Coming web developer" - it should probalby beclass="container"`.
Things that I see are the way your "Up and coming" text overlaps your image and the portfolio thumbnails line up strangely.
zootechdrum
@zootechdrum
Apr 09 2018 04:15
@khaduch i did that on purpose
I hated the way the container looked
so i misspelled it to see what that would look like
if it stretched out past the container .
Ken Haduch
@khaduch
Apr 09 2018 04:16
You might want to try "container-fluid"? That gives a full screen width.
I'm not looking on a tablet or anything - just changing browser width.
zootechdrum
@zootechdrum
Apr 09 2018 04:18
just changed it to that class
thanks
@khaduch your not seeing the white margin? weird
Claudio Restifo
@Marmiz
Apr 09 2018 04:19

@zootechdrum I don't see any white margin.

Also I don't see any section 1
All I can see in your code is a part_2 (and 3 class). I assume by "section 1" you mean the header with the background image?

zootechdrum
@zootechdrum
Apr 09 2018 04:20
Screen Shot 2018-04-08 at 9.19.31 PM.png
@Marmiz yes
part one
I took a seen shot
screen*
Ken Haduch
@khaduch
Apr 09 2018 04:24
@zootechdrum - I'm seeing a lot of messed up alignments at different screen widths - to me that indicates some poorly constructed HTML or CSS... still trying to get a feeling for what's going on. At one point I'm seeing your "Up and coming" section shifted way off to the left, like around a 745px viewport width.
It might be a bad interaction between your CSS and Bootstrap's column classes. You might be overriding some CSS properties that would make the columns work?
Claudio Restifo
@Marmiz
Apr 09 2018 04:26

@zootechdrum oh I see what you mean now.
Weird it appears it's coming from the codepen iframe.

you can remove it by giving the body a property of overflow: hidden.

This just remove the symptom, You should investigate on the cause you are having this issue.
Perhaps as @khaduch is suggesting you have some weird CSS interaction in there.

Ken Haduch
@khaduch
Apr 09 2018 04:27
@zootechdrum - if you run the "Analyze CSS" in the CSS dropdown, it flags a couple problems, not sure if they are causing issues, depends on how the browser handles it
zootechdrum
@zootechdrum
Apr 09 2018 04:28
@khaduch did not know that
@Marmiz i tried overflow hidden
fixed it but removed part 3 and part 3 lol
god damn
Claudio Restifo
@Marmiz
Apr 09 2018 04:28
that's where your issue lays than
zootechdrum
@zootechdrum
Apr 09 2018 04:29
@Marmiz what do you mean
Ken Haduch
@khaduch
Apr 09 2018 04:30
@zootechdrum - on your image you have a "margin" setting that puts a 280px margin on the left wide - that's definitely going to mess up alignment at various widths because if you get to a point where that exceeds the margin that the grid would align things differently, then it's going to be bad placement. That's one example of a thing that could go wrong. (And is probably going wrong.)
German Gamboa Gonzalez
@germangamboa95
Apr 09 2018 04:31
guy can I have some feedback on my latest project? https://germangamboa95.github.io/giphyProject.io/
zootechdrum
@zootechdrum
Apr 09 2018 04:32
@khaduch I will look into it I know now that that is whats goint bad somhow
Ken Haduch
@khaduch
Apr 09 2018 04:34

@zootechdrum - the same thing is causing a problem with your "content_container, and the margin that sets the left margin to -160px - that shifts the text block along to the left so that the text is out of the picture. You can see a lot of problems just by setting the viewport to different widths and then finding where things are going wrong. In general big fixed margins and widths for things do not play well with responsive design.

Good luck with getting things tidied up!

Ken Haduch
@khaduch
Apr 09 2018 04:40
@germangamboa95 - that's a fun project! It seems to be rather slow to load thing - but it's probably loading a lot of data! One thing I would suggest is to make a title area for the current set of GIFs that is being displayed. I guess that it's kind of obvious, except when it's not. :) But it's a nice project, once again!
German Gamboa Gonzalez
@germangamboa95
Apr 09 2018 04:43
@khaduch Thanks for the feedback as always! And yes it normally loads 20mb worth of images on first load :/ I think I can optimize it by not having it load the still plus the gif at the same time.
CamperBot
@camperbot
Apr 09 2018 04:43
germangamboa95 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3857 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Apr 09 2018 04:45
@germangamboa95 - I don't know what it is about GIFs that can be so mesmerizing... :) But you certainly come up with some nice little projects!
German Gamboa Gonzalez
@germangamboa95
Apr 09 2018 04:47
Lol They are a fun time waster. Ah I currently have to pump out a few of those a week since I am doing a full stack coding bootcamp. I do have free code camp to thank for giving me a good head start:)
and by free code camp I mean all of you who have helped me with my endless questions at times:)
Claudio Restifo
@Marmiz
Apr 09 2018 04:51
@germangamboa95 to further optimize your page you can:
1 - load the assets and only then load the images previews with a nice loader/placeholder in place of the images
2- load the gif only after a user click so that you pull in only the one the user actually clicks
German Gamboa Gonzalez
@germangamboa95
Apr 09 2018 04:58
@Marmiz Thanks sir! That is going in the todo list for this app:)
CamperBot
@camperbot
Apr 09 2018 04:58
germangamboa95 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1201 | @marmiz |http://www.freecodecamp.org/marmiz
Claudio Restifo
@Marmiz
Apr 09 2018 04:59
@germangamboa95 :+1: gl and happy coding
Ehidin
@eabg
Apr 09 2018 05:21
can someone help me figure this out. wanting to change css or animation targeting just the box linked to
button.png
buttonn.png
Darren
@DarrenfJ
Apr 09 2018 05:46
@coderNewby ah yes.. check my answer ...
John
@flyboy1565
Apr 09 2018 06:04
Question. Anyone know a Js lib, that would easily make gauges that are responsive .
anthonygallina1
@anthonygallina1
Apr 09 2018 06:07
@flyboy1565 Could you do it with CSS and and write the selector etc? https://www.cssscript.com/creating-fast-and-responsive-gauges-with-pure-css/
Ehidin
@eabg
Apr 09 2018 06:16
gott it!
JoEezy
@JoEeeezy_twitter
Apr 09 2018 06:22

function diffArray(arr1, arr2) {

  var newArr = arr1.concat(arr2).sort(function(a,b) {return a > b;});
  var results = [];

  for (var i = 0; i < newArr.length; i++){
    if (newArr[i] !== newArr[i + 1]){

      results.push(newArr[i]);

    }
  }

  return results;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
does this look wrong?
trying to find the difference between two arrays
when i change (newArr[i] !== newArr[i + 1]) to (newArr[i] == newArr[i + 1]) it returns 1,2,3,5
but when it's (newArr[i] !== newArr[i + 1]) it returns 1,2,3,4,5
i feel like it's suppose to be straightforward but it doesn't do what i thought it would :eyes:
Markus Kiili
@Masd925
Apr 09 2018 06:30
@JoEeeezy_twitter There are many ways to do this, but that logic is not working.
Check also that the looped element is not equal to the element before. Then it might work.
Markus Kiili
@Masd925
Apr 09 2018 06:36
Some input array elements are strings, and you are not sorting them properly.
JoEezy
@JoEeeezy_twitter
Apr 09 2018 06:38
@Masd925 hmmm yeah i think i understand where i screwed up ...
i think it's still checking each but not all match https://i.imgur.com/TMfAGOH.png
German Gamboa Gonzalez
@germangamboa95
Apr 09 2018 06:44
converting gifs into base64 and creating a download button was fun :| night guys
Markus Kiili
@Masd925
Apr 09 2018 06:46
@JoEeeezy_twitter Checking against the one before and one after will work, if you first sort them properly.
Adetunji Adegbite
@twonjee2002
Apr 09 2018 07:01
Hello all, I am having an issue with my javascript code. Anyone that can please crack this for me will be highly appreciated.
cmdnames = 'ENQ JSL.BUILD.TOKEN TOKEN EQ '+username+'-'+jtoken;
docommand(cmdnames);
var finding = window.document.getElementById("enquiryDataSizer").innerText;
console.log(finding);
Markus Kiili
@Masd925
Apr 09 2018 07:03
@twonjee2002 What is it logging?
Adetunji Adegbite
@twonjee2002
Apr 09 2018 07:04
the docommand function is supposed to initiate a display on the page with an id "enquiryDataSizer" but i guess it is taking some time to execute and so i am unable to capture the response.
@Masd925 it says cannot get innerText on null variable
Markus Kiili
@Masd925
Apr 09 2018 07:05
@twonjee2002 Are you running the script at the end of body or inside document ready or onload event handler?
If you just run it inside the head element, the dom is not ready.
Adetunji Adegbite
@twonjee2002
Apr 09 2018 07:09
actually the issue is that the function do command calls another system (server side) and then the result is displayed. however i do not know how to wait for the response to be displayed @Masd925
Markus Kiili
@Masd925
Apr 09 2018 07:09
@twonjee2002 You are using some async method inside docommand?
Adetunji Adegbite
@twonjee2002
Apr 09 2018 07:10
let me paste the docommand function
Markus Kiili
@Masd925
Apr 09 2018 07:26
@twonjee2002 Not sure what is happening on that script, but in general, if you have some async method (contacting backend etc), you need to do things inside that method callback function. Only there you know that the response has come.
Adetunji Adegbite
@twonjee2002
Apr 09 2018 07:29
i guess the callback function is what i need, just that I have not figured that out yet. Thanks. @Masd925
Ali Bulut
@ali27001
Apr 09 2018 08:08
Untitled.png
how to make
Oyelowo Oyedayo
@Oyelowo
Apr 09 2018 08:48
Hi Guys, for an unknown reason, I was unable to claim the responsive web design certificate. What could be the problem? Thanks in advance
LydaTech
@lydatech
Apr 09 2018 10:48
@Oyelowo there is a known issue that hasnt been fixed yet freeCodeCamp/freeCodeCamp#17031
Victor De Los Santos
@rdelosh
Apr 09 2018 11:25
anybody wants to cooperate with the votingApp from the node section?
Lazizxon Akromov
@LazizkhonAkrom_twitter
Apr 09 2018 12:07
Hello! I have just completed
My first project which is Tribute page
Please, comment it
LydaTech
@lydatech
Apr 09 2018 12:17
@LazizkhonAkrom_twitter looks good. One issue I see is <p><h2>Early years</h2></br>
you dont nest h elements inside of p elements
Stephen James
@sjames1958gm
Apr 09 2018 12:29
@LazizkhonAkrom_twitter Looks good.
Looks like you copied the info from Wikipedia (you still have references [number]). You might want to at least remove the reference marks.
Also, Collage should be College.
Lazizxon Akromov
@LazizkhonAkrom_twitter
Apr 09 2018 12:57
Thank you Stephen!
@lydatech Thnk you for your comments!
Ghost
@ghost~5928d90bd73408ce4f629b9e
Apr 09 2018 12:58
can anyone look at @freecodecamp/HelpBackEnd thank you for ur time
CamperBot
@camperbot
Apr 09 2018 12:58
2hexgfx_twitter sends brownie points to @freecodecamp :sparkles: :thumbsup: :sparkles:
api offline
Norvin Burrus
@ndburrus
Apr 09 2018 13:12
@LazizkhonAkrom_twitter nice page/site ... :sparkles:
  • Collage, s/b College ...unless, it appears that way in wiki - looks like it doesn't...
zootechdrum
@zootechdrum
Apr 09 2018 13:53
Good morning from the states
can someone help me
on some front end stuff
Ken Haduch
@khaduch
Apr 09 2018 13:54
@LazizkhonAkrom_twitter - your tribute page is very nice. One thing that I would suggest / recommend is that for readability, you should limit the maximum width of the text area to something around 80 characters, you can find readability recommendations at various places, but on a wide screen it is not as easy to read text that extends all the way across the screen. Also, as Norvin pointed out, check your spelling. I see the header "Philantropy" which should be "Philanthropy" - also in your text you have numbers in square brackets which might be referring to page numbers or footnote numbers in some article? Rather than have numbers there that do not link to the referenced material, it would be better just to cite the entire source for your material and put a link to it, and perhaps it is the wikipedia article that you have linked down in the footer? But it's a nice site - I like the way you offset the text against a solid background, that is definitely easier to read than having it against the background images. Nice work!
Daniel Simeonov
@dbsimeonov
Apr 09 2018 13:54
Share it :) If we can we will help
zootechdrum
@zootechdrum
Apr 09 2018 13:54
I cant seem to stop my content fro spilling over to part 2 of my webpage
Daniel Simeonov
@dbsimeonov
Apr 09 2018 13:54
Do you have codepen?
Ken Haduch
@khaduch
Apr 09 2018 13:54
@zootechdrum - good morning - please post your questions / URL, etc. and we'll take a look
zootechdrum
@zootechdrum
Apr 09 2018 13:55
here is the url
if you resize to the most minimum windows size it spills over by a little but. But just enough to aggravate me lol
Daniel Simeonov
@dbsimeonov
Apr 09 2018 13:57
thats because you have fixed height ;)
Ken Haduch
@khaduch
Apr 09 2018 13:57
@zootechdrum - check your opening and closing tags for your divs, that's where I would start. Looks like a potential problem there. Esepecially in the "Up and coming web developer section.)
and if there is still fixed height as @dbsimeonov points out, that's also a problem!
Daniel Simeonov
@dbsimeonov
Apr 09 2018 13:59
Ken are you good with javascript? Can you help me with something
Ken Haduch
@khaduch
Apr 09 2018 13:59
@dbsimeonov - I can take a shot at it...
zootechdrum
@zootechdrum
Apr 09 2018 14:00
@dbsimeonov where do you see a fixed height?
Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:00
Cool, I'm building my website and I have the fancy idea to create a background with random strings which will change with the time. But never seen it before and not sure how it would like so I just started to build it but got stuck .. I have a codepen where I got. https://codepen.io/DSimeonov/pen/OvaXGQ?editors=0011
zootechdrum
@zootechdrum
Apr 09 2018 14:00
checked closing divs all line up where they should be
Ken Haduch
@khaduch
Apr 09 2018 14:00
@zootechdrum - I might have been incorrect about the opening and closing tags. I was going by the appearance after "Tidy HTML", and it just wasn't indenting properly due to some formatting.
zootechdrum
@zootechdrum
Apr 09 2018 14:01
@khaduch its hard to tidy up in codepen
but plan to do lol\
Ken Haduch
@khaduch
Apr 09 2018 14:02
@zootechdrum - I found a place in the img tag where the attributes were not space separated and after putting a space in there it seemed to tidy up a bit better.
@dbsimeonov - so I'm seeing some words appear on the background of your pen - what are you having trouble with?
Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:04
So the next step for me is to generate like 20 words on load, and append them for the background which I can do it. But the problem after that is that don't know what effect should I use to get random strings and replace them with another ones. Because I'm thinking it will be really ugly that way.. because they will have different width
Asking just for an advice if its worth it .
@zootechdrum On the header or your part1 i saw something like height: 100% after I removed it the default went to auto and it was okay so it stretch depending on the content. But the problem is its bootstrap and its hard for me to find where was the other mistake that your content on the part-2 goes outside its box
@zootechdrum and I think you misspelled experience in your navbar. I'm not good with English either :D
zootechdrum
@zootechdrum
Apr 09 2018 14:09
@dbsimeonov hahhah
yeah i did
Yeah your right i removed it and it worked but now the 3 images are going outside its box
ahhhh
Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:11
Usually the way I do everything (of course with flexbox) I just create container* and give it whatever padding I want so it will never break or go outside its container. Just with bootstrap I don't remember all of the classes and can not trace from where it breaks :D
zootechdrum
@zootechdrum
Apr 09 2018 14:12
@dbsimeonov Hey I used height 100% because i wanted the image to cover the entire page when someone clicked on it
without it it does not do that and the image shrinks
Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:12
Let me try something
zootechdrum
@zootechdrum
Apr 09 2018 14:12
@dbsimeonov fur sure
Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:14
So you want to fix your header right? When it goes to mobile media query the text to stay inside its container?
zootechdrum
@zootechdrum
Apr 09 2018 14:15
yes and should not go into part 2
AbrisM
@AbrisM
Apr 09 2018 14:21
Has anyone gotten the does not overide abstract error?
Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:40
does anyone knows the name of this plugin ? http://carbure.co/
for the background effect
Ken Haduch
@khaduch
Apr 09 2018 14:41

@dbsimeonov - I don't know what effect you're trying to get - maybe it would be better to do something other than words, so that it wouldn't be so obvious with changes? I can see what you mean, though about trying to keep it from turning ugly after a while? Maybe if you pick a certain width for your text area and fill it, then clip it at the borders and prune off other words after it gets beyond a certain length?

t

Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:42
@khaduch Yea I was thinking but won't be pretty. Looking for alternatives for interactive background on my portfolio..
AbrisM
@AbrisM
Apr 09 2018 14:42
why not use a .mov file instead?
If you want busy backgrounds
Ken Haduch
@khaduch
Apr 09 2018 14:43
@dbsimeonov - that one that you posted above - that's crazy! You can grab the individual images on the background and bounce them around... cool! :)
Daniel Simeonov
@dbsimeonov
Apr 09 2018 14:43
@AbrisM .mov is videos as background? Never tried that
AbrisM
@AbrisM
Apr 09 2018 14:44
Yes
AbrisM
@AbrisM
Apr 09 2018 14:45
Thanks, its an error that shouldn't be popping up though. primaryStage is a reserved word in JFX so it should recongnize it
LydaTech
@lydatech
Apr 09 2018 14:49
@dbsimeonov its not a plugin. its written in js
Norvin Burrus
@ndburrus
Apr 09 2018 14:53
@AbrisM is there some code?
LydaTech
@lydatech
Apr 09 2018 14:59
@dbsimeonov its a mix of jquery and css
LydaTech
@lydatech
Apr 09 2018 15:07
@dbsimeonov the actual element is a canvas item
ok done talking to myself...
zootechdrum
@zootechdrum
Apr 09 2018 15:09
ok everything is lining up good now
the last thing i would like to do is reduce the white space from top and bottom from part 2(the three images)
i have tries adjusting part 3 but it creates a white space on the bottom or on the right side of the website
alpox
@alpox
Apr 09 2018 15:12

@zootechdrum The white space on bottom is from

.bttn {
    margin: 60px;
    ....
}

this margin

You can add a margin-bottom: 30px or so to decrease the white space
The white space on top is from #part_2
kerafyrm02
@kerafyrm02
Apr 09 2018 15:37
Good morning ppl
Im here for about 10mins anyone need help
Shubham Singh
@imshubhamsingh
Apr 09 2018 16:16
hey guys just finished learning vuejs fundamentas and vuex, and created a small app along side. What you guys think https://github.com/imshubhamsingh/IPL-dashboard
steve84
@raynor84
Apr 09 2018 16:17

Hi I am stuck on sum all odd fibonachi
"

function sumFibs(num) {
var fib =[1,1];
var result = 0;
for(var i=1; i<num;i++) {
var odd = fib[i]+fib[i-1];
fib.push(odd);
}
for(i=0; i<fib.length; i++) {
if(fib[i] % 2 != 0)
result=fib[i];
}
return result;
}

sumFibs(1000);
"

``

``
function sumFibs(num) {
var fib =[1,1];
var result = 0;
for(var i=1; i<num;i++) {
var odd = fib[i]+fib[i-1];
fib.push(odd);
}
for(i=0; i<fib.length; i++) {
if(fib[i] % 2 != 0)
result=fib[i];
}
return result;
}

sumFibs(1000);
``

Adetunji Adegbite
@twonjee2002
Apr 09 2018 16:19
I am calling a function that renders a result and trying to get the response from the result but my script executes before the frame is loaded
Daniel Simeonov
@dbsimeonov
Apr 09 2018 16:35
@lydatech sorry I was away. I think its way too complicated for my abilities, thanks!
CamperBot
@camperbot
Apr 09 2018 16:35
dbsimeonov sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 2769 | @lydatech |http://www.freecodecamp.org/lydatech
Deepak Gowda
@Deep2322_twitter
Apr 09 2018 16:44
can anyone give me examples on how to make js file with configurations to make a additional api call as per the configuration and add the collected fields from the api response to some other object.
fahrixx
@fahrixx
Apr 09 2018 17:21
Hi
German Gamboa Gonzalez
@germangamboa95
Apr 09 2018 17:34
Hey!
Brad
@bradtaniguchi
Apr 09 2018 17:42
@Deep2322_twitter Your asking like 3 different broad questions, not sure how anyone can help
Adetunji Adegbite
@twonjee2002
Apr 09 2018 18:32
how do i wait for a page to finish rendering before using getElementById()? my code is executing before page renders.
Michael Karpinski
@karpimpski
Apr 09 2018 18:39
does anybody know a good source on website design concepts? I'm comfortable with front-end code, but I just can't make a website look good
Brad
@bradtaniguchi
Apr 09 2018 18:39
@twonjee2002 Idk how your rendering your page, but with vanillajs you can use window.onload = function() {// your code here}
rk
@rajkumart08_twitter
Apr 09 2018 18:48

hi,

  • I am new to js.
  • I am trying to display an output like this a3b2c4d3 for a string aaabbccccddd.
  • wrote a code.
  • but I am not getting desired output.
  • can you guys tell me how to fix it.
  • so that in future I can fix it myself.
  • providing code below

https://jsfiddle.net/ouspwmm8/


var countLetters = "aaabbccccddd";
console.log("countLetters.length --->" + countLetters.length);
var countNumberLetter = 0;
var i;
var a;

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

   if(countLetters[i] == countLetters[i+1]) {
    countNumberLetter = countNumberLetter + 1;

  } 

}

console.log("countNumberLetter--------->" + countLetters[i] + countNumberLetter);
Daniel Feldman
@Feldbot
Apr 09 2018 18:56
Why does this code run automatically without needing to call with a ? It was my understanding that an execution context needed to be called for functions to execute.
 function NothingSpecial() {
    console.log( "Don't mind me!" );
}

var a = NothingSpecial();
Michael Karpinski
@karpimpski
Apr 09 2018 18:57
@Feldbot if you console.log a, I think you should get null since that would assign the return value of NothinSpecial() to a
Kaz Baig
@kbaig
Apr 09 2018 18:59
@Feldbot You'd need to call a if you did var a = NothingSpecial;
Daniel Feldman
@Feldbot
Apr 09 2018 19:00
@kbaig @karpimpski But why would does it automatically execute, rather than being stored as a variable, to be called later?
Kaz Baig
@kbaig
Apr 09 2018 19:05
@Feldbot You're assigning the result of the function call to a right now, not the function itself
Daniel Feldman
@Feldbot
Apr 09 2018 19:10
@kbaig I understand since it has the () in the assignment, it is would return the value of that function, but why is it firing off to begin with? I thought the variable would hold the reference to that function, but wouldn't execute without being called later by entering a. But it automatically is executed...
Brad
@bradtaniguchi
Apr 09 2018 19:15
@Feldbot This is assigning the function to a:
var a = NothingSpecial;

a() // this will print the function

This is the same, but with an anonymous function
var a = function () {
  console.log( "Don't mind me!" );
}
Daniel Feldman
@Feldbot
Apr 09 2018 19:17

I tried a couple things here to better understand how variables are evaluated and returned, but I'm a little confused about when the engine decides to evaluate expressions:

Here a console statement is automatically evaluated, returning a string:

var text = console.log('free code camp');

And here the variable reference doesn't returns undefined, and only evaluates the expression when I call the variable:

var number = 1 + 2;
Kaz Baig
@kbaig
Apr 09 2018 19:19
@Feldbot number is not evaluating 1 + 2 when you call it. It's evaluating 1 + 2 to 3 and then assigning 3 to number when you define the variable. In the same way, console.log('free code camp') is being evaluated when you define text
Brad
@bradtaniguchi
Apr 09 2018 19:19
They key is (), once you have parentheses somewhere JS will "execute" its contents.
Daniel Feldman
@Feldbot
Apr 09 2018 19:22
@kbaig Why does text return a value automatically, and number doesn't? That is, why wouldn't number just return 3 automatically like text automatically returned "free code camp"?
Kaz Baig
@kbaig
Apr 09 2018 19:26
@Feldbot by "text evaluating automatically", I presume you mean seeing 'free code camp' in the console. Seeing that in the console is a side effect of the assignment, not a result of the assignment itself. Assigning a variable a value of console.log('free code camp') is saying store whatever the result of calling console.log with the arg ' free code camp' to the variable. In this case, there is no result so you're actually not assigning a value to the variable so it stays undefined. However, a side effect of calling console.log in this case is seeing 'free code camp' logged to the console
Daniel Feldman
@Feldbot
Apr 09 2018 19:34

@kbaig That is a helpful explanation for that example. Getting back to this one:

 function NothingSpecial() {
    console.log( "Don't mind me!" );
}

var a = NothingSpecial();

Why does a return the result of NothingSpecial when it is assigned? Is this a side effect of console.log too?

@kbaig Do you know of a good reference to explain side effects?
Kaz Baig
@kbaig
Apr 09 2018 19:35
@Feldbot Yep. This is almost the same as var a = console.log( "Don't mind me!" );
@Feldbot perhaps this is also helpful to review
function NothingSpecial() {
  console.log( "Don't mind me!" );
  return 'Mind me though!';
}

var a = NothingSpecial(); // "Don't mind me" is logged to the console because the first line of NothingSpecial says to log it to the console
a; // has a value of 'Mind me though!'
Daniel Feldman
@Feldbot
Apr 09 2018 19:50
@kbaig Ha ha! Great example :-) I still am fuzzy on why the var a assignment creates the side effect. Why is the function called during assignment to the variable?
Kaz Baig
@kbaig
Apr 09 2018 19:52
You called the function by doing NothingSpecial()
If you just wanted to set give a the function, you would have to do NothingSpecial instead
Daniel Feldman
@Feldbot
Apr 09 2018 19:59
@kbaig But in your example you called the function after that with a. That resolves itself to the function call, no? The variable assignment shouldn't be a direct call for the function—even with ()—but a variable reference only without automatic execution.
Kaz Baig
@kbaig
Apr 09 2018 20:02
@Feldbot
var a = NothingSpecial(); // I'm calling the function here and passing the returned value to a
a; // just checking what value a has. Not calling a function here
If I want to assign a the function and then call that function through a:
var a = NothingSpecial;
a();
Markus Kiili
@Masd925
Apr 09 2018 20:03
@Feldbot The assignment operator = evaluates the right hand side to a value and assigns it to the variable on the left. Here the right hand side (function call) evaluates to a string (return value of the function).
And yes, much happens under the hood when a function call is made. What happens cannot be fully explained without the concept of an execution context.
Daniel Feldman
@Feldbot
Apr 09 2018 20:11
In Kaz's example (above the last two), I'm now confused why assigning var a = NothingSpecial() doesn't return 'Mind me though!'. He showed how that is returned by a;, but why wouldn't that be returned the first time if it is executing NothingSpecial upon assignment?
@Masd925 I have some understanding of execution context if that would help explain this.
Markus Kiili
@Masd925
Apr 09 2018 20:15
@Feldbot A var declaration evaluates to undefined and an assignment to the assigned value.
And a evaluates to the value stored in that variable.
Boo Far
@vapidlyrapid
Apr 09 2018 20:17
I'm trying to build a navbar and can't for the life of me figure out why the padding on the link elements only applies when I hover over them: https://jsfiddle.net/sdk3gLy0/1/
LydaTech
@lydatech
Apr 09 2018 20:19
@vapidlyrapid add display: inline-block; to your a selector
Boo Far
@vapidlyrapid
Apr 09 2018 20:25
@lydatech: thank you. that did it. May I ask how that worked?
CamperBot
@camperbot
Apr 09 2018 20:25
vapidlyrapid sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 2771 | @lydatech |http://www.freecodecamp.org/lydatech
Daniel Feldman
@Feldbot
Apr 09 2018 20:29
@Masd925 Isn't a part of the assigned value the return value of the function? Why wouldn't it return Mind me though! on assignment?
Ken Haduch
@khaduch
Apr 09 2018 20:30
@Feldbot - I think that the variable a would have the value "Mind me though!" in the first case - since that was the return value.
Markus Kiili
@Masd925
Apr 09 2018 20:31
@Feldbot In var a = NothingSpecial(); the assignment operator evaluates the function call to a value and it is assigned to variable a. That whole expression with var is evaluated to undefined because that is what declarations evaluate to.
Just a = NothingSpecial() would evaluate to the assigned value (that is the return value from the function call) because assignments evaluate to the assigned value.
ExpressyCode
@ExpressyCode
Apr 09 2018 20:38
Hey, do someone know why style.display = "block" doesn't work on my codepen? Its the Random Quote Machine project https://codepen.io/ExpressyCode/pen/vRQzWp?editors=0010
Ken Haduch
@khaduch
Apr 09 2018 20:41
@ExpressyCode - I think that your display: block is working, there seems to be a problem with your iframe, though, it's not taking any space? For some reason, the iframe has style="position: static; visibility: visible; width: 1px; height: 1px;" so it is only 1px by 1px?
LydaTech
@lydatech
Apr 09 2018 20:44
@vapidlyrapid an a element bu default is displayed inline. Meaning by default you cant assign it height nor width. Once you change it to block or inline block you can then set those properties
zootechdrum
@zootechdrum
Apr 09 2018 20:44
hey guys
Daniel Feldman
@Feldbot
Apr 09 2018 20:44
@Masd925 Are you saying any var declaration will always return undefined? I'm confused by your example with var a = NothingSpecial() vs. a = NothingSpecial(), and why those would evaluate differently.
zootechdrum
@zootechdrum
Apr 09 2018 20:44
close ot finishing up my profile page
But still need to fix the responsiveness of the site
Markus Kiili
@Masd925
Apr 09 2018 20:45
@Feldbot That is what I am saying.
zootechdrum
@zootechdrum
Apr 09 2018 20:45
For whatever reason the first 3 buttons are disapearing when you go to iphone screen size 5/5s in chroe
chrom
Daniel Feldman
@Feldbot
Apr 09 2018 20:46
@Masd925 I know vars initially return undefined during the initial evaluation when they are scoped, is that what you mean?
Markus Kiili
@Masd925
Apr 09 2018 20:48
@Feldbot What var declarations evaluate to has no meaning what so ever, but the fact that assignments evaluate to the assigned value for example enables chaining assignments like a = b = 5;
zootechdrum
@zootechdrum
Apr 09 2018 20:48
wait
i think i got it
Markus Kiili
@Masd925
Apr 09 2018 20:50
@Feldbot Declared variables are assigned undefined at the declaration phase. That is not the same thing as what declarations evaluate to.
John.O
@jozenua
Apr 09 2018 20:51
hey does anyone here know how to show add a FB livestream video to a website so that people that visit the website are watching can watch the livestream on the website
ExpressyCode
@ExpressyCode
Apr 09 2018 20:54
@khaduch Thanks for taking your time. Any ide how to fix it?
CamperBot
@camperbot
Apr 09 2018 20:54
expressycode sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3859 | @khaduch |http://www.freecodecamp.org/khaduch
Daniel Feldman
@Feldbot
Apr 09 2018 20:55
@Masd925 @kbaig
Please correct my misunderstanding... In this code, var a is initially undefined in the declaration phase, then as it is assigned the function NothingSpecial() and it is immediately invoked during assignment. As a side effect of that invocation/assignment, it logs to the console. If it has been invoked at this point, why doesn't it return the value 'Mind me though!'?
function NothingSpecial() {
  console.log( "Don't mind me!" );
  return 'Mind me though!';
}

var a = NothingSpecial(); // "Don't mind me" is logged to the console because the first line of NothingSpecial says to log it to the console
a; // has a value of 'Mind me though!'
Markus Kiili
@Masd925
Apr 09 2018 20:59
@Feldbot Function or function call is not assigned. What is assigned is what that function call evaluates to and it is the return value 'Mind me though!'. That value is assigned to variable a. What that whole line evaluates to has no meaning. That value is not used in anything.
Ken Haduch
@khaduch
Apr 09 2018 21:01
@ExpressyCode - well, no... :) I'm a little confused about how that twitter stuff works. It never seems to make sense to me! I found some method for setting up the tweet a long time ago, and I don't think that it was this way, but I'm looking at the docs now. I would like to think that whatever they are telling you to do in all of the copious documentation that they have should work...
Markus Kiili
@Masd925
Apr 09 2018 21:02
@Feldbot So when the engine evaluates the right hand side of the assignment (which is NothingSpecial()) it runs the function and logs the text and then it evaluates the call to the return value that is then assigned to the variable on the left.
creator0323
@Amasian
Apr 09 2018 21:06
how can i store values to 2D dimesional array in loop like this: [[],[],[],[],[]] (Javascript)
Daniel Feldman
@Feldbot
Apr 09 2018 21:06
@Masd925 @kbaig Thanks very much for the help. I think the side effect really threw my understanding on this. Markus, your last couple posts helped crystalize what was going on.
CamperBot
@camperbot
Apr 09 2018 21:06
feldbot sends brownie points to @masd925 and @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 592 | @kbaig |http://www.freecodecamp.org/kbaig
:star2: 4769 | @masd925 |http://www.freecodecamp.org/masd925
Brad
@bradtaniguchi
Apr 09 2018 21:07
@Amasian You need two loops. 1 to access the values in the outer array, and an inner one to access the values in the inner arrays.
creator0323
@Amasian
Apr 09 2018 21:11
@bradtaniguchi for(x=0;;x++) {
for(y=0;;y++) {
answer[x][y]=result;
}
}
like this?
ExpressyCode
@ExpressyCode
Apr 09 2018 21:12
@khaduch Ok weird haha. I tried .setAttribute('style','display: none'); and .setAttribute('style','display:block'); but that didn't do the trick either. Well I guess I have to give up on twitters own a tag solution.
Ken Haduch
@khaduch
Apr 09 2018 21:12

@ExpressyCode - after some further documentation reading, I found that if I added this:

      twttr.widgets.createShareButton(
  '/',
  document.getElementById('twitter'),
  {
    text: myJson.quote
  }
);

just after you generate the quote, I am getting tweet buttons showing up. One for each quote, so you might have to do some cleanup... but I have to run so I hope that gets you some help!

ExpressyCode
@ExpressyCode
Apr 09 2018 21:13
@khaduch Oh ok thanks man!! :)
CamperBot
@camperbot
Apr 09 2018 21:13
expressycode sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
api offline
Brad
@bradtaniguchi
Apr 09 2018 21:14
@Amasian Yes, but your missing the conditional for your loops
creator0323
@Amasian
Apr 09 2018 21:16
@bradtaniguchi thank you for help I will try it on my work
Brad
@bradtaniguchi
Apr 09 2018 21:17
@Amasian np :D
Daniel Simeonov
@dbsimeonov
Apr 09 2018 21:22

Good evening guys ;) Been playing around with css animation classes last few hours, I faced small issue which I know the reason but don't know how to fix it.

  • When you go to projects it gives it a class fromRight
  • When you move to experiments it removes the class from projects and the effect is the opposite of what I want.
  • The other links are working good(my opinion) but I think I should create like new animation to go to the other side and be like invisible for his default position or something?

https://dbsimeonov.github.io/

Abhi Indoria
@AIndoria
Apr 09 2018 22:00
i.e. how to search again without refreshing the page.
Does nayone know how do I make the ajax call repeat wihtout refreshing the page? https://repl.it/@AIndoria/EcstaticScholarlyTranslation
Brad
@bradtaniguchi
Apr 09 2018 22:02
@AIndoria When would you run the search again? (like if the user clicked a button or something?)
Abhi Indoria
@AIndoria
Apr 09 2018 22:02
@bradtaniguchi If the user typed something else in the search box and pressed enter
Brad
@bradtaniguchi
Apr 09 2018 22:03
Hmm, seems like it should make the call again, but then I only spent a few seconds looking over the code
Abhi Indoria
@AIndoria
Apr 09 2018 22:03
@bradtaniguchi well, upon the first press it does make the call, it just doesn't repeat it on subsequent enter presses
Brad
@bradtaniguchi
Apr 09 2018 22:05
@AIndoria Seems like you have a lot of bugs when looking at the console :/
Abhi Indoria
@AIndoria
Apr 09 2018 22:05
@bradtaniguchi only happens in goddamn repl.it for some reason
Brad
@bradtaniguchi
Apr 09 2018 22:06
Hard to tell what's wrong with it, I think your bug is probably something small and dumb.
Abhi Indoria
@AIndoria
Apr 09 2018 22:07
Wonder if I can just clear the results dom after the enter event runs so it'd load the entire thing
but that'd result in even uglier code
so
(function clearResults(){ document.getElementById("resultsbox").innerHTML=""; })();
worked. sorta
DarkxPunk
@DarkxPunk
Apr 09 2018 22:12
OKay I am having some weird issues with :nth-child...
I set :nth-child(1) :nth-child(2) :nth-child(3) but only 1 and 2 are getting the styles..? What is up with that.
Oh wait
Abhi Indoria
@AIndoria
Apr 09 2018 22:14
...yeah
you only have 3 children don't you?
@DarkxPunk :P
DarkxPunk
@DarkxPunk
Apr 09 2018 22:15
Wait no… Same shit...
I have 7 children. a h1 and a bunch of sections
Abhi Indoria
@AIndoria
Apr 09 2018 22:15
@DarkxPunk do you have the code somewhere online
Victor De Los Santos
@rdelosh
Apr 09 2018 22:16
lol for a moment i was thinking of kids when saying children lol
DarkxPunk
@DarkxPunk
Apr 09 2018 22:16
Okay I think I figured it out, but this is dumb
What is the point of attaching :nth-child to a tag if it includes in the nth-child tags that it is not attached to!
Just end up using nth-of-type
@rdelosh This isnt the 1950s, cant afford 7 children anymore.
Victor De Los Santos
@rdelosh
Apr 09 2018 22:23
:v
Michael
@g4m3rm1k3
Apr 09 2018 22:30
haha I have 4 children
DarkxPunk
@DarkxPunk
Apr 09 2018 23:18
@g4m3rm1k3 Damn boi
include*engine
@newtothat
Apr 09 2018 23:36
what color picker do you recommend which has more options and is quick to use
Daniel Simeonov
@dbsimeonov
Apr 09 2018 23:48
ColorZilla