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
Greg Duncan
@GregatGit

@JackEdwardLyons

var myArr = [ [1,2], [3,4]];

for (var i = 0; i < myArr.length; i++){
    for (var j = 0; j < myArr[i].length; j++)
        console.log(myArr[i][j]);
}

the second for loop is nested in the first

Jack Lyons
@JackEdwardLyons
ah ok
so its not like bracket notation?
so it adds [i] first then [j]
Greg Duncan
@GregatGit
console.log(myArr[1][0]); / / => 3
@JackEdwardLyons there is no adding
Jack Lyons
@JackEdwardLyons
it displays
Greg Duncan
@GregatGit
it accesses it
var myArr = [ [1,2], [3,4]];
myArr[0][1] = 'apple';

for (var i = 0; i < myArr.length; i++){
    for (var j = 0; j < myArr[i].length; j++)
        console.log(myArr[i][j]);
}
that for loop would put out
1
apple
3
4
Greg Duncan
@GregatGit
@JackEdwardLyons I looked at your code
source.length is undefined
Jack Lyons
@JackEdwardLyons
ok
Greg Duncan
@GregatGit
source is an object.
Jack Lyons
@JackEdwardLyons
thanks @GregatGit i think i got it
CamperBot
@camperbot
jackedwardlyons sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 612 | @gregatgit |http://www.freecodecamp.com/gregatgit
Jack Lyons
@JackEdwardLyons
yeah, so this code...
collection[i][sourceKey[j]]
how does it work?
Greg Duncan
@GregatGit
@JackEdwardLyons do you know how to run a snippet in the chrome dev tools?
collection[i][sourceKey[j]] - collection is an array so collection[i] will give you the first thing in the collection that happens to be an object
becauce collection[i] is an object if you put a property in [] after it - since sourceKey[j] is a string
Lars
@Oppenheimer1
is anyone around I can ask code questions to?
Greg Duncan
@GregatGit
@Oppenheimer1 we might be able to help
Lars
@Oppenheimer1
I just figured it out. I was trying to see why my code wasn't passing all the tests but it's because I built it to pass the function and not to remove items from the array using shift but here's what I had for the Drop it algorithm
function dropElements(arr, func) {
// Drop them elements.
var newArr = [];
for(var i=0; i<arr.length; i++){
if(func(arr[i]) === true){
newArr.push(arr[i]);
}
}
return newArr;
}
dropElements([1, 2, 3], function(n) {return n < 3; });
also how do I get my code to display like code and not like this in a post
Greg Duncan
@GregatGit
``` on a seperate line before and after the code
you can just edit your post above
Dan Logajan
@hiltydiggs
use three backticks (left of the '1' key) before and after the code
Greg Duncan
@GregatGit
This message was deleted
CamperBot
@camperbot
:bulb: to format code use backticks! ``` more info
Lars
@Oppenheimer1
I love that robot thing. It's like Iron Man's assistant friend before it became that Superhero Vison character.
cool, thx Greg and Dan
Dan Logajan
@hiltydiggs
var arrayOfObjects = [{"a": 5}, {"b": 7}, {"c": 9}];
//to access an array item, we use it's index (starting from 0) in square brackets
//so arrayOfObjects[0] === {"a": 5}, arrayOfObjects[1] === {"b": 7}, arrayOfObjects[2] === {"c": 9}
@JackEdwardLyons
Abdoul rachid ayouba
@abdoul-rachid

<style>
.red-text {
color: red;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

how do i create an entry for p elements and set up the font-size to 16px
i have been struggling on this, any help would appreciated
Dan Logajan
@hiltydiggs
In css, html elements are just selected with their name
p {
  font-size: 16px;
}
Abdoul rachid ayouba
@abdoul-rachid
the question says inside the same style class
Dan Logajan
@hiltydiggs
<style>
.red-text {
  color: red;
  font-size: 16px;
}
</style>
Abdoul rachid ayouba
@abdoul-rachid
that's exactly what i'm doing but it's wrong
Dan Logajan
@hiltydiggs
Does it say inside the style element or class?
OceanMountains
@OceanMountains

I'm trying to finish up the Twitch API project. I can't figure out why channels that are "online" show up as "offline." I used an if/else to display if shows are offline/unavailable/online. Right now, the "unavailable" shows display as "unavailable" so it is working to some extent. Anyone have any insight?

http://codepen.io/OceanMountains/pen/MewxWO

Dan Logajan
@hiltydiggs
<style>
.red-text {
  color: red;
}

p {
  font-size: 16px;
}
</style>
OceanMountains
@OceanMountains
(it doesn't run in Chrome but will run in other browsers)
Dan Logajan
@hiltydiggs
@OceanMountains sorry, I don't see the problem off hand.
OceanMountains
@OceanMountains
Thanks for taking a look @hiltydiggs. I feel like I'm close.
CamperBot
@camperbot
oceanmountains sends brownie points to @hiltydiggs :sparkles: :thumbsup: :sparkles: