These are chat archives for FreeCodeCamp/HelpJavaScript

20th
May 2016
Peter Weinberg
@no-stack-dub-sack
May 20 2016 00:00
Question: is there any particular reason why the var in the example constructor functions are not written in the typical camel case, i.e. starts with a lowercase? Not sure if this is relevant or if there is some specific reason for this...
```
var Car = function(wheels, seats, engines)
var Car = function(wheels, seats, engines)
printingprinting
@printingprinting
May 20 2016 00:00
Becasue ther is a space between var and car?
var myCAr
myCar*
Peter Weinberg
@no-stack-dub-sack
May 20 2016 00:01
@printingprinting I think you just disproved that, there is also a spice between var and myCar
var Car = function(wheels, seats, engines) {
  //Change this constructor
  this.wheels = wheels;
  this.seats = seats;
  this.engines = engines;
};

//Try it out here
var myCar = new Car(1200, 0.5, 27);
DamianMitchell
@DamianMitchell
May 20 2016 00:02
ok...I'm not sure if my codepen can link to another site? Can someone explain to me if codepen does? and how?
printingprinting
@printingprinting
May 20 2016 00:03
@no-stack-dub-sack hmm, I guess that I am not sure. But there might not be rule against having a capital first word. It might be more of a guideline to follow camel case rules.
EricOber
@EricOber
May 20 2016 00:03
can someone tell me whut is rong with me code? Im on "Multiple Identical Options in Switch Statements"
function sequentialSizes(val) {
  var answer = "";
  // Only change code below this line
  switch (val) {
    case 1: "Low";
    case 2: "Low";
    case 3: "Low";
      answer = "Low";
      break;
    case 4: "Mid";
    case 5: "Mid";
    case 6: "Mid";
      answer = "Mid";
      break;
    case 7: "High";
    case 8: "High";
    case 9: "High";
      answer = "High";
      break;
  }


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

// Change this value to test
sequentialSizes("Low");
Wise
@WiseNN
May 20 2016 00:04
This message was deleted
Peter Weinberg
@no-stack-dub-sack
May 20 2016 00:04
@DamianMitchell your code should have the target like appears in this:
<a href="https://www.linkedin.com/in/peter-weinberg-b7911a9b" class="grow btn btn-primary" target="_blank">
so target="_blank" will allow you link to connect you to outside sites
DamianMitchell
@DamianMitchell
May 20 2016 00:05
@no-stack-dub-sack what about in JQuery or JS
Peter Weinberg
@no-stack-dub-sack
May 20 2016 00:05
@DamianMitchell sorry, can't help you there
@printingprinting you are def right, it's just a guideline, just wondering why this is the only exception I've seen and if it serves any specific funtion
Wise
@WiseNN
May 20 2016 00:06

Can someone tell me what this error means in the code camp challenge??

SyntaxError: Invalid flags supplied to RegExp constructor 'sitting'


function myReplace(str, before, after) {
  before=before.substring(0,before.length-1);


 var re = new RegExp("\("+before + "\)\\S", after);

function changeMe(match)
  {
    return match;

  }
  str.replace(re,changeMe);

}

myReplace("He is Sleeping on the couch", "Sleeping", "sitting");
printingprinting
@printingprinting
May 20 2016 00:07
@no-stack-dub-sack Might be because multiple people have submitted challenges.
Stephen James
@sjames1958gm
May 20 2016 00:07
@Am3ricanPaladin Those strings after each case are not needed - also you call this with a number I seem to recall.
@WiseNN The second parameter to RegExp is flags "gi" for example.
EricOber
@EricOber
May 20 2016 00:08
hey @sjames1958gm thanks, so you are saying that I do not need to put "LOW" after case 1:
CamperBot
@camperbot
May 20 2016 00:08
am3ricanpaladin sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1177 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Peter Weinberg
@no-stack-dub-sack
May 20 2016 00:08
@Am3ricanPaladin exactly
Stephen James
@sjames1958gm
May 20 2016 00:08
@Am3ricanPaladin yes
EricOber
@EricOber
May 20 2016 00:08
thank you
eeflores
@eeflores
May 20 2016 00:08
@WiseNN the second parameter to RegExp is flags - look at https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/RegExp
Peter Weinberg
@no-stack-dub-sack
May 20 2016 00:09
@Am3ricanPaladin Also, he is right, you should be calling with a number, not a string
EricOber
@EricOber
May 20 2016 00:09
right. i see that now @no-stack-dub-sack thank you too
CamperBot
@camperbot
May 20 2016 00:09
am3ricanpaladin sends brownie points to @no-stack-dub-sack :sparkles: :thumbsup: :sparkles:
:cookie: 247 | @no-stack-dub-sack |http://www.freecodecamp.com/no-stack-dub-sack
Peter Weinberg
@no-stack-dub-sack
May 20 2016 00:11
@Am3ricanPaladin good luck! I'm not that much further ahead of you... I did that last week some time
EricOber
@EricOber
May 20 2016 00:13
good luck to you too!
Daniel Tovar
@ldanieltvr
May 20 2016 00:14

Stuck on a JSON challenge. ```var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

var gloveBoxContents = myStorage.car.inside ["glove box"];This challenge is telling me I'm not using dot and bracket notation to accessmyStorage``` — I am, aren't I?

One day I will learn how to properly use markdown on Gitter lol
Stephen James
@sjames1958gm
May 20 2016 00:15
@ldanieltvr put your ``` on a separate line
Wise
@WiseNN
May 20 2016 00:15
@sjames1958gm ahh right… thanks
CamperBot
@camperbot
May 20 2016 00:15
wisenn sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1178 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
May 20 2016 00:15
@ldanieltvr It looks correct
Daniel Tovar
@ldanieltvr
May 20 2016 00:15
@sjames1958gm thanks.. so is it a bug?
CamperBot
@camperbot
May 20 2016 00:15
ldanieltvr sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1179 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Daniel Tovar
@ldanieltvr
May 20 2016 00:16
for reference, it's the "
Accessing Nested Objects in JSON" challenge
Stephen James
@sjames1958gm
May 20 2016 00:16
@ldanieltvr Try refreshing the browser
Frank XC
@tenkdayz
May 20 2016 00:17

anyone here know how increment a div's margin using a button? something like

function move(){
    div.style.marginLeft += 5+"px";
}

but this doesnt work

Daniel Tovar
@ldanieltvr
May 20 2016 00:17
@sjames1958gm still giving me a red X for Use dot and bracket notation to access myStorage
Stephen James
@sjames1958gm
May 20 2016 00:18
var gloveBoxContents = myStorage.car.inside["glove box"];
@ldanieltvr Maybe there is a space before the [
Daniel Tovar
@ldanieltvr
May 20 2016 00:18
@sjames1958gm ah, that was it! thanks again!
CamperBot
@camperbot
May 20 2016 00:18
ldanieltvr sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: ldanieltvr already gave sjames1958gm points
Aryan
@aryandua
May 20 2016 00:20
@tenkdayz that should work
Frank XC
@tenkdayz
May 20 2016 00:20
@aryandua doesnt..
Aryan
@aryandua
May 20 2016 00:20
Oh!
Because you are adding px to the value of marginLeft
do you get it?
J
@J-Mari
May 20 2016 00:23
Hey! Looking for help with one of the challenges
Aryan
@aryandua
May 20 2016 00:24
which one?
J
@J-Mari
May 20 2016 00:24
An early one, Stand In Line.
Freinet Brutus
@freinet12
May 20 2016 00:26
does anyone know how to do the Word Blank challenge?
Stephen James
@sjames1958gm
May 20 2016 00:27
@J-Mari You need to add code to the function provided that adds item to the end of arr and then removes and returns the first element of arr.
J
@J-Mari
May 20 2016 00:27
I've got the line "item = testArr.shift();" and now I'm unsure what I'm supposed to be doing next.
Stephen James
@sjames1958gm
May 20 2016 00:28
@J-Mari Don't use testArr use arr . You need to add to end of the array and that isn't shift
Frank XC
@tenkdayz
May 20 2016 00:28
@aryandua how can I fix that?
Aryan
@aryandua
May 20 2016 00:29
umm...
create another variable
like
var x=div.style.marginLeft;
Jareth MacArthur
@Jtmaca9
May 20 2016 00:30
Hwy guys, im stuck in "Where art thou"
'''js
CamperBot
@camperbot
May 20 2016 00:30
:bulb: to format code use backticks! ``` more info
Aryan
@aryandua
May 20 2016 00:30
x+=5
and div.Style.marginLeft=x;
Jareth MacArthur
@Jtmaca9
May 20 2016 00:30

'''
function whereAreYou(collection, source) {
// What's in a name?
var arr = [];
// Only change code below this line
collection.map(function(item){
var keys = Object.keys(item);
var k = Object.keys(source);
for(var i = 0; i < keys.length; i++){
if(item[keys[i]] == source[keys[i]] && keys[i] == k[0]){
arr.push(source);
}
}
});

// Only change code above this line
return arr;
}
'''

CamperBot
@camperbot
May 20 2016 00:30
:bulb: to format code use backticks! ``` more info
Aryan
@aryandua
May 20 2016 00:31
This message was deleted
Jareth MacArthur
@Jtmaca9
May 20 2016 00:31
whoops sorry
function whereAreYou(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  collection.map(function(item){
    var keys = Object.keys(item);
    var k = Object.keys(source);
    for(var i = 0; i < keys.length; i++){
      if(item[keys[i]] == source[keys[i]] && keys[i] == k[0]){
        arr.push(source);
      }
    }
  });

  // Only change code above this line
  return arr;
}
Am i misunderstanding the question?
Aryan
@aryandua
May 20 2016 00:32
var x=div.style.marginLeft;
x+=5
and div.Style.marginLeft=x+"px";
@tenkdayz
Stephen James
@sjames1958gm
May 20 2016 00:33
@Jtmaca9 Your middle check looks ok, not sure what the keys[i] == k[0]
@Jtmaca9 Also, you will need to have all of them match before pushing it on the return arr.
Jareth MacArthur
@Jtmaca9
May 20 2016 00:36
@sjames1958gm oh i see, think i have seen what i did wrong, thank you heaps!
CamperBot
@camperbot
May 20 2016 00:36
jtmaca9 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1180 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Norvin Burrus
@ndburrus
May 20 2016 00:46
This message was deleted
webMEDIX
@webMEDIX
May 20 2016 00:46
Could use help on the "Stand in Line" task. I have tried a number of things. Not sure if I am getting this right.
Norvin Burrus
@ndburrus
May 20 2016 00:47
@webMEDIX can you post your code?
webMEDIX
@webMEDIX
May 20 2016 00:47
be gentle

function nextInLine(arr, item) {
item = arr.push;

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));

Norvin Burrus
@ndburrus
May 20 2016 00:48
@webMEDIX ...review/check the push syntax (hint: what are you push/ing on?)
webMEDIX
@webMEDIX
May 20 2016 00:49
push is meant to add to a string
NegrilloC
@NegrilloC
May 20 2016 00:50

why does this not work? ```function destroyer(arr) {
// Remove all the values
var filtArr = arguments[0].filter(function(val){
for(var i = 1; i<arguments.length; i++){
if(val === arguments[i]){
return;
}
}
return val;
});

return filtArr;
}```

Norvin Burrus
@ndburrus
May 20 2016 00:50
@webMEDIX this may be helpful: MDN, Array.prototype.push(), {ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push }
SyntaxEDIT
arr.push(element1, ..., elementN)
webMEDIX
@webMEDIX
May 20 2016 00:51
I think I am getting it now. TY
Aryan
@aryandua
May 20 2016 00:52

function myReplace(str, before, after) {
 var  myArr=str.split;
  for(i=0;i<myArr.length;i++) {
    if(myArr[i]===before) {
      myArr[i]=after;
    }
  }
 str = myArr.join; 
  return str;
}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
what is wrong with this code/
?
Norvin Burrus
@ndburrus
May 20 2016 00:53
@webMEDIX you're on fire, now!! :fire:
Aryan
@aryandua
May 20 2016 00:53
@ndburrus did you do the search and replace algorithim?
Norvin Burrus
@ndburrus
May 20 2016 00:54
@aryandua is that the challenge name? if so, i don't think so... i didn't see a challenge with that name...
J
@J-Mari
May 20 2016 00:59
Could someone please lend me a hint on Word Blanks? didn't realize I'd skipped the challenge somehow.
I've built a string but have no spaces in between the words.
webMEDIX
@webMEDIX
May 20 2016 01:03
Yeah I was wrong. No idea what I am doing.
kakalak-lumberJack
@kakalak-lumberJack
May 20 2016 01:04
@J-Mari just to prod you to think it out, think about how when you add strings you have to leave a space at the end of the first one, right?
webMEDIX
@webMEDIX
May 20 2016 01:05
I definately dont think .push was right. But, got now idea where to go with this one.
richiedSIS
@richiedSIS
May 20 2016 01:05
function palindrome(str) {
  // Good luck!
  if(str ===null)
    return false;

  var newStr = str.toLowerCase().replace(/\W/g,'');
  //return newStr;
  var left=0; var right=newStr.length-1;
  while(left<right){
    if(newStr[left]!==newStr[right])
      return false;
    left++;
    right--;

  }
  return true;

}

palindrome("0_0 (: /-\ :) 0-0");
I'm having trouble with this challenge. I think I need to remove the underscore using the regex, but can't figure out how. Any suggestions?
NegrilloC
@NegrilloC
May 20 2016 01:05
Hey guys, looking for help on destroyer challenge
function destroyer(arr) {
  // Remove all the values
  var filtArr = arguments[0].filter(function(val){
    for(var i = 1; i<arguments.length; i++){
      if(val === arguments[i]){
        return;
      }
    }
    return val;
  });

  return filtArr;
}
Norvin Burrus
@ndburrus
May 20 2016 01:05
@J-Mari ok, it sounds like a space needs to be added between strings.... a space is just a string, so do you know how to add one/them? also, can you post your code? :sparkles:
J
@J-Mari
May 20 2016 01:05
Ah, silly me. Fixed the space error.
Norvin Burrus
@ndburrus
May 20 2016 01:07
@webMEDIX ok.. there are two operations needed: a) adding a number to the end of the array, and b) removing the first element of the array. which two operations (methods) do you see using? :)
@J-Mari kudos to you ! :+1:
webMEDIX
@webMEDIX
May 20 2016 01:08
should be using .push and .unshift
@ndburrus should be using .push and .unshift
Ken Haduch
@khaduch
May 20 2016 01:09
@aryandua - one problem is that you do not have parens () after your split and join.
Norvin Burrus
@ndburrus
May 20 2016 01:09
@webMEDIX great! ...have we adjusted the (method) syntax? also, can you post your code, so far?
webMEDIX
@webMEDIX
May 20 2016 01:10
I scratched it and I am starting fresh
But should be something like this
Norvin Burrus
@ndburrus
May 20 2016 01:11
@webMEDIX ...alright. remember, we need to capture the removed array element :)
webMEDIX
@webMEDIX
May 20 2016 01:11
function nextInLine(arr, item) {
item = arr.push(arr +1);
This is where I am lost.
Ken Haduch
@khaduch
May 20 2016 01:12
@aryandua - then, within the parentheses, you have to put the separator character that you want to use.
J
@J-Mari
May 20 2016 01:12
I'm stuck at the same part, @webMEDIX .
webMEDIX
@webMEDIX
May 20 2016 01:12
@J-Mari amen. I am not alone.
Norvin Burrus
@ndburrus
May 20 2016 01:13
@webMEDIX @J-Mari ok, we need to rethink using unshift as one of the methods. are you sure you want that one? also, we don't want to assign anything to item. we want to add item (the number) to the end of the array....
webMEDIX
@webMEDIX
May 20 2016 01:15
@ndburrus I am sorry replace .unshfit with .shift
arr.push;
Norvin Burrus
@ndburrus
May 20 2016 01:16
@webMEDIX ok, good. the syntax for the Array.prototype.shift() method is arr.shift(hint - the item input needs a home...)...
webMEDIX
@webMEDIX
May 20 2016 01:16
arr.shift;
J
@J-Mari
May 20 2016 01:16
item = arr.shift(); is what I have.
But it's only part of completion.
I don't think I'm understanding what I'm doing.
Norvin Burrus
@ndburrus
May 20 2016 01:17
@J-Mari @webMEDIX ok, let's be clear - we aren't interested in assigning (=) anythig to the var/iable item... understand?
J
@J-Mari
May 20 2016 01:18
Yup.
webMEDIX
@webMEDIX
May 20 2016 01:18
so remove the var item. just focus on assigning the array
got it
Norvin Burrus
@ndburrus
May 20 2016 01:18
@J-Mari @webMEDIX this example may be helpful:
Example
Remove the first item of an array:

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
The result of fruits will be:

Orange,Apple,Mango
J
@J-Mari
May 20 2016 01:18
So we
have the second step.
webMEDIX
@webMEDIX
May 20 2016 01:19
so we should be showing
arr.push();
arr.shift();
so far
Norvin Burrus
@ndburrus
May 20 2016 01:20
@webMEDIX @J-Mari see how the line below removes the first item of the array, and returns that item?
fruits.shift();
webMEDIX
@webMEDIX
May 20 2016 01:21
returns the item minus the first item.
yep got ya
J
@J-Mari
May 20 2016 01:21
array minus first item?
Norvin Burrus
@ndburrus
May 20 2016 01:21
@webMEDIX ok the first line of code (your push statement) is ok, so far... you do, however, need to tell the code what you are push/ing.... so, what would go inside of the parenthesis?
J
@J-Mari
May 20 2016 01:21
right
Michael
@michaeldiegogil
May 20 2016 01:22
Create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console.
Call the function.
what the hell am i doing worng
wrong
wrong*
god i cant even spell

// Example
function functionWithArgs(a, b) {
console.log(a - b);
}
functionWithArgs(10, 5); // Outputs 5

// Only change code below this line.

function functionWithArgs(arg1, arg2) {
console.log(arg1 - arg2);
}

webMEDIX
@webMEDIX
May 20 2016 01:22
@ndburrus inside would go (1)
Norvin Burrus
@ndburrus
May 20 2016 01:23
@webMEDIX is "1" the number input given in the challenge?
Chris B
@yeti-detective
May 20 2016 01:23
outputs sum & you're outputting the difference
J
@J-Mari
May 20 2016 01:23
no.
item is the number.
arr.push(item);
Norvin Burrus
@ndburrus
May 20 2016 01:23
@webMEDIX @J-Mari ...take a look at the two inputs/variable/s for the nextInLine function
Michael
@michaeldiegogil
May 20 2016 01:24
but what am i typing wrong
this is my code
function functionWithArgs(arg1, arg2) {
console.log(arg1 - arg2);
}
Norvin Burrus
@ndburrus
May 20 2016 01:24
@J-Mari good...that's correct, for the first line of code.... let's move to the next line.... does it make sense so far?
Chris B
@yeti-detective
May 20 2016 01:24
console.log(arg1+arg2)
Michael
@michaeldiegogil
May 20 2016 01:25
omg
@yeti-detective
webMEDIX
@webMEDIX
May 20 2016 01:25
@ndburrus I get it now. Sorry. I was reading wayy wayy too much into it.
Michael
@michaeldiegogil
May 20 2016 01:26
thanks @yeti-detective
CamperBot
@camperbot
May 20 2016 01:26
michaeldiegogil sends brownie points to @yeti-detective :sparkles: :thumbsup: :sparkles:
:cookie: 314 | @yeti-detective |http://www.freecodecamp.com/yeti-detective
Chris B
@yeti-detective
May 20 2016 01:26
@michaeldiegogil see if that works, also don't forget you create a function like var functionWithArgs = function(a, b){}
Norvin Burrus
@ndburrus
May 20 2016 01:26
@webMEDIX ok, super! :+1: does it pass?
Ronique Ricketts
@RoniqueRicketts
May 20 2016 01:26
hello guys
webMEDIX
@webMEDIX
May 20 2016 01:26
just not getting the second half on the shift
Norvin Burrus
@ndburrus
May 20 2016 01:26
@J-Mari ...how about you, are you seeing it?
Michael
@michaeldiegogil
May 20 2016 01:27
@yeti-detective it worked, i feel so freaking dumb. idk why i didnt think to put a + instead of a -
J
@J-Mari
May 20 2016 01:27
@ndburrus I've got the two lines, don't know what I'm supposed to be doing next.
Norvin Burrus
@ndburrus
May 20 2016 01:27
@webMEDIX ok, let's continue on.... you have part of the next line of code already. hint: now you might want to use a variable to capture the removed element! (we are working on the second line...)
Ronique Ricketts
@RoniqueRicketts
May 20 2016 01:28
for repeat a string repeat a string why can't I return str.repeat(num);
Chris B
@yeti-detective
May 20 2016 01:28
@michaeldiegogil it happens to us all
Norvin Burrus
@ndburrus
May 20 2016 01:29
@webMEDIX you had this piece of the second line previously...
arr.shift();
Ronique Ricketts
@RoniqueRicketts
May 20 2016 01:29
function repeatStringNumTimes(str, num) {
  // repeat after me
  return str.repeat(num);
}

repeatStringNumTimes("abc", 3);
why can't this work?
Norvin Burrus
@ndburrus
May 20 2016 01:29
@webMEDIX are you thinking about using a var/iable?
webMEDIX
@webMEDIX
May 20 2016 01:29
@ndburrus yes and I tried the variables. None of them seemed to work
Norvin Burrus
@ndburrus
May 20 2016 01:30
@webMEDIX well, that may be a result of how the var was used... the second line we have returns a result, right?
webMEDIX
@webMEDIX
May 20 2016 01:31
@ndburrus right
Norvin Burrus
@ndburrus
May 20 2016 01:31
@webMEDIX ok, what would you want to do with that result? hint (from instructions): "The nextInLine function should then return the element that was removed."
Chris B
@yeti-detective
May 20 2016 01:31
@RoniqueRicketts that works fine in https://repl.it/CTF2
Ronique Ricketts
@RoniqueRicketts
May 20 2016 01:31
I did that and it says that its incorrect for the given challenge
webMEDIX
@webMEDIX
May 20 2016 01:32
@ndburrus hoping to return the element that was removed, I think
Norvin Burrus
@ndburrus
May 20 2016 01:32
@webMEDIX excellent! so, how would we do that? right now, the shift method has a result that nobody knows about...
Matthew Hand
@mmhand123
May 20 2016 01:33
@RoniqueRicketts just returning str.repeat doesn't handle the case of negative numbers
webMEDIX
@webMEDIX
May 20 2016 01:33
@ndburrus so the item vairiable should be re-added
Chris B
@yeti-detective
May 20 2016 01:34
@mmhand123 @RoniqueRicketts yeah, nailed it. One of the tests is for -2 ,and str.repeat returns an error for negative numbers
Norvin Burrus
@ndburrus
May 20 2016 01:34
@webMEDIX we're done with item. it was added to the end of the array. we are now concerned with the element that is removed from the front of the array (which has nothing to do with item).... the item that is removed from the front of the array is produced by the shift method. we just need to return that value to meet the challenge requirement, right?
webMEDIX
@webMEDIX
May 20 2016 01:35
@ndburrus yeah so I am lost
Norvin Burrus
@ndburrus
May 20 2016 01:36
@webMEDIX hmmm... slow down, relax, and reread the above comment/s....
webMEDIX
@webMEDIX
May 20 2016 01:36
@ndburrus yeah so where do I get the var for that
Norvin Burrus
@ndburrus
May 20 2016 01:37
@webMEDIX can we create one?
@webMEDIX or one might be able to just return the value?
webMEDIX
@webMEDIX
May 20 2016 01:37
@ndburrus I dont see why not. But I thought we had to do it all in the function
Norvin Burrus
@ndburrus
May 20 2016 01:38
@webMEDIX hmmm... good thought... can we assign the function value (result) to the var/iable you mentioned getting? ...and possibly ten returning the variable?
Samuel Palmeira
@Inginex
May 20 2016 01:38
anyone can help me in a search input ?
webMEDIX
@webMEDIX
May 20 2016 01:39
@ndburrus Not following you.
Norvin Burrus
@ndburrus
May 20 2016 01:39
@webMEDIX ok, the shift method has the value we need, correct?
webMEDIX
@webMEDIX
May 20 2016 01:40
@ndburrus yes
Chris B
@yeti-detective
May 20 2016 01:40
@Inginex sup?
Norvin Burrus
@ndburrus
May 20 2016 01:40
@webMEDIX is there an easy way to get that value? hint: the instructions use the word "return" (any significance?)
Samuel Palmeira
@Inginex
May 20 2016 01:40
@yeti-detective sup :D
Chris B
@yeti-detective
May 20 2016 01:40
@Inginex What do you need for your search input?
Samuel Palmeira
@Inginex
May 20 2016 01:41
@yeti-detective i need a tip for the search of this project http://codepen.io/inginex/full/XdLeLd/
webMEDIX
@webMEDIX
May 20 2016 01:42
@ndburrus so we would use the return:arr.shift;
Norvin Burrus
@ndburrus
May 20 2016 01:42
@webMEDIX we can try that conceptually. but, what is that semi-colon doing in there?
webMEDIX
@webMEDIX
May 20 2016 01:43
@ndburrus yeah I do that all the time. Sorry
Norvin Burrus
@ndburrus
May 20 2016 01:43
@webMEDIX did you try it?
Chris B
@yeti-detective
May 20 2016 01:43
@Inginex scroopynoopers is a valid channel, which I only know because I used it to test mine thinking, 'there is no way someone took the name scroopynoopers'
Michael
@michaeldiegogil
May 20 2016 01:44
ok these instructions keep confusing me

Instructions
Declare a local variable myVar inside myLocalScope. Run the tests and then follow the instructions commented out in the editor.

Hint
Refreshing the page may help if you get stuck.

webMEDIX
@webMEDIX
May 20 2016 01:44
@ndburrus yep. no dice
Moisés Man
@moigithub
May 20 2016 01:44
@webMEDIX shift is a method.. so need ()
Norvin Burrus
@ndburrus
May 20 2016 01:44
@webMEDIX ok, no worries. might a var/iable be useful here? (and then we could simply return the variable)
webMEDIX
@webMEDIX
May 20 2016 01:45
@ndburrus So what are we trying to claim.
J
@J-Mari
May 20 2016 01:45

Well I've got
arr.push(item);
arr.shift();

and it's telling me that I'm missing something else.

nextInLine([2], 1) should return 2
nextInLine([5,6,7,8,9], 1) should return 5
Clay Walter
@ClayWalter
May 20 2016 01:45
Can I get some help on Global Scope and Functions?

// Declare your variable here
var myGlobal = 10;

function fun1() {
  oppsGlobal = 5;// Assign 5 to oopsGlobal Here

}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
Moisés Man
@moigithub
May 20 2016 01:46
@J-Mari shift remove the first array element..but also give back the removed element
u need to return that removed element
Norvin Burrus
@ndburrus
May 20 2016 01:46
@webMEDIX well, we could assign the function/result to a variable, then return the variable to satisfy the requirement, make sense?
J
@J-Mari
May 20 2016 01:46
So I should be returning what I've shifted?
Stephen James
@sjames1958gm
May 20 2016 01:46
@Inginex What isn't happening?
Moisés Man
@moigithub
May 20 2016 01:46
:+1: @J-Mari
Samuel Palmeira
@Inginex
May 20 2016 01:46
@yeti-detective I think you don't understand very well, let me try to explain, I need to create a search system that shows only the item fetched and hide the other items, do you have any tips for what I can do this? =/
J
@J-Mari
May 20 2016 01:47
@moigithub Returning what I've shifted, by literally "return ar..shift();" makes everything go wrong. ): What am I doing.
Moisés Man
@moigithub
May 20 2016 01:47
@J-Mari post ALL ur modified code
webMEDIX
@webMEDIX
May 20 2016 01:47
@ndburrus yeah but where are we getting the var name from
Norvin Burrus
@ndburrus
May 20 2016 01:48
@webMEDIX it's your call. what should we name it?
Keenen Garnett
@Wallyw4
May 20 2016 01:48
If your having to hard of a time with the algorithm challenges is that this sites way of telling you your not ready?
Stephen James
@sjames1958gm
May 20 2016 01:48
@Inginex Are you wanting to hide the ones that are not selected on enter?
Samuel Palmeira
@Inginex
May 20 2016 01:49
@sjames1958gm exactly
Norvin Burrus
@ndburrus
May 20 2016 01:49
@J-Mari might a variable be useful?
J
@J-Mari
May 20 2016 01:49
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  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));
Chris B
@yeti-detective
May 20 2016 01:50
@Inginex when you post the search results, use the jQuery .remove() on the your main <ul>?
J
@J-Mari
May 20 2016 01:50
thanks @ndburrus
CamperBot
@camperbot
May 20 2016 01:50
j-mari sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 375 | @ndburrus |http://www.freecodecamp.com/ndburrus
J
@J-Mari
May 20 2016 01:50
thanks @moigithub
CamperBot
@camperbot
May 20 2016 01:50
j-mari sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1194 | @moigithub |http://www.freecodecamp.com/moigithub
Stephen James
@sjames1958gm
May 20 2016 01:50
@Inginex Give each li the id of the user and then you can go through the list and set display: none for those that don't match.
Norvin Burrus
@ndburrus
May 20 2016 01:50
@J-Mari super! does it pass?
Chris B
@yeti-detective
May 20 2016 01:50
@Inginex you probably want to put the current <ul> in a div so you have something to append to after you remove it, though
J
@J-Mari
May 20 2016 01:51
No, it doesn't. After returning "arr.shift();" everything has become incorrect again, after running the test.
Moisés Man
@moigithub
May 20 2016 01:51
@J-Mari u "shift"ing twice!! :) remove the first one
J
@J-Mari
May 20 2016 01:51
@moigithub oh my god.
it passes.
whew.
Norvin Burrus
@ndburrus
May 20 2016 01:52
@J-Mari take your foot off the gas (shift) :)
J
@J-Mari
May 20 2016 01:52
@ndburrus :P
Norvin Burrus
@ndburrus
May 20 2016 01:52
@webMEDIX how are we doing?
Samuel Palmeira
@Inginex
May 20 2016 01:52

@yeti-detective @sjames1958gm but like some that can works ?

var search = $("input").val();
$("input").keypress(function(e){
if (e.which == 13){
$("#user:contains('"+search+"')").show();

        }
J
@J-Mari
May 20 2016 01:53
@webMEDIX Hey, how're you doing?
webMEDIX
@webMEDIX
May 20 2016 01:53
@ndburrus just tried var nextInLine2 = arr.shift();
no dice
Norvin Burrus
@ndburrus
May 20 2016 01:53
@J-Mari kudos to you!! :sparkles:
Keenen Garnett
@Wallyw4
May 20 2016 01:53
I got through the first challenge fine the second one I asked for help the third one I'm stumped its just discouraging. @ndburrus
J
@J-Mari
May 20 2016 01:54
@webMEDIX Hey! Definitely overcomplicating stuff.
@Wallyw4 Never give up, always ask for help. Even if it's just for extra explanation! And ask about everything because no question is stupid when you're learning!
Norvin Burrus
@ndburrus
May 20 2016 01:54
@Wallyw4 moment... @webMEDIX are you returning the created variable? can you post your code?
webMEDIX
@webMEDIX
May 20 2016 01:55

function nextInLine(arr, item) {
arr.push(item);
arr.shift();

return item; // Change this line
}
var nextInLine2=arr.shift();
// 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));

Norvin Burrus
@ndburrus
May 20 2016 01:56
@webMEDIX why are we returning item? and, there are 2 shift methods being implemented?
@webMEDIX ok, lets add clarity. set your variable to the first shift method. remove the 2nd shift method. return the variable. go!
Chris B
@yeti-detective
May 20 2016 01:57
@J-Mari is right @Wallyw4 ! Never give up! You can do it!
J
@J-Mari
May 20 2016 01:58
So I've skipped the challenge Word Blanks, I don't think I'm understanding what to do correctly?
webMEDIX
@webMEDIX
May 20 2016 01:58
@J-Mari conctanate
J
@J-Mari
May 20 2016 01:59
I've done that but incorrectly.
Haha.
Norvin Burrus
@ndburrus
May 20 2016 01:59
@J-Mari basically, you're building an outpt string.... using the variables given.... create a sentence that you'd like to build.... (start there)
Chris B
@yeti-detective
May 20 2016 01:59
@J-Mari it's helpful to me to use sites like labs.codecademy.com and repl.it to test out code that isnt't working
J
@J-Mari
May 20 2016 01:59
I've heard codeacademy tutorials are also quite helpful!
Norvin Burrus
@ndburrus
May 20 2016 02:00
@Wallyw4 which challenge, please?
Wendy Medeiros
@wendyr21
May 20 2016 02:00
help create array
CamperBot
@camperbot
May 20 2016 02:00
no wiki entry for: create array
webMEDIX
@webMEDIX
May 20 2016 02:00
@J-Mari dont forget the spaces
Norvin Burrus
@ndburrus
May 20 2016 02:00
@webMEDIX how are we doing?
J
@J-Mari
May 20 2016 02:00
@webMEDIX I fixed those earlier but no avail.
@ndburrus Yep, have a sentence with concatenated words and spaces.
Stephen James
@sjames1958gm
May 20 2016 02:01
@Inginex Maybe something like this: (you'll need to move user as an id to a class and change your css)
    availableTags.forEach(function(tag) {
          if (search === "" || tag === search) {
            $("#" + tag).show();
          } 
          else {
            $("#" + tag).hide();            
          }
Norvin Burrus
@ndburrus
May 20 2016 02:01
@J-Mari ok, so can start building the string? hint: a variable will be useful...
Keenen Garnett
@Wallyw4
May 20 2016 02:01
The palindrome one I'm eating and stuff so I don't have any code but idk it just seems like I didn't learn something or something idk maybe. If I start on it again ill hit you up @ndburrus
webMEDIX
@webMEDIX
May 20 2016 02:02
@ndburrus still lost at this point
@ndburrus think i screwed the pooch here
Norvin Burrus
@ndburrus
May 20 2016 02:02
@webMEDIX ok, post code please.. we'll go line by line. the pooch will be fine in a moment.
Vivek Jadon
@vjadon
May 20 2016 02:04
Testing Objects for Properties
Need help
here is the code
Samuel Palmeira
@Inginex
May 20 2016 02:04
@sjames1958gm thanks stephen i will try
CamperBot
@camperbot
May 20 2016 02:04
inginex sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1181 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Vivek Jadon
@vjadon
May 20 2016 02:04

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

function checkObj(checkProp) {
// Your Code Here
if(myObj.hasOwnProperty(checkProp))
{
return myObj.checkProp;
}

return "Not Found";
}

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

Stephen James
@sjames1958gm
May 20 2016 02:05
@Inginex It looks like your keypress handler is registered 14 times, make sure it isn't inside some loop or callback
Rachel Melville
@rjmelville
May 20 2016 02:05
Looking for some help on 'Return Largest Number in Arrays'. I can't figure out why the reduce method isn't working to flatten the array of arrays...
function largestOfFour(arr) {
  for (var i = 0; i < arr.length; i++) {
    for (var j = 0; j < arr[i].length; j++){
      arr[i].sort(function(a,b) { return (b-a);}).splice(1).reduce(function(a,b) { return a.concat(b);},[]);
      }
  }
  return arr;
}
Norvin Burrus
@ndburrus
May 20 2016 02:05
@vjadon ok, with dot notation you have to be specific - with bracket notation, you can use variables... make sense?
Stephen James
@sjames1958gm
May 20 2016 02:06
@vjadon You can only .checkProp if you are trying to get property name "checkProp" here you want the property where the name is stored in checkProp. That requires different syntax.
Vivek Jadon
@vjadon
May 20 2016 02:06
got it thnx
Samuel Palmeira
@Inginex
May 20 2016 02:07
@sjames1958gm ok
Stephen James
@sjames1958gm
May 20 2016 02:07
@rjmelville Looks like you are reconstructing the arr at each arr[i] - if you are sorting arr[i] why not just pick off the first value.
@rjmelville Also, seems like one loop too many
J
@J-Mari
May 20 2016 02:08
Oh my god.
I had too many spaces and that's why the challenge didn't pass for me.
Are you serious.. lol
@webMEDIX How're you going? Sent you private message. :)
Is this chat room mostly for Challenge related questions (for JS)?
Chris B
@yeti-detective
May 20 2016 02:11
@J-Mari that is my impression, that it's for JS help for challenges
Rachel Melville
@rjmelville
May 20 2016 02:11
@sjames1958gm But don't I need a nested loop in order to sort each nested array?
Norvin Burrus
@ndburrus
May 20 2016 02:12
@vjadon did it pass?
J
@J-Mari
May 20 2016 02:12
@yeti-detective Ah! Okay. Is there a room for JS help in general? Have a non-FCC related problem.
Stephen James
@sjames1958gm
May 20 2016 02:13
@J-Mari Ask away here
webMEDIX
@webMEDIX
May 20 2016 02:13
@J-Mari @yeti-detective I think this is for general js help too
J
@J-Mari
May 20 2016 02:13
@webMEDIX Ah ok, awesome.
Chris B
@yeti-detective
May 20 2016 02:13
@webMEDIX General JavaScript raided my village & killed my family. He will have NO HELP from me.
Stephen James
@sjames1958gm
May 20 2016 02:14
@yeti-detective :+1:
J
@J-Mari
May 20 2016 02:14
@sjames1958gm Oh but it's larger than just a piece of code. It's a whole bundle which I'm looking for explanation with. :(
Stephen James
@sjames1958gm
May 20 2016 02:15
You can PM me
Sometimes the discussion can help others but if it a lot of code, maybe a link?
Samuel Palmeira
@Inginex
May 20 2016 02:21
@sjames1958gm still not work D:
Stephen James
@sjames1958gm
May 20 2016 02:23
@Inginex :(
Michael
@michaeldiegogil
May 20 2016 02:25
Stand in line......any tips, advice....anyone?
webMEDIX
@webMEDIX
May 20 2016 02:25
@michaeldiegogil YEAH, cry
@michaeldiegogil Just finished it
J
@J-Mari
May 20 2016 02:25
@webMEDIX Hahaha.
Michael
@michaeldiegogil
May 20 2016 02:26
@webMEDIX check...whats the next step?
J
@J-Mari
May 20 2016 02:26
@michaeldiegogil Don't overcomplicate it, understand what you need to use first and then know where to implement that.
rphares
@rphares
May 20 2016 02:27
check out push, pop, shift, and unshift... hint: you only need two of those ;) @michaeldiegogil
webMEDIX
@webMEDIX
May 20 2016 02:27
@michaeldiegogil Yeah @J-Mari is absolutley right
rphares
@rphares
May 20 2016 02:27
(sorry, wrong tag)
Moisés Man
@moigithub
May 20 2016 02:27
@Inginex ID's are supposed to be unique
$("#users").append('<li id="user" class="'+ state + '
if u wanna multiple elements have same identifier.. u can use class
$("#users").append('<li class="user '+ state + '
Michael
@michaeldiegogil
May 20 2016 02:28
I guess my problem is the question. i really dont understand what theyre asking for
Norvin Burrus
@ndburrus
May 20 2016 02:29
@webMEDIX .....good for you!! :+1:
Deanna
@DeannaB
May 20 2016 02:29
I am brand new to JS and need some very basic help...how to initialize a variable
Chris B
@yeti-detective
May 20 2016 02:29
@michaeldiegogil try to look at the tests & 'should returns' and then reverse-logic how to get there
Moisés Man
@moigithub
May 20 2016 02:29
@Inginex once u fix that.. u can use ur :contains(...) selector to do ur hide/show
ofc.. u need to hide first everything, n show only the "selected" element
Randy Goldsmith
@Dueldrawer8
May 20 2016 02:30
@DeannaB what part are you on?
Chris B
@yeti-detective
May 20 2016 02:30
@DeannaB var nameYourVariable = 'this initialized value is a string'
Samuel Palmeira
@Inginex
May 20 2016 02:30
@moigithub I had not noticed this o.O
Deanna
@DeannaB
May 20 2016 02:30
Understanding Uninitialized Variables
Norvin Burrus
@ndburrus
May 20 2016 02:30
@DeannaB var a =1;
Randy Goldsmith
@Dueldrawer8
May 20 2016 02:31
@DeannaB what Chris said.. you just declare a variable by using var variableName
then to assign it to something you use the equals (=) sign
Chris B
@yeti-detective
May 20 2016 02:31
@DeannaB var unInVar; // this is an uninitialized variable
Randy Goldsmith
@Dueldrawer8
May 20 2016 02:31
followed by whatever you want to assign it to
@yeti-detective true
Chris B
@yeti-detective
May 20 2016 02:32
@Dueldrawer8 thanks!
CamperBot
@camperbot
May 20 2016 02:32
yeti-detective sends brownie points to @dueldrawer8 :sparkles: :thumbsup: :sparkles:
:cookie: 397 | @dueldrawer8 |http://www.freecodecamp.com/dueldrawer8
Deanna
@DeannaB
May 20 2016 02:32

// Initialize these three variables
var a = "5";
var b = "10";
var c = "I am a";

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";

// Initialize these three variables
var a = "5";
var b = "10";
var c = "I am a";

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";

rphares
@rphares
May 20 2016 02:32
5 and 10 are numbers
Deanna
@DeannaB
May 20 2016 02:32
oops sorry
rphares
@rphares
May 20 2016 02:32
numbers dont need quotes :blush: ;)
Deanna
@DeannaB
May 20 2016 02:32
oh!
ahhhh that was it!
jgoldverg
@jgoldverg
May 20 2016 02:33
the var is just a container u initialized correctly but yea u dont need the quotes
Deanna
@DeannaB
May 20 2016 02:33
@rphares Thank you!
CamperBot
@camperbot
May 20 2016 02:33
deannab sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star2: 4723 | @rphares |http://www.freecodecamp.com/rphares
Deanna
@DeannaB
May 20 2016 02:33
<--- total noob
rphares
@rphares
May 20 2016 02:33
sure thing-- you can have numbers in quotes... but then they are strings, not numbers :blush: totally confusing, but it gets easier
(also noob! :blush: nice to meet you~)
jgoldverg
@jgoldverg
May 20 2016 02:33
white belt for life
Deanna
@DeannaB
May 20 2016 02:33
@yeti-detective @ndburrus @Dueldrawer8 Thank you all also!
CamperBot
@camperbot
May 20 2016 02:33
deannab sends brownie points to @yeti-detective and @ndburrus and @dueldrawer8 :sparkles: :thumbsup: :sparkles:
:cookie: 315 | @yeti-detective |http://www.freecodecamp.com/yeti-detective
:cookie: 398 | @dueldrawer8 |http://www.freecodecamp.com/dueldrawer8
:cookie: 376 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
May 20 2016 02:33

@DeannaB JavaScript Variables , tutorialspoint, JavaScript Variables, {ref: http://www.tutorialspoint.com/javascript/javascript_variables.htm }
Like many other programming languages, JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container.

Before you use a variable in a JavaScript program, you must declare it. Variables are declared with the var keyword as follows.

<script type="text/javascript">
<!-- var money; var name; //-->
</script>

Deanna
@DeannaB
May 20 2016 02:34
@rphares Nice to meet others! I'm just starting on JS--so far I have some HTML, CSS, and SQL under my belt. JS is a bit of a step up, it feels like. :)
jgoldverg
@jgoldverg
May 20 2016 02:34
actually question so declaring a var would having different data types in it so number string char affect how much memory is allocated for it?
Wendy Medeiros
@wendyr21
May 20 2016 02:36
function factorialize(num) {
var sum = 1;
for (i = 1; i <=num ; i++){
sum = sum * i;
}
num = sum;
return num;
}
factorialize(5);
is there a better way of writing this:
function factorialize(num) { var sum = 1; for (i = 1; i <=num ; i++){ sum = sum * i; } num = sum; return num; } factorialize(5);
Stephen James
@sjames1958gm
May 20 2016 02:37
@Inginex One issue is that the user that you added to class is mixed case, but your local array is lowercase. Try using links variable for the class.
rphares
@rphares
May 20 2016 02:37
i had a total zero when i started here-- as in, never even owned a smart phone, no personal computer or free internet for most of the last decade (lived abroad). FCC is pretty great-- I'm doing my best to catch up, but yeah... JS can a lot :blush: @DeannaB . But its sure fun! In no time, you'll be helping me~
Moisés Man
@moigithub
May 20 2016 02:37
@Inginex
.append('<li class="user '+ state <<<
user is a class soo should be $(".user:contains( .... etc <-- with a dot
by default all ur "users" are shown...
so need to hide all first...
$(".user").hide();
$(".user:contains(.... etc").show()
Stephen James
@sjames1958gm
May 20 2016 02:37
These two lines aren't needed just return sum;
num = sum;
return num;
@wendyr21 :point_up:
Chris B
@yeti-detective
May 20 2016 02:38
@wendyr21 are you trying to get the factorial of num? I AM TOTALLY WORKING ON FACTORIALS RIGHT NOW!
Wendy Medeiros
@wendyr21
May 20 2016 02:39
@yeti-detective :) yep. Sorrry if i put in an answer.. mines is probably wrong way anyways lol
Deanna
@DeannaB
May 20 2016 02:39
@rphares Wow, that's awesome! My story is that after living in Silicon Valley for several years, I didn't get started learning to code until I left the area about a year and a half ago. I had to learn some HTML and SQL for something at work, and from there I just wanted to keep learning more.
Wendy Medeiros
@wendyr21
May 20 2016 02:39
@sjames1958gm tx :)
CamperBot
@camperbot
May 20 2016 02:39
wendyr21 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1182 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
May 20 2016 02:39
@wendyr21 - here is a way that uses recursion
function factorialize(num) {
   if (num <= 1) return 1;
   return num * factorialize(num - 1);
  }
factorialize(5);
Chris B
@yeti-detective
May 20 2016 02:40
@wendyr21 This is actually how I learned about recursive functions. Yeah, what @sjames1958gm said
Wendy Medeiros
@wendyr21
May 20 2016 02:40
hahahahah i have never used recursive though i love how it looks cleaner
Moisés Man
@moigithub
May 20 2016 02:40
@Inginex and... var search = $("input").val();
should be inside ur IF condition when Enter Key (13) is pressed.. so it takes the new value
Chris B
@yeti-detective
May 20 2016 02:40
@wendyr21 codecademy has a good JavaScript lesson on recursive functions
Wendy Medeiros
@wendyr21
May 20 2016 02:40
thanks!!!! i will need to check it out :)
Samuel Palmeira
@Inginex
May 20 2016 02:42
@moigithub now he's hiding, but does not show the user selected
Moisés Man
@moigithub
May 20 2016 02:42
@Inginex wrong order :) hide() first
Samuel Palmeira
@Inginex
May 20 2016 02:43
@moigithub Jesus Christ that stupid error haha
@moigithub Thanks, you helped me too much Moisés. o/
CamperBot
@camperbot
May 20 2016 02:44
inginex sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1196 | @moigithub |http://www.freecodecamp.com/moigithub
Moisés Man
@moigithub
May 20 2016 02:44
:+1: :)
Islam Ibakaev
@dagman
May 20 2016 02:45
or this
function factorialize(num) {
  return (num <= 1) ?  1 : num * factorialize(num - 1);
}
tesfie
@tesfie
May 20 2016 02:45
hi guys what is the problem with this one
var a=7;
var b=a;
Islam Ibakaev
@dagman
May 20 2016 02:45
no problem
tesfie
@tesfie
May 20 2016 02:46
@dagman but it does not work out
Islam Ibakaev
@dagman
May 20 2016 02:46
what the error you get returned?
Wendy Medeiros
@wendyr21
May 20 2016 02:46
put in your function:)
tesfie
@tesfie
May 20 2016 02:46
b should have a value of 7
Wendy Medeiros
@wendyr21
May 20 2016 02:46
so we can view it
Moisés Man
@moigithub
May 20 2016 02:47
thats all the code ?? @tesfie
Stephen James
@sjames1958gm
May 20 2016 02:47
@dagman I think you have your test wrong (num > 1)
@tesfie Try refresh?
Wendy Medeiros
@wendyr21
May 20 2016 02:47
@sjames1958gm how long have you been programming? you know alot! :)
tesfie
@tesfie
May 20 2016 02:47
i did
Stephen James
@sjames1958gm
May 20 2016 02:47
1975
tesfie
@tesfie
May 20 2016 02:48
@sjames1958gm i did
Stephen James
@sjames1958gm
May 20 2016 02:48
This web stuff is where I am new.
Moisés Man
@moigithub
May 20 2016 02:48
so u started with fortran,cobol n all those stuff :) @sjames1958gm
tesfie
@tesfie
May 20 2016 02:49
@moigithub do u have any idea where the problem is
var a=7;
var b=a;
Moisés Man
@moigithub
May 20 2016 02:49
that 2 lines is all the code u have?? or there r more ? @tesfie
tesfie
@tesfie
May 20 2016 02:49
@moigithub that is it
Stephen James
@sjames1958gm
May 20 2016 02:50
@tesfie this is the one?
// Setup
var a;
var b = 2;

// Only change code below this line

var a = 7;
var b = a;
Islam Ibakaev
@dagman
May 20 2016 02:50
@tesfie what's the name of challenge?
Stephen James
@sjames1958gm
May 20 2016 02:50
@tesfie Try reset and re-enter it looks right
DwayneCode
@DwayneCode
May 20 2016 02:50
hi everyone, I need help with the Testing Objects for Properties challenge
tesfie
@tesfie
May 20 2016 02:50
132
@sjames1958gm ok
Islam Ibakaev
@dagman
May 20 2016 02:51
@tesfie :worried:
tesfie
@tesfie
May 20 2016 02:51
@dagman 132
Moisés Man
@moigithub
May 20 2016 02:51
do not touch the lines above :) @tesfie
Islam Ibakaev
@dagman
May 20 2016 02:51
@tesfie name...
rphares
@rphares
May 20 2016 02:51
(there arent numbers, @tesfie -- those are your points! :) challenges have names, not numbers :blush: )
Stephen James
@sjames1958gm
May 20 2016 02:52
I am on challenge 1182 :)
Moisés Man
@moigithub
May 20 2016 02:52
about @rphares
CamperBot
@camperbot
May 20 2016 02:52
:star2: 4723 | @rphares |http://www.freecodecamp.com/rphares
Moisés Man
@moigithub
May 20 2016 02:52
wonder if that challenge number exist :P
DwayneCode
@DwayneCode
May 20 2016 02:52

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

function checkObj(checkProp) {
// Your Code Here
for (checkProp in myObj) {
if (myObj.hasOwnProperty(checkProp)) {

}

}
return checkProp;

}

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

Stephen James
@sjames1958gm
May 20 2016 02:52
@DwayneCode
help format
CamperBot
@camperbot
May 20 2016 02:52
no wiki entry for: formate
Stephen James
@sjames1958gm
May 20 2016 02:52
help format
CamperBot
@camperbot
May 20 2016 02:52

: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

rphares
@rphares
May 20 2016 02:53
lol, uh-oh .. anyone wanna help me on challenge 4723? :|
Islam Ibakaev
@dagman
May 20 2016 02:53
@moigithub maybe she did one challenge 4723 times? :worried:
Moisés Man
@moigithub
May 20 2016 02:53
^_^
DwayneCode
@DwayneCode
May 20 2016 02:54
@sjames1958gm well i'm at a lost on how to proceed. I think i need a for in loop
Islam Ibakaev
@dagman
May 20 2016 02:54
sorry for sarcasm :worried:
rphares
@rphares
May 20 2016 02:54
lol, no sorries necessary :blush:
Islam Ibakaev
@dagman
May 20 2016 02:54
rollem
CamperBot
@camperbot
May 20 2016 02:54
Islam Ibakaev
@dagman
May 20 2016 02:55
:smile:
rphares
@rphares
May 20 2016 02:55
(okay, maybe now you need to say sorry... :wink: )
Moisés Man
@moigithub
May 20 2016 02:55
instead of :sparkles: points probably would be good to add :tea: or :coffee: to :cookie: points :) and :cake: like a badge system
Islam Ibakaev
@dagman
May 20 2016 02:56
@rphares what do you think about my really ugly portfolio? :worried:
rphares
@rphares
May 20 2016 02:56
haha-- you still need some placeholders and the like, correct?
Islam Ibakaev
@dagman
May 20 2016 02:58
yeah...
:worried:
DwayneCode
@DwayneCode
May 20 2016 02:58
can anyone give me some pointers on the Testing Objects for Properties challenge?
Islam Ibakaev
@dagman
May 20 2016 02:58
no
rphares
@rphares
May 20 2016 02:59
@DwayneCode , easier to get help if you format your code-- thats why they posted those instruction, but--
Islam Ibakaev
@dagman
May 20 2016 02:59
:worried:
rphares
@rphares
May 20 2016 02:59
you dont need for (checkProp in myObj) {
and
use bracket notation for the return
those two things oughta sort a lot of the issues, @DwayneCode ~
Islam Ibakaev
@dagman
May 20 2016 03:00
@rphares wanna take a look at your portfolio :worried:
DwayneCode
@DwayneCode
May 20 2016 03:00
ok let me make changes
Islam Ibakaev
@dagman
May 20 2016 03:00
let me let me :smile:
rphares
@rphares
May 20 2016 03:00
sure thing-- @DwayneCode , if you paste again, though-- do try and format :blush:
explain format
CamperBot
@camperbot
May 20 2016 03:00

: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

rphares
@rphares
May 20 2016 03:00
;)
odiscious
@odiscious
May 20 2016 03:00
Has anyone completed chunkArrayInGroups(arr, size)
?
DwayneCode
@DwayneCode
May 20 2016 03:00
@rphares will do
Islam Ibakaev
@dagman
May 20 2016 03:00
@odiscious me
odiscious
@odiscious
May 20 2016 03:01
@dagman great!
Here's what I've got:

function chunkArrayInGroups(arr, size) {
// Break it up.
var x = new Array();
var firstSlice = 0;
var secondSlice = size;
var count = 0;
for (var i = 0; i < arr.length; i++) {
while(count < size){
count++;
x.push(new Array(size));
//console.log("slice: " + count + arr.slice(firstSlice,secondSlice));
x[i].push(String(arr.slice(firstSlice, secondSlice)));
i++;
firstSlice += size;
secondSlice += size;
}

}
//console.log(x[0]);
//console.log(x1);
console.log("length: " + x.length);
return x;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);

Islam Ibakaev
@dagman
May 20 2016 03:01
@odiscious omg
too many words
odiscious
@odiscious
May 20 2016 03:01
hahaha
Islam Ibakaev
@dagman
May 20 2016 03:02
@odiscious
function chunkArrayInGroups(arr, size) {
  return arr.length > size ? [arr.splice(0, size)].concat(chunkArrayInGroups(arr, size)) : [arr];
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3); // returns [[0, 1, 2], [3, 4, 5]]
:smile:
like a boss :smile:
DwayneCode
@DwayneCode
May 20 2016 03:02
@dagman how do you post your code like that?
Islam Ibakaev
@dagman
May 20 2016 03:02
it's a magic...
help format @DwayneCode
CamperBot
@camperbot
May 20 2016 03:03
no wiki entry for: format @dwaynecode
Islam Ibakaev
@dagman
May 20 2016 03:03
ok...
help format
CamperBot
@camperbot
May 20 2016 03:03

: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

Islam Ibakaev
@dagman
May 20 2016 03:04

@DwayneCode

no wiki entry for: format @dwaynecode
i were trying to format you :smile: lol

Angel
@Anjali-Pai
May 20 2016 03:04
Onobonm high-minded linking obononobnobmoobobmoobobmoboooobmoboboobobmoobmobmobobmobmobmoboboboblnlnlnlnlnnonononlnlnlnlnononknlnonlnonononnononnnonoononlnnon.onononmnononnonononmooonnonononmoonononoonnnonnobmonmnobnmooobobobobobobooonobmonoon
DwayneCode
@DwayneCode
May 20 2016 03:04
lol
Islam Ibakaev
@dagman
May 20 2016 03:04
@Anjali-Pai this is perfect sentence man :sparkles:
Keenen Garnett
@Wallyw4
May 20 2016 03:05
@ndburrus after all day of racking my brain i did it with no help i did the algorithm challenge i was stuck on I DID IT!!! thankyou @ndburrus
CamperBot
@camperbot
May 20 2016 03:05
wallyw4 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 377 | @ndburrus |http://www.freecodecamp.com/ndburrus
Islam Ibakaev
@dagman
May 20 2016 03:05
@Anjali-Pai not many keys on your keyboard :smile: right
@Wallyw4 congratulations :sparkles:
Norvin Burrus
@ndburrus
May 20 2016 03:06
@Wallyw4 you are top of the food chain!! kudos to you!! :+1:
odiscious
@odiscious
May 20 2016 03:06
@dagman were you trying to create a stack overflow?
Keenen Garnett
@Wallyw4
May 20 2016 03:06
thank you all that challenge had me second guessing my intelligence lol thank yoou all so much :)
odiscious
@odiscious
May 20 2016 03:07
arr.splice(0, size)].concat(chunkArrayInGroups(arr, size))
Islam Ibakaev
@dagman
May 20 2016 03:07
@odiscious lol wat?
odiscious
@odiscious
May 20 2016 03:07
@dagman arr.splice(0, size)].concat(chunkArrayInGroups(arr, size))
Islam Ibakaev
@dagman
May 20 2016 03:07
@odiscious and?
odiscious
@odiscious
May 20 2016 03:07
calling the same function within itself, passing the same values
Islam Ibakaev
@dagman
May 20 2016 03:07
@odiscious not the same :smile:
@odiscious take a look at .splice() method :smile:
Norvin Burrus
@ndburrus
May 20 2016 03:08
@Wallyw4 your intelligence is world class! ...we all need to grow at times... :)
odiscious
@odiscious
May 20 2016 03:08
@dagman I'm digging through it now
@dagman clearly I have some reading to do.. Thank you, for the help.. if you get bored, I'd like to know why my code doesn't work..
CamperBot
@camperbot
May 20 2016 03:09
odiscious sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:cookie: 570 | @dagman |http://www.freecodecamp.com/dagman
Islam Ibakaev
@dagman
May 20 2016 03:10
@odiscious can u post again?
odiscious
@odiscious
May 20 2016 03:10

function chunkArrayInGroups(arr, size) {
// Break it up.
var x = new Array();
var firstSlice = 0;
var secondSlice = size;
var count = 0;
for (var i = 0; i < arr.length; i++) {
while(count < size){
count++;
x.push(new Array(size));
//console.log("slice: " + count + arr.slice(firstSlice,secondSlice));
x[i].push(String(arr.slice(firstSlice, secondSlice)));
i++;
firstSlice += size;
secondSlice += size;
}

}
//console.log(x[0]);
//console.log(x[1]);
console.log("length: " + x.length);
return x;
}

DwayneCode
@DwayneCode
May 20 2016 03:12
@rphares thank you
CamperBot
@camperbot
May 20 2016 03:12
dwaynecode sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star2: 4724 | @rphares |http://www.freecodecamp.com/rphares
rphares
@rphares
May 20 2016 03:12
you got it? congrats and happy coding, @DwayneCode ! :)
DwayneCode
@DwayneCode
May 20 2016 03:13
yeah I did :+1:
Michael
@michaeldiegogil
May 20 2016 03:13
stand in line help!!
arr.push(item);
var shifted = arr.shift();
return shifted; // Change this line
}
I dont know what I am typing wrong.
Donald
@codescout811
May 20 2016 03:15
Assignment with a return value...please help me here.
Call the processArg function with an argument of 7 and assign its return value to the variable processed.
Michael
@michaeldiegogil
May 20 2016 03:15
im getting error that arr.push is not a function
Jareth MacArthur
@Jtmaca9
May 20 2016 03:15
@codescout811 can you post some code? use the ``` code formatter
OneRandomJamie
@OneRandomJamie
May 20 2016 03:16
What is the variable supposed to be defined as in the Local Scope and Function challenge?
rphares
@rphares
May 20 2016 03:16
myVar, if i recall,
but what you define ti as doesn't matter at all...
(the name may not either, gimme a sec to look)
yeah, myVar
Donald
@codescout811
May 20 2016 03:17

// Example
var changed = 0;

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

changed = change(10);

// Setup
var processed = (0,2);

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

// Only change code below this line

Instructions
Call the processArg function with an argument of 7 and assign its return value to the variable processed.

OneRandomJamie
@OneRandomJamie
May 20 2016 03:17
@rphares I put cat at one point and it said it was undefined still.
rphares
@rphares
May 20 2016 03:17
@OneRandomJamie , can you paste your formatted code please? :blush:
Jareth MacArthur
@Jtmaca9
May 20 2016 03:18
@OneRandomJamie type first and then code on the next line followed by anothr
` without the spaces :)
OneRandomJamie
@OneRandomJamie
May 20 2016 03:18
@rphares Thank you but never mind apparently i was supposed to backspace something.
CamperBot
@camperbot
May 20 2016 03:18
onerandomjamie sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star2: 4725 | @rphares |http://www.freecodecamp.com/rphares
rphares
@rphares
May 20 2016 03:19
@codescout811 , two steps--
we are gonna assign the value to the variable processed right? for practice-- how do you assign the value 2 to processed?
deebsFCC
@deebsFCC
May 20 2016 03:22
@kutsuya1 That is redonk, do you have a link to it?
Islam Ibakaev
@dagman
May 20 2016 03:23
@odiscious you solution was hardly readable to be honestly so i made another one ease to read i believe so
function chunkArrayInGroups(arr, size) {
  var temp = [];
  var result = [];

  for (var i = 0; i < arr.length; a++) {
    if (i % size !== size - 1)
      temp.push(arr[i]);
    else {
      temp.push(arr[i]);
      result.push(temp);
      temp = [];
    }
  }

  if (temp.length !== 0)
    result.push(temp);
  return result;    
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3);
Norvin Burrus
@ndburrus
May 20 2016 03:23
@codescout811 you are only changing code where indicated (below the comment line). these are the instructions "Instructions
Call the processArg function with an argument of 7 and assign its return value to the variable processed." do you understand what is necessary? hint: basically you'll have an assignment, and a function call (with an argument) :) additional note/s: your function, argument, and return var/iable are defined for you...
Donald
@codescout811
May 20 2016 03:26
Thanks @ndburrus I'm working on it. It's hard coz I stop learning coding for 3 months . just back today.
CamperBot
@camperbot
May 20 2016 03:26
codescout811 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 378 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
May 20 2016 03:26
@codescout811 no worries - just like riding a bicycle.... you'll be fine.... :+1: and, welcome back!!
Donald
@codescout811
May 20 2016 03:27
@ndburrus Thanks,,,Ilove this community. I love to learn more! yoohooo I got It!
CamperBot
@camperbot
May 20 2016 03:27
codescout811 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: codescout811 already gave ndburrus points
Norvin Burrus
@ndburrus
May 20 2016 03:28
@codescout811 you're the greatest.... :sparkles:
hnryzhng
@hnryzhng
May 20 2016 03:29
can anyone give me some advice on how to construct the expand/collapse all button using jQuery on the Freecodecamp Map page?
robertky
@robertky
May 20 2016 03:33
So, when I use this code, it won't remove "null" from the array. I really don't see why. Can anyone help?:

function bouncer(arr) {
// Don't show a false ID to this bouncer.
for(var x=0;x<arr.length;x++)
{
if(arr[x]===false || arr[x]==="" || arr[x]===null || arr[x]===0 || arr[x]===undefined || arr[x]===NaN)
{
arr.splice(x, 1);
x--;
}
}
return arr;
}

bouncer([1, null, NaN, 2, undefined]);

Anthony Hernandez
@tacodestroyer
May 20 2016 03:33
anyone have a second to answer a question on the "return a value from a function with return" challenge?
robertky
@robertky
May 20 2016 03:33
It should remove null, but it leaves it in, but removes NaN and undefined fine.
Norvin Burrus
@ndburrus
May 20 2016 03:33
@OneRandomJamie did you resolve Local Scope and Functions ?
odiscious
@odiscious
May 20 2016 03:35
@dagman no worries... I'm going to have to keep digging my heels in. There's some particulars about javascript that I'm just not picking up; especially, with accessing arrays and manipulating data.
Thanks again!
Norvin Burrus
@ndburrus
May 20 2016 03:35
@tacodestroyer ...sure... what is the question, please?
robertky
@robertky
May 20 2016 03:35
Anyone?
Chris Lacaille
@ChrisL108
May 20 2016 03:36
Why does this cut off the last number if it is smaller than 'size' variable
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var newArr = [];
  for (var i=0 ; i <= arr.length ; i++) {
    newArr.push(arr.splice(0, size));
  }
  return newArr;
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3);
* If what is left over in the arr is less then size
Anthony Hernandez
@tacodestroyer
May 20 2016 03:36
@ndburrus I passed the challenge but I'm not sure why my output gave timesfive(5)=== 25

// Example
function minusSeven(num) {
return num - 7;
}

// Only change code below this line
function timesFive(num) {
return num * 5;
}

timesFive(0);

Donald
@codescout811
May 20 2016 03:38
@ndburrus Thanks a million....
CamperBot
@camperbot
May 20 2016 03:38
codescout811 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: codescout811 already gave ndburrus points
daiwik
@daiwik
May 20 2016 03:38
This message was deleted
robertky
@robertky
May 20 2016 03:39

function bouncer(arr) {
// Don't show a false ID to this bouncer.
for(var x=0;x<arr.length;x++)
{
if(arr[x]===false || arr[x]==="" || arr[x]===null || arr[x]===0 || arr[x]===undefined || arr[x]===NaN)
{
arr.splice(x, 1);
x--;
}
}
return arr;
}

bouncer([1, null, NaN, 2, undefined]);

Does anyone know why the above wont remove null?
Donald
@codescout811
May 20 2016 03:39
@tacodestroyer Thanks for the tips.
CamperBot
@camperbot
May 20 2016 03:39
codescout811 sends brownie points to @tacodestroyer :sparkles: :thumbsup: :sparkles:
:cookie: 185 | @tacodestroyer |http://www.freecodecamp.com/tacodestroyer
robertky
@robertky
May 20 2016 03:39
It removes everything else fine.
Norvin Burrus
@ndburrus
May 20 2016 03:40
@codescout811 you're welcome! anytime.... :sparkles:
Peter Weinberg
@no-stack-dub-sack
May 20 2016 03:40
Can someone tell me if the Factorialize a Number algorithm challenge uses a loop? Not sure if I'm overthinking this or not...
Norvin Burrus
@ndburrus
May 20 2016 03:40
@tacodestroyer i get o return...
Marty
@martyav
May 20 2016 03:40
@robertky i had a similar problem when working on this problem. this helped me understand why trying to get rid of null was so annoyingly difficult: https://www.sitepoint.com/javascript-truthy-falsy/
Anthony Hernandez
@tacodestroyer
May 20 2016 03:41
you get 0?
Samuel Cupidon
@Zerazera
May 20 2016 03:41
@no-stack-dub-sack You can solve the factorial problem recursively or iteratively
Peter Weinberg
@no-stack-dub-sack
May 20 2016 03:41
@Zerazera meaning you can either use a loop or not?
Norvin Burrus
@ndburrus
May 20 2016 03:41
@tacodestroyer whoops.... i get the same result - 25...moment. 25 is the correct result, 5 5 does equal 25 (function times 5 is working, isn't it, num 5) !
Peter Weinberg
@no-stack-dub-sack
May 20 2016 03:42
@Zerazera iterative would imply loop I guess...
Samuel Cupidon
@Zerazera
May 20 2016 03:42
@no-stack-dub-sack Meaning you either call the program on itself until it reaches a base case, or you use a loop within the problem
robertky
@robertky
May 20 2016 03:42
@martyav , but shouldn't null===null return true?
I feel like that isn't the issue with my code, even though I thought it was.
Peter Weinberg
@no-stack-dub-sack
May 20 2016 03:42
@Zerazera ok, thanks
CamperBot
@camperbot
May 20 2016 03:42
no-stack-dub-sack sends brownie points to @zerazera :sparkles: :thumbsup: :sparkles:
:cookie: 440 | @zerazera |http://www.freecodecamp.com/zerazera
Anteli
@Anteli
May 20 2016 03:43
I'm having problems with keyCodes. I have a calculator and I want to use "=" and "+" on the keyboard as an input, but it seems that on my Finnish keyboard those have the same keyCode 187 ("=" is shift + 0 and "+" has it's own key. Is there a way to still use "=" and "+" for different actions although the have the same keyCode (according to this: http://www.cambiaresearch.com/articles/15/javascript-key-codes)?
Samuel Cupidon
@Zerazera
May 20 2016 03:44
@Anteli Why not use Enter for =?
Anteli
@Anteli
May 20 2016 03:45
@Zerazera I'll use it as well, but I'd like to use "=" too if it is possible.
Islam Ibakaev
@dagman
May 20 2016 03:47
@robertky you can utilize .filter() method to get rid of falsy stuff
return arr.filter(function(el) {
  return el;
});
robertky
@robertky
May 20 2016 03:47
Anyone know why this code doesn't work?
[false, null, 0, NaN, undefined, ""]
Anthony Hernandez
@tacodestroyer
May 20 2016 03:47
@ndburrus yeah 5*5 is 25 but i'm not passing in 5, I'm passing in 0 and I still get that returned in my console.
robertky
@robertky
May 20 2016 03:47

function bouncer(arr) {
// Don't show a false ID to this bouncer.
for(var x=0;x<arr.length;x++)
{
if(arr[x]===null || arr[x]==="" || arr[x]===false || arr[x]===0 || arr[x]===undefined || arr[x]===NaN)
{
arr.splice(x, 1);
x--;
}
}
return arr;
}

bouncer([false, null, 0, NaN, undefined, ""]);

Anthony Hernandez
@tacodestroyer
May 20 2016 03:47
i'm saying timesFive(0);
robertky
@robertky
May 20 2016 03:47
The above returns [null]
But, arr[x]===null returns true.
So, its getting to the if statement.
Anthony Hernandez
@tacodestroyer
May 20 2016 03:48

and inside my timesFive function, i'm saying

return num * 5;

Norvin Burrus
@ndburrus
May 20 2016 03:48
@tacodestroyer well, timesFive(0) correctly returns 0 (0 * 5 = 0).... browser refresh?
Islam Ibakaev
@dagman
May 20 2016 03:48
@robertky this is not gonna work arr[x]===NaN
Anthony Hernandez
@tacodestroyer
May 20 2016 03:48
@ndburrus hmmm, not doing that in my window
robertky
@robertky
May 20 2016 03:49
@Dagman, it does work.
for that, so no that isn't the issue.
My issue is with NULL.
It wont remove null.
Samuel Cupidon
@Zerazera
May 20 2016 03:49
@Anteli Have you tried event.which? https://api.jquery.com/event.which/
robertky
@robertky
May 20 2016 03:49
Anyone know why?
Anthony Hernandez
@tacodestroyer
May 20 2016 03:49
@ndburrus yeah same thing after a refresh
@ndburrus I'm not going to worry about it too much. Sounds like it works fine for other people :smile:
acgillette
@acgillette
May 20 2016 03:50
@robertky is there a realon you're not using filter?
reason*
it would make the problem much simpler
Caleb Martin
@caleb272
May 20 2016 03:50
  <script type="text/javascript">
    var user = {{ user | json | safe }};
  </script>
// I’m loading the user object into the html file before sending it to the client how do i get it out on the client side
+++
???
Norvin Burrus
@ndburrus
May 20 2016 03:50
@tacodestroyer can you try replit { https://repl.it/ }?
robertky
@robertky
May 20 2016 03:50
@acgillette , what is filter?
acgillette
@acgillette
May 20 2016 03:51
look at the documentation provided in the problem explanation, specifically the Array.filter function
thats what I used and my code ended up only being 8 lines
Norvin Burrus
@ndburrus
May 20 2016 03:51
@tacodestroyer i use the following code and it appears to not have any issues: curious - does it pass the tests/requirements?
//  @tacodestroyer

// Example

function minusSeven(num) {
return num - 7;
}
// Only change code below this line
function timesFive(num) {
return num * 5;
}
timesFive(0);
acgillette
@acgillette
May 20 2016 03:52
also look at documentation for Boolean objects and look up "truthy and falsy" concepts for javascript @robertky
Anteli
@Anteli
May 20 2016 03:53
@Zerazera Thanks! I'll check it out!
CamperBot
@camperbot
May 20 2016 03:53
:cookie: 441 | @zerazera |http://www.freecodecamp.com/zerazera
anteli sends brownie points to @zerazera :sparkles: :thumbsup: :sparkles:
robertky
@robertky
May 20 2016 03:53
@acgillette , thanks for that. I don't think its a truthy/falsy issue though. arr[x] (where this is null) ===null returns true.
CamperBot
@camperbot
May 20 2016 03:53
robertky sends brownie points to @acgillette :sparkles: :thumbsup: :sparkles:
:cookie: 279 | @acgillette |http://www.freecodecamp.com/acgillette
robertky
@robertky
May 20 2016 03:53
I tested it.
acgillette
@acgillette
May 20 2016 03:54
can you post the code in the code format?
it'd be easier to read that way
robertky
@robertky
May 20 2016 03:55
Ok, how do you do that @acgillette?
I never understood how to post code here correctly.
Norvin Burrus
@ndburrus
May 20 2016 03:55
help format @robertky
CamperBot
@camperbot
May 20 2016 03:55

: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

robertky
@robertky
May 20 2016 03:55
in the chat.

function bouncer(arr) {
// Don't show a false ID to this bouncer.
for(var x=0;x<arr.length;x++)
{
if(arr[x]===null || arr[x]==="" || arr[x]===false || arr[x]===0 || arr[x]===undefined || arr[x]===NaN)
{
arr.splice(x, 1);
x--;
}
}
return arr;
}

bouncer([false, null, 0, NaN, undefined, ""]);

Robert Richey
@0x0936
May 20 2016 03:55
Boolean('falsy') // true illustrating that a Boolean function can be used to coerce a value into true or false. Take it another step, using filter, and you can iterate over the elements of an array, passing each element into Boolean() to construct a new array of truthy values
acgillette
@acgillette
May 20 2016 03:56
yeah, this code is really unwieldy.
Stefano Long
@Tefo123
May 20 2016 03:56
hello I need help, I don't speak too much english so I don't understand what I need to do in these exercice: bonfire, return largest numbers in arrays somebody please can explain me what I need to do?
acgillette
@acgillette
May 20 2016 03:56
even without filter using Boolean would make it a lot simpler
robertky
@robertky
May 20 2016 03:56

'''

function bouncer(arr) {
// Don't show a false ID to this bouncer.
for(var x=0;x<arr.length;x++)
{
if(arr[x]===null || arr[x]==="" || arr[x]===false || arr[x]===0 || arr[x]===undefined || arr[x]===NaN)
{
arr.splice(x, 1);
x--;
}
}
return arr;
}

bouncer([false, null, 0, NaN, undefined, ""]);
'''

CamperBot
@camperbot
May 20 2016 03:56
:bulb: to format code use backticks! ``` more info
robertky
@robertky
May 20 2016 03:56
I used back ticks....................
Robert Richey
@0x0936
May 20 2016 03:57
those are not backticks. these are backticks ```
Islam Ibakaev
@dagman
May 20 2016 03:58
@robertky you cant do this by simple iteration because NaN is not equal to NaN
you should use .filter() method
acgillette
@acgillette
May 20 2016 03:59
yes that's correct
robertky
@robertky
May 20 2016 03:59

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  for(var x=0;x<arr.length;x++)
  {
    if(arr[x]===null || arr[x]==="" || arr[x]===false || arr[x]===0 || arr[x]===undefined || arr[x]===NaN)
    {
      arr.splice(x, 1);
      x--;
    }
  }
  return arr;
}

bouncer([false, null, 0, NaN, undefined, ""]);
Norvin Burrus
@ndburrus
May 20 2016 03:59
@robertky the backticks key is to the left of the 1 (number one) key. also, you may find the chat & compose buttons to the right of the text area useful...
robertky
@robertky
May 20 2016 03:59
NaN isnt the issue..............
NaN is removed when I run this code.
null is the only issue.
Islam Ibakaev
@dagman
May 20 2016 03:59
@robertky 0_0
Unbug Lee
@unbug
May 20 2016 03:59
guys, here is my Solutions for algorithm challenges https://github.com/unbug/freecodecampa-algorithm
acgillette
@acgillette
May 20 2016 04:00
NaN just means it's a Not a Number, it won't be equal to itself
oh weird
Unbug Lee
@unbug
May 20 2016 04:00
anyone want to talk abut please fire a issue,
robertky
@robertky
May 20 2016 04:00
Run the code...it removes.
NaN is a "thing".
Peter Weinberg
@no-stack-dub-sack
May 20 2016 04:00
Why is it that this code acts like a loop and doesn't just stop at 20? I'm calling the function with 5, the first if statement is not satisfied so it returns the second return, which gives a value of 20. Why does the code not stop there instead of continuing to run through until the first if statement is met? What's telling the code to keep running?
function factorialize(num) {
  if (num === 0) {
    return 1;
  }

  return num * factorialize(num - 1);

}

factorialize(5);
robertky
@robertky
May 20 2016 04:00
null is only thing that doesn't remove.
it does it for other stuff too.
Islam Ibakaev
@dagman
May 20 2016 04:01
@no-stack-dub-sack num <= 1
@robertky [ NaN ] the output
should be empty array
robertky
@robertky
May 20 2016 04:02
it says null
[null] is output.
not NaN
Wayne Bunch
@waynebunch
May 20 2016 04:03
function destroyer(arr) {
  var args = Array.prototype.slice.call(arguments);
  args.splice(0, 1);
  return arr.filter(function(element) {
    return args.indexOf(element) === -1;
  });
}
Can someone explain what element does here? I don't understand where it's getting input from?
Islam Ibakaev
@dagman
May 20 2016 04:04
@robertky this should work
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  for(var x=0;x<arr.length;x++)
  {
    if(arr[x]===null || arr[x]==="" || arr[x]===false || arr[x]===0 || arr[x]===undefined || isNaN(arr[x]))
    {
      arr.splice(x, 1);
      x--;
    }
  }
  return arr;
}

bouncer([false, null, 0, NaN, undefined, ""]);
Robert Richey
@0x0936
May 20 2016 04:04
if (!Boolean(arr[x])) { arr.splice(x--, 1) }
acgillette
@acgillette
May 20 2016 04:05
@robertky you really should use the documentation though, this code is way more complicated than it should be
Islam Ibakaev
@dagman
May 20 2016 04:05
@robertky change arr[x]===NaN to this isNaN(arr[x])
robertky
@robertky
May 20 2016 04:05
ok, I'll read the documentation.
isNan() removes words.
strings are removed as well.
It will pass this test.
but not one with strings.
Islam Ibakaev
@dagman
May 20 2016 04:06
@robertky is NaN returns true if the value not a number
@robertky arr[x]===NaN the catch
because NaN not equal to NaN
acgillette
@acgillette
May 20 2016 04:07
Use array.filter
Islam Ibakaev
@dagman
May 20 2016 04:07
but isNaN(NaN) returns true
acgillette
@acgillette
May 20 2016 04:07
even just using Boolean would help here
Peter Weinberg
@no-stack-dub-sack
May 20 2016 04:07
@dagman I don't follow - the code runs fine, that's not the issue, I guess i just don't understand why it passes the test. I would think it would stop running.
Islam Ibakaev
@dagman
May 20 2016 04:08
@acgillette he doesnt know about filter
and Boolean
acgillette
@acgillette
May 20 2016 04:09
@waynebunch element in this case is the element of the array being passed into the filter
@dagman I know but it'd take like 2 minutes of reading it to get it haha
and it'd make the code so much more simpler
Islam Ibakaev
@dagman
May 20 2016 04:10
that's true...
acgillette
@acgillette
May 20 2016 04:10
@waynebunch when you use array you pass the value of each element of the array to the function, so the function takes that as the input for each iteration
Islam Ibakaev
@dagman
May 20 2016 04:11
do you guys hate my ugly portfolio??? :worried:
acgillette
@acgillette
May 20 2016 04:12
Anyways while i'm here I actually came in to ask for advice on the Cipher problem haha
ronaldrdguez
@ronaldrdguez
May 20 2016 04:13
@waynebunch
Internally filter will loop through the array, the function you pass will get the current array element, it works more/less like this
function filter(array, fn) {
  var filtered = [];

  for (var i = 0; i < array.length; i++) {
    if (fn(array[i]))
      filtered.push(array[i]);
  }

  return filtered;
}
Islam Ibakaev
@dagman
May 20 2016 04:13
yep
Peter Weinberg
@no-stack-dub-sack
May 20 2016 04:13
@acgillette wow you just answered a question I had days ago that nobody was able to explain properly (or I didn't ask properly). Either way, glad I was here to catch it.
Islam Ibakaev
@dagman
May 20 2016 04:13
well done
Wayne Bunch
@waynebunch
May 20 2016 04:14
@acgillette @ronaldrdguez Thank you...didn't know they worked together. Good stuff
CamperBot
@camperbot
May 20 2016 04:14
waynebunch sends brownie points to @acgillette and @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 281 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
:cookie: 280 | @acgillette |http://www.freecodecamp.com/acgillette
acgillette
@acgillette
May 20 2016 04:14
@no-stack-dub-sack haha glad to (belatedly) help
Peter Weinberg
@no-stack-dub-sack
May 20 2016 04:15
@acgillette and accidentally haha
Islam Ibakaev
@dagman
May 20 2016 04:15
maybe should clean it up
function filter(array, fn) {
  var filtered = [],
         i,
         len = array.length;

  for (i = 0; i < len; i +=1) {
    if (fn(array[i]))
      filtered.push(array[i]);
  }

  return filtered;
}
Eldar Tinjić
@EldarT90
May 20 2016 04:17
if (window.matchMedia("(max-width: 510px)").matches) {
   $("#febe").html("Front-end Developer <br/> Back-end Developer");
}
else { $("#febe").html("Front-end Developer, Back-end Developer");}
how do i check for this if statement continously
because the way it works is that it checks resolution on loading of the page, but not after its changed later
Islam Ibakaev
@dagman
May 20 2016 04:18
@EldarT90 setInterval
Eldar Tinjić
@EldarT90
May 20 2016 04:18
@dagman it will work? hmm let me tyr
Wayne Bunch
@waynebunch
May 20 2016 04:18
So if Array wasn't used, element would not have input, correct?
Islam Ibakaev
@dagman
May 20 2016 04:18
@EldarT90 why not do it using css media queries
acgillette
@acgillette
May 20 2016 04:19
@waynebunch yes, because the input from the function is dependant on using arr.filter
Eldar Tinjić
@EldarT90
May 20 2016 04:20
@dagman i need to change html
Wayne Bunch
@waynebunch
May 20 2016 04:20
gotcha, you're awesome
acgillette
@acgillette
May 20 2016 04:20
np :)
Eldar Tinjić
@EldarT90
May 20 2016 04:21
@dagman btw thanks it works, why do i forget to apply it in this case is beyond me
CamperBot
@camperbot
May 20 2016 04:21
eldart90 sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:cookie: 571 | @dagman |http://www.freecodecamp.com/dagman
Islam Ibakaev
@dagman
May 20 2016 04:22
@EldarT90
#febe {
    position: relative;
}

#febe:after {
    content: 'Front-end Developer <br/> Back-end Developer';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    display: none;
}

@media screen and(max-width: 510px) {
    #febe:after {
        display: block;
    }
}
acgillette
@acgillette
May 20 2016 04:23
anyone who finished the caesar problem willing to help point me in the right direction?
Islam Ibakaev
@dagman
May 20 2016 04:23
@EldarT90 try it
Eldar Tinjić
@EldarT90
May 20 2016 04:23
@dagman hmm but through js i have to use only 3 lines of code, unless it causes some other problems (which i havent noticed) i dont mind it
but this is good to know
in other instances
Islam Ibakaev
@dagman
May 20 2016 04:24
@EldarT90 :smile:
Coy Sanders
@coymeetsworld
May 20 2016 04:24
yeah @acgillette what do you need help with?
Eldar Tinjić
@EldarT90
May 20 2016 04:25
@dagman but if you are good in css, maybe you can help me with another stricly css related problem
Islam Ibakaev
@dagman
May 20 2016 04:25
@EldarT90 why not
DwayneCode
@DwayneCode
May 20 2016 04:25
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  // Add record here
  myMusic[1] = [
  {
    "artist": "Michael Jackson",
     "title": "Bad",
     "release_year": 1987,
     "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
      "gold": true

  }
];
```
acgillette
@acgillette
May 20 2016 04:25
I don't know why, for this one I don't even know where to begin. I understand how charCodeAt and fromCharCode works but I'm stuck on the best way to implement it, especially given we're supposed to pass on spaces and punctuation (originally I thought about turning the string into an array and doing it that way)
Islam Ibakaev
@dagman
May 20 2016 04:26
@acgillette find formula
google it
DwayneCode
@DwayneCode
May 20 2016 04:26
syntax is dogging me late, can anyone spot my issue and point me in the right direction?
Coy Sanders
@coymeetsworld
May 20 2016 04:26
@acgillette you'll just want to "encrypt" letters, anything else you can just pass through like spaces
so first thing you'll want to do is when you're going through the string is check if its a letter or not, then from there encrypt it
acgillette
@acgillette
May 20 2016 04:27
I like thinking through the logic myself though, I'd rather not just google the answer
Coy Sanders
@coymeetsworld
May 20 2016 04:27
:thumbsup: @acgillette
Eldar Tinjić
@EldarT90
May 20 2016 04:27
@dagman https://codepen.io/EldarT/full/oxRexK/ try lowering resolution to 766px
acgillette
@acgillette
May 20 2016 04:27
solving the puzzle is the best (worst) part of programming!
Eldar Tinjić
@EldarT90
May 20 2016 04:27
you will see problem with elements below "previous projects"
Islam Ibakaev
@dagman
May 20 2016 04:27
@DwayneCode you should have both objects in one array, comma separeted
Eldar Tinjić
@EldarT90
May 20 2016 04:27
which i have hard time centering
DwayneCode
@DwayneCode
May 20 2016 04:28
hmm, ok i'll give that a shot
Islam Ibakaev
@dagman
May 20 2016 04:29
@EldarT90 so what the issue cos all looks fine...
Eldar Tinjić
@EldarT90
May 20 2016 04:29
@dagman on resolution below 767px?
acgillette
@acgillette
May 20 2016 04:30
does javascript have a way of checking is a character is a letter or not? Could I just do if str.charAt(i) > A && < Z @coymeetsworld
or => A and <= Z
Coy Sanders
@coymeetsworld
May 20 2016 04:30
im not sure if you can compare it that way
but even if you could it may not be the best way to do it
because say that works and you find out the character is B, how do you convert it?
acgillette
@acgillette
May 20 2016 04:31
yeah, thats where I'm mostly stuck, how to check if the character is a letter
Stack Overflow has surprisingly not been useful this time around for that
Darryl Gibson
@n2diy
May 20 2016 04:32
@acgillette typeof should tell you if the character is a string, numeral boolean, etc...
Coy Sanders
@coymeetsworld
May 20 2016 04:32
look at the helpful links the challenge gives you
that part isn't needed @n2diy for the challenge she's working on. Its for Caesar's Cipher, everything given is a string
ronaldrdguez
@ronaldrdguez
May 20 2016 04:33
@acgillette
'A'.charCodeAt() -> 65
'Z'.charCodeAt() -> 90
so yes, you can take any capital letter and check if it is within range.
Coy Sanders
@coymeetsworld
May 20 2016 04:33
@acgillette charCodeAt is what you want to look at
Darryl Gibson
@n2diy
May 20 2016 04:33
@coymeetsworld roger that.
Coy Sanders
@coymeetsworld
May 20 2016 04:33
it will give you the ASCII value and A-Z is sequentially numbered in ASCII
so A is 65, B is 66, etc.
acgillette
@acgillette
May 20 2016 04:34
if (str.charCodeAt(i) => 65 || str.charCodeAt(i) <= 90)
Eldar Tinjić
@EldarT90
May 20 2016 04:34
@dagman ?
acgillette
@acgillette
May 20 2016 04:34
so like this?
whoops should be &&
Coy Sanders
@coymeetsworld
May 20 2016 04:34
yeah with &&
well and not =>
everything else inside that range you don't encrypt, but you still need to put it in your encrypted string
"SERR PBQR PNZC" translates to "FREE CODE CAMP" with the spaces still
acgillette
@acgillette
May 20 2016 04:35
why not => ? if i is equal to 65 I should encrypt that as well no? Because that'd be A?
Coy Sanders
@coymeetsworld
May 20 2016 04:35
because its >= :)
had them switched
Islam Ibakaev
@dagman
May 20 2016 04:36
@EldarT90
@media (max-width: 767px) {
ul {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}
}
Coy Sanders
@coymeetsworld
May 20 2016 04:36
thats what i meant sorry
acgillette
@acgillette
May 20 2016 04:36
ahhhh ok haha
Coy Sanders
@coymeetsworld
May 20 2016 04:36
but yeah if that test passes that means that character is a letter
capital letter but that's all you need to encrypt, to simplify
don't have to account for a-z, just A-Z
acgillette
@acgillette
May 20 2016 04:37
that helped a lot thanks @coymeetsworld for the millionth time haha
CamperBot
@camperbot
May 20 2016 04:37
acgillette sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 912 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
May 20 2016 04:37
no problem :thumbsup: @acgillette
acgillette
@acgillette
May 20 2016 04:37
once I'm done with this I'm finally done with the beginning challenges yay
Coy Sanders
@coymeetsworld
May 20 2016 04:37
:thumbsup: whoops lol
nice work
Eldar Tinjić
@EldarT90
May 20 2016 04:38
@dagman hmm, it doesn't work :(
@dagman i didnt mean content inside the "dark blue box", but the box itself
you will see it has some kind of weird padding which is not padding
on left side
acgillette
@acgillette
May 20 2016 04:40
ok here is where my code got stuck also last time I tried it. It says I can't do this assignment but I'm not sure what the alternative is
Eldar Tinjić
@EldarT90
May 20 2016 04:40
blob
@dagman
acgillette
@acgillette
May 20 2016 04:40

