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
Stephen James
@sjames1958gm
@lestairon I am seeing most of the newer courses on sites like Udemy using more of ES6
@andrewmarushko I would use array.map for that
@andrewmarushko
someArray.map((element, index) => {
   element.id = index + 1;
   return element;
}
Juli Cheng
@julicheng
hi @sjames1958gm thank you for your reply! what is a module ? is it an external file ? thanks
CamperBot
@camperbot
julicheng sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8894 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Fernando
@lestairon
I guess ES6 doesn't have that many libraries tho
Stephen James
@sjames1958gm
@julicheng Yes, a module is another file.
steve84
@raynor84
this works:
´´´

function diffArray(arr1, arr2) {
  var newArr = [];
 arr1.forEach(function(value, index) {
     if(arr2.indexOf(value)==-1) {
       newArr.push(value);
     }
 });
  arr2.forEach(function(value, index) {
    if(arr1.indexOf(value)==-1) {
    newArr.push(value);
  }           
 });


  // Same, same; but different.
  return newArr;
}

diffArray(["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]);
Stephen James
@sjames1958gm
@andrewmarushko You could even use the spread syntax
someArray.map((element, index) => ({...element, id: index+1})
@raynor84 :+1:
steve84
@raynor84
thx
Markus Kiili
@Masd925
@raynor84 You have essentially the same code there twice, so you could refactor that functionality into a function that you use twice.
Stephen James
@sjames1958gm
@raynor84 Your code in forEach is basically what filter does for you
this is the same using filter
newArr = arr1.filter(function(value) { return arr2.indexOf(value)==-1})
newArr.concat(arr2.filter(function(value) return arr1.indexOf(value) == -1})
steve84
@raynor84
@james need to check it again... it didn't work
Fernando
@lestairon
Does someone know why when i try to type "}" in Codepen it replaces it with a /* */?
Juli Cheng
@julicheng
thanks @sjames1958gm import $ from 'jquery' import TweenMax from 'gsap' is 'jquery' the file location ?
CamperBot
@camperbot
julicheng sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
api offline
steve84
@raynor84
for some reason arr2 is not filtering the values out... eventhough it is almost the same code
catalin560
@catalin560
hello can someone help me with some loops? so I have a number of elements with id's like "video-id-###" how do I loop and store each id in an array? (preferably using jquery)
Markus Kiili
@Masd925
@catalin560 Sounds like String manipulation, so take a look at JS String methods.
Fernando
@lestairon
Oh no
FCC's weather api icon has like the opposite aesthetic that i'm using for my weather app
It's actually kinda funny hahah
Andrew Marushko
@andrewmarushko
@sjames1958gm Thanks dude, it’s works :)
CamperBot
@camperbot
andrewmarushko sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8895 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
catalin560
@catalin560
@Masd925 seems to have worked with splice()
catalin560
@catalin560
is there a way to use arrays as selectors in jquery?
Sweet Coding :)
@SweetCodingInc
@catalin560 array of what?
catalin560
@catalin560
never mind just found out how to do it
array of ids
Stephen James
@sjames1958gm
@lestairon Just a note. Since you add your click handler for F/C inside your click handler for location.
If you click the location button again, you add a second click handler, and again if you click again.
If you put a console.log() inside there you will see it called an additional time for each location click.
it doesn't affect this app much, but for other apps, it might. Just something I wanted to point out.
Fernando
@lestairon
Oh, so it can cause performance issues?
Stephen James
@sjames1958gm
@lestairon Yes
Fernando
@lestairon
So, it can be fixed just making the variable global, right?
Stephen James
@sjames1958gm
@lestairon Making the temperature and the celsius boolean global
Fernando
@lestairon
Now it should be fixed
Ali Bulut
@ali27001
https://codepen.io/alibulut/pen/oproLq?editors=1100 <li> why the icons do not show ?
Fernando
@lestairon
I think now i'm able to see the source code of the original weather app by FCC since i finished my pen, kind of
Just wanted to see which api were they using for their icons, since it matches with mine too
Ian
@toianw
@ali27001 your font awesome link is not valid. The request for <link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css"> is giving a 404 error. I think you need to register for font Awesome now and they will send you a valid CDN link by email.
Ali Bulut
@ali27001
@toianw <link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
is not this cdn
Ian
@toianw
@ali27001 no, the CDN would be something like href="https://use.fontawesome.com/...
that just looks like an example link for if you had the fonts installed locally on your server