Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:38
    @bjorno43 banned @real-action
  • Feb 01 2020 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 2020 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
Clyde Lobo
@oppiniated
@bikalkhawas hint: debug mode runs on http, your editor view is on https, run your pen on http and it will work. I want you to find out why it does not work on https. SO try http://codepen.io/bikal/pen/GrNpMw and this should work
Bikal Khawas
@bikalkhawas
@oppiniated thank you so much, :smile:
CamperBot
@camperbot
bikalkhawas sends brownie points to @oppiniated :sparkles: :thumbsup: :sparkles:
:cookie: 509 | @oppiniated |http://www.freecodecamp.com/oppiniated
Muhammad Hasham
@MuhammadHasham23
@adityaparab so what is the difference between the both?
Darth Skywalker
@adityaparab

@MohammadHasham

@adityaparab so what is the difference between the both?

:point_up: This (2nd message)

Muhammad Hasham
@MuhammadHasham23
with Array.prototype.forEach we can traverse the array but what about the second one?
@adityaparab
Darth Skywalker
@adityaparab
you do exactly the same thing
Muhammad Hasham
@MuhammadHasham23
can you explain me this
function forEach(array, action) { for (var i = 0; i < array.length; i++) action(array[i]); }
forEach(["Wampeter", "Foma", "Granfalloon"], console.log); // → Wampeter // → Foma // → Granfalloon
why are we passing action with it
Darth Skywalker
@adityaparab

in fact, the function

function forEach(array, action) { 
  for (var i = 0; i < array.length; i++) 
    action(array[i]); 
}

explains how Array.prototype.forEach works internally.

Array.prototype.forEach = function(action){
  for (var i = 0; i < this.length; i++) 
    action(this[i]); 
}
Muhammad Hasham
@MuhammadHasham23
why is action passed as an argument?
Darth Skywalker
@adityaparab
it's nothing but a callback function.
Muhammad Hasham
@MuhammadHasham23
okay!
@adityaparab Thanks.
CamperBot
@camperbot
mohammadhasham sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 877 | @adityaparab |http://www.freecodecamp.com/adityaparab
Darth Skywalker
@adityaparab
take a look at this
var x = console.log

x('Hello! I am alias for console.log');
so the 2nd parameter action becomes an alias for console.log
Muhammad Hasham
@MuhammadHasham23
yeah! that is what i can understand!
okay thanks
Darth Skywalker
@adityaparab
and when you call action, you're in fact calling console.log
Muhammad Hasham
@MuhammadHasham23
i see.
i'll give that a try!
Darth Skywalker
@adityaparab
and why do they pass action as a parameter? That's because forEach expects a callback function that it will operate on each element in the array
Muhammad Hasham
@MuhammadHasham23
really nicely explained.
thanks man
can you give me a link to study for each?
@adityaparab
Darth Skywalker
@adityaparab

@MohammadHasham

:point_up: Here! ;)

Try and understand what's going on there
Mostafa Masri
@thefakeweed
ive been trying to do it since 2 days and its getting on my nerves :/
Muhammad Hasham
@MuhammadHasham23
just a last thing @adityaparab
Marianissimus
@Marianissimus
@mml3b show us your code - preferably a link to your codepen
Muhammad Hasham
@MuhammadHasham23
var numbers = [1, 2, 3, 4, 5], sum = 0;
 forEach(numbers , function(number)
 { sum += number; });
 console.log(sum); // → 15
why is forEach directly called here
Mostafa Masri
@thefakeweed
dude i keep editing and removing codes and adding and removing :((( http://codepen.io/mml3b/pen/KaamPX
Darth Skywalker
@adityaparab
@MohammadHasham because you have function forEach defined in your code
Muhammad Hasham
@MuhammadHasham23
i am really dumb!
@adityaparab Thanks.
CamperBot
@camperbot
mohammadhasham sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:warning: mohammadhasham already gave adityaparab points
Darth Skywalker
@adityaparab
@MohammadHasham :+1:
no worries.
Mostafa Masri
@thefakeweed
i have no clue what to write at first and what to include :/
Darth Skywalker
@adityaparab
@mml3b you might wanna create your portfolio after you've done your projects
that way you will have something to show on your portfolio
for now, you can just put some text about yourself and be done with it
Sacha Morgese
@TheOmegaBlack

Hey there, I just posted this in the main chat but it's probably more appropriate here:

I am looking for help for No repeats please.

I solved it, but even though the program outputs the right results every time, it doesn't pass and it's all-red-x-land. I googled around and it seems people have problems with global variables but I am not using any. I have spent hours trying to understand what's wrong, don't really want to go and copy someone else code to pass.

https://jsfiddle.net/6g9jwLyr/1/

Cale Switzer
@Tennyx
Does anyone know why sometimes the FA twitter icon in this pen doesn't render?
https://codepen.io/Tennyx/pen/KaNxJX