function rot13(str) { // LBH QVQ VG!

  var num = 0;

  for(var i = 0; i < str.length; i++) {
    if (str.charCodeAt(i) >= 65 && str.charCodeAt(i) <= 90) {
      num = str.charCodeAt(i) + 13;
      str.charAt(i) = str.fromCharCode(num);
    }
  }


  return str;
}
Coy Sanders
@coymeetsworld
May 20 2016 04:41
you have to make a new String that's why, remember Strings are immutable?
acgillette
@acgillette
May 20 2016 04:41
Crap, didn't remember that at all
Coy Sanders
@coymeetsworld
May 20 2016 04:42
yeah, no big deal just make a new string instead of changing in place
but also you'll see theres another issue after that, but do that part first
acgillette
@acgillette
May 20 2016 04:42
yeah the other issue is then how do I pass on the non letter stuff?
Coy Sanders
@coymeetsworld
May 20 2016 04:42
just pass it through
if you get a space, put a space there
if its a question mark, add the question mark. Those characters don't get encrypted
Lizzy
@DevElisabeth
May 20 2016 04:45
This message was deleted
acgillette
@acgillette
May 20 2016 04:46
for(var i = 0; i < str.length; i++) {
if (str.charCodeAt(i) >= 65 && str.charCodeAt(i) <= 90) {
num = str.charCodeAt(i) + 13;
deEncrypt = deEncrypt + deEncrypt.fromCharCode(num);
}
}
it says fromCharCode is not a function
Eldar Tinjić
@EldarT90
May 20 2016 04:47
@dagman thanks it looks better, what was the change?
CamperBot
@camperbot
May 20 2016 04:47
eldart90 sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:warning: eldart90 already gave dagman points
Samuel Cupidon
@Zerazera
May 20 2016 04:48
@acgillette String.fromCharCode(number)
Lizzy
@DevElisabeth
May 20 2016 04:48
Hi all! I am feeling discouraged trying to learn how to translate what I learned in free code camp to actual problems. Maybe I don't fully grasp the syntax?
Samuel Cupidon
@Zerazera
May 20 2016 04:49
This message was deleted
acgillette
@acgillette
May 20 2016 04:50
oh ok yeah that works now (kind of lol, I think this is where you're saying there'd be a problem @coymeetsworld )
Islam Ibakaev
@dagman
May 20 2016 04:51
i have reseted padding
@EldarT90 your project description looks bad on small resolutions
@EldarT90 you add padding-left = 50px
Eldar Tinjić
@EldarT90
May 20 2016 04:53
@dagman yes, so it was padding after all, i just forgot which one
Islam Ibakaev
@dagman
May 20 2016 04:53
yep
Eldar Tinjić
@EldarT90
May 20 2016 04:53
lot of mess in my code, but hopefully the result will look nice in the end
Coy Sanders
@coymeetsworld
May 20 2016 04:53
ya @acgillette , need to add a bit more logic in there
when you encounter a letter
acgillette
@acgillette
May 20 2016 04:54
ok I see, I need to constrain it so it stays within the parameters right?
Cause I'm getting a bunch of non letter stuff when I return it right now
Coy Sanders
@coymeetsworld
May 20 2016 04:54
correct
Islam Ibakaev
@dagman
May 20 2016 04:54
@EldarT90 the font-family is a bit uncomfortable to read :worried:
Coy Sanders
@coymeetsworld
May 20 2016 04:54
Islam Ibakaev
@dagman
May 20 2016 04:54
@EldarT90 though its up to u
Coy Sanders
@coymeetsworld
May 20 2016 04:55
so like say you ran into a Z @acgillette, if you add 13 to the ascii value that would be 90+13 = 103, 103 translates to lower case g
Eldar Tinjić
@EldarT90
May 20 2016 04:55
@dagman hmm
Coy Sanders
@coymeetsworld
May 20 2016 04:55
if you had N, adding 13 would make it return left bracket [
Eldar Tinjić
@EldarT90
May 20 2016 04:56
@dagman i will prolly try few other font combos in the end, i find it nice, but i agree in some instances maybe its not the best choice, and its not nice to have 2font types on 1 page
Lizzy
@DevElisabeth
May 20 2016 04:57
I want to complete a challenge that asks me to write code that takes a string argument counts the number of letters, number of words, number of spaces, total number of characters, and calculates the average word length and returns the output as a single object without using any libraries. So the answer would be a returned object, not a string. Every time I find helpful information on how to execute the code I can't figure out how to even begin. Can someone help explain how to start a new JavaScript counting code to me?
Does it all go in the JS box on codepen?
Islam Ibakaev
@dagman
May 20 2016 04:57
@EldarT90 are you going to put your portfolio online?
Lizzy
@DevElisabeth
May 20 2016 04:57
I DO NOT want anyone to write the code for me
Islam Ibakaev
@dagman
May 20 2016 04:58
@veganlizzy wat?
never?
Coy Sanders
@coymeetsworld
May 20 2016 04:58
object like a JSON object @veganlizzy ?
Islam Ibakaev
@dagman
May 20 2016 04:58
0_0
Eldar Tinjić
@EldarT90
May 20 2016 04:58
@dagman maybe, why?
Lizzy
@DevElisabeth
May 20 2016 04:58
@dagman lol that's in reference to my question^^
Islam Ibakaev
@dagman
May 20 2016 04:59
@veganlizzy just a bit of fun :smile:
@EldarT90 so in such case i recommend you https://pages.github.com/
@EldarT90 i used it for myself
when recently tried to rebuild my portfolio
Eldar Tinjić
@EldarT90
May 20 2016 05:00
@dagman hmm, so i dont need those file managers i guess this way? i already used github for my backend projects but i see why not using it in this case
so much easier i think
Lizzy
@DevElisabeth
May 20 2016 05:00
@coymeetsworld is a JSON object like what we learned in Object Oriented and Functional Programming?
Islam Ibakaev
@dagman
May 20 2016 05:00
@EldarT90 yep it is very easy :smile:
Eldar Tinjić
@EldarT90
May 20 2016 05:01
@dagman when i registered first to github, iwas like : "why the hell would some1 use this, with all commands git push gaarh" and than after 2 days - ok its not bad; after 10 days - github is the best ! :D
Coy Sanders
@coymeetsworld
May 20 2016 05:02
JSON is different than that @veganlizzy, I guess I'm not sure what your output is supposed to be. This is outside of the FCC challenges right?
Samuel Cupidon
@Zerazera
May 20 2016 05:02
@EldarT90 You don't have to do the commands if you don't want to -- there are plenty of front ends for any operating system
Islam Ibakaev
@dagman
May 20 2016 05:02
@EldarT90 yeah... as a developer or upcoming one we should use it definetly :smile:
Eldar Tinjić
@EldarT90
May 20 2016 05:02
@Zerazera well now im fine wiht it ^^ and many other back-end things but that was just first impression; after you lern something, you start liking it ^^
Islam Ibakaev
@dagman
May 20 2016 05:02
@EldarT90 it is kind of one of our skills
Eldar Tinjić
@EldarT90
May 20 2016 05:02
and it even has direct approach
Jason Keenan
@raavin
May 20 2016 05:03
P
Eldar Tinjić
@EldarT90
May 20 2016 05:03
i was looking for something to upload my sounds for Simon challenge for hours
and i couldnt find some uploader with direct access to file, and than one guy told me try github
and ofc it worked
Islam Ibakaev
@dagman
May 20 2016 05:03
@raavin yo man your face is kind of pixelized :worried:
is it okay?
@EldarT90 i used dropbox
Randy Goldsmith
@Dueldrawer8
May 20 2016 05:04
is there a way you can access twitch icons even when the channel is offline? i tried here but its not working
http://codepen.io/duel_drawer8/pen/QNxyNq
Jason Keenan
@raavin
May 20 2016 05:04
@dagman that's the way I always look. I have cream but...😏
Eldar Tinjić
@EldarT90
May 20 2016 05:05
@dagman dropbox works only if you registered before 2014-15 (for free) otherwise iw ould have to pay
so github worked nicely for me
and its ofc easy upload
Islam Ibakaev
@dagman
May 20 2016 05:05
@raavin ok :confused:
Eldar Tinjić
@EldarT90
May 20 2016 05:05
i dont have to use commands , i can do it directyl too
which is convinient for 1 file push
@Dueldrawer8 yes you can
Lizzy
@DevElisabeth
May 20 2016 05:06
@coymeetsworld It is outside of the FCC Challenges. The challenge sources the FCC JavaScript and Object Oriented and Functional Programming sections to be completed in order to complete the challenge, so I was hoping I could get help on how to translate what we learned in Java to real code. I have an example output if you would like to see!
Islam Ibakaev
@dagman
May 20 2016 05:06
@EldarT90 have you tried yeoman to scaffold projects?
Randy Goldsmith
@Dueldrawer8
May 20 2016 05:06
@EldarT90 mind sharing? lol..
Eldar Tinjić
@EldarT90
May 20 2016 05:06
@dagman never heard for it
Islam Ibakaev
@dagman
May 20 2016 05:07
@EldarT90 :smile:
Eldar Tinjić
@EldarT90
May 20 2016 05:07
Randy Goldsmith
@Dueldrawer8
May 20 2016 05:07
if you click that.. freecodecamp isnt streaming but thats the data
Coy Sanders
@coymeetsworld
May 20 2016 05:07
sure @veganlizzy, and if you have the link to the challenge i'd like to see it
Eldar Tinjić
@EldarT90
May 20 2016 05:08
@dagman hmm what does it do
Coy Sanders
@coymeetsworld
May 20 2016 05:08
to see what they mean by return an object
Islam Ibakaev
@dagman
May 20 2016 05:08
Coy Sanders
@coymeetsworld
May 20 2016 05:08
thats kind of a vague statement
Islam Ibakaev
@dagman
May 20 2016 05:09
@EldarT90 scaffold project
Eldar Tinjić
@EldarT90
May 20 2016 05:09
@dagman so, like a frame that you can build on with some things taken care of ?
@dagman you have too much free time on your hand :D
Islam Ibakaev
@dagman
May 20 2016 05:10
trying to be creative :worried:
@EldarT90 yep
Randy Goldsmith
@Dueldrawer8
May 20 2016 05:12
@EldarT90 thank you
CamperBot
@camperbot
May 20 2016 05:12
dueldrawer8 sends brownie points to @eldart90 :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @eldart90 |http://www.freecodecamp.com/eldart90
Islam Ibakaev
@dagman
May 20 2016 05:13
Eldar Tinjić
@EldarT90
May 20 2016 05:15
@dagman i like functionality and idea, but font is maybe too big for desktop users
Darth Skywalker
@adityaparab
May 20 2016 05:15
@dagman : Looking good mate! :)
Yeah, I'd also suggest you reduce font size!
@dagman : Another suggestion. You have @import statements in CSS file. It is slow like hell. A W3C recommended way is to convert these @imports in link tags in your html. It loads way faster than @import in css. Here is a nice blog post that explains why! - http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
Islam Ibakaev
@dagman
May 20 2016 05:31
@EldarT90 @adityaparab thx guys but i am not gonna use it as real portfolio it was just first try :smile:
CamperBot
@camperbot
May 20 2016 05:31
dagman sends brownie points to @eldart90 and @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 367 | @eldart90 |http://www.freecodecamp.com/eldart90
:cookie: 260 | @adityaparab |http://www.freecodecamp.com/adityaparab
Win Pkt
@winnwinsome
May 20 2016 05:37

