Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
Markus Kiili
@Masd925
You assign the given value to the property on the object if the property is not tracks and value is not an empty string.
Jason
@carpediem1213
@Masd925 Interesting. Why value on the right side?
Markus Kiili
@Masd925
@carpediem1213 The assignment operator = evaluates the right side (the value inside value parameter) and assigns it to the variable on the left side (property prop of the object with the given id).
Jason
@carpediem1213
@Masd925 I have 3 out of 4 green tests. There must be a problem with value = collection[id][prop].push();
same issue with value on the right side
Markus Kiili
@Masd925
@carpediem1213 Post the code again.
Jason
@carpediem1213
```js
if ((value !== "") && (prop != "tracks"))
{
collection[id][prop] = value; }
else if ((value !== "") && (prop == "tracks")) {
collection[id][prop].push() = value; }
else if (value === "") {
delete collection[id][prop]; }
return collection;
Markus Kiili
@Masd925
@carpediem1213 There is no assignment if you push.
value goes inside the parens.
Jason
@carpediem1213
@Masd925 Thanks! Everything works. I'm going to have to review "push" and JSON some more.
CamperBot
@camperbot
carpediem1213 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 953 | @masd925 | http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
@carpediem1213 You're wellcome.
Jason
@carpediem1213
the only way to get to prop is the multi-dimensional array with the [][], right?
no other notation?
Markus Kiili
@Masd925
@carpediem1213 They are objects inside objects.
And you access objects with syntax obj[key].
Arrays are actually objects too. That is why you access array elements with the same [] syntax.
Matt
@mattbag
This message was deleted
what am i missing here...
Markus Kiili
@Masd925
@mattbag Loop through the contacts.
Matt
@mattbag
oh sure thanks
something else, everything i wrapped n the for loop now
ArnoMauriceLieshout
@ArnoMauriceLieshout
Could someone help me I am stuck at the card counting assignment this is what my code looks like:
var count = 0;

function cc(card) {
  // Only change code below this line
  if(card < 1){
    return card + " Hold";
  } else if(card >= 1){
    return card + " Bet";
  }


  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);
Aleksander Gębicki
@Takumar
@ArnoMauriceLieshout "Bet" if the count is positive, or "Hold" if the count is zero or negative.
Put the border of your condition on 0 not 1
if (card <= 0) {
  return count + " Hold";
}

@ArnoMauriceLieshout now you have to first create another checking to set count variable depending on given card:

+1 for cards 2, 3, 4, 5, 6
0 for cards 7, 8, 9
-1 for cards 10, 'J', 'Q', 'K','A'

dvoci
@dvoci
This message was deleted
CamperBot
@camperbot
no wiki entry for: with this returning blank
dvoci
@dvoci
This message was deleted
ArnoMauriceLieshout
@ArnoMauriceLieshout
@Takumar I got that part but count is not a global variable so I can't call it inside my function
Aleksander Gębicki
@Takumar
@ArnoMauriceLieshout var count = 0; you have it declared before your function, it is global. It is visible in your function.
venkatesh prabhu
@venkateshprabhu2
Hello
I am getting expected output
but, it's not accepting
ArnoMauriceLieshout
@ArnoMauriceLieshout
to add to the count is it better to use a switch or a if else
venkatesh prabhu
@venkateshprabhu2

```var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.

var newArray = oldArray.filter(function(val){return val >5;});
```

var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.

var newArray = oldArray.filter(function(val){return val >5;});
Markus Kiili
@Masd925
@venkateshprabhu2 Your code is keeping all the elements that are greater than 5.
Filter keeps the elements for which the callback function returns true (or truthy) value.
venkatesh prabhu
@venkateshprabhu2
@Masd925 oops! I misunderstood
I misunderstood the question. Thanks @Masd925
CamperBot
@camperbot
venkateshprabhu2 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 954 | @masd925 | http://www.freecodecamp.com/masd925
ArnoMauriceLieshout
@ArnoMauriceLieshout
I don't understand what I am doing wrong could someone help me
var count = 0;

function cc(card) {
  // Only change code below this line
  switch(count){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count = count+1;
      break;

    case 7:
    case 8:
    case 9:
      count = count;
      break;

    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count = count-1;
}



  if(card < 1){
    return count + " Hold";
  } else if(card >= 1){
    return count + " Bet";
  }


  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);
venkatesh prabhu
@venkateshprabhu2
@ArnoMauriceLieshout switch(count)??
ArnoMauriceLieshout
@ArnoMauriceLieshout
that should be card right
venkatesh prabhu
@venkateshprabhu2
yes
ArnoMauriceLieshout
@ArnoMauriceLieshout
I changed that but it still doesn't work
Aleksander Gębicki
@Takumar
@ArnoMauriceLieshout you have to check count variable if it is positive or negative not card
if(count <= 0 ){
@ArnoMauriceLieshout I have told you about it half and hour ago :point_up: 9 lutego 2016 09:28