These are chat archives for FreeCodeCamp/HelpJavaScript

24th
May 2016
eduwin7
@eduwin7
May 24 2016 00:00
can someone help me with testing objects for preperties
CP
@lubere0102
May 24 2016 00:00

Stand in Line
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.

Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.

'''
CamperBot
@camperbot
May 24 2016 00:01
:bulb: to format code use backticks! ``` more info
CP
@lubere0102
May 24 2016 00:01

function nextInLine(arr, item) {
  // Your code here
  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
i don't get the question
can anyone help me with this
Holly
@hmowilliams
May 24 2016 00:01

// 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("delta");
bleujai
@bleujai
May 24 2016 00:02
@eduwin7 I think you posted something earlier. Did you see my response before and if so was it helpful?
Holly
@hmowilliams
May 24 2016 00:02
I've tried all kinds of things, this is the code I currently have.
Joseph
@revisualize
May 24 2016 00:03
@hmowilliams You're result variable is "" and you're returning result. Also, you need to wrap text in quotes.
bleujai
@bleujai
May 24 2016 00:03
@hmowilliams ok, a few things: the last object item should not have a comma. The values for the keys are strings. Lastly, check what your function is returning.
eduwin7
@eduwin7
May 24 2016 00:03
let me see
bleujai
@bleujai
May 24 2016 00:04
@hmowilliams Sorry, don't change the return item but assign what you need to return to result.
eduwin7
@eduwin7
May 24 2016 00:04
@bleujai i don't see it
bleujai
@bleujai
May 24 2016 00:05
@eduwin7 Go ahead and post your code again. Do you know how to do it with the js format?
By using the backticks?
tesfie
@tesfie
May 24 2016 00:06
hi guys i need help on this

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";

// Your code below this line

string.result= myNoun + " " + myAdjective + " " + myVerb + " " + myAdverb;
// Your code above this line
return result;
}

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

Joseph
@revisualize
May 24 2016 00:06
@tesfie string.result is not an object.
eduwin7
@eduwin7
May 24 2016 00:06

var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function testObj(checkProp) {
// Your Code Here

return myObj.hasOwnProperty("gift");
}

Joseph
@revisualize
May 24 2016 00:06
@tesfie hint: remove string. done.
tesfie
@tesfie
May 24 2016 00:07
@revisualize so what can i do
Holly
@hmowilliams
May 24 2016 00:07
@revisualize @bleujai , I feel like instead of "var lookup" I should have "var result" again, but that gives me an error alert.
Marvin Andara
@babycakez
May 24 2016 00:07
function addTogether() {
  var sum = 0;
  var args = Array.from(arguments);
  for(var i = 0; i < args.length; i++){
    if(typeof(args[i]) !== "number"){
      return undefined;
    }
  }
  return function() {
    sum = args[0] + args[1];
  };

}

addTogether(2)(3);
bleujai
@bleujai
May 24 2016 00:07
return myObj.hasOwnProperty("gift");
Holly
@hmowilliams
May 24 2016 00:07
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  var result = {
    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("delta");
bleujai
@bleujai
May 24 2016 00:07
rethink this line.
Marvin Andara
@babycakez
May 24 2016 00:07
that is supposed to return 5 for that call
Joseph
@revisualize
May 24 2016 00:07
@hmowilliams GREAT!
tesfie
@tesfie
May 24 2016 00:07
@revisualize thanks
CamperBot
@camperbot
May 24 2016 00:07
tesfie sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1147 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
May 24 2016 00:07
@hmowilliams You just need 1 more line of code.
Holly
@hmowilliams
May 24 2016 00:08
@revisualize Ah, should it go up at the top? Above the setup comment?
Joseph
@revisualize
May 24 2016 00:08
@hmowilliams Wait! That isn't correct. You need to change your object back to lookup
eduwin7
@eduwin7
May 24 2016 00:08

function myObj(checkProp) {

// Your Code Here

return myObj.hasOwnProperty("gift");
}

bleujai
@bleujai
May 24 2016 00:08
@hmowilliams The instructions ask to name the object lookup so after you have your lookup object you can assign the object value to result using the function argument.
Joseph
@revisualize
May 24 2016 00:09
@hmowilliams
Instructions
Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
Holly
@hmowilliams
May 24 2016 00:10
Ah, I got stuck on that one and skipped ahead. Bad idea. :P
richiedSIS
@richiedSIS
May 24 2016 00:10
Hi there. I'm having a lot of trouble with the Falsy Bouncer exercise. I feel like I'm testing for all the cases, but still am missing something somewhere. Could anyone take a look and point me in the right direction? ```
CP
@lubere0102
May 24 2016 00:10
Stand in Line
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.
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
```
richiedSIS
@richiedSIS
May 24 2016 00:10
```
bleujai
@bleujai
May 24 2016 00:10
@eduwin7 Each time your function is called it will test to see if "gift" is a property. How do you get it to work for any time the function is called with a parameter?
richiedSIS
@richiedSIS
May 24 2016 00:10

function bouncer(arr) {
  // Don't show a false ID to this bouncer.

  for(var i=0;i<arr.length;i++){
    var value=Boolean(arr[i]);
    if(isNaN(value) || !value || value===0 || value===null || value==="" || value=="undefined")
      arr.splice(i,i+1);
    }
 return arr;
}

bouncer([7, "ate", "", false, 9]);
//bouncer([false, null, 0, NaN, undefined, ""]);
CP
@lubere0102
May 24 2016 00:10

function nextInLine(arr, item) {
  // Your code here
  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Joseph
@revisualize
May 24 2016 00:10
@lubere0102 One second.
@lubere0102 You haven't done anything.
CP
@lubere0102
May 24 2016 00:11
yes i don't know what to do
T.T
Joseph
@revisualize
May 24 2016 00:11
@lubere0102
// Write a function nextInLine which takes 
// an array (arr) and a number (item) as arguments.
function nextInLine(arr, item) {
    // Add the number to the end of the array,

    // then remove the first element of array.
    // The nextInLine function should 
    // then return the element that was removed.
    return item; // Change this line
}

@lubere0102 How do you add a "number" (item) to the end of an array?
example array:

var myArr = [0,2,4,6,8]

How do I add var num = 10; to the end of that array?

Chrisqtran3
@Chrisqtran3
May 24 2016 00:13
@revisualize This requires the use of pop/push/shift/unshift correct?
Marvin Andara
@babycakez
May 24 2016 00:13
if anyone has completed the Arguments Optional algorithm challenge and can help me please message me.
Miguel T Rivera
@mtrivera
May 24 2016 00:13
I'm working on the binary agents algorithm. I'm not getting the expected results.
var binaryTest = "01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111";

var base = 2, digits = 8, total = 0, charArr = [];

function binaryToDec(binaryStr){
    newStr = binaryStr.split(" ");        //convert into array of 8-digit binary strings

    for(var ix = 0; ix < newStr.length; ix++){
    for(var count = 0; count < binaryStr.length; count++) {
        digits--;
        total += binaryStr[count] * Math.pow(base, digits);
    }
    return charArr.push(total);    //push ascii code to array
  }
}
binaryToDec(binaryTest);
console.log(total);
Joseph
@revisualize
May 24 2016 00:13
@Chrisqtran3 Look up each of those items.
Holly
@hmowilliams
May 24 2016 00:14
var playerName = "16";
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = testObj[Montana];       // Change this Line
var player = testObj[16];   // Change this Line
Joseph
@revisualize
May 24 2016 00:14
@revisualize What about playerName ?
Moisés Man
@moigithub
May 24 2016 00:15
@migueltrivera what the inner loop does ?
Holly
@hmowilliams
May 24 2016 00:15
@revisualize Ha, wow. Can't believe I missed that. Let me see if I can get it now...
Joseph
@revisualize
May 24 2016 00:15
@hmowilliams Where did you get var playerName = "16"; from?
Chrisqtran3
@Chrisqtran3
May 24 2016 00:15
@revisualize It seems like we would use push and shift.
Joseph
@revisualize
May 24 2016 00:15
@Chrisqtran3 Done?
Holly
@hmowilliams
May 24 2016 00:16
@revisualize I made it up based on the example.
Joseph
@revisualize
May 24 2016 00:16
Remove var playerName = "16"; not needed.
Moisés Man
@moigithub
May 24 2016 00:16
@migueltrivera return exit the funciton immediatelly.. so ur for loopin only once
Chrisqtran3
@Chrisqtran3
May 24 2016 00:16
push to add the "item" to the end, then shift to remove the zeroeth position
Miguel T Rivera
@mtrivera
May 24 2016 00:16
@moigithub it converts the 8-digit binary value to decimal value
Joseph
@revisualize
May 24 2016 00:16
@Chrisqtran3 Great.. How can I help you?
Moisés Man
@moigithub
May 24 2016 00:18
@migueltrivera n what for u using charArr ?
push give back the array length..so
return arr.push( ...) its not returning an array .. but the new arr.length
Joseph
@revisualize
May 24 2016 00:18
@hmowilliams Did you complete that challenge?
Holly
@hmowilliams
May 24 2016 00:19
@revisualize No, still stuck.
Joseph
@revisualize
May 24 2016 00:19
@hmowilliams Let me try to un-stick you.
Chrisqtran3
@Chrisqtran3
May 24 2016 00:19
function nextInLine(arr, item) {
  // Your code here
  arr = arr.push(item);
  arr = arr.shift();

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Joseph
@revisualize
May 24 2016 00:19
@Chrisqtran3 No.
@Chrisqtran3 remove arr =
@Chrisqtran3 Also you're returning the item not the value that was removed.
@hmowilliams Where're you at?
Holly
@hmowilliams
May 24 2016 00:20
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = testObj[Montana];       // Change this Line
var player = testObj[16];   // Change this Line
Chrisqtran3
@Chrisqtran3
May 24 2016 00:20
Sorry I'm doing this one at a time and I'm still at the first part, which is add the item to the end of the array
@revisualize
Joseph
@revisualize
May 24 2016 00:20
@hmowilliams Okay humor me for a second.
Diego Mayer
@Chrono79
May 24 2016 00:21
@NoahPierceSD you can use: String.fromCharCode.apply(null, arr)
Joseph
@revisualize
May 24 2016 00:22

@hmowilliams Let's say I had an array instead of an object.

var myArr = ["N","M","U"]

var index;
var result = myArr;

How would I have result be "M"?
And I want to use index as my variable.

Jack Gilbert
@j-gilla
May 24 2016 00:22
Evening all, I'm working through Javascript Koans. The below tests are not passing anyone know why?
  it("should create arrays", function() {
    var emptyArray = [];
    expect(typeof(emptyArray)).toBe('object');
    expect(emptyArray.length).toBe(0);
Holly
@hmowilliams
May 24 2016 00:24
<var index = myArr(1)>? @revisualize
Chrisqtran3
@Chrisqtran3
May 24 2016 00:24
I got it @revisualize . Thanks a lot for the help!
CamperBot
@camperbot
May 24 2016 00:24
chrisqtran3 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1148 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
May 24 2016 00:24
var myArr = ["N","M","U"]

var index = 1;
var result = myArr[index];
Daniel Blanco
@Danultimate
May 24 2016 00:24
Can anyone help me with my code?
Joseph
@revisualize
May 24 2016 00:25
@hmowilliams How about that?
Daniel Blanco
@Danultimate
May 24 2016 00:25

function nextInLine(arr, item) {
// Your code here
arr.push(6);
return item = arr.shift(); // Change this line
}

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

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

Holly
@hmowilliams
May 24 2016 00:25
@revisualize Ah, okay. Thinking...
Joseph
@revisualize
May 24 2016 00:25
@Danultimate
// Write a function nextInLine which takes 
// an array (arr) and a number (item) as arguments.
function nextInLine(arr, item) {
    // Add the number to the end of the array,

    // then remove the first element of array.
    // The nextInLine function should 
    // then return the element that was removed.
    return item; // Change this line
}
Shashi Dwivedi
@ShashiDwivedi
May 24 2016 00:26
@gilbertjacke what kind of error it is giving?
Joseph
@revisualize
May 24 2016 00:26
@hmowilliams What if instead of having your indexes be numbers you could have them be whatever you wanted. (Objects)
@Danultimate How do you add a number (item) to the end of an array?
richiedSIS
@richiedSIS
May 24 2016 00:27
function destroyer(arr) {
  // Remove all the values
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
destroyer([3, 5, 1, 2, 2], 2, 3, 5);
For this one, how can I access the numbers that are being passed in. I was going to add them to the parameter list in the function header, but if they change I don't know how to account for that
Moisés Man
@moigithub
May 24 2016 00:28
@Danultimate u should not hardcode numbers like 6.. but use variables to make ur code work with any number
Joseph
@revisualize
May 24 2016 00:29
@hmowilliams
Same principle applies here:
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};
// Only change code below this line;
var playerNumber = 16;       // Change this Line
var player = testObj[playerNumber];   // Change this Line
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:30
Help Chunky Monkey
CamperBot
@camperbot
May 24 2016 00:30

:point_right: algorithm chunky monkey [wiki]

Algorithm Chunky Monkey

Explanation

Our goal for this Algorithm is to split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument). There are 4 green checks (objectives) our code needs to pass in order to complete this Algorithm:

  1. (['a', 'b', 'c', 'd'], 2) is expected to be [['a', 'b'], ['c', 'd']]
  2. ([0, 1, 2, 3, 4, 5], 3) is expected to be [[0, 1, 2], [3, 4, 5]]
  3. ([0, 1, 2, 3, 4, 5], 2) is expected to be [[0, 1], [2, 3], [4, 5]]
  4. ([0, 1, 2, 3, 4, 5], 4) is expected to be [[0, 1, 2, 3], [4, 5]]

Click More information under the Algorithm title and read the helpful links if you haven't yet.

:pencil: read more about algorithm chunky monkey on the FCC Wiki

Elizabeth Fine
@elizabethfinedev
May 24 2016 00:30
could anyone please tell me what : stands for in a regex? i cant seem to find it
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:30
just finished Chunky Monkey, but I know my solution is diff that what they expected, interested to see the others. I just recently figured out you could do this!
Joseph
@revisualize
May 24 2016 00:31
@BananaHavana we need more context.
@BananaHavana
/:/
: matches the character : literally
bleujai
@bleujai
May 24 2016 00:32
@BananaHavana (?:x) Matches x but does not remember the match.
Any help?
Joseph
@revisualize
May 24 2016 00:32
@no-stack-dub-sack PM Me your code.
Holly
@hmowilliams
May 24 2016 00:33

@revisualize

@hmowilliams
Same principle applies here:

// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};
// Only change code below this line;
var playerNumber = 16;       // Change this Line
var player = testObj[playerNumber];   // Change this Line

Wow, I was set on going the opposite way. That worked instantly, of course. Thanks!

CamperBot
@camperbot
May 24 2016 00:33
hmowilliams sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1149 | @revisualize |http://www.freecodecamp.com/revisualize
CyrilSL
@CyrilSL
May 24 2016 00:33
This message was deleted
Joseph
@revisualize
May 24 2016 00:33
@hmowilliams Do you actually understand what is going on there?
@hmowilliams Because you need that knowledge for the other challenge.
Holly
@hmowilliams
May 24 2016 00:35
I think so. <var playerNumber = 16> tells the next line what part to reference. I'm going to try applying it to the other challenge and see if I get it.
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:35
@revisualize How do I PM here?
Joseph
@revisualize
May 24 2016 00:35
@no-stack-dub-sack /query @username
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:36
just type my message and the enter /query @username?
Joseph
@revisualize
May 24 2016 00:36
@no-stack-dub-sack did you try it?
But using my username?
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:37
function chunkArrayInGroups(arr, size) {
  var newArr = [];
  for (i = 0; i < arr.length; i++) {
    newArr.push(arr.splice(0, size));
  }
  if (arr.length > 0) {
    newArr.push(arr);
  }

  return newArr;
}

chunkArrayInGroups(["a", "b", "c", "d", "e", "fg", "hi", "jkl", "m", "n", "o", "PQR", "stu", "v"], 4);
/query @revisualize
Is that public ?
Joseph
@revisualize
May 24 2016 00:37
@no-stack-dub-sack yes.
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:37
Whoops
well hopefully no one else here is working on this now
Joseph
@revisualize
May 24 2016 00:39
@no-stack-dub-sack I PM'd you my code.
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:42
It didn't pop up... where do I receive PMs here? I'm still relatively new with this chat system
I can always go check out your solution in your map
Holly
@hmowilliams
May 24 2016 00:42
Got it!!
// 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 phonetic = lookup[val];
  var result = phonetic; 
  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("delta");
jgoldverg
@jgoldverg
May 24 2016 00:42
hey guys im stuck on this challenge its the incrememnt challenge i cant seem to get it
Joseph
@revisualize
May 24 2016 00:42
@hmowilliams That kind of works.
bleujai
@bleujai
May 24 2016 00:42
@no-stack-dub-sack Left side bar. Mine says One on One Conversations
Joseph
@revisualize
May 24 2016 00:42
@hmowilliams You could consolidate that.
Holly
@hmowilliams
May 24 2016 00:43
@revisualize It passed the challenge but it still has an exclamation mark next to the second var result.
Joseph
@revisualize
May 24 2016 00:43
?
One second.
bleujai
@bleujai
May 24 2016 00:44
@hmowilliams You declared result as a variable twice. Once it's initialized you then use it without re-declaring it.
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:44
@revisualize I have no left side bar - are you separate in Gitter? I'm accessing the chat through the challenge page, that's prob why. Hang on.
Joseph
@revisualize
May 24 2016 00:45
@hmowilliams var result = phonetic; ... result is already defined.
@no-stack-dub-sack OH! Yeah. I use www.gitter.im
bleujai
@bleujai
May 24 2016 00:45
@hmowilliams Also you put your lookup[val] into phonetic and then passed phonetic into result. How can you save a line of code here?
Holly
@hmowilliams
May 24 2016 00:45
@bleujai Ah, right... that would be the point of initializing it in the first place... :/
Ken Haduch
@khaduch
May 24 2016 00:47
@jgoldverg - the increment operator changes the value of the variable that you have used it on, so myVar++; would be the way to increment the value in myVar - you do not need to reassign it back to the myVar variable. In fact, that might not change the value of myVar at all? I'm curious... but you don't need the myVar =...
Peter Weinberg
@no-stack-dub-sack
May 24 2016 00:48
@revisualize I'm in the PM now
Holly
@hmowilliams
May 24 2016 00:48
@bleujai @revisualize
// 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"
  };

  result = lookup[val];
  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("delta");
Joseph
@revisualize
May 24 2016 00:49
@hmowilliams And.. You could break the rules and simplify it further.
@hmowilliams remove var result = ""; and move the lookup[val] down to the return statement.
bleujai
@bleujai
May 24 2016 00:50
@revisualize @hmowilliams No need to break the rules. Just play in the Code Camp sandbox.
Joseph
@revisualize
May 24 2016 00:50
@bleujai hashtag-i.break.rules.
bleujai
@bleujai
May 24 2016 00:51
@revisualize #I-keep-rules
Holly
@hmowilliams
May 24 2016 00:53
@revisualize @bleujai I figured out one thing on my own: if I were going to break the rules, which I would never do cough cough... I'd have to add this to make it entirely fit the challenge< return '"' + lookup[val] + '"';>
Joseph
@revisualize
May 24 2016 00:54
@hmowilliams :)
bleujai
@bleujai
May 24 2016 00:54
@hmowilliams So you don't think that it's returning a string?
Holly
@hmowilliams
May 24 2016 00:57
@bleujai It's returning Denver without quotes. Following the rules though, it's returning with quotes, because of <var result = "";>
bleujai
@bleujai
May 24 2016 00:58
@hmowilliams The test result area doesn't show the quotes but it is a string. If you ran a test to see what the value of a variable is you could see that it's a string. You'll learn that a little later.
Holly
@hmowilliams
May 24 2016 00:59
@bleujai Cool!
bleujai
@bleujai
May 24 2016 01:00
This message was deleted
Freinet Brutus
@freinet12
May 24 2016 01:02

hey guys, i'm having some trouble with the "Testing Objects for Properties" challenge. can anyone help? here is my code: // Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(myObj) {

if(myObj.hasOwnProperty("gift")){
return "pony";

}else if(myObj.hasOwnProperty("pet")){
return "kitten";

}else if(myObj.hasOwnProperty("bed")){
return "sleigh";
}
// Your Code Here
else{
return "Not Found";
}

}

// Test your code by modifying these values
checkObj("gift");

EricOber
@EricOber
May 24 2016 01:02
use ```
adily
@adiyous
May 24 2016 01:07
I need help plz
Joan Acosta
@choanm
May 24 2016 01:08
Hey guys! I'm really stuck in the in the card counting challenge :(
bleujai
@bleujai
May 24 2016 01:09
@freinet12 Use the parameter for your function.
@adiyous What are you working on?
adily
@adiyous
May 24 2016 01:10
get json with jquery
$(document).ready(function() {

    $("#getMessage").on("click", function(){
      // Only change code below this line.

      if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function(position) {
          $("#data").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);
          $.getJSON("api.openweathermap.org/data/2.5/weather?lat=" + position.coords.latitude + "lon=" + position.coords.longitude + "&id=6511ae4ad2fa914f2f22383fc29ba358",    function(json){
        $("#data").html(JSON.stringify(json));
      });
       });
      }
bleujai
@bleujai
May 24 2016 01:11
I've had problems with that lately too. When I check the console it says that it needs a secure http.
Any help from the big guns in the room?
I meant @adiyous for my last post.
Stewart Anderson
@stewie1570
May 24 2016 01:13
I'm new to the chat but have been programming for a while. Is it a security error in the console? Or, what is the error or wrong behavior?
bleujai
@bleujai
May 24 2016 01:14
For me it's a block or error from codePen. There is a msg that it needs to be a secure connect, https.
Stewart Anderson
@stewie1570
May 24 2016 01:14
Tried prefixing the url with https:// ?
wintersunI
@wintersunI
May 24 2016 01:14
@freinet12 Hey...you have to change the functiont parameter to other name but myObj
bleujai
@bleujai
May 24 2016 01:15
@stewie1570 Yeah.
Stewart Anderson
@stewie1570
May 24 2016 01:15
Also, might need to make this a JSONP request. You can do that by suffixing "&callback=?". JQuery will do the rest.
richiedSIS
@richiedSIS
May 24 2016 01:16
I'm stuck on the Seek and Destroy problem. I'm trying to use filter and Arguments object, but I might be going at it incorrectly. Any help would be much appreciated!

function destroyer(arr) {
  //Create an array with the values from the parameter list
  var args = Array.from(arguments);
  console.log("The length is " + arguments.length);
  var result =[];
  //declare a variable with the number of additional parameters being passed in
  var times = args.length-1;
  //run the filter function for each parameter in the loop
  while(times >=0){
    result = args[0].filter(isInArray(args, args[times]));
    times--;
  }
  return result;
}

function isInArray(values) {
  //values = Array.from(arguments);
  for(var i = 1; i < values[0].length; i++){
    if(values[0][i]===values[i+1])
      values[0].splice(i,i+1);
  }
  return values;

}

// filtered is [12, 130, 44]
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
destroyer([3, 5, 1, 2, 2], 2, 3, 5);
Stewart Anderson
@stewie1570
May 24 2016 01:16
I had to make mine a JSONP request. Otherwise I got a cross origin security exception.
bleujai
@bleujai
May 24 2016 01:16
@stewie1570 Alright, I'll try that. What does the P stand for?
Stewart Anderson
@stewie1570
May 24 2016 01:17
Good question :) I used to know...but I don't now..
bleujai
@bleujai
May 24 2016 01:18
@stewie1570 That's cool. Thanks.
CamperBot
@camperbot
May 24 2016 01:18
bleujai sends brownie points to @stewie1570 :sparkles: :thumbsup: :sparkles:
:cookie: 305 | @stewie1570 |http://www.freecodecamp.com/stewie1570
Stewart Anderson
@stewie1570
May 24 2016 01:18
@bleujai looks like it stands for padding...no idea why. I basically tells the server to return a script that calls my callback with the requested data.
@bleujai No problem. Did it work?
bleujai
@bleujai
May 24 2016 01:19
I've made a mental note for my project later. There was someone else who came to the room with the q.
Stewart Anderson
@stewie1570
May 24 2016 01:19
Cool. Yeah, I think a lot of people get stumped on that.
bleujai
@bleujai
May 24 2016 01:20
Yeah, I've almost completed my advanced projects but I still have 2 of my intermediate. I'm not enjoying APIs.
Norvin Burrus
@ndburrus
May 24 2016 01:20
@choanm did you get assistance?
Stewart Anderson
@stewie1570
May 24 2016 01:21
Nice! I've got a question of my own if anyone can help.
dropElements([0, 1, 0, 1], function(n) {return n === 1;}) should return [1, 0, 1]
Why wouldn't this return [1]?
I don't think I'm understanding the requirements of the "drop it" challenge...

Ohhh! Now that I look at it again, they probably just want to chop the first x elements that don't match the function reqs. I'll try that.

Did anyone else need assistance with anything though??

bleujai
@bleujai
May 24 2016 01:25
@stewie1570 Yeah, you return the rest of the array once you find a true predicate.
Norvin Burrus
@ndburrus
May 24 2016 01:25
@freinet12 did you get it resolved?
Stewart Anderson
@stewie1570
May 24 2016 01:25
Yeah, I misunderstood :) Thanks!
1ety
@1ety
May 24 2016 01:27
How to write the following logic in JS
Wise
@WiseNN
May 24 2016 01:28
Anyone here use Angular?
1ety
@1ety
May 24 2016 01:28
Why the ["a","b"] doesn't come out in the following code:
function chunkArrayInGroups(arr, size) {
var arrPush=[];
var counter= 0;
while(counter<arr.length){
arrPush = arr.slice(counter, counter+size);
counter = counter+size;
}
return arrPush;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
?
Jesus Vega
@ParagonChuy
May 24 2016 01:32

function smallestCommons(arr) {
  var sortedArr = arr.sort(function(a,b) { return a - b; });

  /*
    Successfully returns range array 
  */

  var range = [];
  for(i = sortedArr[0]; i < sortedArr[1] + 1; i++){
    range.push(i);
  }

  /*
    Successfully returns gcd
  */

  function gcd(x,y){
    if( !y ){
      return x;
    }
    return gcd( y , x % y);
  }

  /*
    Successfully lcd
  */

  function lcd(a,b){
    return (a * b) / gcd(a,b);
  }

  /*
    Implement a multiplier to loop through the array
  */

  return "";//Final return statement
}


smallestCommons([1,5]);
Can somebody help me with the smaller common multiple algorithm
bleujai
@bleujai
May 24 2016 01:32
@1ety Each time it runs through the loop it rewrites pushArr.
OneRandomJamie
@OneRandomJamie
May 24 2016 01:32
I am stuck on Assignment with a Returned Value. Can someone show me what I am doing wrong?
This message was deleted
bleujai
@bleujai
May 24 2016 01:33
@1ety Change that line and you're likely to have it work.
Seekar
@Seekar
May 24 2016 01:34
is there a function to be sure that a caracter is an alphabet ?
Jesus Vega
@ParagonChuy
May 24 2016 01:34
@Seekar Look into regex expressions
OneRandomJamie
@OneRandomJamie
May 24 2016 01:34
This message was deleted
This message was deleted
Seekar
@Seekar
May 24 2016 01:35
thx @ParagonChuy , i will look into it
thompsonsaraht
@thompsonsaraht
May 24 2016 01:35
I'm on the Stand in Line challenge and for some reason, I'm really not getting this at all. Can someone explain it or point me to a good resource?
CamperBot
@camperbot
May 24 2016 01:35
seekar sends brownie points to @paragonchuy :sparkles: :thumbsup: :sparkles:
:cookie: 358 | @paragonchuy |http://www.freecodecamp.com/paragonchuy
Jesus Vega
@ParagonChuy
May 24 2016 01:35
No problem
bleujai
@bleujai
May 24 2016 01:36
@Seekar Sounds like a time to use RegEx.
Norvin Burrus
@ndburrus
May 24 2016 01:36
@1ety does this help?
function chunkArrayInGroups(arr, size) {

var arrPush=[];
console.log("arrPush: " + arrPush);

var counter= 0;
console.log("counter: " + counter);

while(counter<arr.length){
    arrPush = arr.slice(counter, counter+size);
    console.log("arrPush: " + arrPush);

    counter = counter+size;
    console.log("counter: " + counter);
}

console.log("arrPush: " + arrPush);
return arrPush;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
-----------------------------
arrPush: 
counter: 0
arrPush: a,b
counter: 2
arrPush: c,d
counter: 4
arrPush: c,d
=> [ 'c', 'd' ]
OneRandomJamie
@OneRandomJamie
May 24 2016 01:37

<// Example
var changed = 0;

function change(num) {
return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function processArg(num) {
return (num + 3) / 5;
}

// Only change code below this line
function processArg(7) ;
return (num +3)/ 5;
processed = change(7);

``` Could some help me with Assignment with a Returned Value?

bleujai
@bleujai
May 24 2016 01:38
@thompsonsaraht Have you studied any of these? .push(), .pop(), .shift(), .unshift()
@thompsonsaraht You won't need them all but they are in the same category of changing what is in an array.
Luis Ulua
@uluawebdev
May 24 2016 01:40
```
thompsonsaraht
@thompsonsaraht
May 24 2016 01:40
Yes, I've done those, is that what I need for this challenge? I thought about using those, but it talks about queue, so I just assumed that was what I needed. Perhaps I'm just making it harder than it needs to be.
Luis Ulua
@uluawebdev
May 24 2016 01:40

//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 lookUpProfile(firstName, prop){
// Only change code below this line
  if(firstName === true && prop === true) {
    return firstName && prop;
  }
  else if (firstName === false) {
    return "No such contact";
  } else if (prop === false) {
    return "No such property";
  }
// Only change code above this line
}

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

What am I doing wrong?
Norvin Burrus
@ndburrus
May 24 2016 01:41
@thompsonsaraht stand in line introduces the concept of what a queue is... it seems a little confusing because you might think you need a special function or something...
thompsonsaraht
@thompsonsaraht
May 24 2016 01:41
@OneRandomJamie try changing 'change' to processArg in the last line.
1ety
@1ety
May 24 2016 01:41
@ndburrus yes it is. Thanks.
CamperBot
@camperbot
May 24 2016 01:41
1ety sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 415 | @ndburrus |http://www.freecodecamp.com/ndburrus
bleujai
@bleujai
May 24 2016 01:41
@thompsonsaraht You can do it with a combination of those I mentioned.
Norvin Burrus
@ndburrus
May 24 2016 01:41
@1ety i thought the same thing when i read that exercise... :) once you get past that concept part, the rest is straight forward - using array methods to achieve the requirement/s...
thompsonsaraht
@thompsonsaraht
May 24 2016 01:42
@bleujai Thank you! I'll try that.
CamperBot
@camperbot
May 24 2016 01:42
:cookie: 377 | @bleujai |http://www.freecodecamp.com/bleujai
thompsonsaraht sends brownie points to @bleujai :sparkles: :thumbsup: :sparkles:
bleujai
@bleujai
May 24 2016 01:44
@thompsonsaraht He brings up a good point, @ndburrus . The challenge helps to understand how a queue will work to handle things in a first in first out type of manner.
Norvin Burrus
@ndburrus
May 24 2016 01:46
@uluawebdev ...looking at code now...
Mariusz Bachurski
@embahr
May 24 2016 01:47
I'm stuck on Stand In Line as well... I currently have 3/4 checkmarks... been stuck for about 10-15 mins..
bleujai
@bleujai
May 24 2016 01:47
@embahr What do you have so far?
Norvin Burrus
@ndburrus
May 24 2016 01:48
@uluawebdev hmmm... are we really looking for [a] boulean/s here? hint: we need to use the profile table array/object... :)
  if(firstName === true && prop === true) {
Holly
@hmowilliams
May 24 2016 01:48
Is the wiki not working for other people?
bleujai
@bleujai
May 24 2016 01:49
@hmowilliams The wiki tab in FCC?
Mariusz Bachurski
@embahr
May 24 2016 01:49
I took the "Change this line" and threw in "return arr.shift(), arr.push(item);" which checks all except the second requiremnt
Holly
@hmowilliams
May 24 2016 01:49
@bleujai The main page comes up, but the links aren't working for me.
Links to the individual challenges.
bleujai
@bleujai
May 24 2016 01:50
@hmowilliams I just clicked the Wiki tab on the FCC website and there is a new style for the wiki.
Is that what you mean?
Stephen James
@sjames1958gm
May 24 2016 01:51
@embahr Is that the correct order of operations?
Jason Shoemaker
@kutsuya1
May 24 2016 01:51
@embahr I did the push first, then the shift
bleujai
@bleujai
May 24 2016 01:51
@hmowilliams At the top there is a search or you can scroll down in the small scroll area to something you might be looking for.
Norvin Burrus
@ndburrus
May 24 2016 01:52
@OneRandomJamie did you get it resolved?
Jason Shoemaker
@kutsuya1
May 24 2016 01:52
@embahr because what happens if the arr is empty?
Holly
@hmowilliams
May 24 2016 01:52
@bleujai It normally works for me but not today. Is there a way to share a screenshot on here?
Mariusz Bachurski
@embahr
May 24 2016 01:52
@bleujai I imagine that my solution is all wrong...total newbie here... but its the first thing that I thought to do and it almost worked :)
bleujai
@bleujai
May 24 2016 01:53
Before you try that do a hard refresh. For PC you press Ctrl + F5
Stephen James
@sjames1958gm
May 24 2016 01:53
@embahr The operations are correct, read the instructions on the order.
bleujai
@bleujai
May 24 2016 01:53
@embahr I got it to return [["a","b"],["c","d"]]
Luis Ulua
@uluawebdev
May 24 2016 01:54
LMAO I just remembered about hasown property an bracket notation
Michael Kuang
@kuangmichael07
May 24 2016 01:54

Hey guys, I have got some code here about the concept of code that I don't get it:

function foo(a) {
    console.log( a + b );
    var b = 4;
}

foo( 2 );

The result is NaN.
In the theory, RHS reference for b and compiler should get it inside the foo scope

bleujai
@bleujai
May 24 2016 01:54
I had to change something but I'm not sure if it'd work for the other tests for the challenge.
Luis Ulua
@uluawebdev
May 24 2016 01:54
Thanks @ndburrus
CamperBot
@camperbot
May 24 2016 01:54
uluawebdev sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 416 | @ndburrus |http://www.freecodecamp.com/ndburrus
Jason Shoemaker
@kutsuya1
May 24 2016 01:54
@embahr nextInLine([], 1);
Stewart Anderson
@stewie1570
May 24 2016 01:55
@kuangmichael07 I think you want to put var b = 4; as the first line in that function.
Stephen James
@sjames1958gm
May 24 2016 01:55
@kuangmichael07 The definition of b is moved to the front of the function, but not the setting of b, likely that will console.log NaN?
bleujai
@bleujai
May 24 2016 01:56
@kuangmichael07 Looking at your code, console.log will print to the console a + b, but b at this point is not defined and then after that you declare b as a variable and assign it the number 4.
Jason Shoemaker
@kutsuya1
May 24 2016 01:56
@kuangmichael07 my turn :)
bleujai
@bleujai
May 24 2016 01:57
@kutsuya1 Go fors it.
Mariusz Bachurski
@embahr
May 24 2016 01:57
@sjames1958gm @kutsuya1 @bleujai YES!!! thank you! I can't believe it was that easy :) just swapped the order
CamperBot
@camperbot
May 24 2016 01:57
embahr sends brownie points to @sjames1958gm and @kutsuya1 and @bleujai :sparkles: :thumbsup: :sparkles:
:star2: 1224 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 378 | @bleujai |http://www.freecodecamp.com/bleujai
:cookie: 340 | @kutsuya1 |http://www.freecodecamp.com/kutsuya1
Stephen James
@sjames1958gm
May 24 2016 01:57
@embahr :+1:
bleujai
@bleujai
May 24 2016 01:57
@embahr Nice work!
Jason Shoemaker
@kutsuya1
May 24 2016 01:59
@embahr Make sure you understand why it works now. The learning stacks up
Michael Kuang
@kuangmichael07
May 24 2016 01:59
@sjames1958gm @kutsuya1 @stewie1570 Thank you guys
CamperBot
@camperbot
May 24 2016 01:59
kuangmichael07 sends brownie points to @sjames1958gm and @kutsuya1 and @stewie1570 :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @stewie1570 |http://www.freecodecamp.com/stewie1570
:star2: 1226 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 341 | @kutsuya1 |http://www.freecodecamp.com/kutsuya1
Stephen
@stephepush
May 24 2016 02:01
I'm working on "Profile Lookup". I'm missing something, and I would also like to make this code look... standard, too:
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i<contacts.length; i++){
  if (firstName == "firstName") {
    if (prop !== prop) {
      return ("No such property");
    } else { return (prop);}
  } else { return ("No such contact");
   }
}
Jason Shoemaker
@kutsuya1
May 24 2016 02:01
@kuangmichael07 Good job :)
help manage packages with npm
CamperBot
@camperbot
May 24 2016 02:02
no wiki entry for: map manage-packages-with-npm
Mariusz Bachurski
@embahr
May 24 2016 02:03
@kutsuya1 I think I'm getting it. It even had the correct order right in the instructions :) I'm glad I was on the right track right from the get-go. Thanks!
CamperBot
@camperbot
May 24 2016 02:03
embahr sends brownie points to @kutsuya1 :sparkles: :thumbsup: :sparkles:
:warning: embahr already gave kutsuya1 points
Jason Shoemaker
@kutsuya1
May 24 2016 02:04
@embahr yes :) no problem
bleujai
@bleujai
May 24 2016 02:04
@stephepush You're correctly seeing that you have an array to iterate through. What type of elements are in the array?
Stewart Anderson
@stewie1570
May 24 2016 02:06
@stephepush It looks like it is expecting you to find the matching contact and return the value of the specified prop, right?
Norvin Burrus
@ndburrus
May 24 2016 02:06
@uluawebdev congrats! :)
Stephen
@stephepush
May 24 2016 02:06
@bleujai, the elements of the array are objects
Stewart Anderson
@stewie1570
May 24 2016 02:06
So, in your loop have an if statement that looks to see if the firstName matches, if so then return contacts[index][prop];
Stephen
@stephepush
May 24 2016 02:07
@stewie1570 , for your first question, yes
ah
let me try that, @stewie1570 , thanks
CamperBot
@camperbot
May 24 2016 02:07
stephepush sends brownie points to @stewie1570 :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @stewie1570 |http://www.freecodecamp.com/stewie1570
Stephen
@stephepush
May 24 2016 02:07
and thanks @bleujai
CamperBot
@camperbot
May 24 2016 02:07
stephepush sends brownie points to @bleujai :sparkles: :thumbsup: :sparkles:
:cookie: 379 | @bleujai |http://www.freecodecamp.com/bleujai
Stewart Anderson
@stewie1570
May 24 2016 02:07
@stephepush If it makes it through the whole array without returning then return "No such element."
bleujai
@bleujai
May 24 2016 02:07
@stephepush Remember how to access the values of an object.
That will be important here.
Stephen
@stephepush
May 24 2016 02:08
oh yeah, okay
Stewart Anderson
@stewie1570
May 24 2016 02:08
@stephepush for the no such prop you can return contacts[index][prop] || "No such property exists";
Assuming that's the correct wording...
bleujai
@bleujai
May 24 2016 02:09
maybe it will keep things clearer if I say access the keys and values of an object.
Stephen
@stephepush
May 24 2016 02:09
but how do I access the values of an object if the object doesn't have a variable assigned
bleujai
@bleujai
May 24 2016 02:09
you are accessing the object through the contact array.
Jason Shoemaker
@kutsuya1
May 24 2016 02:09
each task has some hints
well not all I guess..but many
Stewart Anderson
@stewie1570
May 24 2016 02:10
@stephepush you use the brackets to access an object in the array. You can also use the brackets to access props of an object.
bleujai
@bleujai
May 24 2016 02:11
@stewie1570 earlier mentioned to use contacts[index][firstName or prop] to access what you need.
Jason Shoemaker
@kutsuya1
May 24 2016 02:11
obj.hasOwnProperty("aKey");
Stewart Anderson
@stewie1570
May 24 2016 02:11
@bleujai Aaah
bleujai
@bleujai
May 24 2016 02:11
index here is the variable that you are using to iterate with in your loop.
We've probably helped too much. Go see what you can do with what we've mentioned.
Luke
@lukeharris
May 24 2016 02:12
@stephepush So I’d walk through exactly what the test wants you to do. It wants to you
  1. Determine if the contacts object has the first name mentoned with the function
  2. If the firstname DOES exist within the object, list it’s property
  3. If there is a firstName but no property, mark it as “No such property”
  4. If there is no firstName, return as “No such name"
You’re 1st if() statement should have an === because you want an exact name mentioned in the contacts object
wrong your, but whatevs.
bleujai
@bleujai
May 24 2016 02:13
@lukeharris I start typing fast and forget to distinguish that too.
Luke
@lukeharris
May 24 2016 02:13
:P
Stephen
@stephepush
May 24 2016 02:14
@stewie1570 , [i][firstName or prop] in the case of this exercise
bleujai
@bleujai
May 24 2016 02:14
@lukeharris You can edit your posts if you ever want to. Look to the right of the timestamp.
Jason Shoemaker
@kutsuya1
May 24 2016 02:14
going to make a misteak
Luke
@lukeharris
May 24 2016 02:15
oh. just like slack. oops.
Jason Shoemaker
@kutsuya1
May 24 2016 02:15
/misteak/mistake/g
Puja
@Pujachaubey
May 24 2016 02:15
hii frds i got stuck in Introducing JavaScript Object Notation JSON
Jason Shoemaker
@kutsuya1
May 24 2016 02:15
hmm
bleujai
@bleujai
May 24 2016 02:15
@kutsuya1 there you go. Use RegEx
Jason Shoemaker
@kutsuya1
May 24 2016 02:15
@bleujai thought I saw a way to do that in Gitter
Puja
@Pujachaubey
May 24 2016 02:15
have any one done this test.
Jason Shoemaker
@kutsuya1
May 24 2016 02:16
@Pujachaubey maybe..which test?
Stewart Anderson
@stewie1570
May 24 2016 02:16
@stephepush I think you'll want contacts[i][prop] but make sure that when you return this "i" is the index of the contacts that matches on firstName to the first parameter ("firstName").
Puja
@Pujachaubey
May 24 2016 02:16
Introducing JavaScript Object Notation JSON
Luke
@lukeharris
May 24 2016 02:16
can we see the test please?
Stewart Anderson
@stewie1570
May 24 2016 02:16
@stephepush Doest that make sense?
Puja
@Pujachaubey
May 24 2016 02:17
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}
// Add record here
];
nstructions
Add a new album to the myMusic JSON object. Add artist and title strings, release_year number, and a formats array of strings.
Luke
@lukeharris
May 24 2016 02:17
Okay. Where’s your attempt at making the second object?
Aryan
@aryandua
May 24 2016 02:18

function diffArray(arr1, arr2) {
  var newArr = [];
  var x=true;
  function myFilter(val) {
   for(var i=0;i<arr2.length;i++) {
     if(arr2[i]==val) {
      return false;
     }
   }
    return x;
  }
  function otherFilter(val)  {
     for(var i=0;i<arr1.length;i++) {
     if(arr1[i]==val) {
      return false;
     }
   }
    return true;
  }

newArr=arr1.filter(myFilter);

var otherArr=arr2.filter(otherFilter);

return newArr;
}
diffArray([1, 2], [3,5]);
Puja
@Pujachaubey
May 24 2016 02:18
after the }.
Aryan
@aryandua
May 24 2016 02:18
Hey guys why does this not pass all the tests?
Luke
@lukeharris
May 24 2016 02:18
Can I see you try it and show me where you’re getting help up on?
Aryan
@aryandua
May 24 2016 02:18
??
Jason Shoemaker
@kutsuya1
May 24 2016 02:19
@Pujachaubey add a , },
{ //next record
Luke
@lukeharris
May 24 2016 02:19
(Was going to see if he could figure it out, but yes that’s the answer) :P
Puja
@Pujachaubey
May 24 2016 02:20
actually i am not understanding how to add .
Luke
@lukeharris
May 24 2016 02:20
oh. well just mimic the first object
I would imagine.
Put everything in a new {}
Puja
@Pujachaubey
May 24 2016 02:21
May i use myMusic[1] like that
Freinet Brutus
@freinet12
May 24 2016 02:21
@ndburrus @bleujai @wintersunI hey sorry i took so long to respond. I had to take care of some stuff. So you guys are saying instead of having function checkObject() I should have function myObj() ?
Aryan
@aryandua
May 24 2016 02:21

function diffArray(arr1, arr2) {
var newArr = [];
var x=true;
function myFilter(val) {
for(var i=0;i<arr2.length;i++) {
if(arr2[i]==val) {
return false;
}
}
return x;
}
function otherFilter(val) {
for(var i=0;i<arr1.length;i++) {
if(arr1[i]==val) {
return false;
}
}
return true;
}

newArr=arr1.filter(myFilter);

var otherArr=arr2.filter(otherFilter);

return newArr;
}
diffArray([1, 2], [3,5]);


function diffArray(arr1, arr2) {
  var newArr = [];
  var x=true;
  function myFilter(val) {
   for(var i=0;i<arr2.length;i++) {
     if(arr2[i]==val) {
      return false;
     }
   }
    return x;
  }
  function otherFilter(val)  {
     for(var i=0;i<arr1.length;i++) {
     if(arr1[i]==val) {
      return false;
     }
   }
    return true;
  }

newArr=arr1.filter(myFilter);

var otherArr=arr2.filter(otherFilter);

return newArr;
}
diffArray([1, 2], [3,5]);
Jason Shoemaker
@kutsuya1
May 24 2016 02:21
@Pujachaubey add similar keys with different values. click "run test" it'll show you want it is looking for
Aryan
@aryandua
May 24 2016 02:21
what is wrong with my code??
bleujai
@bleujai
May 24 2016 02:21
@freinet12 Repost your code please.
Jason Shoemaker
@kutsuya1
May 24 2016 02:22
@Pujachaubey I suppose you could do it in code
Freinet Brutus
@freinet12
May 24 2016 02:22

@bleujai // Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(myObj) {

if(myObj.hasOwnProperty("gift")){
return "pony";

}else if(myObj.hasOwnProperty("pet")){
return "kitten";

}else if(myObj.hasOwnProperty("bed")){
return "sleigh";
}
// Your Code Here
else{
return "Not Found";
}

}

// Test your code by modifying these values
checkObj("gift");

Puja
@Pujachaubey
May 24 2016 02:22
so may i again define var myMusic =[{
in the end of line
Luke
@lukeharris
May 24 2016 02:23
no, within the myMusic create a new {}
Puja
@Pujachaubey
May 24 2016 02:23
ok
Dylan
@dhcodes
May 24 2016 02:23
@aryandua what's the challenge?
Luke
@lukeharris
May 24 2016 02:23
This message was deleted
Puja
@Pujachaubey
May 24 2016 02:24
i am trying.
Aryan
@aryandua
May 24 2016 02:24
diff two arrays
Dylan
@dhcodes
May 24 2016 02:24
@aryandua also it looks like you're making two arrays when I think you need one
Jason Shoemaker
@kutsuya1
May 24 2016 02:24
@Pujachaubey objects are like this var obj {};
daiwik
@daiwik
May 24 2016 02:24
This message was deleted
bleujai
@bleujai
May 24 2016 02:24
@freinet12 Let me check the starting code they give you. What challenge is this?
Dylan
@dhcodes
May 24 2016 02:25
@aryandua you need to make one array at the end. Maybe concat otherArr onto newArr?
Aryan
@aryandua
May 24 2016 02:25
yes
lemme try that
Jason Shoemaker
@kutsuya1
May 24 2016 02:25
@Pujachaubey this worked but the editor doesn't like it:
myMusic[1]["artist"] = "daft";
Freinet Brutus
@freinet12
May 24 2016 02:25
@bleujai Testing Objects for Properties
Aryan
@aryandua
May 24 2016 02:26
nope
bleujai
@bleujai
May 24 2016 02:26
@freinet12 K.
Aryan
@aryandua
May 24 2016 02:26
doesnt work
Dylan
@dhcodes
May 24 2016 02:26
@daiwik could you use regex?
bleujai
@bleujai
May 24 2016 02:27
@freinet12 The parameter for the function was initially checkProp
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

}

// Test your code by modifying these values
checkObj("gift");
Aryan
@aryandua
May 24 2016 02:27
@dhcodes what is wrong/?
Puja
@Pujachaubey
May 24 2016 02:28
@kutsuya1 ok i am trying.
Trevor Hunka
@Grizvok
May 24 2016 02:28
woot just got the palindrome algorithm...that one was a lot of fun.
Freinet Brutus
@freinet12
May 24 2016 02:28
@bleujai so should i leave it as is or was i correct for chanking (checkProp) to (myObj) ?
Dylan
@dhcodes
May 24 2016 02:30
@aryandua what i said worked for me!
bleujai
@bleujai
May 24 2016 02:30
@freinet12 It needs to be the way they gave it to you. You don't want to have a global variable and a parameter with the same name. The computer would not be able to distinguish what you were really wanting.
Dylan
@dhcodes
May 24 2016 02:30
sorry
didn't mean tthe !
how did dyou concat them @aryandua
?
bleujai
@bleujai
May 24 2016 02:30
@freinet12 Then you were on the right track by using myObj.hasOwnProperty().
Rada
@Radascript
May 24 2016 02:31
Hey guys, so I've skipped No Repeats Please cause I have no idea how to solve it elegantly without it running out every possible combo. Can anyone give me a tip please?
bleujai
@bleujai
May 24 2016 02:31
@freinet12 Now think about what you need to do to finish the function. It may help to write out your thoughts. Do some psuedo code.
Aryan
@aryandua
May 24 2016 02:31
@dhcodes newArr.concat(otherArr);
Freinet Brutus
@freinet12
May 24 2016 02:32
@bleujai Thanks. Let try again and I'll let you know if i got it correct
CamperBot
@camperbot
May 24 2016 02:32
freinet12 sends brownie points to @bleujai :sparkles: :thumbsup: :sparkles:
:cookie: 380 | @bleujai |http://www.freecodecamp.com/bleujai
bleujai
@bleujai
May 24 2016 02:32
@Radascript Good idea to skip it. It was the toughest for me to understand from the advanced stuff.
@Radascript JK on skipping it.
Dylan
@dhcodes
May 24 2016 02:33
@aryandua did you return it?
return newArr.concat(otherArr);
Aryan
@aryandua
May 24 2016 02:33

function diffArray(arr1, arr2) {
  var newArr = [];
  var x=true;
  function myFilter(val) {
   for(var i=0;i<arr2.length;i++) {
     if(arr2[i]==val) {
      return false;
     }
   }
    return true;
  }
  function otherFilter(val)  {
     for(var i=0;i<arr1.length;i++) {
     if(arr1[i]==val) {
      return false;
     }
   }
    return true;
  }

newArr=arr1.filter(myFilter);

var otherArr=arr2.filter(otherFilter);
otherArr.concat(newArr);
return newArr;
}
diffArray([1, 2], [3,5]);
thats my code
whoops
Dylan
@dhcodes
May 24 2016 02:33
@aryandua in your way, you need to return otherArr
Rada
@Radascript
May 24 2016 02:33
@bleujai yeah I was thinking about it when I was falling asleep and I actually had a dream about coding it lol
Dylan
@dhcodes
May 24 2016 02:33
or you can just return the concat line
bleujai
@bleujai
May 24 2016 02:34
@Radascript Yep, I understand that.
Aryan
@aryandua
May 24 2016 02:34
yay it worked thx @dhcodes
CamperBot
@camperbot
May 24 2016 02:34
aryandua sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:cookie: 872 | @dhcodes |http://www.freecodecamp.com/dhcodes
bleujai
@bleujai
May 24 2016 02:34
@Radascript I've heard of an algorithm for it. Want me to mention it or do you want to try it yourself some more?
Dylan
@dhcodes
May 24 2016 02:34
welcome
Norvin Burrus
@ndburrus
May 24 2016 02:40
@freinet12 repost: it looks like you changed code that shouldn't have been changed.
Rada
@Radascript
May 24 2016 02:40
@bleujai I don't even know man...... It feels like giving up but I'm so sick of it lol
bleujai
@bleujai
May 24 2016 02:41
Doesn't sound like you are ready then.
Norvin Burrus
@ndburrus
May 24 2016 02:43
@freinet12 this was the original initial setup:
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
Freinet Brutus
@freinet12
May 24 2016 02:43
@bleujai @ndburrus if I say function checkObj(checkProp), my first if statement works, but the others don't. Wehn i say function checkObj(myObj), nothing works
Norvin Burrus
@ndburrus
May 24 2016 02:43
@freinet12 alright, should we go with the initial code setup for now? or would you prefer to re-write the challenge? (just kidding...) :)
bleujai
@bleujai
May 24 2016 02:44
@freinet12 function checkObj(checkProp) is how they gave it to you and it'll work well to go with that.
@freinet12 What's your full code so far?
Freinet Brutus
@freinet12
May 24 2016 02:46

@bleujai var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp){

if(myObj.hasOwnProperty("gift")){
return "pony";

}else if(myObj.hasOwnProperty("pet")){
return "kitten";

}else if(myObj.hasOwnProperty("bed")){
return "sleigh";
}
// Your Code Here
else{
return "Not Found";
}

}

// Test your code by modifying these values
checkObj("gift");

Norvin Burrus
@ndburrus
May 24 2016 02:46
@freinet12 the next issue we'll examine is how the code attempts to access data. review/check the following example (there are more instances...): hint: pay special attention to the strings ("gift" & "pony")
  if(myObj.hasOwnProperty("gift")){
    return "pony";
bleujai
@bleujai
May 24 2016 02:47
You have a parameter for the function, checkProp. How can you use it to work for many different function calls?
Puja
@Pujachaubey
May 24 2016 02:48
one statment is not matching after defining .my code is here.

var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
},

// Add record here
{
"artist": "Puja ch",
"title": "chaubey",
"release_Year": "1992",
"formats": [
"cd",
"8p",
],

}
];

Norvin Burrus
@ndburrus
May 24 2016 02:48
@freinet12 the key/value pair table was created for a reason - to use it.... :)
Puja
@Pujachaubey
May 24 2016 02:49
just see my code.
ok i finf
*find
CamperBot
@camperbot
May 24 2016 02:49

find undefined

more entries:
undefined

Norvin Burrus
@ndburrus
May 24 2016 02:49
@Pujachaubey follow each record item's format carefully... can we say "where is (fill in the blank - platinum, gold, other?)" :)
Joseph
@revisualize
May 24 2016 02:49
@ndburrus Why don't you just use the variable?
Puja
@Pujachaubey
May 24 2016 02:50
yes i run the test.
Norvin Burrus
@ndburrus
May 24 2016 02:51
@revisualize that's exactly what @freinet12 is looking at, i hope... :+1:
Puja
@Pujachaubey
May 24 2016 02:51
thanks for help @ndburrus
CamperBot
@camperbot
May 24 2016 02:51
pujachaubey sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 417 | @ndburrus |http://www.freecodecamp.com/ndburrus
bleujai
@bleujai
May 24 2016 02:51
function checkObj(checkProp){
       var anyNewVariable = checkProp;
      return anyNewVariable;
}

checkObj("gift");
What will this function return that I created? I made it to remind you about the use of parameters.
Norvin Burrus
@ndburrus
May 24 2016 02:51
@Pujachaubey Congrats!! :sparkles:
Marvin Andara
@babycakez
May 24 2016 02:51
anyone having trouble with binary agents?
Norvin Burrus
@ndburrus
May 24 2016 02:52
@freinet12 how are we doing?
bleujai
@bleujai
May 24 2016 02:54
@ndburrus What's the correct terminology? Is 'gift' in my function call above the parameter and checkProp is the argument for the function?
Freinet Brutus
@freinet12
May 24 2016 02:54
@bleujai it will return checkProp
bleujai
@bleujai
May 24 2016 02:54
@freinet12 and what is checkProp?
checkProp is a variable. What is assigned to the argument/variable checkProp?
Freinet Brutus
@freinet12
May 24 2016 02:55
@bleujai anyNewVariable
bleujai
@bleujai
May 24 2016 02:56
the function will return 'gift'
Freinet Brutus
@freinet12
May 24 2016 02:56
@bleujai it will return gift
bleujai
@bleujai
May 24 2016 02:57
Yes, gift, the string, is passed to the function or you could do another function call and that parameter would go to the function.
```js

```js
function checkObj(checkProp){
var anyNewVariable = checkProp;
return anyNewVariable;
}

checkObj("gift");

haha, dang it.
Norvin Burrus
@ndburrus
May 24 2016 02:58
@bleujai are you referring to @freinet12 's code?
bleujai
@bleujai
May 24 2016 02:58
function checkObj(checkProp){
       var anyNewVariable = checkProp;
      return anyNewVariable;
}

checkObj(23);
Now what does checkObj return?
Freinet Brutus
@freinet12
May 24 2016 02:59
@bleujai it'll return 23
Dhrumil Shah
@Dhrumil1808
May 24 2016 02:59
It will give 23
bleujai
@bleujai
May 24 2016 02:59
Yes. A function can receive many different things to use as its arguments.
Strings, numbers, boolean values, and more.
Norvin Burrus
@ndburrus
May 24 2016 03:00
@bleujai 23 - just run it, or console.log(anyNewVariable);, or repl it ( https://repl.it/ )... this may be helpful for visualizing what is happening with the code - http://pythontutor.com/
bleujai
@bleujai
May 24 2016 03:02
@ndburrus Right, I'm trying to use it as a teaching tool. Maybe I'm hitting at it too hard but i want @freinet12 to think about how functions work from a little easier example.
Norvin Burrus
@ndburrus
May 24 2016 03:02
@bleujai ok.... :+1:
bleujai
@bleujai
May 24 2016 03:04
@freinet12 You were using .hasOwnProperty() earlier. How can you use that in combination with the function parameter to get the desired outcome for the function?
Freinet Brutus
@freinet12
May 24 2016 03:06
@bleujai would it be chekProp.hasOwnProperty("gift") ?
Victor
@abeledovictor
May 24 2016 03:07

need some help with the check for palindromes challenge


function palindrome(str) {
  var pal2;
  var pal1;
  pal1 = str;
  esrever.reverse(str);
  pal2 = esrever.reverse(str);
  if (pal2 === pal1) {
    return true;
  } else if (pal2 !== pal1) {
    return false;
  }
}



palindrome("eye");

it doesnt return false

bleujai
@bleujai
May 24 2016 03:07
@freinet12 .hasOwnProperty() works to see if an object has a certain property.
You can use the global variable myObj to check by using .hasOwnProperty().
What variable will you use inside the () of .hasOwnProperty()?
Travis
@travisbartholome
May 24 2016 03:10
@abeledovictor Have you defined esrever as an object somewhere?
Victor
@abeledovictor
May 24 2016 03:11
@travisbartholome no, should I add var esrever; ?
Norvin Burrus
@ndburrus
May 24 2016 03:12
@abeledovictor
ReferenceError: esrever is not defined
Travis
@travisbartholome
May 24 2016 03:12
Well, right now.. What @ndburrus just posted is happening.
Freinet Brutus
@freinet12
May 24 2016 03:12
@bleujai myObj ?
bleujai
@bleujai
May 24 2016 03:13
checkProp
Travis
@travisbartholome
May 24 2016 03:13
@abeledovictor Still, I wouldn't add esrever; it wouldn't serve any purpose here.
Victor
@abeledovictor
May 24 2016 03:13
@travisbartholome @ndburrus and how should I define it? can I use str directly?
bleujai
@bleujai
May 24 2016 03:15
myObj.hasOwnProperty(checkProp)
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
       return myObj.hasOwnProperty(checkProp);
  }
}

// Test your code by modifying these values
checkObj("gift");
@freinet12 what will this return?
and why?
Norvin Burrus
@ndburrus
May 24 2016 03:16
@abeledovictor hmmm... check the logic... you have 2 var/iables setup (pal1 & pal2). then you add a third, esrever. it looks like you are creating too many variables... it would be helpful to focus on reaching the solution which rpimarily involves manipulating the adjusted string, so that it can be compared to the original string....
bleujai
@bleujai
May 24 2016 03:17
@freinet12 Here is a good resource to understand what .hasOwnProperty( ) does.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
Chris
@email362
May 24 2016 03:18
hey guys i need help. my arr.shift() function isnt working.
bleujai
@bleujai
May 24 2016 03:18
I'll keep helping but @ndburrus may have a better direction to help you in than I am currently doing.
Chris
@email362
May 24 2016 03:18
how do i display the code lol?
Freinet Brutus
@freinet12
May 24 2016 03:18
@bleujai it will return pony
Norvin Burrus
@ndburrus
May 24 2016 03:18
help format @email362 just type help format (or any subject), and camperbot will assist if possible.
CamperBot
@camperbot
May 24 2016 03:18

: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 thecode`.

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

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

Victor
@abeledovictor
May 24 2016 03:18

function palindrome(str) {
  var pal;
  pal = str;
  pal.reverse(str);
  if (pal === pal.reverse(str)) {
    return true;
  } else if (pal !== pal.reverse(str)) {
    return false;
  }
}



palindrome("eye");
NixonRichard
@NixonRichard
May 24 2016 03:19
help localscope
CamperBot
@camperbot
May 24 2016 03:19
no wiki entry for: localscope
NixonRichard
@NixonRichard
May 24 2016 03:19
help local scope
CamperBot
@camperbot
May 24 2016 03:19

:point_right: challenge global vs local scope in functions [wiki]

Challenge Global vs Local Scope in Functions

It is possible to have both local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.

In this example:

var someVar = "Hat";
function myOutfit() {
  var someVar = "Head";
  return someVar;
}

The function myOutfit will return "Head" because the local version of the variable is present.

:pencil: read more about challenge global vs local scope in functions on the FCC Wiki

bleujai
@bleujai
May 24 2016 03:19
@freinet12 You are getting closer. It will return true because of what .hasOwnProperty() does.
Chris
@email362
May 24 2016 03:20
whats a back tick?
Victor
@abeledovictor
May 24 2016 03:20
it returns pal.reverse is not a function
NixonRichard
@NixonRichard
May 24 2016 03:20
\
Norvin Burrus
@ndburrus
May 24 2016 03:20
@email362 backtick is the key to the left of the number 1 key
Chris
@email362
May 24 2016 03:21

\\js
function nextInLine(arr, item) {
// Your code here

arr = arr.push(item);
arr = arr.shift();

return arr.shift(); // Change this line
}

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

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

Travis
@travisbartholome
May 24 2016 03:21
@email362 Check out the documentation for Array.shift(); specifically, look at what that method returns, then decide how that works in your function.
bleujai
@bleujai
May 24 2016 03:21
@freinet12 If I had this code it would return pony.
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
       return myObj[checkProp];
  }
}

// Test your code by modifying these values
checkObj("gift");
Freinet Brutus
@freinet12
May 24 2016 03:21
@bleujai because checkProp is the parameter and anything we put inside checkObject() will either be false if it's not a proprty for myObj or true
Travis
@travisbartholome
May 24 2016 03:22
@abeledovictor Strings in JS don't have a .reverse() method; it's only defined on the Array prototype. So you'll want to either convert your strings to arrays to play with them, or you'll want to find a different way to go about the challenge.
Chris
@email362
May 24 2016 03:22

```js
function nextInLine(arr, item) {
// Your code here

arr = arr.push(item);
arr = arr.shift();

return arr.shift(); // Change this line
}

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

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

```js

bleujai
@bleujai
May 24 2016 03:23
@freinet12 Yes, I think you are on the right track.
Kevin Schwert
@kevinpschwert
May 24 2016 03:23
On the Reverse a String challenge it's not allowing me to run the test. I click the button and sometimes it says that it's processing it and other times I click the button and nothing happens.
Victor
@abeledovictor
May 24 2016 03:23
@travisbartholome thanks, I ll try to solve it in another way
CamperBot
@camperbot
May 24 2016 03:23
abeledovictor sends brownie points to @travisbartholome :sparkles: :thumbsup: :sparkles:
:cookie: 132 | @travisbartholome |http://www.freecodecamp.com/travisbartholome
Norvin Burrus
@ndburrus
May 24 2016 03:24
@email362 ok, the code is saying that arr (the inputted array) is going to equal the item tht is pushed onto itself?
Freinet Brutus
@freinet12
May 24 2016 03:24
@bleujai i'm supposed to use if else right?
Norvin Burrus
@ndburrus
May 24 2016 03:25
@email362 in this line: ...just add the item to the end of the array and move on! :)
arr = arr.push(item);
Chris
@email362
May 24 2016 03:25
@ndburrus oh oops xD
@ndburrus LOLOLOLOL
@ndburrus IM SO STUPID
bleujai
@bleujai
May 24 2016 03:26
@freinet12 Yep. That will work.
Chris
@email362
May 24 2016 03:26
@ndburrus thanks dude. i just realized my mistake xD
CamperBot
@camperbot
May 24 2016 03:26
email362 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 418 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
May 24 2016 03:27
@email362 well done!! :+1: no, you are not.... :)
NixonRichard
@NixonRichard
May 24 2016 03:27
var processed = 0;

function processArg(num) {
  return (num + 3) / 5;
}

// Only change code below this line
var processed = 0;
function processArg(num){
  return (num +2);
}

processed = processArg(0);
bleujai
@bleujai
May 24 2016 03:27
From the Mozilla Developer Glossary: When a function is called, arguments are passed to the function as input, and the function can optionally return an output. When do we correctly use the word parameter? Anyone have a thought on this?
NixonRichard
@NixonRichard
May 24 2016 03:27
hi what s wrong with my code ?
Anna
@sunnyanya
May 24 2016 03:28
blob
Norvin Burrus
@ndburrus
May 24 2016 03:28
@NixonRichard which challenge is this?
Chris
@email362
May 24 2016 03:28
@ndburrus maybe i should take a break. ive been doing fcc since 11 in the morning and its 8:30 now xD
NixonRichard
@NixonRichard
May 24 2016 03:28
Assignment with a Returned Value
bleujai
@bleujai
May 24 2016 03:28
@NixonRichard Did you change some of the original code? Something doesn't look right.
Norvin Burrus
@ndburrus
May 24 2016 03:29
@email362 wow... that is persistence defined !
NixonRichard
@NixonRichard
May 24 2016 03:29
gya
bleujai
@bleujai
May 24 2016 03:29

@NixonRichard Here is given code.
```js
// Example
var changed = 0;

function change(num) {
return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function processArg(num) {
return (num + 3) / 5;
}

// Only change code below this line

NixonRichard
@NixonRichard
May 24 2016 03:29
im fine
got the code
bleujai
@bleujai
May 24 2016 03:30
// Example
var changed = 0;

function change(num) {
  return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function processArg(num) {
  return (num + 3) / 5;
}

// Only change code below this line
robertky
@robertky
May 24 2016 03:31

I can't get this code to properly filter out all null or blank stuff. It filters out everything but numbers. It filters out letters too, but it should not do that.

```

Norvin Burrus
@ndburrus
May 24 2016 03:31
@bleujai ok, here is where we are: "Call the processArg function with an argument of 7 and assign its return value to the variable processed."
robertky
@robertky
May 24 2016 03:31

function bouncer(arr) {
// Don't show a false ID to this bouncer.
arr=arr.filter(filterOut);
return arr;
}

function filterOut(varb)
{
if(varb===false || varb===null || varb===NaN || varb==="" || varb===0)
{
return false;
}
else
{
return true;
}
}

bouncer([7, "ate", "", false, 9]);
```

NixonRichard
@NixonRichard
May 24 2016 03:31
processed = processArg(7);
robertky
@robertky
May 24 2016 03:31

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  arr=arr.filter(filterOut);
  return arr;
}

function filterOut(varb)
{
  if(varb===false || varb===null || varb===NaN || varb==="" || varb===0)
  {
    return false;
  }
  else
  {
    return true;
  }
}

bouncer([7, "ate", "", false, 9]);
That is the code, this will filter out everything but the 7 and 9
Norvin Burrus
@ndburrus
May 24 2016 03:32
@NixonRichard bingo! :sparkles: did it pass?
robertky
@robertky
May 24 2016 03:32
Sorry, above code is the old code....................
bleujai
@bleujai
May 24 2016 03:32
@ndburrus Yeah, I just noticed that code was changed above the commented line. The challenge asks to only add code below there.
robertky
@robertky
May 24 2016 03:32
I meant this code filters out everything but the numbers.....

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  arr=arr.filter(filterOut);
  return arr;
}

function filterOut(varb)
{
  if(varb===false || varb===null || isNaN(varb) || varb==="" || varb===0)
  {
    return false;
  }
  else
  {
    return true;
  }
}

bouncer([7, "ate", "", false, 9]);
Deanna
@DeannaB
May 24 2016 03:33
Hello...having trouble with the replacing backslashes with single quotes
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
Norvin Burrus
@ndburrus
May 24 2016 03:33
@bleujai nice observation..... :fire:
Jack Gilbert
@j-gilla
May 24 2016 03:33
Hey, I'm working on some Javascript koans - I can't seem to get this one. How can I assign two values to the same key in the same object? This doesn't make sense to me at all. The test is not passing:
  it("should declare functions", function() {
    var person = {};
    function addProperty(object, key, value) {
    person.name='Bill',
    person.age=undefined,
    person.age=30,
  }

    addProperty(person, 'name', 'Bill');
    expect(person.name).toBe('Bill');
    expect(person.age).toBe(undefined);
    addProperty(person, 'age', 30);
    expect(person.age).toBe(30);
  });
NixonRichard
@NixonRichard
May 24 2016 03:33
function nextInLine(arr, item) {
  // Your code here 


  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
what does this mean
Stand in Line
bleujai
@bleujai
May 24 2016 03:34
@DeannaB Is that not working for you?
Norvin Burrus
@ndburrus
May 24 2016 03:35
@NixonRichard ok, here is where you are: "Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed."
bleujai
@bleujai
May 24 2016 03:35
Wait, what do you mean by replacing backslashes?
Deanna
@DeannaB
May 24 2016 03:35
@bleujai I deleted the backslashes and put single quotes around the end, but then it didn't recognize the forward slashes in the link
nelsewehy
@nelsewehy
May 24 2016 03:35
hey guys I'm stuck on javascript
3rd step
Victor
@abeledovictor
May 24 2016 03:35

function palindrome(str) {
var res = str.split("");
  var reverse = res.reverse();
  if (res === reverse) {
    return true;
  } else if (res != reverse) {
    return false;
  }
}
changed the whole code, but still the !== wont work
Deanna
@DeannaB
May 24 2016 03:37
@bleujai well, I got a little farther now--I forgot the code editor put in beginning and ending single quotes
bleujai
@bleujai
May 24 2016 03:37
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
I did something similar to this earlier today and it looks like it should have worked.
Anna
@sunnyanya
May 24 2016 03:37
hi, guys I am struggling with this code
help format
function destroyer(arr) {


  var args = Array.prototype.slice.call(arguments);

  var array = args[0];
  var array2 = args[0];


   //return elem;
  for (var i = 0; i < array.length; i++){
    for (var j = 1; j < args.length; j++){
      if (array[i] === args[j]){
        array2.splice(array2.indexOf(args[j]), 1);

      }
    }
  }

 return array2;
}
destroyer([2, 3, 2, 3], 2, 3);
Deanna
@DeannaB
May 24 2016 03:37
@bleujai ah, got it!
@bleujai Thank you! :)
CamperBot
@camperbot
May 24 2016 03:37
deannab sends brownie points to @bleujai :sparkles: :thumbsup: :sparkles:
:cookie: 381 | @bleujai |http://www.freecodecamp.com/bleujai
bleujai
@bleujai
May 24 2016 03:37
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">" + Link + "</a>";
is that what you are after?
is link a variable?
Deanna
@DeannaB
May 24 2016 03:38
no, I just had to change the backslashes and quotes correctly
it worked now
bleujai
@bleujai
May 24 2016 03:38
@DeannaB Good deal.
@sunnyanya It probably doesn't like that you use the word array as a variable.
That's a reserved JS word.
Daniel Tovar
@ldanieltvr
May 24 2016 03:41
Hey everyone, stuck on the Mutations challenge. I am hitting all of the checkmarks except the first one. for some reason the "y" in "hey" is returning as "true" when i use .indexOf against "hello". Here's my code, what am I doing wrong?
function mutation(arr) {

  var lcArr = [];

  for (i = 0; i < arr.length; i++) {
    lcArr.push(arr[i].toLowerCase());
  }


  var sinStr = lcArr[1].split("");


  for (i=0; i < sinStr.length; i++) {
    if (lcArr[0].indexOf(sinStr[i]) !== -1) {
      return true;

      } else {
        return false; 
      }
} 


}
mutation(["hello", "hey"]);
Norvin Burrus
@ndburrus
May 24 2016 03:41
@freinet12 did you get everything resolved?
Anna
@sunnyanya
May 24 2016 03:41
@bleujai nope, still not working :-(
bleujai
@bleujai
May 24 2016 03:42
@sunnyanya Yeah, I tried it. Must be the capitalized word then.
Let me look some more.
Anna
@sunnyanya
May 24 2016 03:43
@bleujai thank you!
CamperBot
@camperbot
May 24 2016 03:43
sunnyanya sends brownie points to @bleujai :sparkles: :thumbsup: :sparkles:
:cookie: 382 | @bleujai |http://www.freecodecamp.com/bleujai
bleujai
@bleujai
May 24 2016 03:43
@sunnyanya array and array2 are going to be the same value since they both have the same index for args.
NixonRichard
@NixonRichard
May 24 2016 03:44
this s so hard
i dont know the code
bleujai
@bleujai
May 24 2016 03:44
@sunnyanya I'm getting tired. I just realized I haven't read what you are working on.
NixonRichard
@NixonRichard
May 24 2016 03:45

`function nextInLine(arr, item) {
// Your code here
var oneDown = [arr,item].pop();

return item; // Change this line
}

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

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

```

function nextInLine(arr, item) {
  // Your code here 
  var oneDown = [arr,item].pop();

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Anna
@sunnyanya
May 24 2016 03:45
@bleujai I just don't want the array length to change
bleujai
@bleujai
May 24 2016 03:45
@sunnyanya What is this challenge?
NixonRichard
@NixonRichard
May 24 2016 03:45
no no no no
Anna
@sunnyanya
May 24 2016 03:45
@bleujai Seek and Destroy
NixonRichard
@NixonRichard
May 24 2016 03:45
what does that mean to e ?
bleujai
@bleujai
May 24 2016 03:48
@sunnyanya Looking at the tests you won't know how many arguments are beyond the arr argument/variable that is set for the function.
You may think about a way to iterate through the unnamed arguments to judge them against arr.
help me with this
CamperBot
@camperbot
May 24 2016 03:50
no wiki entry for: me with this
NixonRichard
@NixonRichard
May 24 2016 03:50
wiki stand in line
CamperBot
@camperbot
May 24 2016 03:50

:point_right: challenge stand in line [wiki]

Challenge 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 nextInLine 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 nextInLine 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 challenge stand in line on the FCC Wiki

bleujai
@bleujai
May 24 2016 03:50
@sunnyanya Read the first helpful link some more to see if that will help you.
Norvin Burrus
@ndburrus
May 24 2016 03:51
@NixonRichard review/check the array commands needed for the requirements! :) hint: choices - push, pop, shift & unshift....
Anna
@sunnyanya
May 24 2016 03:52
@bleujai do I need to know that? I have the length function for that
Victor
@abeledovictor
May 24 2016 03:52
hey guys I need some help with the check for palindromes challenge, I cant make it work for the false palindromes

function palindrome(str) {
var res = str.split("");
  var reverse = res.reverse();
  if (res === reverse) {
    return true;
  } else if (res != reverse) {
    return false;
  }
}



palindrome("eye");
CyrilSL
@CyrilSL
May 24 2016 03:52
@ldanieltvr
Here is what I tried.
function mutation(arr) {  
  var elem0 = arr[0].toLowerCase();
  var elem1 = arr[1].toLowerCase();

  for(var i = 0; i < elem1.length; i++){
    var check = elem0.indexOf(elem1[i]);
    if (check === -1){
      return false;
    }
  }
  return true;
}

mutation(['hello', 'hey']);
@CyrilSL It works
NixonRichard
@NixonRichard
May 24 2016 03:53
still dont understand
zzz
bleujai
@bleujai
May 24 2016 03:53
@sunnyanya It's good info for this challenge and future times when you will need to use it.
Daniel Tovar
@ldanieltvr
May 24 2016 03:54
@CyrilSL well ain't that just prettier! thanks, I'll try that. still don't understand why my code didn't work only for the "hey"
CamperBot
@camperbot
May 24 2016 03:54
ldanieltvr sends brownie points to @cyrilsl :sparkles: :thumbsup: :sparkles:
:cookie: 303 | @cyrilsl |http://www.freecodecamp.com/cyrilsl
NixonRichard
@NixonRichard
May 24 2016 03:55
help me
CamperBot
@camperbot
May 24 2016 03:55

:point_right: adding snippets to sublime text [wiki]

Adding Snippets To Your Sublime Text Installation

If you are a user of sublime text (I hope you are, it kicks ass. You can get it here), then you may have already noticed some of the tab completion capabilities. For example, when you are opening an html tag such as <p>, it automatically closes the tag as soon as you type /. You can get similar functionality for pieces of code you end up re-writing over and over, and it's surprisingly easy!

Here's an example, which activates after typing div and then tab:

alt text

:pencil: read more about adding snippets to sublime text on the FCC Wiki

Norvin Burrus
@ndburrus
May 24 2016 03:55
@nelsewehy what is js 3rd step?
NixonRichard
@NixonRichard
May 24 2016 03:55
i dont understand
DJ
@qualitymanifest
May 24 2016 03:56
@abeledovictor you've kinda got the right idea, but as it says in the instructions you'll need to remove all non-alphanumerics
bleujai
@bleujai
May 24 2016 03:57
@sunnyanya You are on a better track than I thought. I'll keep looking if you want to stick around.
NixonRichard
@NixonRichard
May 24 2016 03:58
ok im quite get it now
Anna
@sunnyanya
May 24 2016 03:58
@bleujai It would be awesome
@bleujai I even don't get why I am always getting 2 left....
bleujai
@bleujai
May 24 2016 03:59
@sunnyanya Sounds good. See what you can find. I'll look some more too.
2 left?
CyrilSL
@CyrilSL
May 24 2016 03:59
@NixonRichard What is the name of the challenge you're working on?
NixonRichard
@NixonRichard
May 24 2016 04:00
Stand in Line
Anna
@sunnyanya
May 24 2016 04:00
@bleujai yes, my problem is that 2 tests are not working. There is always extra 2
bleujai
@bleujai
May 24 2016 04:00
@sunnyanya I ran a later test. I see what you mean.
Anna
@sunnyanya
May 24 2016 04:00
@bleujai but other tests are fine
it feels like the more arguments you are adding, the better it works
Victor
@abeledovictor
May 24 2016 04:01
@qualitymanifest thanks
CamperBot
@camperbot
May 24 2016 04:01
abeledovictor sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star2: 1170 | @qualitymanifest |http://www.freecodecamp.com/qualitymanifest
DJ
@qualitymanifest
May 24 2016 04:01
@abeledovictor np :+1:
odiscious
@odiscious
May 24 2016 04:01
Anybody solve Falsy Bouncer?
CyrilSL
@CyrilSL
May 24 2016 04:02
@NixonRichard Easy bro.
NixonRichard
@NixonRichard
May 24 2016 04:03
what s the code then ?
how to remove the first element ?
we can use shift ?
CyrilSL
@CyrilSL
May 24 2016 04:03
just put this in between
arr.push(item);
 return arr.shift();
Between these two lines
// Your code here
  arr.push(item);
  return arr.shift();  // Change this line
Thats all.
NixonRichard
@NixonRichard
May 24 2016 04:04
can i change arr. ?
CyrilSL
@CyrilSL
May 24 2016 04:05
No need
Joseph Sepp Lin
@Joseph-Sepp-Lin
May 24 2016 04:05
hello, everyone! im stuck in the challenge: escape sequences in strings. how can i use those escape sequences?
CyrilSL
@CyrilSL
May 24 2016 04:05
@NixonRichard Did it work?
NixonRichard
@NixonRichard
May 24 2016 04:06
it appeats tha tnative log s not a function
CyrilSL
@CyrilSL
May 24 2016 04:06
here is the full code

function nextInLine(arr, item) 
{
  // Your code here
  arr.push(item);
  return arr.shift();  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
odiscious
@odiscious
May 24 2016 04:07
@Joseph-Sepp-Lin just use the slash
@Joseph-Sepp-Lin as such: \n
this represents next line
Victor
@abeledovictor
May 24 2016 04:07
@qualitymanifest i am using the .replace wrong?

function palindrome(str) {
 var newStr = str.replace(/\W+/);
var res = newStr.split("");

  var reverse = res.reverse();
  if (res === reverse) {
    return true;
  } else if (res != reverse){
    return false;
  }
}



palindrome("eye");
bleujai
@bleujai
May 24 2016 04:07
@sunnyanya I think it has to do with splice. As you are removing elements from array2 it is getting shorter and shorter so as the increment goes up some of the values are allowed to slip through.
NixonRichard
@NixonRichard
May 24 2016 04:08
did it work for u @CyrilSL
Justin Woodward
@jwoo92
May 24 2016 04:08
is there a simple way to use a jquery call to grab your entire <body> html? example: $("#id-here").html(body); <-- i know this does not work, but allows you see what i am trying to do.
CyrilSL
@CyrilSL
May 24 2016 04:08
@NixonRichard Of course
DJ
@qualitymanifest
May 24 2016 04:09
@sunnyanya i made some notes on your code, let me know if you need clarification
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  console.log(args); // this shows that you are getting the arguments correctly : [2, 3, 2, 3], 2, 3

  // arr, as provided to the function, is args[0] here. you just need to get rid of the other parts of args that are present in args[0] AKA arr

  var array = args[0]; // this is unnecessary, arr is arg[0] so you can just use that
  var array2 = args[0]; // same here


  // you can use a filter function that removes the parts of args that are present in arr here
}
destroyer([2, 3, 2, 3], 2, 3);
Joseph Sepp Lin
@Joseph-Sepp-Lin
May 24 2016 04:09
@odiscious can you give me an example?
bleujai
@bleujai
May 24 2016 04:09
@sunnyanya I was able to get it to pass by changing the way one of the for loops iterates. Think of how you could do it a different way and you'll likely have it. If you need a stronger clue let me know.
NixonRichard
@NixonRichard
May 24 2016 04:09
it says arr s not defined
it shuold be array
bleujai
@bleujai
May 24 2016 04:10
@qualitymanifest Did you guys get it earlier?
DJ
@qualitymanifest
May 24 2016 04:10
@bleujai get what?
NixonRichard
@NixonRichard
May 24 2016 04:10
ya made it thx @CyrilSL
CamperBot
@camperbot
May 24 2016 04:10
nixonrichard sends brownie points to @cyrilsl :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @cyrilsl |http://www.freecodecamp.com/cyrilsl
nelsewehy
@nelsewehy
May 24 2016 04:11
hey guys
im a bit stuck
bleujai
@bleujai
May 24 2016 04:11
the challenge @sunnyanya is working on.
nelsewehy
@nelsewehy
May 24 2016 04:11
a = a + 1;
b = b + 5;
c = c + " String!";
a = 6;
b = 15;
c =
CyrilSL
@CyrilSL
May 24 2016 04:11
@NixonRichard Good.
nelsewehy
@nelsewehy
May 24 2016 04:11
not sure what c is suppose to be
CyrilSL
@CyrilSL
May 24 2016 04:11
@nelsewehy Which challenge?
nelsewehy
@nelsewehy
May 24 2016 04:11
Understanding Uninitialized Variables
in javascript
NixonRichard
@NixonRichard
May 24 2016 04:12
JSON.stringify(testA
nelsewehy
@nelsewehy
May 24 2016 04:12
i am struggling a bit with those
DJ
@qualitymanifest
May 24 2016 04:12
@abeledovictor sorry i just noticed this, give me a second
NixonRichard
@NixonRichard
May 24 2016 04:12
what s the JSON.stringify ?
Victor
@abeledovictor
May 24 2016 04:12
@qualitymanifest np :D
CyrilSL
@CyrilSL
May 24 2016 04:14
@nelsewehy The answer is given in the question itself read it.
nelsewehy
@nelsewehy
May 24 2016 04:14
c = "I am a";
correct?
CyrilSL
@CyrilSL
May 24 2016 04:14
Yes
nelsewehy
@nelsewehy
May 24 2016 04:14
not working for some reason
a = 6;
b = 15;
c = "I am a";
CyrilSL
@CyrilSL
May 24 2016 04:15
a is 5
nelsewehy
@nelsewehy
May 24 2016 04:15
just want to make sure its correct
CyrilSL
@CyrilSL
May 24 2016 04:15
not 6
Anna
@sunnyanya
May 24 2016 04:15
@bleujai i can't find the error...
nelsewehy
@nelsewehy
May 24 2016 04:15
not working with 5, and 10
CyrilSL
@CyrilSL
May 24 2016 04:15
a is 5 and b is 10;
nelsewehy
@nelsewehy
May 24 2016 04:15
working with 6 and 15
a = 5;
b = 10;
c = "I am a";
not working
but the first two conditions to pass are met when i enter 6 and 15
CyrilSL
@CyrilSL
May 24 2016 04:16
Working for me fine here.
bleujai
@bleujai
May 24 2016 04:16
@sunnyanya We should have considered using .filter() too. Makes the problem much easier. If you iterate through array in reverse you will get the challenge to complete. That way it doesn't skip over values and let them pass through when you go forward. Understand why?
nelsewehy
@nelsewehy
May 24 2016 04:17
weird
i'll paste exactly what i have

// Initialize these three variables
var a;
var b;
var c;

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";
a = 5;
b = 10;
c = "I am a";

a should be defined and have a value of 6
b should be defined and have a value of 15
c should not contain undefined and should have a value of "I am a String!"
Do not change code below the line
now underneath it shows this
CyrilSL
@CyrilSL
May 24 2016 04:17
Youve changed stuff below the line which says you not to change.
nelsewehy
@nelsewehy
May 24 2016 04:18
ahh i see
so everything has to be above
CyrilSL
@CyrilSL
May 24 2016 04:18
Read the // Do not change code below this line
Yes
nelsewehy
@nelsewehy
May 24 2016 04:18
thanks @CyrilSL
CamperBot
@camperbot
May 24 2016 04:18
nelsewehy sends brownie points to @cyrilsl :sparkles: :thumbsup: :sparkles:
:cookie: 305 | @cyrilsl |http://www.freecodecamp.com/cyrilsl
nelsewehy
@nelsewehy
May 24 2016 04:18
i see it now
should have paid more attention
DJ
@qualitymanifest
May 24 2016 04:18
@abeledovictor okay there's a few things. you're going to need to lowercase str from the beginning (using toLowerCase()). your replace also needs work, and i think there may be a problem with your comparison, but that's close
CyrilSL
@CyrilSL
May 24 2016 04:19
@nelsewehy Haha I know, its normal even I used to do that.
nelsewehy
@nelsewehy
May 24 2016 04:20
things are getting a bit tougher, haha hate mistakes like that
Justin Woodward
@jwoo92
May 24 2016 04:20
@jwoo92
having some trouble here. after you complete a search, i can not get my search bar to work again or if i click the home icon, my search bar does not work then either. would anyone like to look over my code please? http://codepen.io/jwoo/pen/grJdMr?editors=1010
CyrilSL
@CyrilSL
May 24 2016 04:20
@nelsewehy Mistakes will ALWAYS happen just dont loose hope when finding answers in more difficult codes.
Victor
@abeledovictor
May 24 2016 04:21
@qualitymanifest thanks ill try again :P
CamperBot
@camperbot
May 24 2016 04:21
abeledovictor sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:warning: abeledovictor already gave qualitymanifest points
Jake
@Jaketh
May 24 2016 04:25
any idea why jQuery on click event would jump me to the top of page, on mobile only, if no anchor tags or links are involved...?
bleujai
@bleujai
May 24 2016 04:28
From the Mozilla Developer Glossary: When a function is called, arguments are passed to the function as input, and the function can optionally return an output. When do we correctly use the word parameter in regard to a function? @qualitymanifest
Justin Woodward
@jwoo92
May 24 2016 04:28
@Jaketh it may be a mobile thing. i had the same issue and confirmed it was only doing it on my mobile device (ios).
DJ
@qualitymanifest
May 24 2016 04:28
@abeledovictor here i left you some notes too:

function palindrome(str) {
    // lowercase it!
 var newStr = str.replace(/\W+/); // several things:

 /** /W doesn't replace underscores
  * you will need the global flag http://www.w3schools.com/jsref/jsref_regexp_g.asp
  * you'll need to specify what to replace these things with (blank space, basically deleting them)
  */
var res = newStr.split("");

  var reverse = res.reverse(); // reverse reverses the array in place so, while res is reversed, so is newStr:
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
  // the way to get around this is to compare newStr with itself reversed, using the methods you learned in "reverse a string"
  if (res === reverse) {
    return true;
  } else if (res != reverse){
    return false;
  }
}

palindrome("eye");
Justin Woodward
@jwoo92
May 24 2016 04:29
@Jaketh my linked buttons would not work and would take me to top of page. i took away codepens css and javascript and it linked perfectly then. i assume it has something to do with codepens editor and mobile devices.
DJ
@qualitymanifest
May 24 2016 04:29
@bleujai one second
Justin Woodward
@jwoo92
May 24 2016 04:29
@Jaketh it is only an assumption, i may be wrong.
bleujai
@bleujai
May 24 2016 04:31
@qualitymanifest Nearmind. Found it.
Note the difference between parameters and arguments:
  • Function parameters are the names listed in the function's definition.
  • Function arguments are the real values passed to the function.
  • Parameters are initialized to the values of the arguments supplied.
DJ
@qualitymanifest
May 24 2016 04:32
yeah, just an example of that
Norvin Burrus
@ndburrus
May 24 2016 04:33
@qualitymanifest how did you make the repl a link to post sample code?
bleujai
@bleujai
May 24 2016 04:34
@qualitymanifest I feel like it's confusing that they use arguments[0] and so on to access unnamed parameters. Maybe it's more that the arguments aren't caught by parameters so they pass into the function as arguments.
Anna
@sunnyanya
May 24 2016 04:34
@bleujai thank you! I, finally, passed it!
CamperBot
@camperbot
May 24 2016 04:34
sunnyanya sends brownie points to @bleujai :sparkles: :thumbsup: :sparkles:
:warning: sunnyanya already gave bleujai points
bleujai
@bleujai
May 24 2016 04:34
@sunnyanya Good for you. Did you keep what you had or use .filter()?
@ndburrus Use the share button.
DJ
@qualitymanifest
May 24 2016 04:35
This message was deleted
Jake
@Jaketh
May 24 2016 04:36
@jwoo92 good idea!
Norvin Burrus
@ndburrus
May 24 2016 04:36
@bleujai nice! thank you...
CamperBot
@camperbot
May 24 2016 04:36
ndburrus sends brownie points to @bleujai :sparkles: :thumbsup: :sparkles:
:cookie: 384 | @bleujai |http://www.freecodecamp.com/bleujai
bleujai
@bleujai
May 24 2016 04:37
@qualitymanifest I understand it much better now thanks. I have to ask, how many WPM do you type?
CamperBot
@camperbot
May 24 2016 04:37
bleujai sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star2: 1171 | @qualitymanifest |http://www.freecodecamp.com/qualitymanifest
bleujai
@bleujai
May 24 2016 04:37
@ndburrus Sure.
@ndburrus You are good at giving examples so that will come in handy.
DJ
@qualitymanifest
May 24 2016 04:38
@bleujai the idea they're trying to teach is that you don't have to hardcode how many arguments a function will get. you can make a function that only expects one or so parameters, but then you can give it more and retrieve them via the arguments object since you will often have functions that takes a varying amount of arguments
Norvin Burrus
@ndburrus
May 24 2016 04:38
@bleujai it sure should... and save window space in the chat area too :+1:
DJ
@qualitymanifest
May 24 2016 04:39
@bleujai np. i have no idea. quickly enough, usually more if i haven't had any :beers: haha
Jake
@Jaketh
May 24 2016 04:39
@jwoo92 holy shnikies man I think you're right. its working fine in d-bug mode... I've been slapping my face against my keyboard for hours.
@jwoo92 thank you!
CamperBot
@camperbot
May 24 2016 04:39
jaketh sends brownie points to @jwoo92 :sparkles: :thumbsup: :sparkles:
:cookie: 326 | @jwoo92 |http://www.freecodecamp.com/jwoo92
Justin Woodward
@jwoo92
May 24 2016 04:40
@Jaketh anytime, glad i could help.
bleujai
@bleujai
May 24 2016 04:40
@qualitymanifest I understand that. It's more so the explanation for the terminology.
Stewart Anderson
@stewie1570
May 24 2016 04:40
I'm new to gitter. How do I send brownie points to someone that helps me?
Norvin Burrus
@ndburrus
May 24 2016 04:40
help brownie points @stewie1570 ..for any subject, type help (subject) and camperbot will assist if possible... :)
CamperBot
@camperbot
May 24 2016 04:40

:point_right: brownie points [wiki]

Brownie Points

The number beside your picture on Free Code Camp tells you how many Brownie Points you have.

A user profile picture next to a with Brownie Points score

There are two ways you can get Brownie Points:

  1. Complete challenges - you get one point per challenge you complete
  2. Help other campers in chat - each time you help another camper and they thank you (by typing "thanks @yourname"), you will get a point

Brownie Points help you look like the kind of person who codes a lot, shares relevant links, and helps people.

They also add to your Streak.

:pencil: read more about brownie points on the FCC Wiki

Stewart Anderson
@stewie1570
May 24 2016 04:40
Ahh, thanks all!
Puja
@Pujachaubey
May 24 2016 04:41
hii i am doing Accessing Nested Objects in JSON
my code is here

var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line
var gloveBoxContents = "glove box";
myStorage.car.inside.gloveBoxContents; // Change this line

bleujai
@bleujai
May 24 2016 04:42
@stewie1570 Brownie points for all!
:)
Puja
@Pujachaubey
May 24 2016 04:42
where i am doing wrong.
Stewart Anderson
@stewie1570
May 24 2016 04:42
@bleujai I was wondering if it would...I don't think it did :)
bleujai
@bleujai
May 24 2016 04:43
@stewie1570 That'd be brownie abuse.
DJ
@qualitymanifest
May 24 2016 04:43
@ndburrus oh sorry i just noticed your comment above. you just have to use the "save" button and it will give you a link
Norvin Burrus
@ndburrus
May 24 2016 04:43
@Pujachaubey hmmmm... you'e giving/finding the desired value yourself! let the code find it for you.... :)
DJ
@qualitymanifest
May 24 2016 04:43
Selection_157.png
bleujai
@bleujai
May 24 2016 04:44
@qualitymanifest Share works as well.
DJ
@qualitymanifest
May 24 2016 04:44
@ndburrus :point_up:
Stewart Anderson
@stewie1570
May 24 2016 04:44
@Pujachaubey To access glove box you'll need to use bracket notation object.["glove box"]
@Pujachaubey Because of the space...
Norvin Burrus
@ndburrus
May 24 2016 04:44
@qualitymanifest ok... and i think share does it also (someone mentioned that, i think)
DJ
@qualitymanifest
May 24 2016 04:44
@bleujai true, i guess that does the same thing but provides the link to you rather than having to copy the search bar
Justin Woodward
@jwoo92
May 24 2016 04:44
@jwoo92
having some trouble here. after you complete a search, i can not get my search bar to work again or if i click the home icon, my search bar does not work then either. would anyone like to look over my code please?
http://codepen.io/jwoo/pen/grJdMr?editors=1010
Norvin Burrus
@ndburrus
May 24 2016 04:46
@Pujachaubey review/check the example code and focus on how they retrieve a value from a property... or get a value from a key/value pair... or access sub/properties of json objects... :)
CyrilSL
@CyrilSL
May 24 2016 04:48
@Pujachaubey Use this var gloveBoxContents = myStorage.car.inside["glove box"];
Puja
@Pujachaubey
May 24 2016 04:48
in instruction its saying retrieve content of the glove box.
CyrilSL
@CyrilSL
May 24 2016 04:49
@Pujachaubey Just past thisvar gloveBoxContents = myStorage.car.inside["glove box"];
Stewart Anderson
@stewie1570
May 24 2016 04:49
@jwoo92 It looks like you're re-rendering the search button. You'll need to re $("#search").click(...) it. Once it's re-rendered it's lost the click binding.
Puja
@Pujachaubey
May 24 2016 04:49
ohhh
actually i did only this myStorage.car.inside["glove box"];
CyrilSL
@CyrilSL
May 24 2016 04:49
Yes
Ross
@Woodywoodruff3
May 24 2016 04:50
Good Evening, I am having issues on Challenge 181 (Global Scope and Functions) I need to figure out how to do this. Inside function fun1, assign 5 to oopsGlobal without using the var keyword. opsGlobal should have a value of 5. I am lost.

function fun1 () {
// Assign 5 to oopsGlobal Here

}

Stewart Anderson
@stewie1570
May 24 2016 04:50
@Pujachaubey Yep, that's bracket notation. Needed when props are reserved words or have spaces etc...
CyrilSL
@CyrilSL
May 24 2016 04:50
Just read whats given in the left side and see the exmple thats what they have done. @Pujachaubey
Justin Woodward
@jwoo92
May 24 2016 04:50
@stewie1570 thats what i was thinking, i just havent came up with a solution yet.
on how to.
Norvin Burrus
@ndburrus
May 24 2016 04:52
@Woodywoodruff3 ok, how would we assign 5 to a variable? hint: assignment operator is?
Ross
@Woodywoodruff3
May 24 2016 04:53
var oopsGlobal = 5
Puja
@Pujachaubey
May 24 2016 04:53
yes i read it but i am not understanding clearly.
Stewart Anderson
@stewie1570
May 24 2016 04:53
@jwoo92 Instead of $("#search").on("click", function() {...} you can name that function e.g. function render(){...} and then $("#search").on("click", render);
Then you can have render call this line again. I think :)
Norvin Burrus
@ndburrus
May 24 2016 04:53
@Woodywoodruff3 the instructions mentioned to not use what word?
CyrilSL
@CyrilSL
May 24 2016 04:53
@Pujachaubey But what i said did work right?
Ross
@Woodywoodruff3
May 24 2016 04:53
Var
Norvin Burrus
@ndburrus
May 24 2016 04:54
@Woodywoodruff3 so, we should remove that?
Ross
@Woodywoodruff3
May 24 2016 04:54
I dont have the Var statement for oops
Puja
@Pujachaubey
May 24 2016 04:54
why we are using var gloveBoxContents i can directly assign mystorage.car.inside["glove box"];
bleujai
@bleujai
May 24 2016 04:55

Instructions
Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10

Inside function fun1, assign 5 to oopsGlobal without using the var keyword. @Woodywoodruff3

Puja
@Pujachaubey
May 24 2016 04:55
@CyrilSL no its not working.
Norvin Burrus
@ndburrus
May 24 2016 04:55
@Woodywoodruff3 no, here (what you just typed) var oopsGlobal = 5 note the exercise text: "In JavaScript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope."
CyrilSL
@CyrilSL
May 24 2016 04:56
@Pujachaubey It should work it worked for me. Post your full code.
Ross
@Woodywoodruff3
May 24 2016 04:56
oh, correct
bleujai
@bleujai
May 24 2016 04:57
This message was deleted
I may have stated too much. See what you come up with.
Norvin Burrus
@ndburrus
May 24 2016 04:58
@Woodywoodruff3 now, we can take care of the next part: "Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10"
Justin Woodward
@jwoo92
May 24 2016 04:59
@stewie1570 i see what you are saying, but my code editor is not accepting it in that format.
Puja
@Pujachaubey
May 24 2016 04:59
yes its done.
Ross
@Woodywoodruff3
May 24 2016 04:59
which I did by writing var myGlobal =10;
Puja
@Pujachaubey
May 24 2016 04:59
@CyrilSL @ndburrus thanks
CamperBot
@camperbot
May 24 2016 04:59
pujachaubey sends brownie points to @cyrilsl and @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @cyrilsl |http://www.freecodecamp.com/cyrilsl
:cookie: 419 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
May 24 2016 04:59
@Woodywoodruff3 ok, super.... and? :) excellent :)
Stewart Anderson
@stewie1570
May 24 2016 05:00
@jwoo92 Hmm, it giving a syntax error?
Justin Woodward
@jwoo92