Hi all, I'm having confusion why this code doesn't work in the 'Record Collection' challenge. '''function updateRecords(id, prop, value) {

if (value!=="" && prop!=="tracks"){
collection[id][prop] = value;
}
else if(prop ==="tracks" && value!=="")
{
collection[id][prop] = value;

}

else if(value ==="") {
delete collection[id][prop];
}

return collection;
}
'''

Markus Kiili
@Masd925
May 20 2016 05:39
@winnwinsome If prop is tracks, you push (into tracks array).
Win Pkt
@winnwinsome
May 20 2016 05:41
@Masd925 Yes and this statements does that right ?
else if(prop ==="tracks" && value!=="")
{
collection[id][prop] = value;
}
Markus Kiili
@Masd925
May 20 2016 05:42
@winnwinsome That overrides the array with value stored in value parameter.
@winnwinsome You should push the value into the array in collection[id][prop], using array .push() method.
Win Pkt
@winnwinsome
May 20 2016 05:47
i see now. Thanks! @Masd925
CamperBot
@camperbot
May 20 2016 05:47
winnwinsome sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1550 | @masd925 |http://www.freecodecamp.com/masd925
k_james
@k-james
May 20 2016 05:49

var myStr="I am a\"double quoted\"string inside\"double quotes\"";

