These are chat archives for FreeCodeCamp/HelpJavaScript

4th
Mar 2016
uCtrlr
@uCtrlr
Mar 04 2016 00:00
@johnlovespi Well first of all you're going to need to go through each contact so you'll need a loop to go through each number.
aleksamarkoni
@aleksamarkoni
Mar 04 2016 00:01
Does anybody else thinks that this code is a bit sexist :)
Pedro Abel Díaz Sánchez
@coderHook
Mar 04 2016 00:01
@dcnr thats right, I missed the .length,
uCtrlr
@uCtrlr
Mar 04 2016 00:01
This message was deleted
aleksamarkoni
@aleksamarkoni
Mar 04 2016 00:01
No that's not the right word
Finesse Rucker
@Finesse315
Mar 04 2016 00:01
still not getting anywhere
Pete Considine
@pjconsidine
Mar 04 2016 00:02
@Finesse315 What the error message?
Pedro Abel Díaz Sánchez
@coderHook
Mar 04 2016 00:02
@dcnr but I still having a problem, because it is not getting the second argument. (I also set sum without the () but it does not make sense to me because I need a second parameter.
Finesse Rucker
@Finesse315
Mar 04 2016 00:02
unsuspected token else
Pete Considine
@pjconsidine
Mar 04 2016 00:02
so something is wrong with the else statement
Pete Considine
@pjconsidine
Mar 04 2016 00:03
those don't usually take parentheses
so it's if (something) { } else { }
you've also still got an extra semicolon
right at the start
that usually messes all kinds of things up
Pedro Abel Díaz Sánchez
@coderHook
Mar 04 2016 00:06
@dcnr btw I think we broke smt, cause now I am not able to run it when setting sum without ()
Finesse Rucker
@Finesse315
Mar 04 2016 00:12
ok i see where i went wrong, gonna keep practicing the if else/if statements thx
Pedro Abel Díaz Sánchez
@coderHook
Mar 04 2016 00:15

I think is enough for me today, I let the current code in case someone can give me a hint on what I am doing wrong.

function add() {
  var sum = 0;

 function sumfirstand(x){

    return function(y){

      if(typeof y === "number"){
        return x + y;

      } else {return undefined;}
    };
  }

 if(arguments.length == 1 && typeof arguments[0] == "number"){

   sum = sumfirstand(arguments[0]);

   return sum;

 }else{

   for(var i = 0; i < arguments.length; i++){
      var type = typeof arguments[i];

       if(type !== "number"){ return undefined;

       } else {   sum += arguments[i];      }
 }

   return sum;
}
}


add(2)(3);

Tomorrow more, nn!

Norman Dela Cruz
@dcnr
Mar 04 2016 00:16
@Abel1987 that should be correct I think
@Abel1987
function add() {
  var sum = 0;

  function sumfirstand(x) {

    return function (y) {
      if (typeof y === "number") {
        return x + y;
      }
    };
  }

  if (arguments.length === 1 && typeof arguments[0] == "number") {
    sum = sumfirstand(arguments[0]);
    return sum;
  }
  else {
    for (var i = 0; i < arguments.length; i++) {
      var type = typeof arguments[i];

      if (type !== "number") {
        return undefined;
      }
      else {
        sum += arguments[i];
      }
    }

    return sum;
  }
}
@Abel1987 at least it's passing for me
Darryl Parks
@punchymango
Mar 04 2016 00:23
Hey everyone
David Young
@dayvidwhy
Mar 04 2016 00:25
yowassup
Sam Reeves
@smreeves
Mar 04 2016 00:27
Gah! Having trouble with instanceof for javascript. I read through the Details of the Object Model. I'm pretty familiar with Java and setting up the class with its constructors but for some reason on this Make a Person challenge I can't seem to get instanceof to return true. I left the structure of the function as is, simply split the string into an array and set up a multiple return statement to make my getter and setter functions. I'm not sure how to get it so the object type is of Person.
Norman Dela Cruz
@dcnr
Mar 04 2016 00:32
@sreeves89 hi will you post your current code?
Sam Reeves
@smreeves
Mar 04 2016 00:32
function Person(firstAndLast) {
  var nameArr = firstAndLast.split(" ");

  return {
    getFirstName : function() {
      return nameArr[0];
    },
    getLastName : function() {
      return nameArr[1];
    },
    getFullName : function() {
      return nameArr[0] + " " + nameArr[1];
    },
    setFirstName : function(first) {
      nameArr[0] = first;
    },
    setLastName : function(last) {
      nameArr[1] = last;
    },
    setFullName : function(firstAndLast) {
      nameArr = firstAndLast.split(" ");
    }   
  };
};

var bob = new Person('Bob Ross');
bob.getFullName();
Pete Considine
@pjconsidine
Mar 04 2016 00:34
@sreeves89 is it necessary that they're all functions? Can't you just assign values?
Norman Dela Cruz
@dcnr
Mar 04 2016 00:34
@sreeves89 as a constructor function, you shouldn't return an object
adamboyer
@adamboyer
Mar 04 2016 00:35
hello everyone, do y'all know if you can seat a loop in another loop example:
Pete Considine
@pjconsidine
Mar 04 2016 00:35
not as explicit values but in terms of the inputs.
Norman Dela Cruz
@dcnr
Mar 04 2016 00:35
@sreeves89 you'd have to do this.getFirstName = function() { ...
Pete Considine
@pjconsidine
Mar 04 2016 00:35
like this.name = nameArr[0]
Pavel
@Savrov
Mar 04 2016 00:36
Hello, can i get a review of my js code here?
Sam Reeves
@smreeves
Mar 04 2016 00:37
OK. Maybe I'm misunderstanding the instanceof test. That's the only test that fails, the rest pass. I'll try to change it to this. ...
Pete Considine
@pjconsidine
Mar 04 2016 00:37
what's the error you're getting?
adamboyer
@adamboyer
Mar 04 2016 00:38
while(blah<blue){
while(cat=green){
var blah = 35;
}
}
Pete Considine
@pjconsidine
Mar 04 2016 00:38
also, make sure it's not supposed to be instanceOf() instead
Tyler Moeller
@TylerMoeller
Mar 04 2016 00:38
@savrov Just post it here or in the CodeReview chatroom https://gitter.im/FreeCodeCamp/CodeReview.
Sam Reeves
@smreeves
Mar 04 2016 00:39
bob instanceof Person should return true. <-- This test fails
Am I supposed to actually write an instanceof? Not certain what I'm really supposed to write in it.
Pavel
@Savrov
Mar 04 2016 00:40
@TylerMoeller thank you
CamperBot
@camperbot
Mar 04 2016 00:40
savrov sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 399 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Rami
@RNwebdk
Mar 04 2016 00:41
OMG
why the ** does this give me false
Norman Dela Cruz
@dcnr
Mar 04 2016 00:41
@sreeves89 no, you shouldn't return an object but use this.name = function() {} inside your constructor function. Or extend Person's prototype, but you'd fail the property count test
Mark Howard
@iheartkode
Mar 04 2016 00:41
@0x0936 what did i do
Rami
@RNwebdk
Mar 04 2016 00:41
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];
console.log(contacts.hasOwnProperty("number"))
Norman Dela Cruz
@dcnr
Mar 04 2016 00:42
@RNwebdk because contacts is an ARRAY
Sam Reeves
@smreeves
Mar 04 2016 00:42
OK, by removing my return functions and switching to this.getFullName = function() ... the instanceof passed.
Tyler Moeller
@TylerMoeller
Mar 04 2016 00:42
@RNwebdk Try this: console.log(contacts[0].hasOwnProperty('number'));
Mark Howard
@iheartkode
Mar 04 2016 00:42
array of objects
Sam Reeves
@smreeves
Mar 04 2016 00:42
Guess I'm still a little hazy on how that turns it into a constructor function.
Rami
@RNwebdk
Mar 04 2016 00:42
OMG thanks @dcnr and @TylerMoeller
CamperBot
@camperbot
Mar 04 2016 00:42
rnwebdk sends brownie points to @dcnr and @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 400 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
:star: 754 | @dcnr | http://www.freecodecamp.com/dcnr
Rami
@RNwebdk
Mar 04 2016 00:44
i hate when you keep looking at your code and try really hard, but still can't find the issue :P
Tyler Moeller
@TylerMoeller
Mar 04 2016 00:44
@RNwebdk lol, that's why I'm here in chat
Mark Howard
@iheartkode
Mar 04 2016 00:44
@RNwebdk whats up?
Sam Reeves
@smreeves
Mar 04 2016 00:45
thanks for the help @dcnr and @pjconsidine
CamperBot
@camperbot
Mar 04 2016 00:45
sreeves89 sends brownie points to @dcnr and @pjconsidine :sparkles: :thumbsup: :sparkles:
:star: 394 | @pjconsidine | http://www.freecodecamp.com/pjconsidine
:star: 755 | @dcnr | http://www.freecodecamp.com/dcnr
Rami
@RNwebdk
Mar 04 2016 00:45
@TylerMoeller your awesome, we need more people like you :D
@iheartkode was just a comment on my other post :) thx anyway for asking
CamperBot
@camperbot
Mar 04 2016 00:45
rnwebdk sends brownie points to @tylermoeller and @iheartkode :sparkles: :thumbsup: :sparkles:
:warning: rnwebdk already gave tylermoeller points
:star: 552 | @iheartkode | http://www.freecodecamp.com/iheartkode
Mark Howard
@iheartkode
Mar 04 2016 00:46
@RNwebdk haha ok
Rami
@RNwebdk
Mar 04 2016 00:47
I need some codeing music, anyone with some cool list on youtube, soundcloud, twitch ect ?
Mark Howard
@iheartkode
Mar 04 2016 00:47
@RNwebdk yes
3 hours
Rami
@RNwebdk
Mar 04 2016 00:49
@iheartkode thx appreciate that :) 3 hours is more then enough ^^
CamperBot
@camperbot
Mar 04 2016 00:49
rnwebdk sends brownie points to @iheartkode :sparkles: :thumbsup: :sparkles:
:warning: rnwebdk already gave iheartkode points
Vincent
@vtli94
Mar 04 2016 00:49

working on loops "Iterate Through an Array with a For Loop” specifically.
can someone explain to how the loop is doing its math?

var myArr = [ 2, 3, 4, 5, 6];
var total = 0;

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

adding the total its 20. If I were to do myArr[4] it equals to 30 myArr[3] = 25, myArr2 = 20, myArr1 = 15, myArr[0] = 10.
I want to know how its processing it.

Mark Howard
@iheartkode
Mar 04 2016 00:49
@RNwebdk yw
Rami
@RNwebdk
Mar 04 2016 00:50
@vtli94 remember to increment i++
ow you did
sorry
Mark Howard
@iheartkode
Mar 04 2016 00:50
@vtli94 each iteration it counts up
Vincent
@vtli94
Mar 04 2016 00:50
right. what does that mean exactly?
its going 0,1,2,3,4
right?
Mark Howard
@iheartkode
Mar 04 2016 00:51
it goes through each item in the array until its empty
@vtli94 yep
Rami
@RNwebdk
Mar 04 2016 00:51
@iheartkode this is so peacefull, OMG i love it
Mark Howard
@iheartkode
Mar 04 2016 00:51
@RNwebdk nice :)
@RNwebdk also on spotify they have a focus music section
just youtube focus music and you will be set lol
Rami
@RNwebdk
Mar 04 2016 00:52
nice
Vincent
@vtli94
Mar 04 2016 00:52
so… if i input myArr[0] how did it get 10?
Mark Howard
@iheartkode
Mar 04 2016 00:53
@vtli94 do you understand indexes in the array?
Vincent
@vtli94
Mar 04 2016 00:53
refresh me please
Mark Howard
@iheartkode
Mar 04 2016 00:53
@vtli94 btw you can do that array look easier ill show
var arr = [1,2,3,4,5,6];
for(var i = 0; i < arr.length; i++) {
     console.log(i);
}
that will output 0 1 2 3 4 5
if we changed it to var i = 1; it will be 12345
Vincent
@vtli94
Mar 04 2016 00:56
right. i understand that
Mark Howard
@iheartkode
Mar 04 2016 00:56
indexes start at 0
Tyler Moeller
@TylerMoeller
Mar 04 2016 00:57

@vtli94 You can always add console.log() to get more detail:

var myArr = [2, 3, 4, 5, 6];
var total = 0;

for (var i = 0; i < myArr.length; i++) {
  console.log('iteration: ' + i + ' = ' + 'total + myArr[i]' + ' = ' + total + ' + ' + myArr[i] + ' = ' + (total + myArr[i]));
  total += myArr[i];
}

Output is:

iteration: 0 = total + myArr[i] = 0 + 2 = 2
iteration: 1 = total + myArr[i] = 2 + 3 = 5
iteration: 2 = total + myArr[i] = 5 + 4 = 9
iteration: 3 = total + myArr[i] = 9 + 5 = 14
iteration: 4 = total + myArr[i] = 14 + 6 = 20
Mark Howard
@iheartkode
Mar 04 2016 00:57
@TylerMoeller great explanation
@TylerMoeller thanks
CamperBot
@camperbot
Mar 04 2016 00:57
iheartkode sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star: 402 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Valeriav521
@Valeriav521
Mar 04 2016 00:58
hey
Tyler Moeller
@TylerMoeller
Mar 04 2016 00:58
Happy to help with this :)
Mateo
@KinichAjaw
Mar 04 2016 00:58
OK, so I'm on "return early pattern" and I've tried the code with abTest. It seems to be working but it won't let me pass.
if (a < 0 || b < 0) {
return "undefined";
}
Vincent
@vtli94
Mar 04 2016 00:59
thanks @iheartkode @TylerMoeller
CamperBot
@camperbot
Mar 04 2016 00:59
vtli94 sends brownie points to @iheartkode and @tylermoeller :sparkles: :thumbsup: :sparkles:
Valeriav521
@Valeriav521
Mar 04 2016 00:59
hello
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 00:59
hello
CamperBot
@camperbot
Mar 04 2016 00:59
:star: 553 | @iheartkode | http://www.freecodecamp.com/iheartkode
:star: 403 | @tylermoeller | http://www.freecodecamp.com/tylermoeller
Vincent
@vtli94
Mar 04 2016 00:59
so how is the ‘total’ calculated?
Valeriav521
@Valeriav521
Mar 04 2016 00:59
hey @Mahin2k
Vincent
@vtli94
Mar 04 2016 00:59
oh nevermind i got it
im thinking too hard
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 00:59
@Valeriav521 hi
can someone help me with this?
Valeriav521
@Valeriav521
Mar 04 2016 01:00
who wants to chat like about whatever?
Mark Howard
@iheartkode
Mar 04 2016 01:00
@vtli94 sometimes taking a break and breathing helps lol
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 01:00
function largestOfFour(arr) {
  // You can do this!
  var result = [];

  for (var i = 0; i < arr.length; i++){
  var largestNumber = 0;
    for(var j=0; j < arr.length; j++){
      if(largestNumber<arr[i][j]){
        result=arr[i][j];
        }
    }
    result.push(largestNumber);
}

  return result;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
can someone help?
t
Vincent
@vtli94
Mar 04 2016 01:00
😅 😅 😅 😅
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 01:00
its not recognizing push as a function
Valeriav521
@Valeriav521
Mar 04 2016 01:01
anyone wanna chat?
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 01:01
@Valeriav521 about?
Valeriav521
@Valeriav521
Mar 04 2016 01:01
about whatever
CamperBot
@camperbot
Mar 04 2016 01:01
you need to ask about @someone!
Valeriav521
@Valeriav521
Mar 04 2016 01:02
okay @camperbot
gvik02
@gvik02
Mar 04 2016 01:02
yes need help with falsy bouncer @Valeriav521
Valeriav521
@Valeriav521
Mar 04 2016 01:02
what @gvik02
gvik02
@gvik02
Mar 04 2016 01:03
I'm stuck with it ! can you help me with this?
assignment
sorry challange
Valeriav521
@Valeriav521
Mar 04 2016 01:03
sure if i know i am kinda new at this
gvik02
@gvik02
Mar 04 2016 01:03
ha ha OK then
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 01:05
can someone help?
Mateo
@KinichAjaw
Mar 04 2016 01:06
Oh, I wasn't supposed to literally put return "undefined"; now I feel silly.
Valeriav521
@Valeriav521
Mar 04 2016 01:07
in what? @Mahin2k java or html?
gvik02
@gvik02
Mar 04 2016 01:10
Need help with falcy Bouncer can anyone help me !
E
@efhjones
Mar 04 2016 01:10
@gvik02 what's your question?
Valeriav521
@Valeriav521
Mar 04 2016 01:10
lol
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 01:11
@KinichAjaw lol
Mateo
@KinichAjaw
Mar 04 2016 01:12
Exactly my response! I was being too literal. XD
Rami
@RNwebdk
Mar 04 2016 01:14
When do i use operater == and === ?
i understand the diffrence , but would it make sence to allways use === ?
gvik02
@gvik02
Mar 04 2016 01:15
This message was deleted
Rami
@RNwebdk
Mar 04 2016 01:16
@gvik02 no var test = "test" is assigning
not 2 ==
but when would it make sense to use the double instead of 3
Khademul Islam Mahin
@Mahin2k
Mar 04 2016 01:18
someone help me

function largestOfFour(arr) {
  // You can do this!
  var result = [];

  for (var i = 0; i < arr.length; i++){
  var largestNumber = 0;
    for(var j=0; j < arr.length; j++){
      if(largestNumber<arr[i][j]){
        result=arr[i][j];
        }
    }
    result.push(largestNumber);
}

  return result;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
.push function is not being recognized
Valeriav521
@Valeriav521
Mar 04 2016 01:19
hey
Rami
@RNwebdk
Mar 04 2016 01:19
@Mahin2k not sure, but i think result.push(largestNumber); is the problem here
again not sure
gvik02
@gvik02
Mar 04 2016 01:23
Math.max.apply() try this @Mahin2k
sethnejame
@sethnejame
Mar 04 2016 01:30
Hey fellas, a little help here
Stumped right now, trying to use the "lookup" object to find "val" and assign tghe associated string to the "result" variable
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

  var lookup = {

    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank",

  };


  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
I already made the table
erm, object rather
E
@efhjones
Mar 04 2016 01:42
@sethnejame what challenge is this?
sethnejame
@sethnejame
Mar 04 2016 01:43
@efhjones "Using Objects for Lookups"
gvik02
@gvik02
Mar 04 2016 01:43
try this lookup[val] @sethnejame
sethnejame
@sethnejame
Mar 04 2016 01:45
@gvik02 no dice :(
I changed the "alpha" to alpha
I think that helped
golfguy1984
@golfguy1984
Mar 04 2016 01:46
function myTest(val) {
  // Only change code below this line

  if (val > 10 || val < 20) {
    return "Outside";

  }

  // Only change code above this line
  return "Inside";
}

// Change this value to test
myTest(15);
Why is this not returning inside?
gvik02
@gvik02
Mar 04 2016 01:48
of-course the val satisfies the if statement so it will return Outside @golfguy1984
use apha itself don't use the "" @sethnejame
sethnejame
@sethnejame
Mar 04 2016 01:50
right, did that
I need to assign the result to the lookup results somehow
i think
*the result variable
golfguy1984
@golfguy1984
Mar 04 2016 01:50
@gvik02 but if i change it to 25 it still returns outside
gvik02
@gvik02
Mar 04 2016 01:51
yes 25 is greater than 10 so
you need to rethink the if statement @golfguy1984
you can directly assign it @sethnejame
sethnejame
@sethnejame
Mar 04 2016 01:52
@gvik02 i tried this. . .
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

  var lookup = {  
    alpha: "Adams",
    bravo: "Boston",
    charlie: "Chicago",
    delta: "Denver",
    echo: "Easy",
    foxtrot: "Frank",

  };

  var result = lookup.val;

  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
No dice
gvik02
@gvik02
Mar 04 2016 01:52
change it to lookup[val];
@sethnejame
sethnejame
@sethnejame
Mar 04 2016 01:53
what's that? the actual object or the result asssignment below
gvik02
@gvik02
Mar 04 2016 01:54
result assignment @sethnejame
sethnejame
@sethnejame
Mar 04 2016 01:54
oh wow
that worked
@gvik02 thanks!
CamperBot
@camperbot
Mar 04 2016 01:54
sethnejame sends brownie points to @gvik02 :sparkles: :thumbsup: :sparkles:
:star: 280 | @gvik02 | http://www.freecodecamp.com/gvik02
gvik02
@gvik02
Mar 04 2016 01:55
you are welcome
cfj2
@cfj2
Mar 04 2016 02:10
function factorialize(num) {
a = 1;
var val;
while(a <= num){
if (typeof num !== undefined) {
val = a * val;
a++;
return val;
}
else{
return a;
}
}
}
factorialize(5);
This is returning null and i dont see how.
bitgrower
@bitgrower
Mar 04 2016 02:12
just fyi, you might want to use var a instead of just a
you are also using val before giving it a value
cfj2
@cfj2
Mar 04 2016 02:20
Thank you. Now it doesn't recognize the val = a * val;
a++;
bitgrower
@bitgrower
Mar 04 2016 02:21
well ... did you give val a value ?
cfj2
@cfj2
Mar 04 2016 02:22
Yes, its set to a default of 1 at the top.
asaki444
@asaki444
Mar 04 2016 02:22
``` 
cfj2
@cfj2
Mar 04 2016 02:22
Where is the thumbs up button?
bitgrower
@bitgrower
Mar 04 2016 02:23
no thumbs up ... just say @username thanks ...
CamperBot
@camperbot
Mar 04 2016 02:23
bitgrower sends brownie points to @username :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for username
asaki444
@asaki444
Mar 04 2016 02:23
``` 
ar contacts = [
{
    "firstName": "Akira",
    "lastName": "Laine",
    "number": "0543236543",
    "likes": ["Pizza", "Coding", "Brownie Points"]
},
{
    "firstName": "Harry",
    "lastName": "Potter",
    "number": "0994372684",
    "likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
    "firstName": "Sherlock",
    "lastName": "Holmes",
    "number": "0487345643",
    "likes": ["Intriguing Cases", "Violin"]
},
{
    "firstName": "Kristian",
    "lastName": "Vos",
    "number": "unknown",
    "likes": ["Javascript", "Gaming", "Foxes"]
}

];

function lookUp(firstName, prop){
// Only change code below this line
for(var i = 0; i < contacts.length; i++){
if(contacts[i].firstName === firstName &&
contacts[i].hasOwnProperty(prop) === true)
{
return contacts[i][prop];
}
else if (contacts[i].firstName !== firstName){
return "No such contact";
}

return "No such property";
}
// Only change code above this line
}
// Change these values to test your function
lookUp("Akira", "address");

```

bitgrower
@bitgrower
Mar 04 2016 02:23
@cfj2 -- if both a & val are 1 -- your code isn't going to go thru your while loop
asaki444
@asaki444
Mar 04 2016 02:23
I am profile lookup
it keeps returning t
that there is no such property on the test one
bitgrower
@bitgrower
Mar 04 2016 02:25
so follow your code thru ... step thru it, @asaki444 ...
it looks at the first contact ... looks to see if the first contact has name "Akira' AND has the property "address" ... it doesn't ... so what will it do next ?
cfj2
@cfj2
Mar 04 2016 02:27
@bitgrower I dont understand. 1 is less then num. Did I mis enter the paramaters?
bitgrower
@bitgrower
Mar 04 2016 02:28
you said val is now 1 ... and a is now 1 ...is that correct?
asaki444
@asaki444
Mar 04 2016 02:28
@bitgrower it did do what it was supposed to do for that. I forgot I changed the test one. I ran lookUp("Sherlock", "likes"), and it said there was no such contact
cfj2
@cfj2
Mar 04 2016 02:28
Yes.
bitgrower
@bitgrower
Mar 04 2016 02:29
so look at your while loop ...
@asaki444 -- so follow your code ... step thru your code & see what it's doing ... use this site to help you pythontutor.com/javascript.html
This message was deleted
rprusia
@rprusia
Mar 04 2016 02:32

Why is this failing?

Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr

var myStr = "\b \t \t \r \n"; // Change this line

i see it backslash not backspace
bitgrower
@bitgrower
Mar 04 2016 02:32
@cfj2 -- you are returning right away ...
cfj2
@cfj2
Mar 04 2016 02:36
I tried switching the if and while paramaters but still no.
bitgrower
@bitgrower
Mar 04 2016 02:36
post your current code ?
cfj2
@cfj2
Mar 04 2016 02:37
function factorialize(num) {
var a = 1;
var val=1;
while(typeof num !== undefined){
if (a <= num) {
val = a * val;
a++;
return val;
}
else{
return a;
}
}
}
factorialize(5);
bitgrower
@bitgrower
Mar 04 2016 02:37
btw -- you can get cool syntax coloring & things if you use this ...
explain formatting
CamperBot
@camperbot
Mar 04 2016 02:38

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

bitgrower
@bitgrower
Mar 04 2016 02:39

so @cfj2

if ( a <= num) <--- 1 < 5 ... yes
val = a val; <--- 11 = 1

a++ <--- a is now 2
then you return val, which is 1 ...
you might want to look around at the various algos for coding factorial -- there are TONS of them around the web ...
...it's also a GREAT problem for getting exposed to using recursion ... because it's very clean & straightforward ... and recursion is something you'll want to at least get exposed to using ...
asaki444
@asaki444
Mar 04 2016 02:41
@bitgrower I am still not getting it... why doesnt it stop at i = 0 for the matchup?
bitgrower
@bitgrower
Mar 04 2016 02:42
I don't understand your question @asaki444
cfj2
@cfj2
Mar 04 2016 02:42
@bitgrower Thankyou. I will go ponder this.
Garrett
@grrttmrtn
Mar 04 2016 02:44

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < multiplyAll.length; i++)
{
for (var j=0; j < multiplyAll[i].length; j++)
{
console.log(multiplyAll[i]*[j]);
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

How much did I screw that up?
bitgrower
@bitgrower
Mar 04 2016 02:44
@cfj2 -- you can use a loop -- but right now you are only going thru your loop one time and returning ... which isn't quite what you want ... so you probably don't want to use return in the loop ... because that takes you right out of your function ...

@grrttmrtn -- are you trying to ? :)

first you might want to use the length of arr instead of the length of multiplyAll (the function)

Garrett
@grrttmrtn
Mar 04 2016 02:47
Ahh yeah...I started with that and stupidly came back and posted it with the function lol
But anyways, it still doesn't work
bitgrower @bitgrower re-programs @camperbot to recognize thank you
CamperBot
@camperbot
Mar 04 2016 02:47
bitgrower sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 1307 | @camperbot | http://www.freecodecamp.com/camperbot
bitgrower
@bitgrower
Mar 04 2016 02:47
er ... that is .. thankyou @camperbot
@grrttmrtn -- I know, that's why I said "first" ...
wanna try posting your revised code with cool syntax coloring ? Just follow the below instructions ...
explain format
CamperBot
@camperbot
Mar 04 2016 02:48

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Garrett
@grrttmrtn
Mar 04 2016 02:48

'function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i < product.length; i++)
{
for (var j=0; j < product[i].length; j++)
{
console.log(product[i]*[j]);
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);'

Still messed up the formatting. One sec
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i < product.length; i++)
    {
      for (var j=0; j < product[i].length; j++)
        {
          console.log(product[i]*[j]);
        }
    }
    // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
CamperBot
@camperbot
Mar 04 2016 02:49
:bulb: to format code use backticks! ``` more info
bitgrower
@bitgrower
Mar 04 2016 02:50
you can edit the same message rather than re-posting ... and the backticks are the character to the left of the # 1 key on most keyboards
and ... product isn't an array ... so product.length is kinda meaningless ... you mean arr ?
asaki444
@asaki444
Mar 04 2016 02:52
@bitgrower on the link that you sent it would only compare the parameters against i = 0. Why is that?
Garrett
@grrttmrtn
Mar 04 2016 02:52
Okay, I changed lengths to arr and left console.log(product[i][j] still having issues with that
bitgrower
@bitgrower
Mar 04 2016 02:53
okay ... your loops are still using product.length -- which isn't even valid because numbers do not have length properties, as far as I know ...
@asaki444 -- you'll have to be a whole lot more specific ... I'm sorry ...
@asaki444 -- are you referring to pythontutor.com/javascript.html ?
:point_up: March 3, 2016 6:53 PM @grrttmrtn
asaki444
@asaki444
Mar 04 2016 02:55
@bitgrower yes that shite
site*
bitgrower
@bitgrower
Mar 04 2016 02:57
you can edit your messages, @asaki444 -- just mouse over to the right, and just to the right of the time 3 dots will show up when you hover over them ... right click, you'll get a context menu, from which you can choose "edit" :)
Garrett
@grrttmrtn
Mar 04 2016 02:57
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i < arr.length; i++)
    {
      for (var j=0; j < arr[i].length; j++)
        {
          console.log(arr[i]*[j]);
        }
    }
    // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
asaki444
@asaki444
Mar 04 2016 02:57
@bitgrower thanks for the tip
CamperBot
@camperbot
Mar 04 2016 02:57
asaki444 sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 706 | @bitgrower | http://www.freecodecamp.com/bitgrower
bitgrower
@bitgrower
Mar 04 2016 02:58
@asaki -- it doesn't go past i= 0 because your code returns before it iterates to the next number ...
@grrttmrtn -- alright ... now we're starting to cook on all burners ... :)
asaki444
@asaki444
Mar 04 2016 02:59
@bitgrower oh! so i should use console.log instead?
bitgrower
@bitgrower
Mar 04 2016 02:59
LOL ... @asaki444 -- depends on what you're trying to do ...
Garrett
@grrttmrtn
Mar 04 2016 02:59
Typically I've been doing alright with JS...this and the profile lookup are my last ones left, but this is way over my head
asaki444
@asaki444
Mar 04 2016 03:00
@bitgrower trying to run the loop to find the match
bitgrower
@bitgrower
Mar 04 2016 03:00
nah ... just a little mental adjustment and you'll be thinking ... "that's all that that was??? pfftttt....let me at the next challenge..."
Garrett
@grrttmrtn
Mar 04 2016 03:00
console log is only going be what it reads out
it isn't going to fix your loop
bitgrower
@bitgrower
Mar 04 2016 03:00
@asaki444 -- console.log is for debugging ... and what @grrttmrtn said ... it's not going to fix your loop ...
so @grrttmrtn .... you know how to address an element of an array, right ?
Garrett
@grrttmrtn
Mar 04 2016 03:02
yup, I want to use dot notation
Sorry dot notation would be arr.whatever
but anyways yes arrary[0-X]
bitgrower
@bitgrower
Mar 04 2016 03:03
@grrttmrtn -- . notation is for objects ... this is for an array ...
so myArray = [1,2,3]; -- how do I address, point to, access, the number 3 ?
Garrett
@grrttmrtn
Mar 04 2016 03:04
myArray[2]
bitgrower
@bitgrower
Mar 04 2016 03:04
awesome ...

now ... what if I had

myArray = [ [1,2,3], [2,3,4],[5,6,7]];

what would myArray[2] be equal to ?

Garrett
@grrttmrtn
Mar 04 2016 03:05
[5,6,7]
bitgrower
@bitgrower
Mar 04 2016 03:05
excellent !!!!
so, if I wanted to address the number 6, how would I do it ?
Garrett
@grrttmrtn
Mar 04 2016 03:06
myArray[2][1]?
bitgrower
@bitgrower
Mar 04 2016 03:06
YUP!!!!!
so ... let's go back a few lessons ...
you remember learning about i++;
?
Garrett
@grrttmrtn
Mar 04 2016 03:07
Yup that's incrementing i in the for loop
bitgrower
@bitgrower
Mar 04 2016 03:07
okay, most commonly ... but I could do something like
product++; as well ...
John Espinoza
@johnlovespi
Mar 04 2016 03:07
@uCtrlr still here
bitgrower
@bitgrower
Mar 04 2016 03:07

now ... do you remember this syntax:

myNum += 1;

Garrett
@grrttmrtn
Mar 04 2016 03:08
myNum = myNum +1
bitgrower
@bitgrower
Mar 04 2016 03:08
yup

so ... if I have a loop like this ...
var num = 3;
j = 0;

for (i = 0; i < num; i++) {
j += 1;
}

what is j going to equal at the end ?

Garrett
@grrttmrtn
Mar 04 2016 03:10
J = 3
bitgrower
@bitgrower
Mar 04 2016 03:10
cool ...
Dustin
@glenohumeral13
Mar 04 2016 03:10
hey guys im stuff on "profile lookup" what am i doing wrong? do i need a for loop? http://www.freecodecamp.com/challenges/profile-lookup#?solution=%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUp(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Aif%20(firstName%20%3D%3D%20contacts.firstName%20%26%26%20prop%20%3D%3D%20contacts%5Bprop%5D)%20%7B%0A%20%20return%20contacts%5Bprop%5D%3B%0A%7D%20else%20if%20(firstName%20!%3D%3D%20contacts.firstName)%20%7B%0A%20%20return%20%22No%20such%20contact%22%3B%0A%7D%20else%20if%20(prop%20!%3D%3D%20contacts.prop)%20%7B%0A%20%20return%20%22No%20such%20property%22%3B%0A%7D%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUp(%22Akira%22%2C%20%22likes%22)%3B%0A
bitgrower
@bitgrower
Mar 04 2016 03:10

what if I said

j *= i;

instead ?

if you don't have a for loop in profile lookup, you definitely need one
John Espinoza
@johnlovespi
Mar 04 2016 03:11
help with profile lookup
CamperBot
@camperbot
Mar 04 2016 03:11
no wiki entry for: with profile lookup
asaki444
@asaki444
Mar 04 2016 03:11
@bitgrower I am still stuck on this problem
John Espinoza
@johnlovespi
Mar 04 2016 03:11
anyone!
Sri Keerthi N
@keerthinerella
Mar 04 2016 03:11
helo frnds.. I'm trying to truncate a string
bitgrower
@bitgrower
Mar 04 2016 03:11
oops, let me change that around @grrttmrtn start j = 1 instead of 0
Sri Keerthi N
@keerthinerella
Mar 04 2016 03:12
but not getting it completely
Garrett
@grrttmrtn
Mar 04 2016 03:12
j would equal 4
Sri Keerthi N
@keerthinerella
Mar 04 2016 03:12

function truncate(str, num) {
// Clear out that junk in your trunk
var trunk = '';
if (str.length > num) {
trunk = str.slice(0, num - 3) + '...';
return trunk;
}

return str;
}

this is what i have used
can anyone help me?
bitgrower
@bitgrower
Mar 04 2016 03:12

@grrttmrtn -- what if I changed the inner loop to do this instead, @grrttmrtn ...

j *= i;

John Espinoza
@johnlovespi
Mar 04 2016 03:12
profile look up
Dustin
@glenohumeral13
Mar 04 2016 03:13
it didnt do anything
http://www.freecodecamp.com/challenges/profile-lookup#?solution=%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUp(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Afor%20(var%20i%20%3D%200%3B%20i%20%3C%20contacts.length%3B%20i%2B%2B)%20%7B%0A%20%20if%20(firstName%20%3D%3D%20contacts.firstName%20%26%26%20prop%20%3D%3D%20contacts%5Bi%5D%5Bprop%5D)%20%7B%0A%20%20return%20contacts%5Bi%5D%5Bprop%5D%3B%0A%7D%20else%20if%20(firstName%20!%3D%3D%20contacts.firstName)%20%7B%0A%20%20return%20%22No%20such%20contact%22%3B%0A%7D%20else%20if%20(prop%20!%3D%3D%20contacts.prop)%20%7B%0A%20%20return%20%22No%20such%20property%22%3B%0A%7D%0A%7D%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUp(%22Akira%22%2C%20%22likes%22)%3B%0A
bitgrower
@bitgrower
Mar 04 2016 03:13
@keerthinerella ..... look carefully at the instructions ...
gloriousjob
@gloriousjob
Mar 04 2016 03:13
@keerthinerella There's another rule you're missing
Sri Keerthi N
@keerthinerella
Mar 04 2016 03:14
is that I'm missing in using slice() function>
?
bitgrower
@bitgrower
Mar 04 2016 03:14
@glenohumeral13 ... describe the data structure in profile lookup ?
David Weedmark
@DavidWeedmark
Mar 04 2016 03:14
working on tic tac toe... can anyone give me a clue about how to put removeEventListener on divs after they've been clicked? http://codepen.io/weedmark/pen/JXdPVr?editors=1111
Dustin
@glenohumeral13
Mar 04 2016 03:14
@bitgrower its a nested object. but idk how to access anything.
gloriousjob
@gloriousjob
Mar 04 2016 03:15
@keerthinerella You've solved the main part of the problem. There's a special case to handle though
bitgrower
@bitgrower
Mar 04 2016 03:15
@glenohumeral13 -- what is the first character after the equal sign in the data structure definition
Dustin
@glenohumeral13
Mar 04 2016 03:15
@bitgrower like are the curly bracket pieces accessed by array bracket notation or what
@bitgrower what
Garrett
@grrttmrtn
Mar 04 2016 03:16
@bitgrower if j=1 adding that to the loop j = 2 if inner loop j *= i
bitgrower
@bitgrower
Mar 04 2016 03:16
look carefully at the data structure definition ... what is the first character after the equal sign on the 2nd line
bitgrower
@bitgrower
Mar 04 2016 03:17
so ... if I have a loop like this ...
var num = 3;
j = 2;
for (i = 0; i < num; i++) {
j *= 1;
}
David Weedmark
@DavidWeedmark
Mar 04 2016 03:17
@grrttmrtn yeah I've got that page practically memorized thanks
CamperBot
@camperbot
Mar 04 2016 03:17
davidweedmark sends brownie points to @grrttmrtn :sparkles: :thumbsup: :sparkles:
:star: 258 | @grrttmrtn | http://www.freecodecamp.com/grrttmrtn
John Espinoza
@johnlovespi
Mar 04 2016 03:17
@glenohumeral13 thanx, question tho in like 33 -- && contacts[i][prop]
why is prop in []
Dustin
@glenohumeral13
Mar 04 2016 03:18
@bitgrower but is the one thing one big array? or can i access the individual curly brackets with contacts[prop]?
David Weedmark
@DavidWeedmark
Mar 04 2016 03:18
I'm hoping not to repeat the same code for each of eight instances I'll need it.
Dustin
@glenohumeral13
Mar 04 2016 03:18
@johnlovespi wouldnt that be how i access a property's value?
bitgrower
@bitgrower
Mar 04 2016 03:18
@glenohumeral13 -- YES ... it is ... a big (well, not too many element) array -- of ... OBJECTS ...
@glenohumeral13 -- so the first thing you must do is address WHICH element of the array ... :)
John Espinoza
@johnlovespi
Mar 04 2016 03:19
@glenohumeral13 i mean i guess im confused on that as well
all look it to it
Dustin
@glenohumeral13
Mar 04 2016 03:19
@bitgrower but isnt there only one element? because everything is in contacts[0] ?
bitgrower
@bitgrower
Mar 04 2016 03:19
@glenohumeral13 -- no ... there are 4 or 5 elements in the array ... (I forget which, think it's 4)
Sri Keerthi N
@keerthinerella
Mar 04 2016 03:19
yeah..got it :smile:
bitgrower
@bitgrower
Mar 04 2016 03:19
each element in the array is an object, though ...
remember ... an array can contain ANYTHING ... objects, subarrays, numbers, booleans ... etc
this one contains objects .
the elements of the array, the different objects, are separated by commas ...
so you have [ {...}, {...}, {...}, {...}]
David Weedmark
@DavidWeedmark
Mar 04 2016 03:23
for anyone looking at my page, I would have thought something like this would work
this.removeEventListener("click");
bitgrower
@bitgrower
Mar 04 2016 03:23
above my paygrade, @DavidWeedmark
@grrttmrtn
David Weedmark
@DavidWeedmark
Mar 04 2016 03:24
@bitgrower while that blows my mind, I appreciate you taking a look. thanks! I'll figure it out I'm sure
CamperBot
@camperbot
Mar 04 2016 03:24
davidweedmark sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 707 | @bitgrower | http://www.freecodecamp.com/bitgrower
bitgrower
@bitgrower
Mar 04 2016 03:24

so ... if I have a loop like this ...
var num = 3;
j = 2;
for (i = 0; i < num; i++) {
j *= 1;
}

now what would j be equal do ...

and the easiest way to do this is to list out each loop iteration and what j equals at the end of that iteration ...
@DavidWeedmark -- just haven't gotten to that corner of js ...
Mike Sakata
@mgsakata
Mar 04 2016 03:25
j would be equal to 2
Garrett
@grrttmrtn
Mar 04 2016 03:25
@DavidWeedmark from the doc it looks like you need to call your function after "click", "function name"
bitgrower
@bitgrower
Mar 04 2016 03:26
good one ... @mgsakata ... and once again I messed up my example !!! LOL ... let me try again ...
var num = 3;
j = 2;
for (i = 0; i < num; i++) {
j *= i;
}
Garrett
@grrttmrtn
Mar 04 2016 03:26
@bitgrower totally understanding your examples then looking at this with an empty mind :facepalm
John Espinoza
@johnlovespi
Mar 04 2016 03:26
@glenohumeral13 hey does your code word
work
Dustin
@glenohumeral13
Mar 04 2016 03:27
@johnlovespi no sorry
Garrett
@grrttmrtn
Mar 04 2016 03:27
@bitgrower j = 4
John Espinoza
@johnlovespi
Mar 04 2016 03:27
ok
Mike Sakata
@mgsakata
Mar 04 2016 03:27
@bitgrower lol. That new sample makes it a much more interesting question :)
bitgrower
@bitgrower
Mar 04 2016 03:27

@grrttmrtn -- you have a couple of different pieces I'm building up, @grrttmrtn ...

oh nuts let me try that again ...actually, it would be zero

David Weedmark
@DavidWeedmark
Mar 04 2016 03:28
@grrttmrtn I actually had that at the bottom and moved it after the last unsuccessful test to see if it would help. guess what... it didn't! lol
bitgrower
@bitgrower
Mar 04 2016 03:28
var num = 3;
j = 2;
for (i = 1; i < num; i++) {
j *= i;
}
Garrett
@grrttmrtn
Mar 04 2016 03:28
@bitgrower wouldn't it equal 4 because i counts up until 2 because it's looking to be less than 3 in that last example?
bitgrower
@bitgrower
Mar 04 2016 03:29
`so ... first time thru the loop it will be j = j * 1
so j will be 2
next time thru the loop it will be j = j * 2
Garrett
@grrttmrtn
Mar 04 2016 03:30
oh damn
I skipped the first couple of loops lol
and jumped right to two ha
bitgrower
@bitgrower
Mar 04 2016 03:31
that's alright ... it's a very human tendency ... we want to jump ahead ... and the computer just plods along ... we have to slow down and think like the computer ... 4
Garrett
@grrttmrtn
Mar 04 2016 03:31
but in your second one j = 4
bitgrower
@bitgrower
Mar 04 2016 03:31
yes !!! excellent ...
now ... you have to multiply all the elements of your 2-D array ... you know how to address each element, you know how to accumulate a product ... "just" put them together to solve the challenge .. :)
see if you can take the pieces we've built up and plug them into the nesting for loops challenge ...
@glenohumeral13 ... (you've got me all kinds of curious about your nickname, reminds me of my A&P classes) ... how ya doin' ?
Dustin
@glenohumeral13
Mar 04 2016 03:35
@bitgrower lol it was my favorite joint in the skeletal unit of A&P. still confused
@bitgrower and the 13 is my fav #
bitgrower
@bitgrower
Mar 04 2016 03:36
LOL I never had a favorite joint ... are you an orthopod or something ? exercise physio guy ?
bitgrower @bitgrower thinks @glenohumeral13 should open a beer "joint" ...
Dustin
@glenohumeral13
Mar 04 2016 03:37
@bitgrower no just nerd
bitgrower
@bitgrower
Mar 04 2016 03:37
so ... have you played around with addressing the objects in your array ?
Garrett
@grrttmrtn
Mar 04 2016 03:39
@bitgrower thank you!
CamperBot
@camperbot
Mar 04 2016 03:39
grrttmrtn sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 708 | @bitgrower | http://www.freecodecamp.com/bitgrower
Garrett
@grrttmrtn
Mar 04 2016 03:40
@bitgrower do you work for fcc, or do you just do this for fun?
bitgrower
@bitgrower
Mar 04 2016 03:40
you figure it out, @grrttmrtn ?!?
fun ...
Garrett
@grrttmrtn
Mar 04 2016 03:40
Finally ha
Dustin
@glenohumeral13
Mar 04 2016 03:40
@bitgrower ive been trying to but im not fully getting it
bitgrower
@bitgrower
Mar 04 2016 03:40
I think FCC is all volunteer ...
@grrttmrtn -- you did really good -- I've seen people struggle much, much more with that ... which is why I built it up the way I did ... I was pretty sure you had the knowledge from previous challenges ... so, I was just reminding you of it ... so you could access it and put the right puzzle pieces together ...
@glenohumeral13 ... gonna call you joint nerd ... LOL ... can you post your code again ?
Abhisek Pattnaik
@abhisekp
Mar 04 2016 03:42
knock knock :door:
bitgrower
@bitgrower
Mar 04 2016 03:42
hey there @abhisekp -- ain't seen you in a while ... where ya been ?
Abhisek Pattnaik
@abhisekp
Mar 04 2016 03:42
@bitgrower FCC main channel :P
bitgrower
@bitgrower
Mar 04 2016 03:42
hmmm oh yeah, guess I don't have that one open ...
Abhisek Pattnaik
@abhisekp
Mar 04 2016 03:43
better
bitgrower
@bitgrower
Mar 04 2016 03:43
better ?
Abhisek Pattnaik
@abhisekp
Mar 04 2016 03:43
@bitgrower Helping people is better here
Coding vs Chatting bla bla bla
bitgrower
@bitgrower
Mar 04 2016 03:44
yeah ... sometimes ...
John Espinoza
@johnlovespi
Mar 04 2016 03:45
@glenohumeral13
hey
got the answea
it makes snence
bitgrower
@bitgrower
Mar 04 2016 03:46
so ... @glenohumeral13 you've got to use contacts[i]<something>
so you index into your array ... (of objects)
Dustin
@glenohumeral13
Mar 04 2016 03:46
@bitgrower like with a for loop?
help format
CamperBot
@camperbot
Mar 04 2016 03:46

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

bitgrower
@bitgrower
Mar 04 2016 03:46
yup
Dustin
@glenohumeral13
Mar 04 2016 03:47
@bitgrower like with contacts[i][prop] ?
bitgrower
@bitgrower
Mar 04 2016 03:47
you're already using a for loop I see ...
Dustin
@glenohumeral13
Mar 04 2016 03:47
bc it didnt work last time
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUp(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (firstName == contacts.firstName && prop == contacts.i) {
  return contacts[prop];
} else if (firstName !== contacts.firstName) {
  return "No such contact";
} else if (prop !== contacts.prop) {
  return "No such property";
}
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
bitgrower
@bitgrower
Mar 04 2016 03:47

@glenohumeral13 ... well ... I think the first thing you need to do is look for a firstname, no ?

And how did you use contacts[i][prop] ?

Dustin
@glenohumeral13
Mar 04 2016 03:48
@bitgrower i did before and it didnt work. like this:
gloriousjob
@gloriousjob
Mar 04 2016 03:48
@bitgrower I don't know about you but I feel like I see this almost every time I get on here :)
bitgrower
@bitgrower
Mar 04 2016 03:48
so ... you're iterating thru the loop in your loop statement, but you are not using the indexing available to you ...
Dustin
@glenohumeral13
Mar 04 2016 03:48
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUp(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (firstName == contacts.firstName && prop == contacts[i][prop]) {
  return contacts[prop];
} else if (firstName !== contacts.firstName) {
  return "No such contact";
} else if (prop !== contacts.prop) {
  return "No such property";
}
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
bitgrower
@bitgrower
Mar 04 2016 03:49
lol @gloriousjob -- there are some challenges that come up a lot ...
@glenohumeral13 -- where are you using contacts[i] please ?
Dustin
@glenohumeral13
Mar 04 2016 03:49
@bitgrower yeah idk what im "indexing" (is that just running through a for loop?). is contacts[0] the bit about akira laine? or all the four objects?
bitgrower
@bitgrower
Mar 04 2016 03:49
ahh ... just once .. you have to use it everywhere within the loop ...
Dustin
@glenohumeral13
Mar 04 2016 03:50
@bitgrower why?
bitgrower
@bitgrower
Mar 04 2016 03:50
contacts[0] is this ...
   {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    }
gloriousjob
@gloriousjob
Mar 04 2016 03:51
@glenohumeral13 Think of it like this: var arr = [3, 5, 7, 9]. To get 5, you'd do arr1.
bitgrower
@bitgrower
Mar 04 2016 03:51
because you have to use it to point to the right element in the array ...
Dustin
@glenohumeral13
Mar 04 2016 03:51
@gloriousjob ahh i see
gloriousjob
@gloriousjob
Mar 04 2016 03:51
But you'd have to do that every time arr[1]
Dustin
@glenohumeral13
Mar 04 2016 03:52

ok so i have this which isnt working ```
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUp(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
if (firstName == contacts.firstName && prop == contacts[i].prop) {
return contacts[i].prop;
} else if (firstName !== contacts.firstName) {
return "No such contact";
} else if (prop !== contacts[i].prop) {
return "No such property";
}
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
```

bitgrower
@bitgrower
Mar 04 2016 03:52
think of each element (each object) as a room ... the index opens the door to THAT room ...
Dustin
@glenohumeral13
Mar 04 2016 03:52
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUp(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (firstName == contacts.firstName && prop == contacts[i].prop) {
  return contacts[i].prop;
} else if (firstName !== contacts.firstName) {
  return "No such contact";
} else if (prop !== contacts[i].prop) {
  return "No such property";
}
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
bitgrower
@bitgrower
Mar 04 2016 03:52
@glenohumeral13 -- you can edit your message ... you need to put the backticks on lines of their own
oops ... you did it ...
change this if (firstName == contacts.firstName && prop == contacts[i].prop) {
to this ` if (firstName == contacts[i].firstName && prop == contacts[i].prop) {
and so on ... wherever you are using contacts within the loop (below the loop iteration definition .. you need to use contacts[i]
Dustin
@glenohumeral13
Mar 04 2016 03:54
@bitgrower but that doesnt work either
gloriousjob
@gloriousjob
Mar 04 2016 03:54
@glenohumeral13 Well, it should get you closer
@glenohumeral13 There's another thing but make sure you understand how this works first. It's key to understanding loops
Dustin
@glenohumeral13
Mar 04 2016 03:57
@gloriousjob idk. my current understanding is that i am using a for loop to run through each object in the array. contacts[i].firstName is the value of the firstName property of each object in the array, where "i" is a number being incremented by the for loop. contacts[i].prop SHOULD be any property that the "prop" variable stands for
bitgrower
@bitgrower
Mar 04 2016 03:57

if I have

retArr = [];
myArr = [1,2,3];
for (var i = 0; i < myArr.length; i++) {
   retArr.push(myArr[i]);
}

do you know what this does?

do you know what retArr will contain after the loop finishes running ...
Dustin
@glenohumeral13
Mar 04 2016 03:58
@bitgrower yeah youre running through the myArr array with i and pushing the indexed array value into retArr. at the end retArr will be [1, 2, 3]
Sidharth Kriplani
@sidkrip
Mar 04 2016 03:59
wiki Sum All Primes
CamperBot
@camperbot
Mar 04 2016 03:59

:point_right: algorithm sum all primes [wiki]

Explanation:

The explanation for this problem is very simple. You will generate a list of prime numbers up to the number you are given as a parameter. Then you need to add them all up and return that value. The tricky part is on generating the list of prime numbers. I suggest you find a code or a good math algorithm that you can turn into code.

:pencil: read more about algorithm sum all primes on the FCC Wiki

bitgrower
@bitgrower
Mar 04 2016 03:59
excellent!!!!
This message was deleted
Dustin
@glenohumeral13
Mar 04 2016 03:59
This message was deleted
demipixel
@demipixel
Mar 04 2016 04:00
should i golf it
bitgrower
@bitgrower
Mar 04 2016 04:00
This message was deleted
demipixel
@demipixel
Mar 04 2016 04:00
??
John Martens
@martensclass
Mar 04 2016 04:00
Help needed With Exact Change Challenge - It's late, I'm tired, maybe I am overlooking something obvious.
I am getting the right answers for the change but not as 2 decimal places. (ie - ["DIME", 0.2], ["QUARTER", 0.5], ["ONE", 1], etc - instead of ["DIME", 0.20], ["QUARTER", 0.50], ["ONE", 1.00]). I can use toFixed(2) to force 2 decimals but then it converts to a string and that is not accepted as the right answer either. Converting back to a number loses the decimal places again. I am stumped. How do I force a number to be 2 decimal places without converting it to a string?
CamperBot
@camperbot
Mar 04 2016 04:00
no wiki entry for: needed with exact change challenge - its late im tired maybe i am overlooking something obviousi am getting the right answers for the change but not as 2 decimal places ie - dime 02 quarter 05 one 1 etc - instead of dime 020 quarter 050 one 100 i can use tofixed2 to force 2 decimals but then it converts to a string and that is not accepted as the right answer either converting back to a number loses the decimal places again i am stumped how do i force a number to be 2 decimal places without converting it to a string
Dustin
@glenohumeral13
Mar 04 2016 04:01
@bitgrower what was gonna be your next example?
demipixel
@demipixel
Mar 04 2016 04:01
@martensclass That doesn't matter
Don't use toFixed(2) as that will convert it to a string
0.5 === 0.50 so no worries
bitgrower
@bitgrower
Mar 04 2016 04:03

@glenohumeral13 -- if you have an array ... assume each element of the array is a room ... the room can contain anything ... but in order to get to anything within the room, you still have to access it by the array index ...

...so, if the element is an object ... then you need to use the array indexing followed by your object addressing ...

your object address can be either dot or bracket ...

if you know the name, and the name is appropriate ... you can use the dot notation ...

contacts[i].firstname

Eric Meling
@Gnilemcire
Mar 04 2016 04:04
help Record Collection
CamperBot
@camperbot
Mar 04 2016 04:04

:point_right: checkpoint record collection [wiki]

Checkpoint: Record Collection

Instructions

You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and has several properties. Not all albums have complete information.

Write a function which takes an id, a property (prop), and a value.

For the given id in collection:

If value is non-blank (value !== ""), then update or set the value for the prop.

If the prop is "tracks" and value is non-blank, push the value onto the end of the tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint record collection on the FCC Wiki

bitgrower
@bitgrower
Mar 04 2016 04:04

or if it's a property named in a variable, then you will use bracket notation

contacts[i][prop]

Sidharth Kriplani
@sidkrip
Mar 04 2016 04:05
wiki Sum All Odd Fibonacci Numbers
CamperBot
@camperbot
Mar 04 2016 04:05

:point_right: algorithm sum all odd fibonacci numbers [wiki]

Explanation:

You will need to gather all the Fibonacci numbers and then check for the odd ones. Once you get the odd ones then you will add them all. The last number should be the number given as a parameter if it actually happens to be an off Fibonacci number.

:pencil: read more about algorithm sum all odd fibonacci numbers on the FCC Wiki

Dustin
@glenohumeral13
Mar 04 2016 04:05
@bitgrower i have this but it isnt working
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUp(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (firstName == contacts[i].firstName && prop == contacts[i][prop]) {
  return contacts[i].prop;
} else if (firstName !== contacts[i].firstName) {
  return "No such contact";
} else if (prop !== contacts[i][prop]) {
  return "No such property";
}
}
// Only change code above this line
}

// Change these values to test your function
lookUp("Akira", "likes");
bitgrower
@bitgrower
Mar 04 2016 04:06
just fyi, it's generally a good idea to use the triple equals ==> === sign instead of the double == sign
Dustin
@glenohumeral13
Mar 04 2016 04:07
@bitgrower yeah i had that originally but i scrapped it in case it was causing the problems
Sidharth Kriplani
@sidkrip
Mar 04 2016 04:07
wiki Steamroller
CamperBot
@camperbot
Mar 04 2016 04:07

:point_right: algorithm steamroller [wiki]

Explanation:

This problem seems simple but you need to make sure to flatten any array, regardless of the level which is what adds a bit of difficulty to the problem.

:pencil: read more about algorithm steamroller on the FCC Wiki

bitgrower
@bitgrower
Mar 04 2016 04:10

anyway .. let's take a look ...

firstName is "Akira" ... so you look at contacts[i].firstName ... and yes, it's Akira ... but then we have to see if this particular object has a property "likes" ... it doesn't ... so it goes to your ELSE statement ...
well ... we already know that firstName === contacts[i].firstName, so it skips that ...

however ... it looks to see if prop !== contacts[i][prop] (which we already determined before, btw)

...and it doesn't ... so it returns "No such property"

since you are returning from the function, you don't look at any of the other objects in your array ...
if you want to do so, you shouldn't return from the loop
Sidharth Kriplani
@sidkrip
Mar 04 2016 04:11
wiki smallest common multiple
CamperBot
@camperbot
Mar 04 2016 04:11

:point_right: algorithm smallest common multiple [wiki]

Explanation:

The smallest common multiple between two numbers is the smallest number that
both numbers can divide into. This concept can be extended to more than two
numbers as well.

We can first start with just finding the smallest common multiple between two
numbers. Naively, you can start writing out multiple of each number until you
write a multiple that exists from both numbers.

An example would be the numbers 3 and 4. The multiples of 3 are 3, 6, 9, 12, 15, 18, ... and the multiples of 4 are 4, 8, 12, 16, 20, .... The
first smallest number we run into in both lists is 12 so this is the smallest
common multiple between 3 and 4.

This problem can be confusing because most people look for the smallest common
multiple of just the two numbers but forget the keyword range. However, this
means that if you are given [1,5], then you have to check for the smallest
common multiple for all the numbers [1,2,3,4,5] that is evenly divisible by
all of them.

:pencil: read more about algorithm smallest common multiple on the FCC Wiki

bitgrower
@bitgrower
Mar 04 2016 04:13

it's important ... what @gloriousjob said ... you need to understand what the code is doing ...

you can put your code in here: pythontutor.com/javascript.html ... and see a cool visualization of what is happening in your code ...

(although I had someone vociferously complain that pythontutor.com was wrong on one of his pieces of code...unfortunately, he was wrong ... )
Evgeny
@PoisonHawk
Mar 04 2016 04:14
Hi all! I just finished Title Case a Sentence. This is my solusion
This message was deleted
bitgrower
@bitgrower
Mar 04 2016 04:14
Hey @PoisonHawk -- generally not a good idea to post solutions in here .. use the codereview room ... but it looks like an interesting solution !!!
help rooms
CamperBot
@camperbot
Mar 04 2016 04:15

:point_right: help rooms [wiki]

Help Rooms

Choose the right room for your question!
:pencil: read more about help rooms on the FCC Wiki
Rex
@RexChip
Mar 04 2016 04:16

function queue(arr, item) {
// Your code here

return arr; // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr1, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

what shoud i do?
Evgeny
@PoisonHawk
Mar 04 2016 04:17
i just want ask how make better this solution, but i cannot normally show code)
bitgrower
@bitgrower
Mar 04 2016 04:17
@rexChip -- you need to use 2 array functions ... here are some you can choose from ... shift, unshift, pop, push ... 2 of them will be used in solving the problem ... BUT you will need to know how to use them correctly ... when you do, it's a simple solution ...
yeah, I understand, @PoisonHawk -- that's why there's a CodeReview room :)
Evgeny
@PoisonHawk
Mar 04 2016 04:18
@bitgrower ok)
Rex
@RexChip
Mar 04 2016 04:22
@bitgrower thanks , but i don't know why to use ... where i can use 2 array function
CamperBot
@camperbot
Mar 04 2016 04:22
rexchip sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 709 | @bitgrower | http://www.freecodecamp.com/bitgrower
bitgrower
@bitgrower
Mar 04 2016 04:23
you have an array, you want to add an item to the array, and then you want to remove (and return) an item from the array (different item) ...
Sumeet Batheja
@bathejasumeet
Mar 04 2016 04:30
Probably enqueue with pop or dequeue with push
Or you can use filter
Eric Meling
@Gnilemcire
Mar 04 2016 04:30
help Record Collection
CamperBot
@camperbot
Mar 04 2016 04:31

:point_right: checkpoint record collection [wiki]

Checkpoint: Record Collection

Instructions

You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and has several properties. Not all albums have complete information.

Write a function which takes an id, a property (prop), and a value.

For the given id in collection:

If value is non-blank (value !== ""), then update or set the value for the prop.

If the prop is "tracks" and value is non-blank, push the value onto the end of the tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint record collection on the FCC Wiki

mukhtar2t
@mukhtar2t
Mar 04 2016 04:41
hi, How I can format a code in a black square
demipixel
@demipixel
Mar 04 2016 04:41
help format
CamperBot
@camperbot
Mar 04 2016 04:41

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Richard Corbett
@reacorbett
Mar 04 2016 04:42
hello everyone!!! :)
MD Alsaffar
@Cyberistic
Mar 04 2016 04:42
Heyyy
mukhtar2t
@mukhtar2t
Mar 04 2016 04:42
hello
demipixel
@demipixel
Mar 04 2016 04:42
Hello
mukhtar2t
@mukhtar2t
Mar 04 2016 04:43

I am wondering why the two codes below giving different result:

First code:

function convert(num) {
  var str = "";
  var tmp;

  tmp = Math.floor(num/1000);
  for(i=0;i<tmp;i++)
    str += "M";

  tmp = Math.floor((num%1000)/100);
  if(tmp === 9) 
    str += "CM";

  else if(tmp >= 5) {
    str += "D";
    for(i=0;i<tmp-5;i++)
      str += "C";
  }
  else if(tmp === 4) 
    str += "CD";
  else if(tmp < 4) {
    for(i=0;i<tmp;i++)
      str += "C";
  }

  tmp = Math.floor((num%100)/10);
  if(tmp === 9)
    str += "XC";
  else if(tmp >= 5) {
    str += "L";
    for(i=0;i<tmp-5;i++)
      str += "X";
  }
  else if(tmp === 4) 
    str += "XL";
  else if(tmp < 4) {
    for(i=0;i<tmp;i++)
      str += "X";
  }

  tmp = num%10;
  if(tmp === 9)
    str += "IX";
  else if(tmp >= 5) {
    str += "V";
    for(i=0;i<tmp-5;i++)
      str += "I";
  }
  else if(tmp === 4) 
    str += "IV";
  else if(tmp < 4) {
    for(i=0;i<tmp;i++)
      str += "I";
  }
  return str;
}

convert(3999);
Richard Corbett
@reacorbett
Mar 04 2016 04:43
after not messing with java script for a few day, i have become slightly rusty.
mukhtar2t
@mukhtar2t
Mar 04 2016 04:44
Second code:
function convert(num) {
  var str = "";
  var tmp;

  tmp = Math.floor(num/1000);
  for(i=0;i<tmp;i++)
    str += "M";

  tmp = Math.floor((num%1000)/100);
  if(tmp === 9) 
    str += "CM";

  else if(tmp >= 5) {
    str += "D";
    for(i=0;i<tmp-5;i++)
      str += "C";
  }
  else if(tmp === 4) 
    str += "CD";
  else if(tmp < 4) 
    for(i=0;i<tmp;i++)
      str += "C";


  tmp = Math.floor((num%100)/10);
  if(tmp === 9)
    str += "XC";
  else if(tmp >= 5) {
    str += "L";
    for(i=0;i<tmp-5;i++)
      str += "X";
  }
  else if(tmp === 4) 
    str += "XL";
  else if(tmp < 4) {
    for(i=0;i<tmp;i++)
      str += "X";
  }

  tmp = num%10;
  if(tmp === 9)
    str += "IX";
  else if(tmp >= 5) {
    str += "V";
    for(i=0;i<tmp-5;i++)
      str += "I";
  }
  else if(tmp === 4) 
    str += "IV";
  else if(tmp < 4) {
    for(i=0;i<tmp;i++)
      str += "I";
  }
  return str;
}

convert(3999);
notice that the only diffrence that I have removed the brackets from the below:
else if(tmp < 4) 
    for(i=0;i<tmp;i++)
      str += "C";
Abhisek Pattnaik
@abhisekp
Mar 04 2016 04:52
@mukhtar2t :point_right: FreeCodeCamp/CodeReview for Code Review after completion
David Weedmark
@DavidWeedmark
Mar 04 2016 04:58
@mukhtar2t my guess would be that by removing the brackets, Javascript is inferring there is a ; at the line break, which it sometimes does when a needed ; is missing
MD Alsaffar
@Cyberistic
Mar 04 2016 04:58
help Return Early Pattern for Functions
CamperBot
@camperbot
Mar 04 2016 04:58

:point_right: challenge return early pattern for functions [wiki]

Challenge: Return Early Pattern for Functions

When a return statement is reached, the execution of the current function stops and control returns to the calling location.

Example

function myFun() {
  console.log("Hello");
  return "World";
  console.log("byebye")
}
myFun();

The above outputs "Hello" to the console, returns "World", but "byebye" is never output, because the function exits at the return statement.
:pencil: read more about challenge return early pattern for functions on the FCC Wiki

MD Alsaffar
@Cyberistic
Mar 04 2016 05:07
Could anyone help me with that challenge? can't seem to understand it
David Weedmark
@DavidWeedmark
Mar 04 2016 05:09
@Cyberistic which part exactly?
MD Alsaffar
@Cyberistic
Mar 04 2016 05:11
@DavidWeedmark I don't really know what to do.
mukhtar2t
@mukhtar2t
Mar 04 2016 05:11
@DavidWeedmark thanks for your point
CamperBot
@camperbot
Mar 04 2016 05:11
mukhtar2t sends brownie points to @davidweedmark :sparkles: :thumbsup: :sparkles:
:star: 372 | @davidweedmark | http://www.freecodecamp.com/davidweedmark
mukhtar2t
@mukhtar2t
Mar 04 2016 05:12
thanks @abhisekp
CamperBot
@camperbot
Mar 04 2016 05:12
mukhtar2t sends brownie points to @abhisekp :sparkles: :thumbsup: :sparkles:
:star: 2244 | @abhisekp | http://www.freecodecamp.com/abhisekp
David Weedmark
@DavidWeedmark
Mar 04 2016 05:12
@Cyberistic okay well you want to specify if a is less than zero or b is less than zero that the console replies with undefined, right?
MD Alsaffar
@Cyberistic
Mar 04 2016 05:13
@DavidWeedmark Yes
David Weedmark
@DavidWeedmark
Mar 04 2016 05:13
so those are the three things to focus on
MD Alsaffar
@Cyberistic
Mar 04 2016 05:13
return a < 0 || b < 0;
is what I did
David Weedmark
@DavidWeedmark
Mar 04 2016 05:13
close
MD Alsaffar
@Cyberistic
Mar 04 2016 05:14
To be honest, I don't understand the whole undefined thing
David Weedmark
@DavidWeedmark
Mar 04 2016 05:14
you just tell it "return undefined"
MD Alsaffar
@Cyberistic
Mar 04 2016 05:15
mhm..?
David Weedmark
@DavidWeedmark
Mar 04 2016 05:15
if a < 0 || b < 0, then "return undefined"
MD Alsaffar
@Cyberistic
Mar 04 2016 05:16
Am I allowed to use if statements?
David Weedmark
@DavidWeedmark
Mar 04 2016 05:16
if you type nothing but "return undefined" the console will respond with "undefined"
oh yeah, you need that for this
MD Alsaffar
@Cyberistic
Mar 04 2016 05:16
Ahh okay
David Weedmark
@DavidWeedmark
Mar 04 2016 05:17
return is like saying "console.log"
let me know if you get it. I'll be around for another 20 mins or so
MD Alsaffar
@Cyberistic
Mar 04 2016 05:18
I completed the challenge
kevharvell
@kevharvell
Mar 04 2016 05:18
could use some help on filtering out on my array. Basically it is only filtering out my first i value argument when I want it to go through my for loop and filter all of the arguments. I believe it has something to do with the return value !== args[i];
function destroyer(arr) {
  // Remove all the values
  var args = Array.prototype.slice.call(arguments);

  var filtered;

  filtered = arr.filter(function destroy(value) {
    for (var i = 1; i < args.length; i++) {
      return value !== args[i];
    }
  });

  return filtered;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
MD Alsaffar
@Cyberistic
Mar 04 2016 05:18
but I still don't get it
David Weedmark
@DavidWeedmark
Mar 04 2016 05:19
@Cyberistic ah, great!
in this case "undefined" is just a word. you could say "return pickles" or "return abc" and it would give you back those instead
MD Alsaffar
@Cyberistic
Mar 04 2016 05:20
Erhhh
David Weedmark
@DavidWeedmark
Mar 04 2016 05:20
I think the focus of this one is to get you used to "return" which you will be using a lot now
MD Alsaffar
@Cyberistic
Mar 04 2016 05:21
What does return exactly do
David Weedmark
@DavidWeedmark
Mar 04 2016 05:22
here, it just tells the browser to return something back to you in the console, much like console.log does
MD Alsaffar
@Cyberistic
Mar 04 2016 05:22
@DavidWeedmark I will do some research later, Thanks for the help though.
CamperBot
@camperbot
Mar 04 2016 05:22
cyberistic sends brownie points to @davidweedmark :sparkles: :thumbsup: :sparkles:
:star: 373 | @davidweedmark | http://www.freecodecamp.com/davidweedmark
John Irle
@JohnIrle
Mar 04 2016 05:23
Could someone help me with the Drop it challenge? I pass all but one test.
function drop(arr, func) {
  // Drop them elements.

  for (var i = 0; i <= arr.length; i++) {
    if (func(arr[0])) {
      break;
    } else {
      arr.shift();
    }
  }

  return arr;
}

drop([1, 2, 3, 4], function(n) {return n > 5; });
Andrew Charlebois
@andrewchar
Mar 04 2016 05:27
i have a peice of code thats acting really weird. in my second if statement i have it calling data.stream.preview.small.. that part is doing its job correct but its making any of the offline stream be removed from the list. cannot figure out why. http://codepen.io/andrewchar/pen/bpdLGv?editors=1011
if i console.log before the if statement, everything comes back as normal. if i console.log after the if statement. it only shows the streams that are online
David Weedmark
@DavidWeedmark
Mar 04 2016 05:28
@doudeman I think you want to return arr instead of the break
Andrew Charlebois
@andrewchar
Mar 04 2016 05:28
but i cant see any errors with the code
gloriousjob
@gloriousjob
Mar 04 2016 05:28
@doudeman Are you supposed to use 0 instead of the index?
John Irle
@JohnIrle
Mar 04 2016 05:29
@gloriousjob The idea is that the array gets smaller with each shift so I keep checking the first element
gloriousjob
@gloriousjob
Mar 04 2016 05:29
@doudeman You should probably use a while instead of a for because that's a bit confusing but anyway...
@doudeman which case fails?
John Irle
@JohnIrle
Mar 04 2016 05:30
@DavidWeedmark That gives me the same answer
@gloriousjob drop([1, 2, 3, 4], function(n) {return n > 5;}) should return []. I'm getting an array with [4]
gloriousjob
@gloriousjob
Mar 04 2016 05:31
@doudeman Funny, I was going to ask what happens when the whole array is dropped
David Weedmark
@DavidWeedmark
Mar 04 2016 05:32
@doudeman its giving you 3,4 instead of []?
gloriousjob
@gloriousjob
Mar 04 2016 05:32
@doudeman You might want to consider your exit conditional
@doudeman in the for loop
Rex
@RexChip
Mar 04 2016 05:32
help stand
CamperBot
@camperbot
Mar 04 2016 05:32

:point_right: challenge understand boolean values [wiki]

Understand Boolean Values

Booleans can only hold the value of either true or false. They are basically little on-off switches.

:pencil: read more about challenge understand boolean values on the FCC Wiki

Rex
@RexChip
Mar 04 2016 05:32
help stand in line
CamperBot
@camperbot
Mar 04 2016 05:32

:point_right: checkpoint stand in line [wiki]

Checkpoint: Stand In Line

About queues

In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

Instructions

Write a function queue which takes an "array" and an "item" as arguments.

Add the item onto the end of the array, then remove the first element of the array.

The queue function should return the element that was removed.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint stand in line on the FCC Wiki

John Irle
@JohnIrle
Mar 04 2016 05:33
@gloriousjob the break?
gloriousjob
@gloriousjob
Mar 04 2016 05:33
@doudeman Yes, and also what your exit criteria is before the break
@doudeman exit of the for loop, that is
@doudeman Consider what your for loop does if I give it arr = []
John Irle
@JohnIrle
Mar 04 2016 05:35
@gloriousjob Ah! That makes sense. Hmmm
Zach
@Moose1551
Mar 04 2016 05:39
Can someone explain to me why this is wrong?:
function golfScore(par, strokes) {
  // Only change code below this line
 if (1) {
    return "Hole-in-one!";
  } else if (2) {
    return "Eagle";
  } else if (3) {
    return "Birdie";
  } else if (4) {
    return "Par";
  } else if (5) {
    return "Bogey";
  } else if (6) {
    return "Double Bogey";
  } else if (strokes >= 7) {
    return "Go Home!";
  }

  // Only change code above this line
}

// Change these values to test
golfScore(4, 2);
John Irle
@JohnIrle
Mar 04 2016 05:40
@gloriousjob The interesting thing is that my code is basically the same solution that is in the wiki
gloriousjob
@gloriousjob
Mar 04 2016 05:41
@doudeman wiki?
David Weedmark
@DavidWeedmark
Mar 04 2016 05:41
@Moose1551 you need to compare the strokes to the par
John Irle
@JohnIrle
Mar 04 2016 05:42
wiki drop it
CamperBot
@camperbot
Mar 04 2016 05:42

:point_right: algorithm drop it [wiki]

Explanation:

Basically while the second argument is not true, you will have to remove the first element from the left of the array that was passed as the first argument.

:pencil: read more about algorithm drop it on the FCC Wiki

David Weedmark
@DavidWeedmark
Mar 04 2016 05:42
@doudeman interesting. yours was just a bit off from what mine was too
gloriousjob
@gloriousjob
Mar 04 2016 05:43
@doudeman Oh, I didn't realize there were spoilers
@doudeman Your exit criteria for the for loop is different
John Irle
@JohnIrle
Mar 04 2016 05:43
It is?
MD Alsaffar
@Cyberistic
Mar 04 2016 05:44
@Moose1551 It should be like this
 if (strokes == 1) {
    return "Hole-in-one!"; 
  }
gloriousjob
@gloriousjob
Mar 04 2016 05:44
@doudeman look closely
@doudeman I'd tell you straight up but this is how you learn :)
John Irle
@JohnIrle
Mar 04 2016 05:46
@gloriousjob the "<="? because making it just less than returns [3, 4]
gloriousjob
@gloriousjob
Mar 04 2016 05:46
@doudeman Try changing it :)
Roy Liu
@pololkk2000
Mar 04 2016 05:46

challenge:Word Blanks
code:
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result ="dog" + "big" + "ran" + "quickly";

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

so i don't know how to solve it.

gloriousjob
@gloriousjob
Mar 04 2016 05:47
@doudeman oh, I see it now
@doudeman yeah, that's why you should use a while loop instead of a for
@doudeman because think about what i is and what your array length is when you do the iterations
John Irle
@JohnIrle
Mar 04 2016 05:48
@gloriousjob I tried a while loop and it only solved the test case I can't pass
gloriousjob
@gloriousjob
Mar 04 2016 05:48
first iteration: i = 0, array = [1, 2, 3, 4]
@doudeman What's the next iteration?
@doudeman also, first iteration, arr.length = 4
@doudeman I know this is basic but can you give the three values for the next iteration? It'll help you see the problem
@doudeman using your for loop
John Irle
@JohnIrle
Mar 04 2016 05:51
okay so all I had to do was declare a variable before the for loop and set it equal to arr.length
gloriousjob
@gloriousjob
Mar 04 2016 05:51
@doudeman Can you see why?
John Irle
@JohnIrle
Mar 04 2016 05:51
that way I had a number that didn't change
gloriousjob
@gloriousjob
Mar 04 2016 05:51
@doudeman There you go :)
John Irle
@JohnIrle
Mar 04 2016 05:52
@gloriousjob thanks
CamperBot
@camperbot
Mar 04 2016 05:52
doudeman sends brownie points to @gloriousjob :sparkles: :thumbsup: :sparkles:
:star: 306 | @gloriousjob | http://www.freecodecamp.com/gloriousjob
Zach
@Moose1551
Mar 04 2016 06:00
@Cyberistic , @DavidWeedmark , thank you. I'm getting there, but I'm stuck again. I don't understand why "Bogey, Double Bogey, and Go Home!" aren't working...
function golfScore(par, strokes) {
  // Only change code below this line
 if (strokes == 1) {
    return "Hole-in-one!";
  } else if (strokes <=par-2) {
    return "Eagle";
  } else if (strokes == par-1) {
    return "Birdie";
  } else if (par) {
    return "Par";
  } else if (strokes == par+1) {
    return "Bogey";
  } else if (strokes == par+2) {
    return "Double Bogey";
  } else if (strokes >= par+3) {
    return "Go Home!";
  }

  // Only change code above this line
}

