Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 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
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Gersho
@Gersho
and put it in that variable
Alex
@cyberpunk1971
and that is where function(num) comes into play
Gersho
@Gersho
yes, it calls the function
Alex
@cyberpunk1971
i think I understand it now. you're awesome dude
thanks @Gersho
CamperBot
@camperbot
cyberpunk1971 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 439 | @gersho |http://www.freecodecamp.com/gersho
Gersho
@Gersho
you can call it multiple times
var blabla = processArg(5);
var foo = processArg(8);
Alex
@cyberpunk1971
another question I have is where/when would I use something like this?
is this for front end? back end? or what?
Gersho
@Gersho
don't worry you'll see plenty of those
it's a basic of coding, it'll be everywhere
Alex
@cyberpunk1971
ok
Gersho
@Gersho
it's usefull to reuse code
Alex
@cyberpunk1971
so is processArg a common term?
Gersho
@Gersho
for exemple my exemple earlier
no i was reusing your exemple ^^
Alex
@cyberpunk1971
ok
Gersho
@Gersho
you name your function as you want it (preferably something to know what it does)
Alex
@cyberpunk1971
is function(num) a common term?
Gersho
@Gersho
the use of a function like that is to re-use it, this one is only 1 line, but if you have a lot, you don't want to retype it)
function is a keyword
Alex
@cyberpunk1971
ok
i was wondering if (num) was common
Gersho
@Gersho
the values in the () are usually called arguments (you can have multiple)
Alex
@cyberpunk1971
i seem to remember something like that is was
ok
i'm pretty new to js
but learning more and more
been studying every night
do u work as a programmer?
Gersho
@Gersho
like
function addNumbers (a,b,c){
return a+b+c;
}
var blabla = addNumbers(2,4,6);
console.log(blabla); // 12

do u work as a programmer?

i wish ^^i'm still learning too

Alex
@cyberpunk1971
i see
have you been applying?
Gersho
@Gersho
no yet i'm trying to move out of where i live, it's a small island (on a path you surely seen on the news lately)
Alex
@cyberpunk1971
oh wow
damn dude that sucks
thank God you're ok
Gersho
@Gersho
got nothing here but neighbour islands weren't so lucky, Maria is for tomorrow
rafaelmonroy
@rafaelmonroy
how can I get my return to be in the proper format for the DNA pairing challenge?
function pairElement(str) {
  var obj = {A:'T', T:'A', C:'G', G:'C'},
      array = str.split(''),
      holderArr = [];
  for (i=0;i<array.length;i++){
    for (var j in obj){
      if (array[i] === obj[j]){
        holderArr.push(array[i] +','+ j );
      }
    }
  }

  return holderArr;
}

pairElement("ATCGA");
right now it returns [[“A,T”],…] but it needs to be [[“A”,"T”],…]
Markus Kiili
@Masd925
@rafaelmonroy Maybe holderArr.push([array[i],obj[array[i]]]);
rafaelmonroy
@rafaelmonroy
@Masd925 YES ! that worked thanks man
CamperBot
@camperbot
rafaelmonroy sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4488 | @masd925 |http://www.freecodecamp.com/masd925
rafaelmonroy
@rafaelmonroy
@Masd925 lol so just another for or while loop instead?
Markus Kiili
@Masd925
@rafaelmonroy You don't need the for in loop at all there.
Just remove the for...in loop and the if.