this appears to be correct but does not validate

Markus Kiili
@Masd925
May 20 2016 05:50
@k-james What is the challenge name?
@k-james Some spaces are missing from your string.
William Coleman
@wcski
May 20 2016 05:53
So I'm trying to step through the Record Collection challenge
(I've only had time to think about it at night when I'm tired and can't think that well heh)
Markus Kiili
@Masd925
May 20 2016 05:54
@wcski What have you done so far?
William Coleman
@wcski
May 20 2016 05:54
The first case I'm trying to solve is this: If value is non-blank (value !== "") and prop is not "tracks" then update or set the value for the prop.
function updateRecords(id, prop, value) {


  if (value !== "" && prop !== "tracks") {
    collection.prop = value;
  }
Markus Kiili
@Masd925
May 20 2016 05:55
@wcski The dot notation only works if the property key string is a valid JS identifier (for example "12" and "lives left" are not) and you write the key after the dot: var cat={clothes:"pants", "lives left":3}; cat.clothes; //returns "pants". Bracket notation works with keys that can be arbitrary strings cat["lives left"]; //returns 3, variables var key="clothes"; cat[key]; //returns "pants", or expressions cat["lives"+" "+"left"]; //returns 3.
So .prop doesn't work there.
Also you need to figure out how to access a particular record with given id. collection.prop doesn't do that.
William Coleman
@wcski
May 20 2016 05:56
k give me a sec
William Coleman
@wcski
May 20 2016 06:04
I know it's not that hard but this one is tough for me. I'm going to keep working it. I knew I wasn't going in the right direction, so thank you @Masd925 for confirming that. I'll pop back in here once I've made some progress
CamperBot
@camperbot
May 20 2016 06:04
wcski sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1551 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
May 20 2016 06:05
@wcski Try to access collection and console.log() things until you know how to access the things you need.
William Coleman
@wcski
May 20 2016 06:09
While you're here, though, @Masd925, I don't understand what it means that dot notation only works if the property key string is a "valid JS identifier"
In your example, would "12" and "lives left" not be valid because they aren't in your cat object or was that not related
Thompson Ike
@hubhubace
May 20 2016 06:10
pls help
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.

function nextInLine(arr, item) {

testArr.push(item);

testArr.shift(0);

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, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

help someone
CamperBot
@camperbot
May 20 2016 06:11
no wiki entry for: someone
Markus Kiili
@Masd925
May 20 2016 06:12
@wcski In JS variable names must obey certain rules, that is be valid identifiers https://developer.mozilla.org/en-US/docs/Glossary/Identifier
@wcski For example "1" is not a valid identifier, but can be used as a property name (arbitrary strings can be used). But because of it not being valid identifier you must use bracket notation on property access: obj[1] and obj["1"] both work, but obj.1 doesn't. Dot notation just is a restricted version of the bracket notation.
William Coleman
@wcski
May 20 2016 06:16
OK, that makes sense
thanks man! that's some good knowledge
Markus Kiili
@Masd925
May 20 2016 06:17
@wcski You're wellcome.
JohnQQ
@JohnQQ
May 20 2016 06:22
@hubhubace
What seems to be the problem in that exercise?
@hubhubace Check out your function nextInLine, more precisely, first argument and whether it is used in function.
Eldar Tinjić
@EldarT90
May 20 2016 06:43
https://raw.githubusercontent.com/jonsuh/hamburgers/master/dist/hamburgers.css - why it wont accept this as css resouce in codepen
it looks perfectly fine to me
NegrilloC
@NegrilloC
May 20 2016 06:58
Hi guys, i'm looking for help on seek and destroy algorithm. Not sure why this doesn't filter the array as i think it would
function destroyer(arr) {
  // Remove all the values
  var filtArr = arr.filter(function(val){
    for(var i = 1; i<arguments.length; i++){
       if(val == arguments[2]){return;}
    }
    return val;
  });

  return filtArr;
}
Martialis39
@Martialis39
May 20 2016 06:58
@NegrilloC hey, let me take a look
NegrilloC
@NegrilloC
May 20 2016 06:59
** i replaced arguments[2] with arguments[i]. it was a remnant of me trying to test it
Markus Kiili
@Masd925
May 20 2016 06:59
@NegrilloC The filter callback has its own arguments object. You are not accessing destroyers arguments for that reason.
NegrilloC
@NegrilloC
May 20 2016 07:01
@Masd925 oh i didn't know that, thanks!
CamperBot
@camperbot
May 20 2016 07:01
negrilloc sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1552 | @masd925 |http://www.freecodecamp.com/masd925
Rudolf Carl Pablico
@rudolfpablico
May 20 2016 07:17
hi guys, I'm on Diff two arrays exercise and its kinda weird
this is my code
```

function diffArray(arr1, arr2) {

  var newarr = arr1.concat(arr2); 
  var sorted = newarr.sort();
  var filtered = [];
  var diff= [];
  var index;
 // return sorted;

for(var i = 0; i < sorted.length; i++){

  index = sorted.indexOf(sorted[i]);

    if(sorted[i] == sorted[i+1])  {    
      sorted.splice(index, 1);

    }
    else{
      filtered[i]= sorted[i];
    }

}

return filtered;


}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
and this is the result
[null,null,null,4]
but still passed
I just want to clear this
Markus Kiili
@Masd925
May 20 2016 07:20
@rudolfpablico You have created an array with holes. Only the index "3" exists.
Rudolf Carl Pablico
@rudolfpablico
May 20 2016 07:21
@Masd925 yea that correct, I've removed them using this code
diff = filtered.filter(function (n) { 
    return (n !== undefined && n !== null && n !== false && n !== 0 && n !== "" && isNaN()!=NaN); });

  return diff;
but i'm just wondering why's that passed
Markus Kiili
@Masd925
May 20 2016 07:23
@rudolfpablico It only has the correct elements which seems to fulfill the tests.
@rudolfpablico Your solution is quite complicated.
cutie3
@cutie3
May 20 2016 07:23
mornind house, pls ve this issue , i need help
Rudolf Carl Pablico
@rudolfpablico
May 20 2016 07:24
@Masd925 really? I think this is the shortest solution to this exercise
ruchi125
@ruchi125
May 20 2016 07:25
can anybody please explain me what are call back functions in simple language?
Markus Kiili
@Masd925
May 20 2016 07:25
@rudolfpablico There are one-liner solutions, so yours is not the shortest.
Rudolf Carl Pablico
@rudolfpablico
May 20 2016 07:26
@Masd925 Glad if I can see those :smile:
Markus Kiili
@Masd925
May 20 2016 07:26
@ruchi125 Callback function means that you create a function (object) and pass it into another function as an argument. Usually the receiving function executes the callback function later.
ruchi125
@ruchi125
May 20 2016 07:27
@Masd925 so like function(another_function())?
kushhal
@kushhal
May 20 2016 07:27

function phoneticLookup(val) {
var result = "charlie";

// Only change code below this line
var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
};

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

// Change this value to test
phoneticLookup("charlie");

HELP
CamperBot
@camperbot
May 20 2016 07:27

CamperBot

Hi, I'm CamperBot! I can help you in this chatroom :smile:

:pencil: read more about camperbot on the FCC Wiki

ruchi125
@ruchi125
May 20 2016 07:27
@Masd925 so like function(another_function())?
ruchi125
@ruchi125
May 20 2016 07:28
but why do we wanna do that?
Markus Kiili
@Masd925
May 20 2016 07:28
@rudolfpablico
cutie3
@cutie3
May 20 2016 07:28
hello pls i need help
Markus Kiili
@Masd925
May 20 2016 07:28
function diffArray(arr1, arr2) {
    return arr1.concat(arr2).filter(function(val, index, array){return array.indexOf(val)===array.lastIndexOf(val);});
}
ruchi125
@ruchi125
May 20 2016 07:28
@cutie3 remember using push(),pop(),shift() and unshift() functions? try using those here
Sanne
@sannek
May 20 2016 07:28
@kushal You need to make sure that you assign the right value to the result. You can access the value of a property in an object like this object[prop] if the property is a variable.
cutie3
@cutie3
May 20 2016 07:29
yes @ruchi125 , i did but not working
Markus Kiili
@Masd925
May 20 2016 07:29
@ruchi125 I can make you an example of callback functions.
ruchi125
@ruchi125
May 20 2016 07:29
@Masd925 sure mark that will be very helpful :D
kushhal
@kushhal
May 20 2016 07:31
@sannek I'm not able to understand
Markus Kiili
@Masd925
May 20 2016 07:32
@ruchi125
function twice (func) {
    func();
    func();
}

function shout () {
    console.log("Hello!");
}

twice(shout); // Hello! Hello!
cutie3
@cutie3
May 20 2016 07:32
hello
pls, house i need help
kushhal
@kushhal
May 20 2016 07:33
@sannek code can only be changed below the var result
I want to ask if I'm doing anything wrong with the code?
Sanne
@sannek
May 20 2016 07:33
@kushhal
function phoneticLookup(val) {
  var result = "charlie";

  // 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;
}
shit, didn't mean to press enter already
Rudolf Carl Pablico
@rudolfpablico
May 20 2016 07:33
@Masd925 thanks mate :smile: really need to study more here
CamperBot
@camperbot
May 20 2016 07:33
rudolfpablico sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1553 | @masd925 |http://www.freecodecamp.com/masd925
ruchi125
@ruchi125
May 20 2016 07:33
@Masd925 i didnt understand, why you didnt use parenthesis wjile passing shout functions ?
cannelflow
@cannelflow
May 20 2016 07:34
@sannek you need to assign value to result first
Sanne
@sannek
May 20 2016 07:34
This message was deleted
cannelflow
@cannelflow
May 20 2016 07:34
@sannek :p
Sanne
@sannek
May 20 2016 07:34
function phoneticLookup(val) {
var result = "charlie";
// Only change code below this line
var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank",
};
result = lookup[val] // You need to reassign the right value to the result
// Only change code above this line
return result;
}
// Change this value to test
phoneticLookup("charlie");
My excuse is that it is still pretty early here and the coffee was terrible
kushhal
@kushhal
May 20 2016 07:35
@sannek Thank you :)
Sanne
@sannek
May 20 2016 07:35
@kushhal Hopefully this makes it a bit clearer
CamperBot
@camperbot
May 20 2016 07:35
kushhal sends brownie points to @sannek :sparkles: :thumbsup: :sparkles:
:cookie: 385 | @sannek |http://www.freecodecamp.com/sannek
Markus Kiili
@Masd925
May 20 2016 07:36
@ruchi125 Functions are objects in JS and they can be created, stored in variables, passed to and returned from functions and also they have code that can be invoked with (). Here the function shout is declared and passed to twice (without invoking). The twice function executes and invokes shout twice.
cutie3
@cutie3
May 20 2016 07:36
hello
kushhal
@kushhal
May 20 2016 07:37
@sannek yea it does :D
Rudolf Carl Pablico
@rudolfpablico
May 20 2016 07:38
@Masd925 could you explain to me what's the meaning of this
return array.indexOf(val)===array.lastIndexOf(val)
ruchi125
@ruchi125
May 20 2016 07:38
@Masd925 ok so when i need to invoke the code inside the function i need to use () but when i have to pass the function i dot need ()?
Markus Kiili
@Masd925
May 20 2016 07:39
@ruchi125 Yes, just using shout means the function. shout() invokes the function.
Yuval
@unc0mm0n
May 20 2016 07:40

Can someone explain to me why here: https://www.freecodecamp.com/challenges/pairwise
the expected return value of

pairwise([0,0,0,0,1,1], 1)

is 10 and not 4? Shouldn't I use only the first instance of (0+1)=1?

ruchi125
@ruchi125
May 20 2016 07:40
@Masd925 alright now i get it. thanx alot for explaining that :D
CamperBot
@camperbot
May 20 2016 07:40
ruchi125 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1554 | @masd925 |http://www.freecodecamp.com/masd925
Yuval
@unc0mm0n
May 20 2016 07:41
@rudolfpablico it checks if the first time the element appears is at the same place as the last. Basically it checks if it appears only once (or 0 times),
Markus Kiili
@Masd925
May 20 2016 07:42
@rudolfpablico That equality comparison checks if the index of the first occurence of val is the index of the last occurence of val. That is true only if val is single.
Rudolf Carl Pablico
@rudolfpablico
May 20 2016 07:43
@unc0mm0n @Masd925 OK :smile: that's really a great code. Probably, I need more reading of documentation hahaha, I'm in lack of these syntax
Varadharajan
@varadha85
May 20 2016 07:44
in free code camp javascript the following error "c should not contain undefined and should have a value of "I am a String!"" i have given proper syntax but not working proper.
ruchi125
@ruchi125
May 20 2016 07:44
@cutie3 ???
you here???
cutie3
@cutie3
May 20 2016 07:44
yes
ruchi125
@ruchi125
May 20 2016 07:45
@cutie3 you need to push items inside the array and remove the first element of the array
cutie3
@cutie3
May 20 2016 07:45
still not getting it
Markus Kiili
@Masd925
May 20 2016 07:45
@rudolfpablico It is better on three lines, but it is a nice functional solution to the problem.
ruchi125
@ruchi125
May 20 2016 07:45
can you share your code here?
@cutie3
cutie3
@cutie3
May 20 2016 07:45
iyes, i can