// Change these values to test
golfScore(4, 2);
CamperBot
@camperbot
Mar 04 2016 06:00
moose1551 sends brownie points to @cyberistic and @davidweedmark :sparkles: :thumbsup: :sparkles:
:star: 374 | @davidweedmark | http://www.freecodecamp.com/davidweedmark
:star: 240 | @cyberistic | http://www.freecodecamp.com/cyberistic
MD Alsaffar
@Cyberistic
Mar 04 2016 06:10
@Moose1551 Whats the error?
Zach
@Moose1551
Mar 04 2016 06:11
@Cyberistic , no error. It's just not passing all the tests. Earlier, I was failing 4 tests, but now it's just the one "Par" Here's the revised code:
function golfScore(par, strokes) {
  // Only change code below this line
 if (strokes == 1) {
    return "Hole-in-one!";
  } else if (strokes <=par-2) {
    return "Eagle";
  } else if (strokes == par-1) {
    return "Birdie";
  } else if (strokes == 4 && par == 4) {
    return "Par";
  } else if (strokes == par+1) {
    return "Bogey";
  } else if (strokes == par+2) {
    return "Double Bogey";
  } else if (strokes >= par+3) {
    return "Go Home!";
  }

  // Only change code above this line
}

// Change these values to test
golfScore(4, 2);
MD Alsaffar
@Cyberistic
Mar 04 2016 06:13
@Moose1551 This is where you are wrong
else if (strokes == 4 && par == 4) {
    return "Par";
Rita Alfonso
@alfonsotech
Mar 04 2016 06:13
else if (strokes == 4 && par == 4) { return "Par";
You want your strokes to equal your par, no && needed
MD Alsaffar
@Cyberistic
Mar 04 2016 06:14
^ That
Zach
@Moose1551
Mar 04 2016 06:15
Ah! So "else if (strokes == 4 par == 4) { return "Par"; }"
Rita Alfonso
@alfonsotech
Mar 04 2016 06:18
not quite
you only need one condition statement, not two
Did you get it @Moose1551 ?
Zach
@Moose1551
Mar 04 2016 06:24
Not quite. I think I'm alomost there, though.
Ryan Park
@rpark4
Mar 04 2016 06:24
Hi, I'm having trouble with the record collection problem. How do you access object properties with variable more than one variable deep?
function update(id, prop, value) {
if (value !== "" && prop !== "tracks"){
collection[id][prop].push(value);
}
Abhishek Kumar
@abhishekKumar1
Mar 04 2016 06:24
@Moose1551 You are comparing storks and par everywhere else why not in par
Markus Kiili
@Masd925
Mar 04 2016 06:26
@rpark4 When the prop is not tracks, you wan't to just assign the value, not push. Use assignment operator.
Zach
@Moose1551
Mar 04 2016 06:26
Like this?
} else if (par == 4) {
return "Par";
MD Alsaffar
@Cyberistic
Mar 04 2016 06:27
Yes
Zach
@Moose1551
Mar 04 2016 06:29
When I changed it to that, I ended up not being able to return 4 tests instead of 1.
Ryan Park
@rpark4
Mar 04 2016 06:30
@Moose1551 if strokes = 4 and par =4 then strokes = par
@Masd925 Thanks. I'm still struggling though
CamperBot
@camperbot
Mar 04 2016 06:31
rpark4 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 1129 | @masd925 | http://www.freecodecamp.com/masd925
Abhishek Kumar
@abhishekKumar1
Mar 04 2016 06:31
@Moose1551 dude not like that compare stokes and par why are you sending 4 it's not in your input function
MD Alsaffar
@Cyberistic
Mar 04 2016 06:33
Okay I need help with the counting cards challenge
Here is my code
var count = 0;

function cc(card) {
  // Only change code below this line
  switch (card) {
    case 2: 
    case 3:
    case 4:
    case 5:
    case 6:
      count++;
      break; 
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count--;
      break;
  }
    if (card <= 6 && card >= 2){
      return count + " Bet";

    }else if (card >= 7 && card <= 9 ){
      return count + " Hold";

    }else if (card == 10 || card === 'J' || card === 'Q' || card === 'K' || card === 'A'){
      return count + " Hold";
    }




  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc(2);
Zach
@Moose1551
Mar 04 2016 06:33
@abhishekKumar1 , is this what you mean?
function golfScore(par, strokes) {
  // Only change code below this line
 if (strokes == 1 && par == 4) {
    return "Hole-in-one!";
  } else if (strokes <=par-2) {
    return "Eagle";
  } else if (strokes == par-1) {
    return "Birdie";
  } else if (par) {
    return "Par";
  } else if (strokes == par+1) {
    return "Bogey";
  } else if (strokes == par+2) {
    return "Double Bogey";
  } else if (strokes >= par+3) {
    return "Go Home!";
  }

  // Only change code above this line
}

// Change these values to test
golfScore(4, 2);
MD Alsaffar
@Cyberistic
Mar 04 2016 06:33
cant get through "Cards Sequence 2, J, 9, 2, 7 should return "1 Bet"" task
Rita Alfonso
@alfonsotech
Mar 04 2016 06:34
@Moose1551 it's just "else if strokes = par" - try that
Markus Kiili
@Masd925
Mar 04 2016 06:35
@Cyberistic Bet/hold decision is based on count.
MD Alsaffar
@Cyberistic
Mar 04 2016 06:35

@Moose1551

else if (strokes == par) {
    return "Par";

Is what you need to do

Ryan Park
@rpark4
Mar 04 2016 06:35
@Cyberistic your if statements should be focusing on the value of count.
MD Alsaffar
@Cyberistic
Mar 04 2016 06:36
@rpark4 Which means..?
Ryan Park
@rpark4
Mar 04 2016 06:37
it means that you want to bet if count is positive, hold if it's 0 and fold if its negative
Zach
@Moose1551
Mar 04 2016 06:37
I did it right before I read the suggestions! Lightbulb moment, haha. Thanks, @abhishekKumar1 @alfonsotech @Cyberistic @rpark4
CamperBot
@camperbot
Mar 04 2016 06:37
moose1551 sends brownie points to @abhishekkumar1 and @alfonsotech and @cyberistic and @rpark4 :sparkles: :thumbsup: :sparkles:
:warning: moose1551 already gave cyberistic points
:star: 353 | @alfonsotech | http://www.freecodecamp.com/alfonsotech
:star: 226 | @rpark4 | http://www.freecodecamp.com/rpark4
:star: 370 | @abhishekkumar1 | http://www.freecodecamp.com/abhishekkumar1
Ryan Park
@rpark4
Mar 04 2016 06:38
woops. there is no folding
Rita Alfonso
@alfonsotech
Mar 04 2016 06:38

@Cyberistic

if (card <= 6 && card >= 2){
      return count + " Bet";

    }else if (card >= 7 && card <= 9 ){
      return count + " Hold";

    }else if (card == 10 || card === 'J' || card === 'Q' || card === 'K' || card === 'A'){
      return count + " Hold";
    }

This is the problem. maybe you've never sat at the blackjack table and counted cards, aye?

Ryan Park
@rpark4
Mar 04 2016 06:39
i did
MD Alsaffar
@Cyberistic
Mar 04 2016 06:39
@alfonsotech Never lol
Thank you both @rpark4
CamperBot
@camperbot
Mar 04 2016 06:39
cyberistic sends brownie points to @alfonsotech and @rpark4 :sparkles: :thumbsup: :sparkles:
:star: 354 | @alfonsotech | http://www.freecodecamp.com/alfonsotech
:star: 227 | @rpark4 | http://www.freecodecamp.com/rpark4
Zach
@Moose1551
Mar 04 2016 06:39
What I'm confused about is how strokes = par if it par was never assigned a value in the first "if"
if (strokes == 1) {
    return "Hole-in-one!";
  } else if (strokes <=par-2) {
    return "Eagle";
  } else if (strokes == par-1) {
    return "Birdie";
  } else if (strokes == par) {
    return "Par";
  } else if (strokes == par+1) {
    return "Bogey";
  } else if (strokes == par+2) {
    return "Double Bogey";
  } else if (strokes >= par+3) {
    return "Go Home!";
  }
Like, how does it know that 4 strokes = par?
Mohammed Shehab
@mshehab93
Mar 04 2016 06:40
Hi, I need some help with a lesson I've been stuck on for a good number of days
Ryan Park
@rpark4
Mar 04 2016 06:40
par and strokes are both input
Rita Alfonso
@alfonsotech
Mar 04 2016 06:40
@Cyberistic lol The way it works is if the total count of the cards coming out is positive, you want to bet; if negative or neutral, you want to hold. The count is the number you've been adding and subtracting in the switch statemnt.
Ryan Park
@rpark4
Mar 04 2016 06:41
at the beginning of the function
Mohammed Shehab
@mshehab93
Mar 04 2016 06:41

The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

DJ
@qualitymanifest
Mar 04 2016 06:41
golfScore(5,5); function golfScore(par, strokes) {
Mohammed Shehab
@mshehab93
Mar 04 2016 06:41
function lookUp(firstName, prop){
// Only change code below this line
  if (firstName === contacts.firstName && prop === contacts.prop) {
    return contacts.prop;
  } else if (firstName !== contacts.firstName) {
    return "No such contact";
  } else if (firstName !== contacts.firstName && prop !== contacts.hasOwnProperty(prop)) {
    return "No such property";
  }
Ryan Park
@rpark4
Mar 04 2016 06:41
thanks @qualitymanifest
CamperBot
@camperbot
Mar 04 2016 06:41
rpark4 sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
Mohammed Shehab
@mshehab93
Mar 04 2016 06:42
:/ all my other lessons in basic js is complete except this one
CamperBot
@camperbot
Mar 04 2016 06:42
:star: 1053 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
DJ
@qualitymanifest
Mar 04 2016 06:42
@rpark4 no, tax you
CamperBot
@camperbot
Mar 04 2016 06:42
qualitymanifest sends brownie points to @rpark4 :sparkles: :thumbsup: :sparkles:
:star: 228 | @rpark4 | http://www.freecodecamp.com/rpark4
Rita Alfonso
@alfonsotech
Mar 04 2016 06:42
@mshehab93 Yes, that's a tough one. Profile Look Up, right?
MD Alsaffar
@Cyberistic
Mar 04 2016 06:42
@alfonsotech Never played that game, so how would I know? lol
Mohammed Shehab
@mshehab93
Mar 04 2016 06:42
@alfonsotech yes
Zach
@Moose1551
Mar 04 2016 06:43
@rpark4 , I see! I was paying to much attention to "if (strokes = 1)...
*too
Mohammed Shehab
@mshehab93
Mar 04 2016 06:43
I can't get to understand the handle on the method .hasOwnProperty
Rita Alfonso
@alfonsotech
Mar 04 2016 06:43
:thumbsup: @Moose1551
Mohammed Shehab
@mshehab93
Mar 04 2016 06:43
and accessing the objects
Zach
@Moose1551
Mar 04 2016 06:44
@alfonsotech , how'd you do that thumbs up?
Mohammed Shehab
@mshehab93
Mar 04 2016 06:44
@Moose1551 if you hover the mouse over that thumbs up itll give you its code
Rita Alfonso
@alfonsotech
Mar 04 2016 06:44
type a colon symbol and "thumb" and you get icon options
" :thumbsup: "
@mshehab93 That's the last one I have left as well so I haven't done it, but maybe we can do it together now?
Marina
@chandra90
Mar 04 2016 06:47
Hello everyone! Please help me with the task :"Golf Code"
Rita Alfonso
@alfonsotech
Mar 04 2016 06:47
hi chandra go for it
Marina
@chandra90
Mar 04 2016 06:47
    return "Eagle";
What I did wrong?
if(strokes=1){
    return "Tiny";
  }else if (strokes<=par-2){
    return "Eagle";
  }else if(par-1){
    return "Birdie";
  }else if(par){
    return "Par";
  }else if(Par+1){
   return "Bogey";
  }else if(par+2){
    return "Double Bogey";
  }else if(strokes>=par+3){
    return "Go Home!";
  }else {
  return "Change Me";
  }
Zach
@Moose1551
Mar 04 2016 06:48
lol
I just banged my head against the wall on that one.
Marina
@chandra90
Mar 04 2016 06:48
@Moose1551 oops lol
if(strokes=1){
    return "Hole-in-one";
  }else if (strokes<=par-2){
    return "Eagle";
  }else if(par-1){
    return "Birdie";
  }else if(par){
    return "Par";
  }else if(Par+1){
   return "Bogey";
  }else if(par+2){
    return "Double Bogey";
  }else if(strokes>=par+3){
    return "Go Home!";
  }else {
  return "Change Me";
  }
@Moose1551 Zach can you help?
Rahul Jain
@rj-unstoppable
Mar 04 2016 06:50
'''
CamperBot
@camperbot
Mar 04 2016 06:50
:bulb: to format code use backticks! ``` more info
Zach
@Moose1551
Mar 04 2016 06:50
@chandra90 , you should compare strokes and par in each "else if" (conditional) statement.
Rahul Jain
@rj-unstoppable
Mar 04 2016 06:50

''' function myTest(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";

// Only change code above this line
return answer;
}
}
// Change this value to test
myTest(1);
'''

CamperBot
@camperbot
Mar 04 2016 06:50
:bulb: to format code use backticks! ``` more info
Rahul Jain
@rj-unstoppable
Mar 04 2016 06:50
function myTest(val) {
  var answer = "";
  // Only change code below this line
  switch (val) {
  case 1:
    answer = "alpha";
    break;
  case 2:
    answer = "beta";
    break;
   case 3:
    answer = "gamma";
    break;
   case 4:
    answer = "delta";

  // Only change code above this line  
  return answer;  
}
}
// Change this value to test
myTest(1);
casse 1 ,2,3 are not workinig
Zach
@Moose1551
Mar 04 2016 06:50
@chandra90 , I'd show you the code, but the others didn't and I learned a bit from it.
Rahul Jain
@rj-unstoppable
Mar 04 2016 06:50
can anyone help
Abhishek Kumar
@abhishekKumar1
Mar 04 2016 06:51
ok @chandra90 if you use else if(par) and pass any number it will pass
you have to compare it with stokes like you did above in if and first else if statement
Ryan Park
@rpark4
Mar 04 2016 06:51
i'm dying on the record collection challenge. I don't know how to assign value within an object using only variables: function update(id, prop, value) {
if (value !== "" && prop !== "tracks"){
collection[id][prop][value]=value;
}
V Arun Kumar
@arunvkumr
Mar 04 2016 06:51
just completed portfolio challenge. need some feedback. :smile:
http://codepen.io/arunkumrv/pen/oxvLoN
Zach
@Moose1551
Mar 04 2016 06:51
@chandra90 , when you first use strokes, use the "==" symbol.
Abhishek Kumar
@abhishekKumar1
Mar 04 2016 06:53
@rpark4 can you post your whole code and tell the challenge name and use this
help format
CamperBot
@camperbot
Mar 04 2016 06:53

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Markus Kiili
@Masd925
Mar 04 2016 06:53
@rpark4 collection[id][prop] accesses the property value, so you assign to it with: collection[id][prop]=value;
Marina
@chandra90
Mar 04 2016 06:53
@Moose1551 got it.But other one?
Ankit Panwar
@coderNoob
Mar 04 2016 06:54
@arunkumrv The footer is kind of big making it look empty
Ryan Park
@rpark4
Mar 04 2016 06:55
thanks again
Rita Alfonso
@alfonsotech
Mar 04 2016 06:55
@rpark4 I'll take a look, but can you post all your code so it will jog my memory
Ryan Park
@rpark4
Mar 04 2016 06:56
@Masd925 just hooked me up. thanks though and @alfonsotech @abhishekKumar1
CamperBot
@camperbot
Mar 04 2016 06:56
rpark4 sends brownie points to @masd925 and @alfonsotech and @abhishekkumar1 :sparkles: :thumbsup: :sparkles:
:warning: rpark4 already gave masd925 points
:star: 356 | @alfonsotech | http://www.freecodecamp.com/alfonsotech
:star: 371 | @abhishekkumar1 | http://www.freecodecamp.com/abhishekkumar1
V Arun Kumar
@arunvkumr
Mar 04 2016 06:56
@coderNoob thanks. i'm on it
CamperBot
@camperbot
Mar 04 2016 06:56
arunkumrv sends brownie points to @codernoob :sparkles: :thumbsup: :sparkles:
:star: 345 | @codernoob | http://www.freecodecamp.com/codernoob
Rita Alfonso
@alfonsotech
Mar 04 2016 07:01
else if(par){ return "Par"; @chandra90
Matthew Stettner
@mstettner
Mar 04 2016 07:02
hello everyone. Hows everyone doing tonight?
Rita Alfonso
@alfonsotech
Mar 04 2016 07:02
Hi @mstettner loverly, you?
Marina
@chandra90
Mar 04 2016 07:02
@mstettner Hello! do not even ask lol
Ryan Park
@rpark4
Mar 04 2016 07:03
fabulously @mstettner. And yourself?
IDriuk
@IDriuk
Mar 04 2016 07:04
Hello! What is the shortest regEx for resolving http://www.freecodecamp.com/challenges/validate-us-telephone-numbers?
Matthew Stettner
@mstettner
Mar 04 2016 07:06
doing well. About to start some more JS learning. hopefully not to fustrating
@chandra90 tough night?
Marina
@chandra90
Mar 04 2016 07:07
@mstettner just one challenge is *
Ankit Panwar
@coderNoob
Mar 04 2016 07:08
@IDriuk This is a tough one. I would suggest you figure it out yourself. Its a great feeling when you get it done all by yourself.
@IDriuk You can test your cases on some useful sites like RegEx
Marina
@chandra90
Mar 04 2016 07:09
@Moose1551 thanks
CamperBot
@camperbot
Mar 04 2016 07:09
chandra90 sends brownie points to @moose1551 :sparkles: :thumbsup: :sparkles:
:star: 201 | @moose1551 | http://www.freecodecamp.com/moose1551
IDriuk
@IDriuk
Mar 04 2016 07:11
@coderNoob I use read-search-ask, and found /^(?:(?:+?1\s(?:[.-]\s)?)?(?:(\s([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s(?:[.-]\s)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s(?:[.-]\s)?([0-9]{4})(?:\s(?:#|x.?|ext.?|extension)\s(\d+))?$/ This is working, but somebody must know better solution.
Ryan Park
@rpark4
Mar 04 2016 07:11
// Only change code below this line function update(id, prop, value) { if (value !== "" && prop !== "tracks"){ collection[id][prop]=value; } else if (value !== "" && prop === "tracks") { collection[id][prop].push(value); } else if (value === "")
well that worked miserably
can't say i didn't try to format that correctly
Matthew Stettner
@mstettner
Mar 04 2016 07:12
anyone know how to comlete the Convert Celsius to Fahrenheitlesson?
Ryan Park
@rpark4
Mar 04 2016 07:13
anyways, I'm supposed to delete prop?
@mstettner yes, what are you struggling with?
Matthew Stettner
@mstettner
Mar 04 2016 07:14
@rpark4 I'm not sure how to write it in to javascript.
i understand the formula
  • 9 / 5 + 32
Ryan Park
@rpark4
Mar 04 2016 07:14
ok
Matthew Stettner
@mstettner
Mar 04 2016 07:14
I just dont know how to appply that formaula into JS
Ryan Park
@rpark4
Mar 04 2016 07:17
so you have a function with an input for celsius
are you following so far?
Matthew Stettner
@mstettner
Mar 04 2016 07:18
Celcius = * 9 / 5 + 32; @rpark4
Ankit Panwar
@coderNoob
Mar 04 2016 07:18
@IDriuk There may be many solutions. A better one? I'm not sure.
Matthew Stettner
@mstettner
Mar 04 2016 07:18
yeah this is my function * 9 / 5 + 32. correct?
@rpark4
Ryan Park
@rpark4
Mar 04 2016 07:18
yeah, so when they give you a function with an input for celsius. you need to define fahrenheit
Ankit Panwar
@coderNoob
Mar 04 2016 07:18
@IDriuk I'm not sure if this is a good solution or bad but here is my solution
function telephoneCheck(str) {
  // Good luck!
  if(str.match(/(\({1})\d{3}(\){1})/g)){
    if(str.match(/^1?[\s-]?\(?(\d{3})\)?[\s-]?(\d{3})[\s-]?\d{4}$/g)){
       return true;
    }
    else
      return false;
  }
  else if(str.match(/^1?[\s-]?\d{3}[\s-]?\d{3}[\s-]?\d{4}$/g))
    return true;
  else
    return false;

}
Matthew Stettner
@mstettner
Mar 04 2016 07:19
okay how do I define fahrenheit?
Ankit Panwar
@coderNoob
Mar 04 2016 07:19
google it
Ryan Park
@rpark4
Mar 04 2016 07:19
fahrenheit = celsius * 9 / 5 + 32
Ankit Panwar
@coderNoob
Mar 04 2016 07:19
and use brackets
Matthew Stettner
@mstettner
Mar 04 2016 07:19
yeah bc right now it is saying that fahrenheit is not defined
@rpark4 makes sense
Ryan Park
@rpark4
Mar 04 2016 07:20
you'll probably need ()
celsius * (9/5) + 32
anyone know how to delete prop at the end of the record collection challenge?
Matthew Stettner
@mstettner
Mar 04 2016 07:22
its giving me a little warning triangle saying "Invalid type of value 'celcius*(9/5) + 32"
Ryan Park
@rpark4
Mar 04 2016 07:22
spelling
Matthew Stettner
@mstettner
Mar 04 2016 07:22
@rpark4 i think i got it
I had '' around it
Ryan Park
@rpark4
Mar 04 2016 07:23
ahh
there you have it
Matthew Stettner
@mstettner
Mar 04 2016 07:23
I need to define fahrenheit also??
which is fahrenheit = celsius?
Ryan Park
@rpark4
Mar 04 2016 07:24
no, you only need to define fahrenheit, celsius is arleady defined.
Matthew Stettner
@mstettner
Mar 04 2016 07:25
how do I define fahrenheit?
'fahrenheit not defined'
that what it is saying
Ryan Park
@rpark4
Mar 04 2016 07:25
you just type fahrenheit = celsius * (9/5) +32
;
that should be the only thing you have to do for that challenge
Matthew Stettner
@mstettner
Mar 04 2016 07:27
it says, "did you mean to return a conditional instead of an assignment?
function convert(celsius) {
  // Only change code below this line


  // Only change code above this line
  if ( typeof fahrenheit !== celsius * (9/5) + 32 ) {
    return fahrenheit;
  } else {
    return  fahrenheit = celsius * (9/5) +32

;
  }
}

// Change the inputs below to test your code
convert(30);
Ryan Park
@rpark4
Mar 04 2016 07:28
read the comments
Tim Großmann
@timgrossmann
Mar 04 2016 07:28
Hello, i'm currently stuck at the "Seek and Destroy" Algorithm challenge...
how can i access the parameters to remove from the array ? there is only 1 parameter in the function signature...
Ankit Panwar
@coderNoob
Mar 04 2016 07:29
@rpark4 delete object.propertyname;
Like this
T N Surender
@tnsurender
Mar 04 2016 07:29
Hi guys .. I am working on to make "weather web app" , can anyone tell , how to trigger the events when the page starts loading ?
demipixel
@demipixel
Mar 04 2016 07:29
bf Seek and Destroy
CamperBot
@camperbot
Mar 04 2016 07:29

:fire:Bonfire: Seek and Destroy :link:

function destroyer(arr) {
  // Remove all the values
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.

more info:  bf details | bf links | hint

demipixel
@demipixel
Mar 04 2016 07:29
@timgrossmann You can add more:
function destroyer(arr, num1, num2) {
...
@tnsurender Are you using jquery?
Matthew Stettner
@mstettner
Mar 04 2016 07:29
there are no comments. it says function convert referenceError: fahrenheit is not defined
T N Surender
@tnsurender
Mar 04 2016 07:29
yup
Tim Großmann
@timgrossmann
Mar 04 2016 07:29
this challenge is so odd
T N Surender
@tnsurender
Mar 04 2016 07:30
@demipixel yup
demipixel
@demipixel
Mar 04 2016 07:30
@tnsurender
$(document).ready(function() {
   ...
});
Tim Großmann
@timgrossmann
Mar 04 2016 07:30
if i console.log the art, there is only the array... But there is an undefined number of Parameters i need to take into consideration
demipixel
@demipixel
Mar 04 2016 07:30
@timgrossmann why?
T N Surender
@tnsurender
Mar 04 2016 07:30
@demipixel I will try and get back to you :) :)
Ryan Park
@rpark4
Mar 04 2016 07:30
@mstettner you will want to push the reset button. then read the //only change code below this line // only change code above this line comments
demipixel
@demipixel
Mar 04 2016 07:30
@tnsurender alright haha
Matthew Stettner
@mstettner
Mar 04 2016 07:31
@rpark4 okay
Ryan Park
@rpark4
Mar 04 2016 07:31
between those two comments, you will define fahrenheit like we had talked about
Tim Großmann
@timgrossmann
Mar 04 2016 07:32
how can i say: this function should take a not yet specified number of parameters ?
demipixel
@demipixel
Mar 04 2016 07:33
@timgrossmann Doesn't the function always take 3 paramaters though?
Tim Großmann
@timgrossmann
Mar 04 2016 07:33
no, only the arr
also there is a test case where 3 arguments are passed
demipixel
@demipixel
Mar 04 2016 07:33
Which?
Matthew Stettner
@mstettner
Mar 04 2016 07:34
@rpark4 thanks i got it
CamperBot
@camperbot
Mar 04 2016 07:34
mstettner sends brownie points to @rpark4 :sparkles: :thumbsup: :sparkles:
:star: 229 | @rpark4 | http://www.freecodecamp.com/rpark4
Tim Großmann
@timgrossmann
Mar 04 2016 07:34
destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return 1.
demipixel
@demipixel
Mar 04 2016 07:34
Oh hm
DJ
@qualitymanifest
Mar 04 2016 07:34
@demipixel it varies. you have to use arguments on this one
Matthew Stettner
@mstettner
Mar 04 2016 07:34
I have no idea how I would know to do that? I mean should i have known what to do? @rpark4
Markus Kiili
@Masd925
Mar 04 2016 07:35
@timgrossmann You should use arguments object for those extra arguments.
Matthew Stettner
@mstettner
Mar 04 2016 07:35
also how could anyone even know how to set that entire code? seems insanely tough to understand?? @rpark4
Tim Großmann
@timgrossmann
Mar 04 2016 07:35
ohh, thanks @Masd925 i'll look up this one
CamperBot
@camperbot
Mar 04 2016 07:35
timgrossmann sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 1130 | @masd925 | http://www.freecodecamp.com/masd925
Ryan Park
@rpark4
Mar 04 2016 07:36
yeah, to some degree. if you read through the code, you see that they have a function named "convert" with the input "celsius" That means that somewhere the code will tell you what "celsius" is, or it will explain how it will get it.
So you look for "convert()" again in the code
Ryan Park
@rpark4
Mar 04 2016 07:37
and you see convert(30) at the bottom
that means that the input is 30, so "celsius = 30
then you have the if statement : if ( typeof fahrenheit !== 'undefined' ) {
return fahrenheit;
} else {
return 'fahrenheit not defined';
}
}
so that means that if the variable fahrenheit is a number, return fahrenheit.
otherwise return "fahrenheit is not defined"
Matthew Stettner
@mstettner
Mar 04 2016 07:41
@rpark4 I hope to one day be able to write that code and understand it. to me right now it is unbelievable that someone could come up with that
Ryan Park
@rpark4
Mar 04 2016 07:41
just keep at it bro
Matthew Stettner
@mstettner
Mar 04 2016 07:41
I wouldnt know where to start
@rpark4 im trying but every lesson that goes by I have fifty more questions
Ryan Park
@rpark4
Mar 04 2016 07:42
keep reading over it, step-by-step. In my experience peeps moves too fast through. if you have a question, even if you got the challenge right, come by the help room and ask.
Pedro Abel Díaz Sánchez
@coderHook
Mar 04 2016 07:42

@dcnr Yeap! it work.. I had to erase the checking function add(2); jeje

Thanks for all the support, It help me a lot!

CamperBot
@camperbot
Mar 04 2016 07:42
abel1987 sends brownie points to @dcnr :sparkles: :thumbsup: :sparkles:
:star: 756 | @dcnr | http://www.freecodecamp.com/dcnr
Ryan Park
@rpark4
Mar 04 2016 07:43
you're definitely in the right place to be lost with a lot of this. You're in good company.
thanks @coderNoob I'm not sure how to use it though
CamperBot
@camperbot
Mar 04 2016 07:45