These are chat archives for FreeCodeCamp/HelpJavaScript

27th
Jan 2017
Colin N. Creighton
@colincreighton
Jan 27 2017 00:00 UTC
Hi guys, just a quick one: is there a way to return just the whole integer and drop the fraction? Like the opposite of the % operator.
Haopei Yang
@haopei
Jan 27 2017 00:00 UTC

Hi folks, I am looking for some regex help. I am trying to create a regex for:

[any integer of length of 3] [one space] [any integer of length of 3] [forward slash ] [any integer of length of 3]

So this would pass: 123 123\123
Pieter Stokkink
@forkerino
Jan 27 2017 00:02 UTC
@CoryCMyers String.charCodeAt(0) what is that? It doesn't seem right here.
@colincreighton Math.floor() might help
Diego Mayer
@Chrono79
Jan 27 2017 00:03 UTC
/^\d{3} \d{3}\\\d{3}$/ that's a backslash @haopei
c0d0er
@c0d0er
Jan 27 2017 00:04 UTC
@taltmann42 thanks!
Colin N. Creighton
@colincreighton
Jan 27 2017 00:05 UTC
@forkerino Thanks Pieter, that looks like the one!
Pieter Stokkink
@forkerino
Jan 27 2017 00:06 UTC
@colincreighton :+1:
Haopei Yang
@haopei
Jan 27 2017 00:06 UTC
Hi @Chrono79 thanks for helping me out
I tried that regex but it doesn’t seem to work as desired
I am testing it here: http://regexr.com/3f5m2
Could I trouble you to have a look for me?
taltmann42
@taltmann42
Jan 27 2017 00:09 UTC
@haopei you need to add the m flag for multiline, as otherwise the first line is considered the beginning of the string (due to the ^ sign)
with the multiline-flag each line is considered a new string
CoryCMyers
@CoryCMyers
Jan 27 2017 00:12 UTC
@forkerino My understanding is that it says to return the results in a string?
Haopei Yang
@haopei
Jan 27 2017 00:13 UTC
Hi @taltmann42, where should the m go? My current regex is \d{1,3} \d{1,3}\\d{1,3}$
It matches this: 123 456\789
But it fails to match:
12 1\3
1 6\90
Diego Mayer
@Chrono79
Jan 27 2017 00:13 UTC
@haopei those aren't any integer of length of 3
if you want to match those too, /^\d{1,3} \d{1,3}\\\d{1,3}$/
taltmann42
@taltmann42
Jan 27 2017 00:13 UTC
in the regexr.com page, there's a menu "flags" in the upper right corner
@haopei
Haopei Yang
@haopei
Jan 27 2017 00:14 UTC
@Chrono79 oops, sorry I meant to say integers with a max of 3 digits. My apologies
taltmann42
@taltmann42
Jan 27 2017 00:14 UTC
@haopei the $ matches the end of the line (or without multiline-flag, end of the string), so it only finds the last occurence
Stanislav Alieksieienko
@Stas1988
Jan 27 2017 00:14 UTC

Hi everyone! Got stuck on this one. What am I doing wrong?

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

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

}

taltmann42
@taltmann42
Jan 27 2017 00:15 UTC
@haopei enable the multiline-flag in the flag-menu, and it should work
@haopei aaand the global-flag, so it keeps looking
Diego Mayer
@Chrono79
Jan 27 2017 00:16 UTC
@taltmann42 I think he has to use global flag too
taltmann42
@taltmann42
Jan 27 2017 00:16 UTC
@Chrono79 just realized that, yep ;)
Haopei Yang
@haopei
Jan 27 2017 00:16 UTC
It works! :)
Thank you @Chrono79 @taltmann42
Diego Mayer
@Chrono79
Jan 27 2017 00:17 UTC
:+1:
@Stas1988 prop === contacts[i][prop]this isn't true ever
Also, your loop won't run more than once that way
Why do you return contacts[i].firstName?
Stanislav Alieksieienko
@Stas1988
Jan 27 2017 00:20 UTC
prop === contacts[i].prop looks better?
I don't know, just tried to return anything. Nothing worked before.
David Amanze
@GodKingShogun
Jan 27 2017 00:21 UTC
hello everyone :smile:
Andytran78
@Andytran78
Jan 27 2017 00:23 UTC
Hi guys, I get this assignment in school about javascript and the buttons I try to do it's not working please help.

</head>
<body>
<p>Press the buttons to change the box!</p>
<div id="box" style="height:150px; width:150px; background-color:orange; margin:25px">
</div>
<button id="button1">Grow</button>

    <button id="button2">Blue</button>

    <button id="button3">Fade</button>

    <button id="button4">Reset</button>

<script type="text/javascript">

document.getElementById("button1").addEventListener("click", function(){
document.getElementById("box").style.height = "250px";
});

document.getElementById("button2").addEventListener("click", function(){
document.getElementById("box").style.color = "blue";
});

document.getElementById("button3").addEventListener("click", function(){
document.getElementById("box").style.opacity = "1";
});

document.getElementById("button4").addEventListener("click", function(){
document.getElementById("box").style.height = "150px";
});

</script>

</body>

</html>

David Amanze
@GodKingShogun
Jan 27 2017 00:23 UTC
@nhocbu go to the help section
super-it-guy
@super-it-guy
Jan 27 2017 00:24 UTC
any one know what to do in the word blank problem in java script?
David Amanze
@GodKingShogun
Jan 27 2017 00:24 UTC
@super-it-guy post what you have so far
Diego Mayer
@Chrono79
Jan 27 2017 00:24 UTC
@Stas1988 no, it doesn't, there is no property whose name is the same as its value
Use hasOwnProperty method to check if the property exist
super-it-guy
@super-it-guy
Jan 27 2017 00:25 UTC
how do you show the console?
EthanD
@EthanDproject
Jan 27 2017 00:25 UTC

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

wordBlanks=("", "", "")
// Your code above this line
return result;
}

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

can anyone help with this
taltmann42
@taltmann42
Jan 27 2017 00:25 UTC
@nhocbu so what's not working there?
David Amanze
@GodKingShogun
Jan 27 2017 00:25 UTC
@Chrono79 i am on the random quote generator and i am calling on this api to get quotes
("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=",
Andytran78
@Andytran78
Jan 27 2017 00:26 UTC
the button blue and Fade
David Amanze
@GodKingShogun
Jan 27 2017 00:26 UTC
@EthanDproject what are the instructions
EthanD
@EthanDproject
Jan 27 2017 00:26 UTC
wordBlanks("","","","") should return a string.
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
taltmann42
@taltmann42
Jan 27 2017 00:26 UTC
@nhocbu blue works but you don't see anything because color affects the font-color, you'd want to change backgroundColor
Diego Mayer
@Chrono79
Jan 27 2017 00:26 UTC
@GodKingShogun didn't do that, but are you sur that's the right url?
taltmann42
@taltmann42
Jan 27 2017 00:27 UTC
@nhocbu fade doesn't do anything because opacity at value 1 is fully visible, whereas 0 is transparent
super-it-guy
@super-it-guy
Jan 27 2017 00:27 UTC

We will now use our knowledge of strings to build a "Mad Libs" style word game we're calling "Word Blanks". You will create an (optionally humorous) "Fill in the Blanks" style sentence.

You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.

We have provided a framework for testing your results with different words. The tests will run your function with several different inputs to make sure all of the provided words appear in the output, as well as your extra strings.

EthanD
@EthanDproject
Jan 27 2017 00:27 UTC
@GodKingShogun wordBlanks("","","","") should return a string.
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
David Amanze
@GodKingShogun
Jan 27 2017 00:27 UTC
@EthanDproject what do you think you're suppose to be doing. attempt to do it first and them come back
:+1:
super-it-guy
@super-it-guy
Jan 27 2017 00:28 UTC
not sure what this means I am still a novice
David Amanze
@GodKingShogun
Jan 27 2017 00:29 UTC
@Chrono79 yes i am sure but the real question is how would i pass a function that would get me a different and random quote each time i click a button
Andytran78
@Andytran78
Jan 27 2017 00:29 UTC
@taltmann42 thanks
EthanD
@EthanDproject
Jan 27 2017 00:30 UTC
@GodKingShogun is this an array
Diego Mayer
@Chrono79
Jan 27 2017 00:30 UTC
@GodKingShogun read the api doc, it says rand in the url, doesn't that get you a new one each call?
EthanD
@EthanDproject
Jan 27 2017 00:30 UTC
the instruction is confusing
David Amanze
@GodKingShogun
Jan 27 2017 00:30 UTC
@EthanDproject what is an array
EthanD
@EthanDproject
Jan 27 2017 00:31 UTC

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

wordBlanks=("", "", "")
// Your code above this line
return result;
}

// Change the words here to test your function
wordB

Jason Luboff
@JLuboff
Jan 27 2017 00:31 UTC
@EthanDproject You should be using string concatenation along with your passed in parameters (myNoun, myAdjective, etc) to create a new line of text that is assigned to results
David Amanze
@GodKingShogun
Jan 27 2017 00:32 UTC
@Chrono79 it gets me a random one each time but every time i click the button it generates a new quote below the old quote. i want to only have one quote at a time on my page
Jason Luboff
@JLuboff
Jan 27 2017 00:32 UTC
@GodKingShogun What are you using to add the text to your page?
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:32 UTC
what jquery function are you using to amend the html @GodKingShogun
Diego Mayer
@Chrono79
Jan 27 2017 00:32 UTC
@GodKingShogun then, the problem isn't the api, it's how you show the quote
super-it-guy
@super-it-guy
Jan 27 2017 00:33 UTC
what is a passed in word
EthanD
@EthanDproject
Jan 27 2017 00:33 UTC
@ @JLuboff thank i will try it again
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:33 UTC
in what sense @super-it-guy
?
David Amanze
@GodKingShogun
Jan 27 2017 00:34 UTC
$(".well").append(a[0].content + "<p>— " + a[0].title + "</p>")
Jason Luboff
@JLuboff
Jan 27 2017 00:34 UTC
@GodKingShogun .append thats why
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:34 UTC
append means to add to the top @GodKingShogun basically
Jason Luboff
@JLuboff
Jan 27 2017 00:34 UTC
Append does exactly that...it appends to the current data
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:34 UTC
prepend means to add to the bottom
Jason Luboff
@JLuboff
Jan 27 2017 00:34 UTC
use .html instead
@GodKingShogun
super-it-guy
@super-it-guy
Jan 27 2017 00:34 UTC
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:35 UTC
means all the words that have been passed as parameters when the function is called @super-it-guy
David Amanze
@GodKingShogun
Jan 27 2017 00:35 UTC
@JLuboff @HeebieGeeBee @JLuboff thanks
RomingArt
@RomingArt
Jan 27 2017 00:36 UTC
Hello can someone help I been working on this simple code for two days its about Manipulating complex objects?
Diego Mayer
@Chrono79
Jan 27 2017 00:37 UTC
@HeebieGeeBee you have append and prepend reversed: http://api.jquery.com/prepend/ http://api.jquery.com/append/
CoryCMyers
@CoryCMyers
Jan 27 2017 00:37 UTC

Anyone willing to point me in the right direction to finish this off? I for the life of me cannot understand why any of the methods I try to apply to arr do not work.
I know I just have to take the values from arr and convert them back to letters with .fromCharCode but I have no idea why it is not taking.

function rot13(str) { // LBH QVQ VG!
    var arr = [];


     for (var i = 0; i < str.length; i++) { 
           var value = str[i].charCodeAt(0);
         if ( value >= 65 && value <= 77 ) {
           arr.push(String.charCodeAt(0) + 13 );
       } else if ( str[i].charCodeAt(0) >= 78 && str[i].charCodeAt(0) <= 90 ) {
           arr.push(String.charCodeAt(0) - 13 );
       } else {
           arr.push(String.charCodeAt(0));
   }  
  }
  return  arr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");

```

EthanD
@EthanDproject
Jan 27 2017 00:37 UTC
@super-it-guy iam really not sure what this is asking for
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:37 UTC
ahh ok @Chrono79
Diego Mayer
@Chrono79
Jan 27 2017 00:38 UTC
:+1:
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:38 UTC
but yeah it was something like that
super-it-guy
@super-it-guy
Jan 27 2017 00:38 UTC
u r also stumpedEthanD
Diego Mayer
@Chrono79
Jan 27 2017 00:38 UTC
close enough
RomingArt
@RomingArt
Jan 27 2017 00:38 UTC
Hello can someone help I been working on this simple code for two days its about Manipulating complex objects?
CoryCMyers
@CoryCMyers
Jan 27 2017 00:39 UTC
@RomingArt Putting in your code helps people help you :P
EthanD
@EthanDproject
Jan 27 2017 00:39 UTC
@super-it-guy yea iam having the same issue here
RomingArt
@RomingArt
Jan 27 2017 00:39 UTC

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

var myMusic = [
{
"artist": "Daft Punk",
"title": "Homework",
"release_year": 1997,
"formats": [
"CD",
"Cassette",
"LP" ],
"gold": true
}
];

HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:39 UTC
means it wants you to make result equal a complete sentence string using the parameters passed in th function, and seperated by spaces and stuff @super-it-guy @EthanDproject
Jason Luboff
@JLuboff
Jan 27 2017 00:40 UTC
@CoryCMyers Shouldn't we be doing arr.push(String.fromCharCode(str[i].charCodeAt(0) + 13)) or something along those lines so that we are converting the number back to a character? (My code might be a little off I'm going off of memory)
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:43 UTC
@RomingArt what does it ask you to do?
grantknaver
@grantknaver
Jan 27 2017 00:45 UTC
anyone have any ideas on how
Ogundele Olumide
@Lumexralph
Jan 27 2017 00:45 UTC
Hey guys is there something wrong with gitter or is Cbot under the weather :hospital: or on vacation :airplane: ?
Jason Luboff
@JLuboff
Jan 27 2017 00:46 UTC
@Lumexralph Gitter was down earlier for a couple hours. Cbot has not returned...
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:46 UTC
on how? @grantknaver
EthanD
@EthanDproject
Jan 27 2017 00:46 UTC
@HeebieGeeBee it looks @HeebieGeeBee @HeebieGeeBee iam stucked here can figure this out
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:46 UTC
do you understand what the parameters of the funcion are @EthanDproject
CoryCMyers
@CoryCMyers
Jan 27 2017 00:46 UTC
@JLuboff Let me try that!
grantknaver
@grantknaver
Jan 27 2017 00:47 UTC
I go about returning the correct change and limiting it to the denominations offer in the provided arguments?
here is the code... (sorry it is long)

function checkCashRegister(price, cash, cid) {

 // Here is your change, ma'am.
  var moneyTypes = [

{name: "ONE HUNDRED", val: 100.00},
{name:"TWENTY", val: 20.00},
{name:"TEN", val: 10.00},
{name: "FIVE", val: 5.00},
{name:"ONE", val: 1.00},
{name: "QUARTER", val: 0.25},
{name: "DIME", val: 0.10}, 
{name: "NICKEL", val: 0.05},
{name:"PENNY", val: 0.01}

];
  var answer = [];
  var inverseCid = cid.sort(function(a,b){
    return a < b;  
  });
  var howManyDenominations = [];
  for(var i = 0; i < cid.length; i++){
    answer.push(cid[i][1]);
    //howManyDenominations.push(Math.round(inverseCid[i][1] / moneyTypes[i].val));
  }
  var cashInDrawer = answer.reduce(function(a,b){return a + b;});
  cashInDrawer = cashInDrawer.toFixed(2);
  var changeDo = cash - price;
  changeDo = changeDo.toFixed(2);

  var changeReturn = [];
    if(cashInDrawer < changeDo){
      return "Insufficient Funds";
    }else if(cashInDrawer === changeDo){
      return "Closed";
    }else{
      for(var a = 0; a < inverseCid.length; a++){
        for(var b = 0; b <moneyTypes.length; b++){
          if(inverseCid[a][0] === moneyTypes[b]){
             if(){

             }  
          }
        }    
      }
    }
  alert(inverseCid[0][0]); 

  //var changeReturnReduced = changeReturn.reduced(function(a,b){return a + b;});
  //var sortedChange = changeDo.sort(function(a,b){return b[1] < a[1];});




}



checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
EthanD
@EthanDproject
Jan 27 2017 00:47 UTC
@HeebieGeeBee calling the function
??
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:48 UTC
no what the parameters of the function are?
DestroyingLight
@DestroyingLight
Jan 27 2017 00:48 UTC
Hi, which is the correct room to ask React related questions?
EthanD
@EthanDproject
Jan 27 2017 00:48 UTC
no
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:49 UTC
@grantknaver those challenges took me ages, a load of head aches and tears
EthanD
@EthanDproject
Jan 27 2017 00:49 UTC
@HeebieGeeBee @HeebieGeeBee no is that what i need to do here
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:49 UTC
i dont really want to look at them again @grantknaver im still recovering
well you need to understand what parameters are in functions @EthanDproject
in that challenge the parameters of the function are like myNoun Myverb etc etc something like that
so it wants you to make your function take those parameters and turn them into one complete string
how would you make result equal myNoun? @EthanDproject
Brent Vaalburg
@SquaresAndCubes
Jan 27 2017 00:53 UTC

Hey guys I am having trouble with the switch statement challenge was wondering if you could look at my code and provide some feedback. ```
function caseInSwitch(val) {
var answer = "";
// Only change code below this line

case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";
break;

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

// Change this value to test
caseInSwitch(1);
```

Jason Luboff
@JLuboff
Jan 27 2017 00:54 UTC
@SquaresAndCubes You never declared your switch statement
Danilo Geronimo
@danilogeronimo
Jan 27 2017 00:54 UTC
@grantknaver i took 6 days to finish this chanlenge :worried:
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:55 UTC
yeah me about same amount of time
and many re writes
i still havent finished al the advanced challenges
Brent Vaalburg
@SquaresAndCubes
Jan 27 2017 00:55 UTC
wow ok
also why did my backticks not work when I just posted code?
grantknaver
@grantknaver
Jan 27 2017 00:55 UTC
lol @danilogeronimo I feel ya it is taking forever!!!!!!!!!!!!!!!!!11
Danilo Geronimo
@danilogeronimo
Jan 27 2017 00:55 UTC
@HeebieGeeBee yes, It was very difficult for me
@grantknaver i know that feel
Stephen James
@sjames1958gm
Jan 27 2017 00:56 UTC
@SquaresAndCubes back ticks must be on their own line
EthanD
@EthanDproject
Jan 27 2017 00:56 UTC
@HeebieGeeBee you would use the + operation
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:57 UTC
just to make result equal myNoun? @EthanDproject
Stephen James
@sjames1958gm
Jan 27 2017 00:57 UTC
@grantknaver Your sort is probably not correct. If you want to reverse then use .reverse()
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:58 UTC
wouldnt you just say result = myNoun?
Stephen James
@sjames1958gm
Jan 27 2017 00:58 UTC
@DestroyingLight You can ask React questions here - or in front end room.
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 00:58 UTC
though my next question that would come in handy how would you make result equal myNoun plus myVerb @EthanDproject
Ogundele Olumide
@Lumexralph
Jan 27 2017 00:59 UTC
@SquaresAndCubes there's no switch statement`
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:00 UTC
feck its so cold
EthanD
@EthanDproject
Jan 27 2017 01:01 UTC
"myNoun"+"myVerb"
@HeebieGeeBee does this makes sense
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:01 UTC
yes but you dont need the quotes for parameters
they are just variables
EthanD
@EthanDproject
Jan 27 2017 01:02 UTC
so it would only be result=myNoun
Ogundele Olumide
@Lumexralph
Jan 27 2017 01:02 UTC
@JLuboff so CBOT is cruising somewhere :laughing:
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:03 UTC
yes, so result = myNoun + myVerb
Ogundele Olumide
@Lumexralph
Jan 27 2017 01:03 UTC
@JLuboff so CBOT is cruising somewhere :laughing:
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:03 UTC
now words usually have spaces inbetween them so how would you add a space in between myNoun + myVerb @EthanDproject ?
she needs her downtime @Lumexralph
He Liu
@HeLiu
Jan 27 2017 01:05 UTC
@sjames1958gm nevermind sir i solved it
function renderInventory(inventory) {
    return inventory.map(function(inv){
        return inv.shoes.map(function(a, index, array){
            return inv.name + ', ' + a.name + ', '+ a.price +'\n';
        }).join('');
    }).join('')
}

console.log(renderInventory([
  {
    name: 'Brunello Cucinelli',
    shoes: [
      {name: 'tasselled black low-top lace-up', price: 1000},
      {name: 'tasselled green low-top lace-up', price: 1100},
      {name: 'plain beige suede moccasin', price: 950},
      {name: 'plain olive suede moccasin', price: 1050}
    ]
  },
  {
    name: 'Gucci',
    shoes: [
      {name: 'red leather laced sneakers', price: 800},
      {name: 'black leather laced sneakers', price: 900}
    ]
  }
]))
yayy
lol
EthanD
@EthanDproject
Jan 27 2017 01:06 UTC

result=myNoun +myVerb

@

HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:06 UTC
looks like a sexy but expensive inventory
no you need to add a space in the form of a string @EthanDproject
He Liu
@HeLiu
Jan 27 2017 01:07 UTC
yeah just planning out my future wardrobe when i get this developer salary thats all
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:07 UTC
so result = myNoun + " " + myVerb
@EthanDproject
lol @HeLiu
He Liu
@HeLiu
Jan 27 2017 01:07 UTC
oh wait those are girl shoes haha
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:08 UTC
i dont judge bro @HeLiu
Nicolas Figueroa
@nicolasfig
Jan 27 2017 01:08 UTC

Hi, I have a problem with one exercise
*Testing objects for properties" maybe it's a bug idk

if(myObj.hasOwnProperty(checkProp)){ return myObj[checkProp]; }else{ return "Not Found"; } This works

EthanD
@EthanDproject
Jan 27 2017 01:08 UTC
@HeebieGeeBee Yes got it !is this for the first question?
Diego Mayer
@Chrono79
Jan 27 2017 01:09 UTC
@NicolasFig what's the problem then?
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:09 UTC
so now just extend that for all the parameters so it makes a complete sentence @EthanDproject
Nicolas Figueroa
@nicolasfig
Jan 27 2017 01:11 UTC
This doesn't
if(myObj.hasOwnProperty(checkProp))
return myObj.checkProp;
}else{
return "Not Found";
}
The problem is in the first return statement it works with bracket notation but doesn't with dot notation.
Diego Mayer
@Chrono79
Jan 27 2017 01:11 UTC
@NicolasFig that's because you can't use dot notation with vars
Review this: https://www.freecodecamp.com/challenges/accessing-objects-properties-with-variables
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:12 UTC
anyone into game development here?
Nicolas Figueroa
@nicolasfig
Jan 27 2017 01:13 UTC
@Chrono79 that's it, tnx
Ian
@IVB107
Jan 27 2017 01:17 UTC

Hey guys, I'm on the Palindromes challenge and my code runs the way I want it to, but for some reason FCC says it doesn't meet all the objectives... For example: One objective is that 'palindrome("_eye");' should return 'true' which it does. When I test my code to meet all the objectives it operates correctly, and yet I can't go on to the next challenge. Does anyone see some sort of formatting error that could be causing this? Here's my code: '''
var myArray = [];

function palindrome(str){
var newString = str.replace(/[^A-Za-z0-9]/g, '');
newString = newString.toLowerCase();
myArray.map.call(newString, function(x){
myArray.push(x);
});
return newString === myArray.reverse().join('');
}

palindrome("eye");
'''

Diego Mayer
@Chrono79
Jan 27 2017 01:20 UTC

@IVB107 don't use globals, they keep their value between tests
And instead of this:

myArray.map.call(newString, function(x){
myArray.push(x);
});

Why didn't you use split("")?

EthanD
@EthanDproject
Jan 27 2017 01:21 UTC

@HeebieGeeBee i try this but does not work function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result=myNoun+" "+myAdjective+" "+myVerb+" "+myAdverb;
//result="dog, big, ran ,quickly";
//result="cat, little, hit ,slowly";

// Your code above this line
return result;
}

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

HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:24 UTC
whats the name of the challenge @EthanDproject ?
Diego Mayer
@Chrono79
Jan 27 2017 01:24 UTC
@HeebieGeeBee word blanks (like the function)
si
@demon9181
Jan 27 2017 01:25 UTC
'test'
EthanD
@EthanDproject
Jan 27 2017 01:25 UTC
Word Blanks @HeebieGeeBee
si
@demon9181
Jan 27 2017 01:25 UTC
how to i put my code into the black box? :p '''code'''
Diego Mayer
@Chrono79
Jan 27 2017 01:25 UTC
This message was deleted
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:26 UTC
it works when i try it result=myNoun+" "+myAdjective+" "+myVerb+" "+myAdverb; just cut this line out reset your code and paste ti back again
@EthanDproject
Diego Mayer
@Chrono79
Jan 27 2017 01:26 UTC
use
```
your code
```
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:27 UTC
using shift enter to get onto a new line ^
si
@demon9181
Jan 27 2017 01:27 UTC
test
nice!
thanks
EthanD
@EthanDproject
Jan 27 2017 01:28 UTC
@HeebieGeeBee great it workds now thanks man
HeebieGeeBee
@HeebieGeeBee
Jan 27 2017 01:29 UTC
np
Ian
@IVB107
Jan 27 2017 01:33 UTC
@Chrono79 If I don't use globals, how can I eliminate multiple non-alphanumerics? I hadn't thought of using split, map() was the first thing that came to mind and it seemed to work for me
Diego Mayer
@Chrono79
Jan 27 2017 01:34 UTC
@IVB107 the global you're using is an array, it has nothing to do about how you eliminate the non-alphanumeric
Move var myArray = [];inside your function
Map works, but is a little excentric when you have split ;)
Ian
@IVB107
Jan 27 2017 01:38 UTC
@Chrono79 Ahh, now it works. I hadn't thought to move that inside the function. And yes! I went ahead and played around with split after you made that suggestion. There are so many methods I forgot to even try that one. Thank you for your help!
Diego Mayer
@Chrono79
Jan 27 2017 01:38 UTC
no problem
LJ
@NYCgirlLearnsToCode
Jan 27 2017 01:48 UTC

hi all! I'm trying to display this on the console but I keep getting "syntaxerror: invalid or unexpected token" Please advise! var answer =
prompt("you free tonight?");
switch(answer) {
case 'yes':
console.log("wanna grab a drink?");
break;
case 'no':
console.log("aw next time then");
break;
case'maybe':
console.log("take a chance!);
break;
case'uh':
console.log("yes");
break;
default:
console.log("helllooooo?");

}

Stephen James
@sjames1958gm
Jan 27 2017 01:49 UTC
@imnotlostrui I might be because you have no space after your case
LJ
@NYCgirlLearnsToCode
Jan 27 2017 01:51 UTC
i just tried adding a space after all my cases before the ' ' ex : case 'maybe' instead of case'maybe' and same error @sjames1958gm
Stephen James
@sjames1958gm
Jan 27 2017 01:52 UTC
@imnotlostrui MIssing " after chance!
LJ
@NYCgirlLearnsToCode
Jan 27 2017 01:53 UTC
thanks you ! @sjames1958gm
Stephen James
@sjames1958gm
Jan 27 2017 01:53 UTC
@imnotlostrui :+1:
LJ
@NYCgirlLearnsToCode
Jan 27 2017 01:53 UTC
ty @sjames1958gm
Jasper
@DreadfulPhD
Jan 27 2017 02:04 UTC
Hi everyone! Can anyone please help me with this... I've been cracking my head on this for some time now but I simply can't see what's wrong. alt
Stephen James
@sjames1958gm
Jan 27 2017 02:07 UTC
@DreadfulPhD lenght or length?
Jasper
@DreadfulPhD
Jan 27 2017 02:07 UTC
Did I really type that wrong 5 times in a row -_-
thanks!
Joseph
@revisualize
Jan 27 2017 02:15 UTC
That PhD must be Dreadful.
Joseph
@revisualize
Jan 27 2017 02:22 UTC
cbot
Jasper
@DreadfulPhD
Jan 27 2017 02:22 UTC
reference to Skins UK show ;)
Joseph
@revisualize
Jan 27 2017 02:23 UTC
Nah-nah-nah-nah, ooh-oh
:musical_score:
I don't know if this song
Is a surrender or a revel
I don't know if this one
Is about me or the devil
:musical_note:
Stephen James
@sjames1958gm
Jan 27 2017 02:26 UTC
cbot has left the building. :elvis:
Joseph
@revisualize
Jan 27 2017 02:26 UTC
I'm about to leave.
Margaret2 @Margaret2 without cbot, it's only a matter of time before the chat devolves into anarchy... * cue apprehensive music *
Stephen James
@sjames1958gm
Jan 27 2017 02:26 UTC
@revisualize Been raining a lot?
Joseph
@revisualize
Jan 27 2017 02:26 UTC
Free Pizza is in the other room.
Stephen James
@sjames1958gm
Jan 27 2017 02:27 UTC
:pizza:
Joseph
@revisualize
Jan 27 2017 02:27 UTC
@sjames1958gm Seattle weather is Seattle weather.
I'm at a meetup event hosted by CDK Global
Stephen James
@sjames1958gm
Jan 27 2017 02:27 UTC
:cake:
@revisualize Didn't know if you were going a little stir crazy :)
Joseph
@revisualize
Jan 27 2017 02:27 UTC
Free :beer: && :pizza:
Michael Donovan
@duff2481
Jan 27 2017 02:27 UTC
trying modify data structure. need to add to array and a number and then remove the first item in array. i'm absolutely lost.
Joseph
@revisualize
Jan 27 2017 02:27 UTC
@sjames1958gm Ahhh.. Twenty One Pilots is one of my favorite bands.
Them and Puscifer.
okay.
:pizza: :clock2:
Stephen James
@sjames1958gm
Jan 27 2017 02:28 UTC
@duff2481 If you are on standInLine then you should have recently completed for challenges for array manipulation?
This one uses 2
@duff2481 You are given the function skeleton - with the parameter arr (the array) and item (the value)
Michael Donovan
@duff2481
Jan 27 2017 02:31 UTC

yes, and i was okay with that. i've got ```
function nextInLine(arr, item) {
// Your code here
nextInLine([],1);
return arr; // Change this line
}

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

and i used nextInLine.shift in order to bring the first item of array in.
Stephen James
@sjames1958gm
Jan 27 2017 02:32 UTC
@duff2481 nextInLine([],1); rhis is calling the function again. - simply use the array functions from the recent challenges push, pop, shift unshift
and arr and item
Dmytro Holysh
@dmk1111
Jan 27 2017 02:32 UTC
Does anyone know how to check 3-digit number if it has 2 same digits and return true or false? Is it better to use RegExp for this?
Edgar Pan
@edgaryp
Jan 27 2017 02:34 UTC
Does any body know why the result array only got 3 Ms?
function convertToRoman(num) {

var arr = num.toString(10).replace(/\D/g, '0').split('').map(Number);
var result = [];
var ones = 0, tens = 0, hundreds = 0, thousands = 0;

function count(x) {
    if (x == 1) {
      ones += arr[0];
    } else if (x == 2) {
      ones += arr[1];
      tens += arr[0];
    } else if (x == 3) {
      ones += arr[2];
      tens += arr[1];
      hundreds += arr[0];
    } else if (x == 4) {
      ones += arr[3];
      tens += arr[2];
      hundreds += arr[1];
      thousands += arr[0];
    }
  }

count(arr.length);

if (thousands !== 0) {

        for (var i = 0; i <= thousands; i++) {
            result.push("M");
            i++;
        }

}
console.log(result); \\["M", "M", "M"]
}
convertToRoman(5000);
Stephen James
@sjames1958gm
Jan 27 2017 02:35 UTC
@edgaryp i++ twice?
Dmytro Holysh
@dmk1111
Jan 27 2017 02:35 UTC
@edgaryp why do you use i++ twice in same loop?
Edgar Pan
@edgaryp
Jan 27 2017 02:37 UTC
@sjames1958gm Ah I was thinking that I need to tell for loop to i++ every time. I think I was thinking as while loop lol
thank you @sjames1958gm @dmk1111
BRlau
@BRlau
Jan 27 2017 02:43 UTC

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
what am i missing here? Should i put var = arr[] in side the function?
thanks
Adam Parrish
@parrish138
Jan 27 2017 02:43 UTC
hey guys, can anyone tell me why my ELSE statement would always be returning as true? My solution works until I include else and then it defaults to else (have tried == or ===)

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

function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i=0; i < contacts.length; i++) {
if (contacts[i].firstName === firstName)
{
return contacts[i][prop];

}    
// Next line causes the error
else {
  return "error";
}

}

}

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

Joseph
@revisualize
Jan 27 2017 02:46 UTC
hi.
eeflores
@eeflores
Jan 27 2017 02:47 UTC
@parrish138 what happens if you remove the else block?
@parrish138 maybe that return statement should be somewhere else ...
BRlau
@BRlau
Jan 27 2017 02:49 UTC
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i<arr.length; i++) {
    for (var j=0; j<arr.length; j++) {
      console.log(arr[i][j]);
    }
  }
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
what am i missing here? Should i put var = arr[] in side the function?
thanks
Joseph
@revisualize
Jan 27 2017 02:49 UTC
for ( ..... ) {
    if (evaluation) {
        return "truth";
    } else {
        return "lies";
    }
 }
This loop doesn't actually loop.
Because return statements cause functions to HALT.
eeflores
@eeflores
Jan 27 2017 02:50 UTC
@BRlau check your inner for statement
Adam Parrish
@parrish138
Jan 27 2017 02:50 UTC
So return will halt the loop even if the evaluation doesn't trigger?
ahh never mind, you mean the for loop
BRlau
@BRlau
Jan 27 2017 02:51 UTC
@eeflores whats 'inner'?
eeflores
@eeflores
Jan 27 2017 02:51 UTC
for() {
  for () { // <- this is the inner loop
  }
}
Dmytro Holysh
@dmk1111
Jan 27 2017 02:52 UTC
@BRlau maybe it should be this way?
for (var j=0; j<arr[i].length; j++) {
Joseph
@revisualize
Jan 27 2017 02:54 UTC
la la la la.
Cindy Xiong
@cindyx123
Jan 27 2017 02:55 UTC

I'm so lost in the counting cards challenge. can some with help me understand what to do?:
```var count = 0;

function cc(card) {

// Only change code below this line

return "Change Me";
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');```

Michael Donovan
@duff2481
Jan 27 2017 02:55 UTC
@sjames1958gm i'm trying to use item.push() - adds to end of array and arr.shift() which should provide first value of array.
Alexis M. Thompson
@alexisthelark
Jan 27 2017 02:55 UTC
Hi! Can I get some input/help on "Return Early Pattern For Functions"?
Joseph
@revisualize
Jan 27 2017 02:55 UTC
@cindyx123
Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
Adam Parrish
@parrish138
Jan 27 2017 02:55 UTC
@eeflores thanks for the suggestion, but not helping

function lookUpProfile(firstName, prop){
// Only change code below this line
var response = 0;
for (var i=0; i < contacts.length; i++) {
if (contacts[i].firstName == firstName)
{
response = contacts[i][prop];

  } else {
  // Next line causes the error
    response = "error";
  }

}
return response;

}

Alexis M. Thompson
@alexisthelark
Jan 27 2017 02:56 UTC

// Setup
function abTest(a, b) {
// Only change code below this line
case 'a'< 0:
return undefined;
case 'b' < 0:
return undefined;
// Only change code above this line

return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2);

eeflores
@eeflores
Jan 27 2017 02:57 UTC
@parrish138 @revisualize had a message that I can't quite link to above ...
BRlau
@BRlau
Jan 27 2017 02:57 UTC

@eeflores @dmk1111
i have added the arr[i]

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

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

it just return product whihc is 1. how can i get the arr going?

Joseph Uchenna
@afrikhero
Jan 27 2017 02:58 UTC
'''
eeflores
@eeflores
Jan 27 2017 02:58 UTC
@BRlau you'll need to modify the product var where the console.log line is at the moment
Joseph Uchenna
@afrikhero
Jan 27 2017 02:58 UTC

'''
function multiplyAll(arr) {
var product = 1;
// Only change code below this line

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

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

'''

@BRlau am having same issue
Adam Parrish
@parrish138
Jan 27 2017 03:00 UTC
@eeflores , @revisualize , thanks guys, yep saw that, didn't help unfortunatley, same issue even when my return is out of the loop. Might just need to run through it on actual js console with some break points
Cindy Xiong
@cindyx123
Jan 27 2017 03:00 UTC
@revisualize so it makes sense to use the switch in the function right
BRlau
@BRlau
Jan 27 2017 03:02 UTC
@eeflores do you mean i need to add product into console.log like this console.log(arr[i][j][product])? but this still wont affect arr
@afrikhero yep this is tough:')
Dmytro Holysh
@dmk1111
Jan 27 2017 03:02 UTC
@BRlau product = arr[i][j]
David
@dkohlruss
Jan 27 2017 03:02 UTC
This part of a function I wrote seems to cause web browsers to crash when I evaluate the challenge... Is there anything wonky I've done here:
Joseph
@revisualize
Jan 27 2017 03:02 UTC
@cindyx123 ifs do NOT require an else.
eeflores
@eeflores
Jan 27 2017 03:02 UTC
@BRlau product = something
but product = arr[i][j] is not enough
David
@dkohlruss
Jan 27 2017 03:03 UTC

function sumFibs(num) {
  var arr = [1];

  for (var i = 0; i <= num; i++) {
    if (i % 2 == 1) {
      arr.push(i);
    }
  }

// And then flatten/add
}

sumFibs(4);
Joseph
@revisualize
Jan 27 2017 03:03 UTC
@dkohlruss No return.
David
@dkohlruss
Jan 27 2017 03:03 UTC
I deleted the return statement for the purpose of showing what is causing the browser to crash
Joseph
@revisualize
Jan 27 2017 03:04 UTC
@dkohlruss That shouldn't cause the browser to crash.
Let me run it.
Dmytro Holysh
@dmk1111
Jan 27 2017 03:04 UTC
@dkohlruss return arr crashes browser?
David
@dkohlruss
Jan 27 2017 03:04 UTC
yea
well
just doing that crashes browser, returns statement or not
Dmytro Holysh
@dmk1111
Jan 27 2017 03:05 UTC
lol)
Joseph
@revisualize
Jan 27 2017 03:05 UTC
That doesn't crash my browser.
I just ran it twice.
Dmytro Holysh
@dmk1111
Jan 27 2017 03:05 UTC
maybe it's time to update browser?
Joseph
@revisualize
Jan 27 2017 03:05 UTC
@dkohlruss Are you using IE9?
David
@dkohlruss
Jan 27 2017 03:05 UTC
god no
newest versions of chrome & firefox both freeze up
Joseph
@revisualize
Jan 27 2017 03:05 UTC
I just ran the code that you posted and ... It works for me.
No crashing.
David
@dkohlruss
Jan 27 2017 03:05 UTC
weird
Dmytro Holysh
@dmk1111
Jan 27 2017 03:05 UTC
Close everything else than
Joseph
@revisualize
Jan 27 2017 03:05 UTC
It returns undefined
@dkohlruss try running the code through www.pythontutor.com/javascript.html
David
@dkohlruss
Jan 27 2017 03:07 UTC
Ah wait, now I see why haha... some of the examples are in the millions, so it's crashing out because it's iterating over a loop a million times
I should just do the challenges in an ide
Joseph Uchenna
@afrikhero
Jan 27 2017 03:09 UTC
@BRlau have you gotten any help?
Dan Sutton
@danthecardman
Jan 27 2017 03:11 UTC

I'm stuck on the Javascript Counting Cards exercise.

var count = 0;

function cc(card) {
// Only change code below this line

switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
card= "5 Bet";
count +=1;
break;
case 7:
case 8:
case 9:
card="0 Hold";
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
card="-5 Hold";
count -=1;
break;

case 3,7,'Q',8,'A':
  count +=1;
  card= "-1 Hold";
 break;
case 2,'J',9,2,7:
  count -=1;
  card= "1 Bet"; 
  break;
case 2,2,10:
  count -=1;
  card= "1 Bet";
  break;
case 3,2,'A',10,'K':
  count -=1;
  card= "-1 Hold";
 break;

}

return card;//"Change Me";
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(3); cc(7); cc('Q'); cc(8); cc('A');

Joseph
@revisualize
Jan 27 2017 03:13 UTC
Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
Dan Sutton
@danthecardman
Jan 27 2017 03:13 UTC

The problems I am having are: I am unable to get Card Sequences to work with these 4 criteria.

3, 7, Q, 8, A should return "-1 Hold"
Cards Sequence 2, J, 9, 2, 7 should return "1 Bet"
Cards Sequence 2, 2, 10 should return "1 Bet"
Cards Sequence 3, 2, A, 10, K should return "-1 Hold"
... as the code below isn't working.
case 3,7,'Q',8,'A':
count +=1;
card= "-1 Hold";
break;
case 2,'J',9,2,7:
count -=1;
card= "1 Bet";
break;
case 2,2,10:
count -=1;
card= "1 Bet";
break;
case 3,2,'A',10,'K':
count -=1;
card= "-1 Hold";
break;

Joseph Uchenna
@afrikhero
Jan 27 2017 03:14 UTC

,,,

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

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

BRlau
@BRlau
Jan 27 2017 03:14 UTC
@eeflores if arr=([[1,2],[3,4],[5,6,7]]), then [i] = [1,2],[3,4],[5,6,7]
[j] = 1,2,3,4,5,6,7, if product= arr[i][j] = [1,2],[3,4],[5,6,7]X1,2,3,4,5,6,7 right? but what i want is multiplies "each" number individually; ex: [1x2][34][56*7] ?
Joseph
@revisualize
Jan 27 2017 03:14 UTC
@afrikhero You have a function multiplyAll but, you're not multiplying anything.
Brian Amos
@StarlingBlaze
Jan 27 2017 03:15 UTC
need help with JQuery
Cindy Xiong
@cindyx123
Jan 27 2017 03:15 UTC

@revisualize, what am i suppose to do from here
var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
}

return "Change Me";
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

Brian Amos
@StarlingBlaze
Jan 27 2017 03:15 UTC
trying to add this: $("button").addClass("animated bounce");

to this: <script>
$(document).ready(function() {

});
</script>

Joseph Uchenna
@afrikhero
Jan 27 2017 03:15 UTC
@revisualize how do I multiply and assign to product. I tried *=
Brian Amos
@StarlingBlaze
Jan 27 2017 03:16 UTC
it doesnt work when i insert it all into the parentheses after the function
Joseph Uchenna
@afrikhero
Jan 27 2017 03:17 UTC
@revisualize thanks
Dan Sutton
@danthecardman
Jan 27 2017 03:18 UTC
Sorry for the last two (large cut and paste ) code I posted. I just learned I can use Gist to post my code I'll need help with
Joseph Uchenna
@afrikhero
Jan 27 2017 03:18 UTC

@BRlau

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

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

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

BRlau
@BRlau
Jan 27 2017 03:20 UTC
@afrikhero i dont understand the concept here, arr[i][j]=7 and 'product'= 1, 7*1= 7; but it shows 5041
5040*
aletanita0821
@aletanita0821
Jan 27 2017 03:22 UTC
I'm in the stand in line part and I got stuck, how am I supposed to make the nextInLine function return the element that was removed?

function nextInLine(arr, item) {
// Your code here
var queue = [arr];
queue.push(item);
queue.shift();

return item; // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine([], 1));
console.log(nextInLine([2], 1));
console.log(nextInLine([5,6,7,8,9], 1)); // Modify this line to test
console.log("After: " + JSON.stringify(nextInLine(testArr, 10)));

help please!
Mauro Ochoa Elizondo
@M8A98
Jan 27 2017 03:24 UTC
var myStr = "FirstLine\n
\SecondLine\\r
ThirdLine";
Hi!
i´m at escpe sequences in Strings, and I really do not understand what is wrong, can someone please help?
BRlau
@BRlau
Jan 27 2017 03:25 UTC
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (var i=0; i<arr.length; i++) {
    for (var j=0; j<arr[i].length; j++) {
      console.log(product*=arr[i][j]);
    }
  }
  // Only change code above this line
  return product;
}
i dont understand what does product*=arr[i][j] mean
Dan Sutton
@danthecardman
Jan 27 2017 03:25 UTC
Please help with the Card Counting exercise. Here's my gist link: danthecardman/gist:90a75d16b79b8278dc5a3761ff53bad3
Joseph Uchenna
@afrikhero
Jan 27 2017 03:26 UTC
@BRlau I didn't use that concept. I just assigned product multiples of arr by product *= arr[i][j]
Dan Sutton
@danthecardman
Jan 27 2017 03:26 UTC
still new at this hope this displays the hyperlink: (danthecardman/gist:90a75d16b79b8278dc5a3761ff53bad3)
BRlau
@BRlau
Jan 27 2017 03:27 UTC
@afrikhero but product is 1, anything times 1 should be the same value
right?
Joseph Uchenna
@afrikhero
Jan 27 2017 03:28 UTC
remove the console.log @BRlau the return statement will do the output
Christopher McCormack
@cmccormack
Jan 27 2017 03:29 UTC
@BRlau product*=arr[i][j] is the equivelant of saying product equals product times the j'th element in the i’th elment of the array ‘arr’
@BRlau you are assigning the result back to product, so the next iteration it would be the new value of product times the next number.
Tina
@tsolar74
Jan 27 2017 03:35 UTC
I am stuck on the Increment a Number with JavaScript on freeCodeCamp. Help!
BRlau
@BRlau
Jan 27 2017 03:37 UTC
@cmccormack do you mind to show the actual numeric value to calculate this? like what value is arr[i][j]
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 03:37 UTC

@revisualize ....What do u think is wrong with my code?

''''
var Bike = function() {

// Only change code below this line.
var gear = 0;

this.setGear =function(change) {

gear += change;

};

this.getGear = function() {
return gear;
};

};

var myCar = new Car();

var myBike = new Bike();
myBike.setGear(4);

BRlau
@BRlau
Jan 27 2017 03:37 UTC
i dont wanna just skin this chapter without understanding it :worried:
kameroer
@kameroer
Jan 27 2017 03:38 UTC

What am I missing here? The function won't pull the property's value:
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
var result = "";
if(myObj.hasOwnProperty(checkProp)){
result = myObj.checkProp;
}else{
result = "Not Found";
}

return result;
}

Sergey Lukin
@not-a-cylon
Jan 27 2017 03:39 UTC
@kameroer try result = myObj[checkProp] instead.
Christopher McCormack
@cmccormack
Jan 27 2017 03:39 UTC
so let’s pretend i = 0 and j =1, if arr = [ [1, 2, 3], [4, 5, 6] ], arr[i][j] is the same as arr[0][1] which is second element of the first element. The first element is [1, 2, 3], the second element of the first element would be 2. Just remember you always start from 0.
Joseph Uchenna
@afrikhero
Jan 27 2017 03:39 UTC
@BRlau the parameters of the function call multiply are the actual numeric value for arr[i][j]
Sergey Lukin
@not-a-cylon
Jan 27 2017 03:40 UTC
otherwise it looks for a key literally named "checkProp"
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 03:40 UTC

@revisualize ....What do u think is wrong with my code?

''''
var Bike = function() {

// Only change code below this line.
var gear = 0;

this.setGear =function(change) {

gear += change;

};

this.getGear = function() {
return gear;
};

};

var myCar = new Car();

var myBike = new Bike();
myBike.setGear(4);

Joseph Uchenna
@afrikhero
Jan 27 2017 03:41 UTC
remember arr was not just declared as a var. It is used as a parameter. When the function calls in [[1,2],[3,4],[5,6,7] as parameters that goes for arr[i][j] @BRlau
kameroer
@kameroer
Jan 27 2017 03:42 UTC
I understand, that wasn't made clear to me in that section. My takeaway was that the bracket notation was used for spaces. It worked. Thank you @not-a-cylon
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 03:43 UTC

What do u think is wrong with my code?

''''
var Bike = function() {

// Only change code below this line.
var gear = 0;

this.setGear =function(change) {

gear += change;

};

this.getGear = function() {
return gear;
};

};

var myCar = new Car();

var myBike = new Bike();
myBike.setGear(4);

HELP PLEASE
Niels3030
@niels3030
Jan 27 2017 03:46 UTC

ok, i totally understand the algorithm, that's not the problem, but what the hell do they mean with "Change the inputs below to test your code" function convertToF(celsius) {
var fahrenheit;

// Only change code below this line
fahrenheit = 9 / 5;
fahrenheit *= -30;
fahrenheit += 32;
//

fahrenheit += 32;
// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF();
fahrenheit = 9 / 5;
fahrenheit *= -10;

BRlau
@BRlau
Jan 27 2017 03:47 UTC
@afrikhero @cmccormack thanks guys, i get it now
Mahaveer
@mahaveer0496
Jan 27 2017 03:47 UTC
it means appointing different inputs to your code so you can see if it works for all the inputs @niels3030
its upto you if you dont wanna do it though
Niels3030
@niels3030
Jan 27 2017 03:48 UTC
@mahaveer0496 so maybe if i just put // comments between my code, i would be good to go?
Mahaveer
@mahaveer0496
Jan 27 2017 03:49 UTC
//comments are ignored while running the code anyways , so yes it would be good to go
Joseph Uchenna
@afrikhero
Jan 27 2017 03:49 UTC
@BRlau am waiting for you when u get to 217 let me know. Let's work in pair
Niels3030
@niels3030
Jan 27 2017 03:50 UTC
@mahaveer0496 Word!! Thank you!!!
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 03:50 UTC
i figured out... i was incrementing my gear at all instance
Mahaveer
@mahaveer0496
Jan 27 2017 03:50 UTC
also you need to Relate celsius ( the argument you're passing) with fahrenheit (in your algo )
@niels3030
i dont see the code where you relate them , so just a heads up :)
BRlau
@BRlau
Jan 27 2017 03:51 UTC
@afrikhero 217?
Joseph Uchenna
@afrikhero
Jan 27 2017 03:52 UTC
@BRlau Yea
Niels3030
@niels3030
Jan 27 2017 03:53 UTC
@mahaveer0496 right, the algorithm is 'temp in celsius times 9/5, +32' I understand that part, but i don't understand how they wanted me to test my code ... for the input, does my code go between ( ) ?
Mahaveer
@mahaveer0496
Jan 27 2017 03:54 UTC
when we call a function we pass in an argument ( that argument is Input )
so that line just means --- try to call you function with different arguments and see if it works
so if your function is function celsiusToFahrenheit(celsius){code} you would give different inputs like celsiusToFahrenheit(32) , celsiusToFahrenheit(-23)
while calling the function celsiusToFahrenheit
understand now ? :)
Krittiya Clark
@krittiyaclark
Jan 27 2017 03:58 UTC
Hi guys - I stuck with the Filter Arrays with filter challenge.
Niels3030
@niels3030
Jan 27 2017 03:58 UTC
@mahaveer0496 omg!!! I hate when it's so simple!!! yes i understand.... thank you so much!!!!!!
Mahaveer
@mahaveer0496
Jan 27 2017 03:58 UTC
you're welcome :)
Krittiya Clark
@krittiyaclark
Jan 27 2017 03:59 UTC
Can anyone help please?
DavHobbs
@DavHobbs
Jan 27 2017 03:59 UTC
Quick question - I am just starting the JavaScript lessons and I want to know the difference between var product = 8 0; AND myVar = 80; ---- in the lessons they write it often as myVar or var product and I am wondering if they are essentially the same
Mahaveer
@mahaveer0496
Jan 27 2017 03:59 UTC
sure can , show what you've done so far :)
var is a Keyword , which means you're declaring a variable @replymedia
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:00 UTC

@niels3030 ... sumthing like this

''''
celsiusToFahrenheit(celsius) {
var Fahrenheit = (celsius * 9 / 5) + 32;
}

//then you call it with u arguement

Krittiya Clark
@krittiyaclark
Jan 27 2017 04:00 UTC
My code

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

// Only change code below this line.

var newArray = oldArray.filter(function(val) {
  return val < 6;
});

var newArray = oldArray;
Mahaveer
@mahaveer0496
Jan 27 2017 04:00 UTC
so var product = 80 means `product is a variable having its value set to 80
mrimosthe1
@mrimosthe1
Jan 27 2017 04:01 UTC
hey guys I am stuck with World Blanks lesson in JavaScript
eeflores
@eeflores
Jan 27 2017 04:01 UTC
@krittiyaclark looks like you're overwriting newArray
DavHobbs
@DavHobbs
Jan 27 2017 04:01 UTC
@mahaveer0496 thank you yes that is understood, however, is stating myVar = 80 the same?
Mahaveer
@mahaveer0496
Jan 27 2017 04:01 UTC
@krittiyaclark what you need help with ?
@replymedia no its not
Manish Giri
@Manish-Giri
Jan 27 2017 04:01 UTC
@krittiyaclark var newArray = oldArray; is wrong
Mahaveer
@mahaveer0496
Jan 27 2017 04:02 UTC
without var you declare a Global variable as far as i know
DavHobbs
@DavHobbs
Jan 27 2017 04:04 UTC
Screen Shot 2017-01-26 at 8.02.44 PM.png
@mahaveer0496 If you look at the screenshot I just took, what is the difference between the example and what is on the code prompt?
Mahaveer
@mahaveer0496
Jan 27 2017 04:05 UTC
@krittiyaclark in your code newArray is the filtered version of oldArray so assigning oldArray to newArray again is wrong
Niels3030
@niels3030
Jan 27 2017 04:06 UTC
@mindsworth thanks pal, i'm so new to JS that I haven't really gotten around to learning the terminology yet... thx again!!!
Krittiya Clark
@krittiyaclark
Jan 27 2017 04:06 UTC
@mahaveer0496 @Manish-Giri You know what I did all you said before I asked for help but I did not work. Now it works!
mrimosthe1
@mrimosthe1
Jan 27 2017 04:06 UTC
![alt](http://D:\Mrinmoy\untitled.png)
Mahaveer
@mahaveer0496
Jan 27 2017 04:07 UTC
@replymedia i think this is what you wanted to know
when using var product = 0 i DECLARED and ASSIGNED a value to that variable , so if i need to use that variable product again , i would simply use product = something else as i've already declared it
Amarillia
@Amarillia
Jan 27 2017 04:07 UTC
Hi! Have a question if somebody can help me please. When you do a simple addition for integers in JS is a+b. But how you do it if you want to use a variable to store the operational sign??
mrimosthe1
@mrimosthe1
Jan 27 2017 04:08 UTC
alt%20%7B%0A%20%20var%20result%20%3D%20%22wrwr%22%3B%0A%20%20%2F%2F%20Your%20code%20below%20this%20line%0A%20%0A%0A%20%20%2F%2F%20Your%20code%20above%20this%20line%0A%20%20return%20result%3B%0A%7D%0A%0A%2F%2F%20Change%20the%20words%20here%20to%20test%20your%20function%0AwordBlanks(%22dog%22%2C%20%22big%22%2C%20%22ran%22%2C%20%22quickly%22)%3B%0A%20%20mynoun%20%2B%20%22is%22%20%2B%20myAdjective%20%2B%20%22so%20it%22%20%2B%20myVerb%20%2B%20%22away%22%20%2B%20myAdverb%3B%0A
god sorry
how do we attatch a image?
I means screenshot
*mean
Mahaveer
@mahaveer0496
Jan 27 2017 04:09 UTC
@Amarillia i think this is how eval(your 1st operand + operator + your 2nd operand)
@Amarillia if you post a link or the challenge i can help better
Krittiya Clark
@krittiyaclark
Jan 27 2017 04:09 UTC
@mahaveer0496 @Manish-Giri Thanks guys!
mrimosthe1
@mrimosthe1
Jan 27 2017 04:10 UTC
hey guys I am stuck with World Blanks lesson in JavaScript error shown is MyNoun not defined
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:11 UTC

@Amarillia ... simple

just do var yourVarName = a + b;

Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:11 UTC
@spyte3n .. let me see your code
Amarillia
@Amarillia
Jan 27 2017 04:12 UTC
@mahaveer0496 this is not a freeCodeCamp challenge, I found it on the internet but this is was what I was searching for :) Many thanks!
thanks @mahaveer0496
Mahaveer
@mahaveer0496
Jan 27 2017 04:12 UTC
i helped ? O.o
i just randomly thought you needed that XD
Amarillia
@Amarillia
Jan 27 2017 04:13 UTC
Hmm are the brownie points not working or I missed sg? @mahaveer0496 Yep, it worked :D
mrimosthe1
@mrimosthe1
Jan 27 2017 04:16 UTC
@mindsworth I am using help for the first time, do ypu mind telling how to send screenshot of the code here
Hassaan Hafeez
@HassHz
Jan 27 2017 04:17 UTC
```
paste code between 3 back ticks
```
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:18 UTC
@spyte3n ... thats it from @HassHz
mrimosthe1
@mrimosthe1
Jan 27 2017 04:21 UTC

\\
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "wrwr";
// Your code below this line
console.log( mynoun + "is" + myAdjective + "so it" + myVerb + "away" + myAdverb);

// Your code above this line
return result;
}

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

\\
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "wrwr";
// Your code below this line
console.log( mynoun + "is" + myAdjective + "so it" + myVerb + "away" + myAdverb);

// Your code above this line
return result;
}

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

Hassaan Hafeez
@HassHz
Jan 27 2017 04:22 UTC
copy paste these backticks: ```
Amarillia
@Amarillia
Jan 27 2017 04:23 UTC
@spyte3n There is an icon next to the text field (where you type your messages) - it is a capital 'M'and down arrow. - If you click on that, opens a pop up window, you can also see the help
mrimosthe1
@mrimosthe1
Jan 27 2017 04:23 UTC
shit I am so dumb I still did not get it
Hassaan Hafeez
@HassHz
Jan 27 2017 04:23 UTC
Then press shift+enter, then paste code, then press shift+enter again and paste those 3 backticks
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:24 UTC
@spyte3n ... works in this order ... Brighter Grammer
myAdjective + "is" + mynoun + "so it" + myVerb + "away" + myAdverb
mrimosthe1
@mrimosthe1
Jan 27 2017 04:24 UTC

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "wrwr";
  // Your code below this line
  console.log( mynoun + "is" + myAdjective + "so it" + myVerb + "away" + myAdverb);

  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Hassaan Hafeez
@HassHz
Jan 27 2017 04:25 UTC
@spyte3n The reason your program doesn't work is because you are putting this mynoun + "is" + myAdjective + "so it" + myVerb + "away" + myAdverb in your console.log(), and not your result variable like you should be doing.
Also that will print: dogisbigso itranawayquickly. So add spaces between your strings/words!
Joseph
@revisualize
Jan 27 2017 04:26 UTC
cbo
cbot
@spyte3n You need to modify and return result
Not ... console.log
mrimosthe1
@mrimosthe1
Jan 27 2017 04:28 UTC
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line
 result= mynoun + " is " + myAdjective + " so it " + myVerb + " away " + myAdverb;

  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
still showing error
Hassaan Hafeez
@HassHz
Jan 27 2017 04:28 UTC
@spyte3n myNoun not mynoun
Joseph
@revisualize
Jan 27 2017 04:29 UTC
yeah. that.
mrimosthe1
@mrimosthe1
Jan 27 2017 04:29 UTC
@HassHz oops sorry
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:29 UTC
@spyte3n ... follow the order i gave u earlier
mrimosthe1
@mrimosthe1
Jan 27 2017 04:29 UTC
Thanks a lot
I did that earlier.
@mindsworth thanks man
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:30 UTC
@spyte3n .. u welcome
Joseph
@revisualize
Jan 27 2017 04:30 UTC
Thanks @camperbot
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 04:31 UTC
plz help

function sumAll(arr) {
var sum = 0;
var min= Math.min(arr);
var max= Math.max(arr);

for (var i =min; i <= max; i++){
    sum += i;
}

return sum;
}

sumAll([1, 4]);

error ?
Hassaan Hafeez
@HassHz
Jan 27 2017 04:33 UTC
@Gurminder-Kaler try doing Math.min(...arr); Math.max(...arr);?
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 04:33 UTC
give me syntax error if i do (...arr)
Hassaan Hafeez
@HassHz
Jan 27 2017 04:34 UTC
@Gurminder-Kaler It works for me, it may give you a warning (shouldn't be an error), but that's because that is ES6
You could also do:
Math.max.apply(arr);
or
Math.max(arr[0], arr[1]);
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 04:37 UTC
@Gurminder-Kaler .. use reduce function on the array that takes two parameter.. min and max
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 04:38 UTC
@HassHz ty
DavHobbs
@DavHobbs
Jan 27 2017 04:38 UTC
@mahaveer0496 thank you
Jalaj
@TheVip
Jan 27 2017 04:43 UTC

I am on the challenge 'Where Do I Belong' and some days ago a guy here gave the solution for the challenge to me,


function getIndexToIns(arr, num) {

  var sortedArr = arr.sort();
  var number = 0;

  for (var i = 0; i < arr.length; i++) {
    if (sortedArr[i] < num) {
      number += 1;
    }
  }

  return number;
}

getIndexToIns([40, 60], 50);

The solution is working but I don't know how and what it is doing, can somebody explain this to me please?

Niels3030
@niels3030
Jan 27 2017 04:43 UTC
...
Albert L. C.
@sirus3020
Jan 27 2017 04:44 UTC
guys. Why is str.fromCharCode() not a function?
Joseph
@revisualize
Jan 27 2017 04:47 UTC
@sirus3020 How are you using it?
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 04:47 UTC
@TheVip it's ezz u are saving a sorted array using arr.sort() into variable named sortedArr(which has now become a array it self),here num = maximum vale which u hit in the sorted array which simultaneously increments a counter named "number" , giving info about the place on which "num" is placed.
Jalaj
@TheVip
Jan 27 2017 04:50 UTC
@Gurminder-Kaler , oh! I was confused that why we are increasing number, anyways now i got it. THANKS!
Albert L. C.
@sirus3020
Jan 27 2017 04:52 UTC
in the ROT13, do I add 13 to the value of the char?
eeflores
@eeflores
Jan 27 2017 04:52 UTC
fromCharCode takes a parameter
var something = String.fromCharCode(67);
"Test".charCodeAt(0);
Albert L. C.
@sirus3020
Jan 27 2017 04:58 UTC
where can i find the charcodes of letters?
eeflores
@eeflores
Jan 27 2017 04:58 UTC
@sirus3020 you can use "A".charCodeAt(0) and "Z".charCodeAt(0)
Albert L. C.
@sirus3020
Jan 27 2017 04:59 UTC
alright. thanks
eeflores
@eeflores
Jan 27 2017 04:59 UTC
@sirus3020 and the other capital letters are in between
Kraig Carr
@Praiseit
Jan 27 2017 04:59 UTC
Has anyone finished the 'Stand in line' challenge? I need some help with it.
eeflores
@eeflores
Jan 27 2017 05:00 UTC
what's the question?
Ammy3165
@Ammy3165
Jan 27 2017 05:01 UTC

hi everybody, I am solving seek and destroy challenge, Look where I am doing wrong,
function destroyer(arr) {
// Remove all the values
for(var i=0, len=arguments[0].length; i<len; i++){
return Array.slice(arguments)!= arguments[1]&&arguments[2];
}
}
var filtered= [].filter(destroyer);

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

Kraig Carr
@Praiseit
Jan 27 2017 05:02 UTC
I don't know what it means by 'Add the number to the end of the array, then remove the first element of array.' Is that what I'm doing to line 5, where the code says 'return item;'?
Ammy3165
@Ammy3165
Jan 27 2017 05:04 UTC
hey is here someone?
eeflores
@eeflores
Jan 27 2017 05:04 UTC
@Praiseit so if you have an array var arr = [4, 5, 6] and call nextInLine(arr, 8) arr will become [5, 6, 8] and the function will return 4
@Ammy3165 maybe returning too early?
@Ammy3165 dunno if your use of filter is correct
jamesjd54
@jamesjd54
Jan 27 2017 05:06 UTC

what do you guys think about this function for the first algorithm challenge? would there be a better way to do it?

function reverseString(str) {
stringArray=str.split("");
reversedArray=stringArray.reverse();
reversedStr=reversedArray.join("");
return reversedStr;

}

reverseString("wooooooooo it works");

Ammy3165
@Ammy3165
Jan 27 2017 05:08 UTC
@jamesjd54 No I Think you did it but you have to give space between "" this symbol
eeflores
@eeflores
Jan 27 2017 05:08 UTC
@jamesjd54 you can single line it
return str.split("").reverse().join("");
will
@williezerocool
Jan 27 2017 05:16 UTC

is this set up right, and i would love any hints as to why its not working https://www.freecodecamp.com/challenges/seek-and-destroy
function destroyer(arr) {
//create function to test if arguments 1 & 2 are in argument 0
function filterArr(){
//create for loop to loop threw argument 0
for(var i=0; i < arguments[0].length; i++){
//condition statement to run check
if (arguments[0][i] === arguments[1] && arguments[0][i] === arguments[2]){
return false;
} else{
return true;
}

}

}
//filtering array
return arr.filter(filterArr);
}

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

Kraig Carr
@Praiseit
Jan 27 2017 05:19 UTC
@eeflores how does 8 being at the end of var arr remove 4?
Jonathan Mancia
@jonmancia
Jan 27 2017 05:20 UTC
What am I doing wrong?
var num = 1;
var fizz = "fizz";
var buzz = "buzz";
while (num < 100){
  if (num % 3 === 0){
    console.log(fizz);
  }
  else if (num % 5 === 0) {
      console.log(buzz)
  }
    else if ((num % 3 && num % 5) === 0) {
      console.log("fizzbuzz");
    }
    else {
      console.log(num);
    }
      num++;
    }
Console.log("fizzbuzz") is not working.
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 05:22 UTC
@jonmancia else if ((num % 3) && (num % 5) === 0) {
console.log("fizzbuzz");
}
Sergey Lukin
@not-a-cylon
Jan 27 2017 05:22 UTC
^
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 05:22 UTC
braces over num%3 and num % 5
try if it works
Jonathan Mancia
@jonmancia
Jan 27 2017 05:23 UTC
why does it do that?
jamesjd54
@jamesjd54
Jan 27 2017 05:27 UTC
is there a way to multiply every value in an array by the next number in the array?
so like [1,2,3] would be 123
1 x 2 x 3 i mean
Sergey Lukin
@not-a-cylon
Jan 27 2017 05:28 UTC
@jamesjd54 yeah, just use a for loop
or the reduce function.
jamesjd54
@jamesjd54
Jan 27 2017 05:29 UTC
cool thanks man
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 05:29 UTC
var multiply ;while(i<max){multiply=arr[i]*arr[i+1];}
@jamesjd54
jamesjd54
@jamesjd54
Jan 27 2017 05:30 UTC
reduce is exactly what i need i think
Sergey Lukin
@not-a-cylon
Jan 27 2017 05:30 UTC
@jonmancia ((num % 3 && num % 5) === 0) --> ((0 && 0) === 0) --> (false === 0) --> false
jamesjd54
@jamesjd54
Jan 27 2017 05:30 UTC
im probably doing this a really inefficient way, but its gunna make my function work
Jonathan Mancia
@jonmancia
Jan 27 2017 05:31 UTC
@not-a-cylon iget it
Sergey Lukin
@not-a-cylon
Jan 27 2017 05:31 UTC
for when num is 15 or 30, which is supposed to be true.
coolio
Jonathan Mancia
@jonmancia
Jan 27 2017 05:31 UTC
thank you @not-a-cylon
Matt Richards
@mattjrichards
Jan 27 2017 05:33 UTC
Can someone help me with lesson #173? What do they mean by "takes an array (arr) and a number (item) as arguments" in this sentence:
Write a function nextInLine which takes an array (arr) and a number (item) as arguments.
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 05:34 UTC
function nextInLine(arr,item){
declare before var arr[]; var item=0;
what i meant was :make sure these are pre- declared declare variables & then create a function
Jonathan Mancia
@jonmancia
Jan 27 2017 05:36 UTC
hey guys, my loop is still not working :worried:
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 05:36 UTC
function nextInLine(arr,item){}
Edgar Pan
@edgaryp
Jan 27 2017 05:37 UTC
Just want to say that I finally passed the Roman Numeral Converter. Very difficult, to me anyway lol Happy coding everyone.
Ayush Bahuguna
@relentless-coder
Jan 27 2017 05:37 UTC
does anyone here have experience with adminLTE template?
Gurminder-Kaler
@Gurminder-Kaler
Jan 27 2017 05:38 UTC
@relentless-coder what about it ?
GauravChandrawale
@GauravChandrawale
Jan 27 2017 05:42 UTC
JSON.stringify wt does mean ??
chapter name : Stand in Line
i didnt get it
in previous lessons thr is no code like this ...
Matt Richards
@mattjrichards
Jan 27 2017 05:44 UTC
@Gurminder-Kaler I'm totally not getting what they want me to do in this lesson.
BRlau
@BRlau
Jan 27 2017 05:44 UTC
@kilocycle meaning that u should put array and number into a function
Matt Richards
@mattjrichards
Jan 27 2017 05:44 UTC
@GauravChandrawale I'm on the same lesson. I'm totally stumped.
GauravChandrawale
@GauravChandrawale
Jan 27 2017 05:45 UTC
:worried:
Ayush Bahuguna
@relentless-coder
Jan 27 2017 05:45 UTC
@Gurminder-Kaler I have built a multilevel menu, but the problem is that whenever I click on the list items that are not inside multilevel, the multilevel won't collapse
jamesjd54
@jamesjd54
Jan 27 2017 05:46 UTC
im doing the algorithm challenges...is it normal to be solving these knowing that your code is way longer than it has to be?
Ayush Bahuguna
@relentless-coder
Jan 27 2017 05:47 UTC
@GauravChandrawale don't want to sound rude, but you should definitely lookup a little bit before asking for help. here's some info on stringify https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
kyadondo Timothy
@chadwalt
Jan 27 2017 05:47 UTC
hello guys has anyone used easyui before
Amarillia
@Amarillia
Jan 27 2017 05:47 UTC
@jonmancia Shouldn't be a semicolon after console.log in the else if?
Ayush Bahuguna
@relentless-coder
Jan 27 2017 05:47 UTC
@GauravChandrawale it's for your own good, otherwise you'd become habitual of being spoon fed
GauravChandrawale
@GauravChandrawale
Jan 27 2017 05:48 UTC
@relentless-coder no but it suddenly came thts y
Ayush Bahuguna
@relentless-coder
Jan 27 2017 05:49 UTC
@GauravChandrawale whatever suits you
Rob Gibb
@RobGibb
Jan 27 2017 05:49 UTC
any way I could get down and boogie before the night is over ?
Joseph
@revisualize
Jan 27 2017 05:49 UTC
Everything that you need to do in Stand In Line was 100% covered by FreeCodeCamp before the lesson.
Rob Gibb
@RobGibb
Jan 27 2017 05:50 UTC
are you making fun of me ?
kyadondo Timothy
@chadwalt
Jan 27 2017 05:51 UTC
come on guys I need some help with easyui javascript framework. Anyone used it before???
Amarillia
@Amarillia
Jan 27 2017 05:51 UTC
@jonmancia also wouldn't be easy if you would use num % 15 === 0 instead of adding both?
Joseph
@revisualize
Jan 27 2017 05:52 UTC
FreeCodeCamp doesn't cover EasyUI ... And it isn't a popular UI. Maybe you should look for a dedicated chat room for the EasyUI Framework.
kyadondo Timothy
@chadwalt
Jan 27 2017 05:53 UTC
@revisualize thanks
Matt Richards
@mattjrichards
Jan 27 2017 05:55 UTC
So we have to use push pop or shift somewhere in the code? Because it's asking to add the number to the end of the array, then remove the first element of the array.
If I go off of what I previously learned, I would think that would have to be somewhere in the code.
Amarillia
@Amarillia
Jan 27 2017 05:56 UTC
@jonmancia When you make a loop it is possible to solve usually with for loop and while loop as well. However there is a slight difference. We use for loops if we know how many times we would like to run a loop (which for fizzbuzz is more appropriate as we know we want to run until 100), and we use while loops until a condition will become false. E.g. move forward until there is a road ahead.
Joseph
@revisualize
Jan 27 2017 05:57 UTC

@kilocycle
Manipulate Arrays With push()

Manipulate Arrays With pop()

Manipulate Arrays With shift()

Manipulate Arrays With unshift()

Matt Richards
@mattjrichards
Jan 27 2017 05:59 UTC
@revisualize So that has to be somewhere in the code for lesson #173?
Joseph
@revisualize
Jan 27 2017 05:59 UTC

The push() method adds one or more elements to the end of an array and returns the new length of the array.

The pop() method removes the last element from an array and returns that element.

The shift() method removes the first element from an array and returns that element.

The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.

Anmar0293
@Anmar0293
Jan 27 2017 06:00 UTC
PLEASE HELP!
WHAT IS WRONG!
mrimosthe1
@mrimosthe1
Jan 27 2017 06:02 UTC
@kilocycle even i am stumped
Matt Richards
@mattjrichards
Jan 27 2017 06:03 UTC
@spyte3n Yeah, they don't prepare us for this one.
mrimosthe1
@mrimosthe1
Jan 27 2017 06:04 UTC
yeah
Anmar0293
@Anmar0293
Jan 27 2017 06:04 UTC
PLEASE HELP!
Matt Richards
@mattjrichards
Jan 27 2017 06:04 UTC
They don't elaborate enough.
mrimosthe1
@mrimosthe1
Jan 27 2017 06:04 UTC
```

function nextInLine(arr, item) {
// Your code here
testArr.push([],1);
testArr.shift();

return item; // Change this line
}

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

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

function nextInLine(arr, item) {
// Your code here
testArr.push([],1);
testArr.shift();

return item; // Change this line
}

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

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

Anmar0293
@Anmar0293
Jan 27 2017 06:05 UTC
Why my code doesn't work?
mrimosthe1
@mrimosthe1
Jan 27 2017 06:05 UTC

function nextInLine(arr, item) {

  ```

// Your code here
testArr.push([],1);
testArr.shift();

return item; // Change this line
}

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

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

Matt Richards
@mattjrichards
Jan 27 2017 06:06 UTC
@spyte3n Is that working for you?
Joseph
@revisualize
Jan 27 2017 06:06 UTC
Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).
The parameters fro nextInLine are an array (arr) and a number (item)
mrimosthe1
@mrimosthe1
Jan 27 2017 06:07 UTC
```

function nextInLine(arr, item) {
// Your code here
testArr.push([],1);
testArr.shift();

return item; // Change this line
}

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

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

```

why is this not coming as code
nope
I was hoping someone could help here @kilocycle
Joseph
@revisualize
Jan 27 2017 06:08 UTC

Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).

The parameters for nextInLine are an array (arr) and a number (item)

Jor
@joreyesl
Jan 27 2017 06:08 UTC
lol
Niels3030
@niels3030
Jan 27 2017 06:09 UTC

this is ridiculous!! I understand the algorithm which is 'Celsius times 9/5, plus 32... my math is great....but what does 'change the inputs mean?' im getting so frustrated!!convertToF(0) should return a number
convertToF(-30) should return a value of -22
convertToF(-10) should return a value of 14
convertToF(0) should return a value of 32
convertToF(20) should return a value of 68
convertToF(30) should return a value of 86

function convertToF(celsius) {
var fahrenheit;
1

2
function convertToF(celsius) {
3
var fahrenheit;
4
// Only change code below this line
5

6

7
// Only change code above this line
8
return fahrenheit;
9
}
10

11
// Change the inputs below to test your code
12
convertToF(30);
13

Joseph
@revisualize
Jan 27 2017 06:09 UTC
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. <--- DONE
Add the number to the end of the array,
then remove the first element of array.
Matt Richards
@mattjrichards
Jan 27 2017 06:10 UTC
@spyte3n Me too.
mrimosthe1
@mrimosthe1
Jan 27 2017 06:10 UTC
@relentless-coder dude Please help man
we tried
I am not getting it man @revisualize
Joseph
@revisualize
Jan 27 2017 06:11 UTC
I even wrote up a WHOLE document about the lesson!
Jor
@joreyesl
Jan 27 2017 06:11 UTC
@niels3030 i dont see the formula. And 'change the input', i believe they are just saying you can change the call argument to test different values.
mrimosthe1
@mrimosthe1
Jan 27 2017 06:11 UTC
please simplify it
Matt Richards
@mattjrichards
Jan 27 2017 06:11 UTC
@revisualize Not to be rude, but we don't understand that terminology yet. Those are really big words for us.
Joseph
@revisualize
Jan 27 2017 06:12 UTC
@kilocycle Did you do Word Blanks?
If you say YES .. then you used parameters.
You had to.
Or should have.
Matt Richards
@mattjrichards
Jan 27 2017 06:13 UTC
yes
Joseph
@revisualize
Jan 27 2017 06:13 UTC
Then you know about parameters.
Right?
Matt Richards
@mattjrichards
Jan 27 2017 06:13 UTC
I'll have to go back over it
mrimosthe1
@mrimosthe1
Jan 27 2017 06:13 UTC
yes
Joseph
@revisualize
Jan 27 2017 06:13 UTC
GREAT.
Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).
Write a function nextInLine which takes an array (arr) and a number (item)
mrimosthe1
@mrimosthe1
Jan 27 2017 06:14 UTC
SO here what do we have to do?
Joseph
@revisualize
Jan 27 2017 06:14 UTC
That part is DONE.
Add the number to the end of the array,
mrimosthe1
@mrimosthe1
Jan 27 2017 06:14 UTC
thats given in the code itself
Joseph
@revisualize
Jan 27 2017 06:14 UTC
How do you add an element to the end of an array?
What if that element is a number (item) ?
Matt Richards
@mattjrichards
Jan 27 2017 06:15 UTC
one of those push shift pop thingies
mrimosthe1
@mrimosthe1
Jan 27 2017 06:15 UTC
push
Joseph
@revisualize
Jan 27 2017 06:15 UTC
Show me.
mrimosthe1
@mrimosthe1
Jan 27 2017 06:15 UTC
testArr.push([],1);
Matt Richards
@mattjrichards
Jan 27 2017 06:16 UTC
push()
Joseph
@revisualize
Jan 27 2017 06:16 UTC
What is the deal with testArr.
Matt Richards
@mattjrichards
Jan 27 2017 06:16 UTC
.push()
Joseph
@revisualize
Jan 27 2017 06:16 UTC

Write a function nextInLine which takes an

array (arr)

and a

number (item)

Add the number (item) (see above) to the end of the array (arr) (see above),
It's like you're skipping over part of the instructions.
So.
How do you add a number (item) to the end of an array (arr)?
Matt Richards
@mattjrichards
Jan 27 2017 06:19 UTC
that's where it gets confusing
Joseph
@revisualize
Jan 27 2017 06:19 UTC
Yes. with .push()
BRlau
@BRlau
Jan 27 2017 06:19 UTC
(arr,>add here<,item)
Joseph Gomez
@jbgomez
Jan 27 2017 06:19 UTC
arr.push(item)
Joseph
@revisualize
Jan 27 2017 06:20 UTC
How?
The push() method adds one or more elements to the end of an array and returns the new length of the array.
var numbers = [1, 2, 3];
numbers.push(4);

console.log(numbers); // [1, 2, 3, 4]

numbers.push(5, 6, 7);

console.log(numbers); // [1, 2, 3, 4, 5, 6, 7]
I even have that information linked on my gist:
Gist by revisualize / FreeCodeCamp - Stand in Line.js
Matt Richards
@mattjrichards
Jan 27 2017 06:24 UTC
It's hard to visualize what this code would look like. "Write a function nextInLine which takes an array (arr) and a number (item) as arguments." It's the way they have this sentence worded. It's totally confusing the crap out of me.
Joseph
@revisualize
Jan 27 2017 06:24 UTC
...
then remove the first element of array.
Matt Richards
@mattjrichards
Jan 27 2017 06:25 UTC
I'll go back over the lessons
Joseph
@revisualize
Jan 27 2017 06:25 UTC
How do you remove the first element from an array (arr)?

The push() method adds one or more elements to the end of an array and returns the new length of the array.

The pop() method removes the last element from an array and returns that element.

The shift() method removes the first element from an array and returns that element.

The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.

Matt Richards
@mattjrichards
Jan 27 2017 06:25 UTC
.push()?
Joseph Gomez
@jbgomez
Jan 27 2017 06:25 UTC
@kilocycle, you should definitely go over the lessons again because that question should make some sense to you
Joseph
@revisualize
Jan 27 2017 06:25 UTC
@kilocycle Push ADDS
ANYHOW.
I'm out.
It's almost 1030pm in Seattle.
Joseph Gomez
@jbgomez
Jan 27 2017 06:26 UTC
@kilocycle I mean that in a helpful way! I certainly don't get everything on the first read
Joseph
@revisualize
Jan 27 2017 06:26 UTC
I need :zzz:
Joseph Gomez
@jbgomez
Jan 27 2017 06:27 UTC
@kilocycle Write a function nextInLine
function nextInLine () {

}
Matt Richards
@mattjrichards
Jan 27 2017 06:27 UTC
Well, I'm not the only one that it's not making sense to.
Joseph Gomez
@jbgomez
Jan 27 2017 06:27 UTC
I know! It can get tough for all of us
Matt Richards
@mattjrichards
Jan 27 2017 06:27 UTC
the lesson is confusing. I don't think there is any arguing that.
Joseph Gomez
@jbgomez
Jan 27 2017 06:28 UTC
you just gotta stick with it and go over it slowly
Matt Richards
@mattjrichards
Jan 27 2017 06:28 UTC
i know. i'll go back over the lessons
Joseph Gomez
@jbgomez
Jan 27 2017 06:28 UTC
Yeah, maybe they need to be slightly rewritten to make it easier to understand. No doubt about that
Matt Richards
@mattjrichards
Jan 27 2017 06:29 UTC
@revisualize @jbgomez thank you
Joseph
@revisualize
Jan 27 2017 06:29 UTC
So suggest a rewrite.
Joseph Gomez
@jbgomez
Jan 27 2017 06:30 UTC

Just take it step by step. You need to write a function. Ok, what is that?

function nextInLine () {

}

The function needs to take arguments. Ok, they go between the parentheses as parameters

function nextInLine (argument1, argument2) {
    // Do stuff with argument1 and argument2
    // return some result
}
Matt Richards
@mattjrichards
Jan 27 2017 06:31 UTC
I just want to get it done and move on. I'm sure it looks clear as day to all you experienced guys, but to us newbs all this terminology is completely alien to us.
Joseph Gomez
@jbgomez
Jan 27 2017 06:31 UTC
and so on and so forth
yeah, just do one step at a time. When you get stuck at a specific step, ask why
Joseph
@revisualize
Jan 27 2017 06:33 UTC
FreeCodeCamp is 100% community driven. You can suggest a rewrite for any lesson and.. It gets reviewed.
Joseph Gomez
@jbgomez
Jan 27 2017 06:33 UTC
I'm a total noob. And i'm not particularly smart, but I realized a long time ago that even though I didn't have the right answers, it was super important to understand what my specific problems were so that I could start asking the right questions!
Joseph
@revisualize
Jan 27 2017 06:33 UTC
@jbgomez I had a hard time learning JavaScript the first time around.
@jbgomez I went through Codecademy and basically copied and pasted the answers.
Radu
@nahmin
Jan 27 2017 06:34 UTC
Hello. who can tell me how do i retrive a full tree info let say from this code :

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

var myMusic = [
{
"artist": "Daft Punk",
"title": "Homework",
"release_year": 1997,
"formats": [
"CD",
"Cassette",
"LP" ],
"gold": true
}
];

i want to retrive my second tree "myMusic[1]
and i want to retrive all the tree..
Anmar0293
@Anmar0293
Jan 27 2017 06:35 UTC
I need help with this please!
mrimosthe1
@mrimosthe1
Jan 27 2017 06:35 UTC
@kilocycle
Joseph Gomez
@jbgomez
Jan 27 2017 06:35 UTC
@revisualize Same! Just the other day I spent 2 hours trying to figure out why my $.post wasn't producing results. I instantiated the array I was trying to use as an object! I just totally mixed up [] and {}
mrimosthe1
@mrimosthe1
Jan 27 2017 06:35 UTC
@kilocycle
Radu
@nahmin
Jan 27 2017 06:35 UTC
i make a new var let say : var secondTree = myMusic[1]. ....
Matt Richards
@mattjrichards
Jan 27 2017 06:35 UTC
@spyte3n yes?
Anmar0293
@Anmar0293
Jan 27 2017 06:35 UTC
I don't understand what is going on! code anyone show me the code solution so I could understand
mrimosthe1
@mrimosthe1
Jan 27 2017 06:35 UTC
``` 

function nextInLine(arr, item) {
// Your code here
arr.push(item);
var n=arr[0];
arr.shift();

return n; // 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));
```

Anmar0293
@Anmar0293
Jan 27 2017 06:35 UTC
I don't understand what is going on! code anyone show me the code solution so I could understand
https://www.freecodecamp.com/challenges/make-object-properties-private
mrimosthe1
@mrimosthe1
Jan 27 2017 06:36 UTC
@kilocycle I got the code this way
Joseph
@revisualize
Jan 27 2017 06:36 UTC
@spyte3n That's one way.
BRlau
@BRlau
Jan 27 2017 06:36 UTC
@nahmin i think that whole thing should be an array instead of two var
Joseph
@revisualize
Jan 27 2017 06:36 UTC

@spyte3n Question:

function getName() { return "Happy Feet" }
var name = getName();
console.log(name);

What do you think is output to the console when you log the variable name?
Why do you think that is?
@spyte3n

Radu
@nahmin
Jan 27 2017 06:37 UTC
@BRlau k I'll try that
tnx
mrimosthe1
@mrimosthe1
Jan 27 2017 06:38 UTC
@revisualize How were you suggesting? COuld send the code here?
@revisualize happy feet ofcourse
Joseph
@revisualize
Jan 27 2017 06:38 UTC
@spyte3n Great. Why?
Anmar0293
@Anmar0293
Jan 27 2017 06:39 UTC
why no one asnwers me?
Matt Richards
@mattjrichards
Jan 27 2017 06:40 UTC
brackets?
mrimosthe1
@mrimosthe1
Jan 27 2017 06:40 UTC
@Anmar0293 I havent reached there man. So cant help
Radu
@nahmin
Jan 27 2017 06:40 UTC
@Anmar0293 me neither .. u are to far right now ±:)
Matt Richards
@mattjrichards
Jan 27 2017 06:40 UTC
won't it return happy feet no matter what?
Joseph
@revisualize
Jan 27 2017 06:40 UTC
Why?
mrimosthe1
@mrimosthe1
Jan 27 2017 06:40 UTC
@revisualize did not get you
Matt Richards
@mattjrichards
Jan 27 2017 06:41 UTC
@Anmar0293 haven't got that far. sorry bud.
Joseph
@revisualize
Jan 27 2017 06:41 UTC
I'm trying to ask a question so I know you understand the logic then I'll tell you your answer.

Question:

function getName() { return "Happy Feet" }
var name = getName();
console.log(name);

What do you think is output to the console when you log the variable name?
Why do you think that is? <-- The important answer.

...
The shift() method removes the first element from an array

and returns that element.

@spyte3n You don't need to create ... var n=arr[0]; at all
You can just return what is returned from the .shift()
why is the backslash always removed on this input:
input palindrome("0_0 (: /-\ :) 0-0")
GauravChandrawale
@GauravChandrawale
Jan 27 2017 06:45 UTC
"3" == 3 // ...... how it will be true /
Joseph
@revisualize
Jan 27 2017 06:45 UTC
@ronstarcool You'll need to remove all non-alphanumeric characters
GauravChandrawale
@GauravChandrawale
Jan 27 2017 06:46 UTC
?
ronald
@ronstarcool
Jan 27 2017 06:46 UTC
yes, this question is not about fixing the challenge.
ronald
@ronstarcool
Jan 27 2017 06:46 UTC
if i log the input string, i see this:
0_0 (: /- :) 0-0
mrimosthe1
@mrimosthe1
Jan 27 2017 06:46 UTC
@revisualize Then what should I write in return/
?
ronald
@ronstarcool
Jan 27 2017 06:46 UTC
somehow, the input gets modified by javascript?
the backslash vanishes. why?
Joseph
@revisualize
Jan 27 2017 06:47 UTC
just do the arr.push(item); and return arr.shift()
@ronstarcool IDK
GauravChandrawale
@GauravChandrawale
Jan 27 2017 06:47 UTC
@revisualize ok
ronald
@ronstarcool
Jan 27 2017 06:47 UTC
i have looked inside my laptop and behind, but the backslash is not there. its gone
gone with the wind
Jor
@joreyesl
Jan 27 2017 06:48 UTC
@ronstarcool look at this lesson to understand why the \ vanishes. https://beta.freecodecamp.com/en/challenges/basic-javascript/escape-sequences-in-strings
Joseph
@revisualize
Jan 27 2017 06:48 UTC
@ronstarcool Well, you're on the BETA .. so take it up with the beta team.
Okay.
mrimosthe1
@mrimosthe1
Jan 27 2017 06:49 UTC
@revisualize its showing error
Mahaveer
@mahaveer0496
Jan 27 2017 06:49 UTC
Backslash is used to be escape a character so you need to use it twice to use a backslash
Joseph
@revisualize
Jan 27 2017 06:49 UTC
@spyte3n WHat?
ronald
@ronstarcool
Jan 27 2017 06:49 UTC
uhuh
Joseph
@revisualize
Jan 27 2017 06:49 UTC
@spyte3n Are you removing two elements?
I bet you are!
ronald
@ronstarcool
Jan 27 2017 06:49 UTC
but, i dont do anything, and still, it backslash is gone

function palindrome(str) {
  console.log(str);
}
Joseph
@revisualize
Jan 27 2017 06:50 UTC
@ronstarcool Take it up with the beta team.
take it up with the beta team.
Jor
@joreyesl
Jan 27 2017 06:50 UTC
@ronstarcool like @mahaveer0496 said, \ is an escape character. If you want to print out \ you need to type \\
Joseph
@revisualize
Jan 27 2017 06:50 UTC
file an issue with the beta team.
GauravChandrawale
@GauravChandrawale
Jan 27 2017 06:50 UTC
@revisualize but "3" is string bcaz its inside the quotes the hw it will be equal to number .... "3" == 3 ../
?
Joe Escobedo
@joeEscob1023
Jan 27 2017 06:50 UTC
can someone give me a good definition of math.random() the FCC camp one is hard to follow through. either that or im just tired aha. So it really just generates a number between 0 and 1?
@GauravChandrawale There is a huge Table for Sameness Comparisons
ronald
@ronstarcool
Jan 27 2017 06:51 UTC
ah, i think i understand now. the backslash is there, but its not printable to the console
GauravChandrawale
@GauravChandrawale
Jan 27 2017 06:51 UTC
ok
mrimosthe1
@mrimosthe1
Jan 27 2017 06:51 UTC

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

Joseph
@revisualize
Jan 27 2017 06:51 UTC
@spyte3n You're doing .shift() twice.
Jor
@joreyesl
Jan 27 2017 06:51 UTC
@ronstarcool yes, its a special symbol. To print it you need to escape it
Darth Skywalker
@adityaparab
Jan 27 2017 06:51 UTC
@spyte3n remove this line arr.shift();
mrimosthe1
@mrimosthe1
Jan 27 2017 06:52 UTC
```
oh ys
wait
ronald
@ronstarcool
Jan 27 2017 06:52 UTC
it works. thanks folks
Jor
@joreyesl
Jan 27 2017 06:52 UTC
@TacoJoe yes, it generates a floating point value (decimal) between 0 (inclusive) and 1 (exclusive)
Joseph
@revisualize
Jan 27 2017 06:52 UTC
@GauravChandrawale Loose equality using ==
Loose equality compares two values for equality, after converting both values to a common type. After conversions (one or both sides may undergo conversions), the final equality comparison is performed exactly as === performs it. Loose equality is symmetric: A == B always has identical semantics to B == A for any values of A and B (except for the order of applied conversions).
mrimosthe1
@mrimosthe1
Jan 27 2017 06:55 UTC
@revisualize thanks man its so easy like this. Gotta improve my effieciency
Joseph
@revisualize
Jan 27 2017 06:55 UTC
@spyte3n Like what?
Because what I feel you did. Is not read anything then come into chat and demand help. But, what my opinion is may be something vastly different from what actually happened.
And of course it is just my b.s. opinion.
And there are some really amazingly helpful people in here. (And I'm not saying that I'm one of them. Because, I don't think I am.)
BRlau
@BRlau
Jan 27 2017 07:03 UTC
The function should check if firstName is an actual contact's firstName
for (i=0; i<firstName.length; i++) this expression wont work as it will only return an array right?
BRlau
@BRlau
Jan 27 2017 07:09 UTC
i am on profile lookup chapter, i am trying to find a way to test if firstName is actaully a true
Joseph
@revisualize
Jan 27 2017 07:10 UTC
@BRlau You're on a challenge that is taking ALL of your previous knowledge and solidifying it into ONE challenge. It is a logic problem along with a coding problem. You have to know quite a bit. Including the shape of the data that you're working with.
BRlau
@BRlau
Jan 27 2017 07:10 UTC
but i find that for (i=0; i<firstName.length; i++); doesnt work very well on this, so i attempted to if statement, but if i do that it must be return. and returning a value will terminate the function
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 07:10 UTC
@BRlau ...... @revisualize will best explain
Joseph
@revisualize
Jan 27 2017 07:10 UTC
@mindsworth No I won't. I just finished a work email.
I'm OUT
:v:
BRlau
@BRlau
Jan 27 2017 07:11 UTC
alright peace thanks anyway bud @revisualize
Joseph
@revisualize
Jan 27 2017 07:11 UTC
@BRlau That link is some of the help that I mostly just copy and paste to people.
BRlau
@BRlau
Jan 27 2017 07:11 UTC
you have been a great helper
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 07:12 UTC
@revisualize ... please this guy need you here
ok... let me try
Follow the link.
Read the link
Answer the questions.
Know the shape of the data that you're working with.
BRlau
@BRlau
Jan 27 2017 07:12 UTC
i am on it
Joseph
@revisualize
Jan 27 2017 07:12 UTC
use www.pythontutor.com/javascript.html if you get stuck to visualize your code.
Chigoziem Nwaiwu
@mindsworth
Jan 27 2017 07:13 UTC
@BRlau ... let me see your code
BRlau
@BRlau
Jan 27 2017 07:13 UTC

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


function lookUpProfile(firstName, prop){
// Only change code below this line
  var name= contact[firstName];
 for (i=0; i<firstName.length; i++);

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Kristian", "lastName");
i still trying to figure out what method to use
so first step is to determine whether firstName is an actualy contact's firstName
Joseph
@revisualize
Jan 27 2017 07:17 UTC
That code that you just posted shows that you dont know about the shape of your data.
BRlau
@BRlau
Jan 27 2017 07:18 UTC
its in an array format
the data
Frank Spin
@frankspin89
Jan 27 2017 07:19 UTC
Morning Guys. Is there a way to write this pice of code a little more elegant?
const newData = {
      organizationName: formData.organizationName || '',
      emailAddress: formData.emailAddress || '',
      phoneNumber: formData.phoneNumber || '',
      address1: formData.address1 || '',
      address2: formData.address2 || '',
      city: formData.city || '',
      state: formData.state || '',
      zip: formData.zip || '',
      country: formData.country || ''
    };
ronald
@ronstarcool
Jan 27 2017 07:26 UTC
you could accept undefined at first and then loop to set those to ''
BRlau
@BRlau
Jan 27 2017 07:27 UTC
this is hard ...
Lyddip
@lydiayhuang
Jan 27 2017 07:27 UTC
hey everyone
problem here
easy one
var output = getStringLength('hello');
console.log(output); // --> 5
function addToBack(arr, element) {
    return arr.concat(elemenent)
  // your code here
}


var output = addToBack([1, 2], 3);
console.log(output); // -> [1, 2, 3]
what I did is somehow wrong
kind of a bummer
Anil Paliwal
@anilpaliwal
Jan 27 2017 07:31 UTC
Hey fellow friends, just finished my portfolio project, take a look feedback welcome http://codepen.io/anil98/pen/NdjyaR
Manish Giri
@Manish-Giri
Jan 27 2017 07:32 UTC
return arr.concat(elemenent)
maybe because of the typo?
Sergey Lukin
@not-a-cylon
Jan 27 2017 07:32 UTC
@lydiayhuang elemenent
Manish Giri
@Manish-Giri
Jan 27 2017 07:32 UTC
@lydiayhuang
Lyddip
@lydiayhuang
Jan 27 2017 07:32 UTC
oh sorry
function addToBack(arr, element) {
    return arr.concat(element)
  // your code here
}


var output = addToBack([1, 2], 3);
console.log(output); // -> [1, 2, 3]
it's still failing
Darth Skywalker
@adityaparab
Jan 27 2017 07:32 UTC

@lydiayhuang you have a typo in the spelling of element

see

 return arr.concat(elemenent)

Should be

 return arr.concat(element);
Lyddip
@lydiayhuang
Jan 27 2017 07:33 UTC
says "should_be_the_same_array_instance_that_was_passed_in"
after I change it to element
still failing
should I do...
Darth Skywalker
@adityaparab
Jan 27 2017 07:33 UTC
@lydiayhuang you might wanna use .push instead of concat
Lyddip
@lydiayhuang
Jan 27 2017 07:33 UTC
return arr.concate(element).push
Niels3030
@niels3030
Jan 27 2017 07:33 UTC
wow....after many frustrating hours of trying all sorts of different js styles & combos, & trying to understand the directions, 1 little algorithm took care of 6 problems at once!!!! wth!!!!
Lyddip
@lydiayhuang
Jan 27 2017 07:33 UTC
how do I write that?
arr.push(element)?
Darth Skywalker
@adityaparab
Jan 27 2017 07:34 UTC
@lydiayhuang
arr.push(element);
return arr;
Lyddip
@lydiayhuang
Jan 27 2017 07:34 UTC
@adityaparab doesn't work.only returns 3
ohhhh
Darth Skywalker
@adityaparab
Jan 27 2017 07:34 UTC
yes. you have to return arr
Sergey Lukin
@not-a-cylon
Jan 27 2017 07:34 UTC
@frankspin89 Stick all keynames into an array and cycle through it? You can assign a value to a key by doing something like objectName["keyName"] = value || ''
might work.
Amarillia
@Amarillia
Jan 27 2017 07:35 UTC
Can somebody explain to me why this code is not working?
function digitize(n) {
  //code here
  var arr = n.split("");
  arr = arr.reverse();
  return arr;
}
Darth Skywalker
@adityaparab
Jan 27 2017 07:35 UTC
.push gives you the length of the array after you add an element. So it returns a number not an array
Niels3030
@niels3030
Jan 27 2017 07:35 UTC
had to take a screen shot, lots of blood tears and hrs spent... and I am venting now bc i feel like im free
Darth Skywalker
@adityaparab
Jan 27 2017 07:36 UTC
@Amarillia what's the name of this challenge?
Jor
@joreyesl
Jan 27 2017 07:37 UTC
@Amarillia what is the function supposed to do? Righ now it looks like you are spliting a string, reversing it, then returning the reversed array.
Amarillia
@Amarillia
Jan 27 2017 07:39 UTC
@ joreyesl @ adityparab It's outside challenge. I have a number n and trying to convert it to an array, split it to digits and reverse it. I just don't get it. I have the error message that n.split() is not a function(probably because it is a number not an array yet). I just don't know how to convert the number to an array so I can use a function on it.
Manish Giri
@Manish-Giri
Jan 27 2017 07:39 UTC
@Amarillia .split() is a string function, while your input n is a number.
Darth Skywalker
@adityaparab
Jan 27 2017 07:39 UTC
@Amarillia : I see. If your n = 123 then should your output be 321?
Manish Giri
@Manish-Giri
Jan 27 2017 07:40 UTC
@Amarillia maybe convert to a string first?
Darth Skywalker
@adityaparab
Jan 27 2017 07:40 UTC
If so, you first need to convert your number to string as .split exists on String.prototype and not on Number.prototype
Sergey Lukin
@not-a-cylon
Jan 27 2017 07:41 UTC
so something like n += "" first
Jor
@joreyesl
Jan 27 2017 07:41 UTC
@Amarillia you need to convert the number to string first. You do n + ''
Darth Skywalker
@adityaparab
Jan 27 2017 07:41 UTC
Something like
function digitize(n) {
  //code here
  var arr = n.toString().split('');
  return +arr.reverse().join('');
}
or even one liner
function digitize(n) {
  return +n.toString().split('').reverse().join('');
}
var x = digitize(123);
console.log(x); // 321
@Amarillia
devpaaji
@devpaaji
Jan 27 2017 07:43 UTC
@adityaparab
why we use +
often when returning
when to use this
Darth Skywalker
@adityaparab
Jan 27 2017 07:43 UTC
@devpaaji : It will coerce the string type to number type whenever possible.
Jor
@joreyesl
Jan 27 2017 07:43 UTC
@devpaaji + is an operator that attempts to convert to number
Amarillia
@Amarillia
Jan 27 2017 07:45 UTC
@adityaparab @joreyesl @Manish-Giri I tried to convert it earlier and yes, it is working better however it shows as a string instead of returning an array and I am not sure how to convert it back from string to a number of arrays.
Expected: '[1, 3, 2, 5, 3]', instead got: '\'1,3,2,5,3\''
Darth Skywalker
@adityaparab
Jan 27 2017 07:45 UTC
@Amarillia show your full code again
Jor
@joreyesl
Jan 27 2017 07:46 UTC
@Amarillia ok if you want an array, then you need to leave out the .join()
Darth Skywalker
@adityaparab
Jan 27 2017 07:46 UTC
may be you're .toStringing it after .split
yes. leave .join('') and the + sign right next to return.
Amarillia
@Amarillia
Jan 27 2017 07:48 UTC
@adityaparab This is what I have now
function digitize(n) {
  //code here
  var arr = n.toString().split("").reverse().join();
  return arr;
}
Jor
@joreyesl
Jan 27 2017 07:48 UTC
@Amarillia leave out the .join()
Ammy3165
@Ammy3165
Jan 27 2017 07:48 UTC
hey is here someone, Pls tell how to convert this into an array, [30, [3,10,5]].
Darth Skywalker
@adityaparab
Jan 27 2017 07:49 UTC
@Ammy3165 [30, [3,10,5]] is already an array
Amarillia
@Amarillia
Jan 27 2017 07:49 UTC
@joreyesl I if I leave out the join() I'll have
Expected: '[1, 3, 2, 5, 3]', instead got: '[\'1\', \'3\', \'2\', \'5\', \'3\']'
Darth Skywalker
@adityaparab
Jan 27 2017 07:49 UTC
@Amarillia yes. just remove that .join() part
Ammy3165
@Ammy3165
Jan 27 2017 07:50 UTC
@adityaparab pls help me to convert into one, removing inside array
Darth Skywalker
@adityaparab
Jan 27 2017 07:50 UTC
@Amarillia I see. Map the output like
function digitize(n) {
  //code here
  var arr = n.toString().split("").reverse().map(n => +n);
  return arr;
}
@Ammy3165 oh! you want to flatten that array?
Amarillia
@Amarillia
Jan 27 2017 07:50 UTC
@adityaparab It doesn't let me to do split("") before toString()
Ammy3165
@Ammy3165
Jan 27 2017 07:51 UTC
@adityaparab I have no idea or forgotten completely
Darth Skywalker
@adityaparab
Jan 27 2017 07:52 UTC
@Amarillia yes, once you .toString the numbers will be of type string. Now after reversing, you need to caste them back to numbers. So you run a map function on each 'number' and convert them into number
:point_up: Like this
@Ammy3165 : try this
function flatten(arr) {
   return Array.isArray(arr) ? Array.prototype.concat.apply([],arr.map(flatten)):arr;
}
Amarillia
@Amarillia
Jan 27 2017 07:53 UTC
@adityaparab Thanks, that worked :D
What does .map(n => +n); do? I have nver used this earlier.
Ammy3165
@Ammy3165
Jan 27 2017 07:53 UTC
@adityaparab hey thanks for helping me
Amarillia
@Amarillia
Jan 27 2017 07:54 UTC
@adityaparab Ohh, got it thanks :D
Thanks for you as well @joreyesl
GabriRa
@GabriRa
Jan 27 2017 07:54 UTC
Hey guys, can you help me with the Make a person Algorithm? I dont relly understand what I should do. I dont know how I should create a new objet method with a fucntion. Any links?
Darth Skywalker
@adityaparab
Jan 27 2017 07:55 UTC

@Amarillia : map will execute the callback function on each of them elements in the array and return the updated array.

.map(n => +n) partially equivalent to saying

.map(function(n){
  return +n;
})
Jor
@joreyesl
Jan 27 2017 07:55 UTC
@Amarillia np, good luck. :thumbsup:
Darth Skywalker
@adityaparab
Jan 27 2017 07:57 UTC
@relentless-coder explain!
@GabriRa Have you read the instructions?
Siddhartha Sehgal
@okaysidd
Jan 27 2017 08:00 UTC

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

How do I proceed with the number of arguments not specified? The arguments are also not given as elements of an array, just normal function-arguments.

GabriRa
@GabriRa
Jan 27 2017 08:01 UTC
Yes and I dont know what they reffer with making a new method for the object. I tried what a I know and got nothing, and I am stuck right now. @adityaparab
Lyddip
@lydiayhuang
Jan 27 2017 08:01 UTC
@joreyesl Thank you!!! You're the BOMB!
@joreyesl Thank you!
Ayush Bahuguna
@relentless-coder
Jan 27 2017 08:01 UTC
@adityaparab what?
Jor
@joreyesl
Jan 27 2017 08:01 UTC
:o yw :p
Lyddip
@lydiayhuang
Jan 27 2017 08:02 UTC
@joreyesl Thank you!
wait, why is points not working?
Darth Skywalker
@adityaparab
Jan 27 2017 08:02 UTC
@GabriRa may be you can share what you've tried so far?
Lyddip
@lydiayhuang
Jan 27 2017 08:02 UTC
AHHHH
sucks!
Darth Skywalker
@adityaparab
Jan 27 2017 08:02 UTC
camperbot partied super hard last night. No brownies for anyone today :D
Lyddip
@lydiayhuang
Jan 27 2017 08:03 UTC
@adityaparab are you serious? is that a thing?
Jor
@joreyesl
Jan 27 2017 08:03 UTC
haha, i suppose
camperbot ran out of brownies
Darth Skywalker
@adityaparab
Jan 27 2017 08:03 UTC
:D
Lyddip
@lydiayhuang
Jan 27 2017 08:03 UTC
@adityaparab @joreyesl omg. is there a bug?
Darth Skywalker
@adityaparab
Jan 27 2017 08:04 UTC
yeah.. there is a virus and it is now going to enter your computer :P
Amarillia
@Amarillia
Jan 27 2017 08:04 UTC
@lydiayhuang @adityaparab That's what I was asking as well previously...I don't get it what happened with the brownies
@joreyesl Can we have macaroons instead of brownies :D
Darth Skywalker
@adityaparab
Jan 27 2017 08:06 UTC
@Amarillia camperbot is a poor fellow cant afford anything else but brownies
for his dad has a brownie factory.
he can't even purchase a chocolate on his own
Amarillia
@Amarillia
Jan 27 2017 08:07 UTC
@adityaparab XD
GabriRa
@GabriRa
Jan 27 2017 08:08 UTC
I got it, I tried everything except this this.getFullName=function (){ return "a"; };
Darth Skywalker
@adityaparab
Jan 27 2017 08:08 UTC
@GabriRa show your full code please
GabriRa
@GabriRa
Jan 27 2017 08:10 UTC
var Person = function(firstAndLast) {
  firstAndLast=firstAndLast.split(" ");
   this.getFullName=function (){
     return firstAndLast[0].toString();
   };

};

var bob = new Person('Bob Ross');
bob.getFullName();
Dont pay much attention to the return, just tryign things
Ogundele Olumide
@Lumexralph
Jan 27 2017 08:12 UTC
CBot is on vacation :laughing:
I got pissed by how gitter was misbehaving yesterday, I hope it's stable now?
Jor
@joreyesl
Jan 27 2017 08:15 UTC
ok everyone just write an IOU, so we can cash in for our brownies once camperbot is back from partying
Ogundele Olumide
@Lumexralph
Jan 27 2017 08:18 UTC
@joreyesl i doubt that, we don't even know where Cbot went let alone an IOU... lol
Ayush Bahuguna
@relentless-coder
Jan 27 2017 08:19 UTC

is this a valid way of selecting classes

$('.list-item:not(.admin)').on('click', function() {
        $('.admin-menu').addClass('hide');
      })

what I am trying to get is that select an element list-item that doesn't have admin class

chramori176
@chramori176
Jan 27 2017 08:28 UTC
Would anyone like to help me out? In FCC's code editor im getting the error: TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context
The weird thing is, my code works just fine in chrome console and completes the task. Here's my code...
function destroyer() {
  var arr = destroyer.arguments[0];
  arr = arr.filter(function(val) {
    for (var i = 1; i < destroyer.arguments.length; i++) {
      if (val === destroyer.arguments[i]) {
        return false;
      }
    }
    return true;
  });
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 1, 3);
Jor
@joreyesl
Jan 27 2017 08:29 UTC
@chramori176 you dont have to use destroyer.arguments just arguments should be fine
chramori176
@chramori176
Jan 27 2017 08:30 UTC
@joreyesl I tried that as well, same error... Thanks though
robrowellajr
@robrowellajr
Jan 27 2017 08:37 UTC
hey guys. doing the random quote generator challenge and could use some help with the js. Im wondering if you guys can spot the mistake
$('#tweet').on("click",function(){
window.open("https://twitter.com/intent/tweet");
Frank Spin
@frankspin89
Jan 27 2017 08:38 UTC
Is't possible to combine the 2 lines?
chramori176
@chramori176
Jan 27 2017 08:38 UTC
@robrowellajr Im not sure, but maybe u have to select window using '$(window)'
Frank Spin
@frankspin89
Jan 27 2017 08:38 UTC
const { organizationName, emailAddress, phoneNumber, address1, address2, city, state, zip, country } = formData;
const newData = { organizationName, emailAddress, phoneNumber, address1, address2, city, state, zip, country };
Matt Richards
@mattjrichards
Jan 27 2017 08:39 UTC
I just want to go on record as saying that Lesson #173 is utterly confusing. So confusing that I got fed up, viewed the solution for it, and I still don't understand it. There is next to nothing in the previous lessons that prepares you for it. I've been stuck on it for over 4 hours, despite previous help. I'm tired, frustrated and angry. I'm going to bed.
chramori176
@chramori176
Jan 27 2017 08:40 UTC
@robrowellajr so maybe try $(window).open("https://twitter.com/intent/tweet");
robrowellajr
@robrowellajr
Jan 27 2017 08:43 UTC
@chramori176 that wouldnt work because Im not targeting the window. Im targeting the "tweet" button in my html id class
@chramori176 thank you for your input though
Satyam Saurabh
@satyam2401
Jan 27 2017 08:46 UTC

function Tweet() {
var a = document.getElementById("quote display").innerText;

window.open("https://twitter.com/intent/tweet?text=" + a);
};
@robrowellajr This worked for me. there is a twitter link between " ".

chramori176
@chramori176
Jan 27 2017 08:47 UTC
@robrowellajr ah okay good luck man
robrowellajr
@robrowellajr
Jan 27 2017 08:47 UTC
@satyam2401 thank you so much. was able to figure it out. for some reason i had to delete say "id" instead of "id class" in my html lol
chramori176
@chramori176
Jan 27 2017 08:48 UTC
@joreyesl Idk if you cared, but I fixed my issue, the problem was with strict mode not allowing the parent functions arguments to be used in a child function.
Satyam Saurabh
@satyam2401
Jan 27 2017 08:52 UTC
@robrowellajr welcome.
Jor
@joreyesl
Jan 27 2017 08:55 UTC
@chramori176 i see, good to know. :thumbsup:
Colin Bell
@Sacs
Jan 27 2017 09:02 UTC
@kilocycle If you are still online, what is the name of the challenge. I don't seem to be able to look up by number :(
Muhammad Hasham
@MohammadHasham
Jan 27 2017 09:08 UTC
can anyone give me an easy example of getters and setters in js
Muhammad Hasham
@MohammadHasham
Jan 27 2017 09:13 UTC
@Sacs thanks i'll have a look
Etienne le Roux
@Elr33
Jan 27 2017 09:17 UTC

var count = 0;

function cc(card) {
// Only change code below this line
switch (card) {

case 2:
case 3:
case 4:
case 5:
case 6:

  var count = +1;

  return count + " Bet";

  break;

case 7:
case 8:
case 9:

  return "Hold";

  break;

case 10:
case "J":
case "Q":
case "K":
case "A":


  var count = -1;

  return count + " Hold";

  break;

}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);

Giovanni
@GiovanniUait
Jan 27 2017 09:18 UTC
Someone Can help me with this ?
/*function factorialize(num) {
  for(var i=num;i>0;i--){
    num = num *(i-1);
  }
  return num;
}

factorialize(5);*/
Etienne le Roux
@Elr33
Jan 27 2017 09:18 UTC
any idea on what i should be doing with this? pretty stuck
Muhammad Hasham
@MohammadHasham
Jan 27 2017 09:20 UTC
@GiovanniUait yeah what is the issue?
Markus Kiili
@Masd925
Jan 27 2017 09:20 UTC
@GiovanniUait You need a variable that you multiply with i. Now you are multiplying the limit number num.
Muhammad Hasham
@MohammadHasham
Jan 27 2017 09:21 UTC
@Masd925 would that be okay if he stores the num somewhere so that it doesn't change and then do the above process?
Matt Richards
@mattjrichards
Jan 27 2017 09:22 UTC
@Sacs Stand in Line
Giovanni
@GiovanniUait
Jan 27 2017 09:23 UTC
@Masd925 what do you mean?
Jor
@joreyesl
Jan 27 2017 09:23 UTC
@GiovanniUait you are replacing the value of num each iteration. You need a different variable to keep track of the factorization.
Markus Kiili
@Masd925
Jan 27 2017 09:23 UTC
@GiovanniUait i goes from num to 1. Some result variable is needed that is multiplied on each step and returned at the end. You can't change num.
Colin Bell
@Sacs
Jan 27 2017 09:26 UTC
@kilocycle What about the problem is giving you trouble?
amarg26
@amarg26
Jan 27 2017 09:29 UTC
var myList = [];
var items=["Chocolate Bar","Ice Cream"];
var qty=[15,21];


for(var i=0; i<items.length;i++)
  {
    for(var j=0; j<qty.length;j++)
      {
        myList[]+=items[i][j];
      }
  }
what is going wrong here ??
Lyddip
@lydiayhuang
Jan 27 2017 09:29 UTC
hiya peoples
got stuck on something...wondering if I can open it up to this chat.
function getAllElementsButNth(array, n) {
    n = 0;
    // where the index starts is at zero
    var eleToDelete = 1;
    // how many values to remove 
   if (!array) {
       return array; 
   } else {
    array.splice(n, eleToDelete);
    return array; 
    }
}


var output = getAllElementsButNth(['a', 'b', 'c'], 1);
console.log(output); // --> ['a', 'c']
this function works but I need to return the exact array if "n" element is out of the range of the array...
Matt Richards
@mattjrichards
Jan 27 2017 09:31 UTC
@Sacs I can pm you tomorrow about it. I just spent a very long time on it and I'm completely burnt out. I'm sure if you scroll up the chat far enough you'll see what was going on. I have to go to bed now though because I'm totally spent. It's 4:30am where I'm at. I've been up all night.
Colin Bell
@Sacs
Jan 27 2017 09:31 UTC
@kilocycle You have four methods that can work on arrays like this. Push and pop work with the end of the array, unshift and shift work with the beginning
Markus Kiili
@Masd925
Jan 27 2017 09:32 UTC
@lydiayhuang What is this check for if(!array)?
Lyddip
@lydiayhuang
Jan 27 2017 09:33 UTC
@Masd925 trying to check if the n(th) element is within range of the array
Markus Kiili
@Masd925
Jan 27 2017 09:33 UTC
That checks if the first passed argument is falsy.
Arrays are truthy.
Lyddip
@lydiayhuang
Jan 27 2017 09:33 UTC
@Masd925 probably not doing it correct. but I just need to create some code that checks if n(th) element is within the range of the array. if not then I will return the array in its entirely
@Masd925 ok so how do I write what i want to do? because I'm just hacking at this point
Colin Bell
@Sacs
Jan 27 2017 09:34 UTC
@lydiayhuang Have you considered comparing n to the length of the array in some fashion?
Lyddip
@lydiayhuang
Jan 27 2017 09:35 UTC
@Sacs I did that and it didn't work
@Sacs would you like to try that?
@Sacs I did... if( n != array.length) { return array }
@Sacs did not work at all
let me try one more time
Markus Kiili
@Masd925
Jan 27 2017 09:36 UTC
@lydiayhuang You don't need that check at all. Just splice the n'th element away with splice and return the array. Splice don't remove anything if n is too big.
Colin Bell
@Sacs
Jan 27 2017 09:37 UTC
Yeah but that would mean if I entered an numer lower than the array length I'd get the array.
Lyddip
@lydiayhuang
Jan 27 2017 09:37 UTC
I already spliced
Markus Kiili
@Masd925
Jan 27 2017 09:38 UTC
@lydiayhuang Why you overwrite n value with 0 at start?
Don't do that.
Lyddip
@lydiayhuang
Jan 27 2017 09:39 UTC
@Masd925 I don't know, I did that and that's what worked, to start the index at 0 I thought
@Masd925 I deleted it and it's still not working
Markus Kiili
@Masd925
Jan 27 2017 09:40 UTC
@lydiayhuang The passed number that is stored in parameter n tells where to splice. You can't lose it.
Lyddip
@lydiayhuang
Jan 27 2017 09:40 UTC
@Masd925 @Sacs showing up "should_return_a_mirror_of_the_original_array_when_passed_an_n_out_of_range
"
@Masd925 got it
@Masd925 @Sacs so uh, what should I do now? I've been trying everything for like..an hour.
@Sacs just wrote if (n < array.length || n > array.length) {return array}
not working still...aiya
Markus Kiili
@Masd925
Jan 27 2017 09:41 UTC
@lydiayhuang Is this doing what is asked:
function getAllElementsButNth(array, n) {
    var eleToDelete = 1;
    array.splice(n, eleToDelete);
    return array; 
}
Colin Bell
@Sacs
Jan 27 2017 09:42 UTC
@lydiayhuang Whats the name of the probem so I can look it up
Markus Kiili
@Masd925
Jan 27 2017 09:42 UTC
@lydiayhuang Is it a FCC challenge?
Lyddip
@lydiayhuang
Jan 27 2017 09:43 UTC
@Masd925 yes...but it's not doing everything it's not returning the orignal array if the "n"is out of range
guys, it's not an FCC challenege
I understand if it's out of scope
it's ok
I will continue tinkering on my own
Markus Kiili
@Masd925
Jan 27 2017 09:45 UTC
@lydiayhuang It is returning it. Maybe there is something else missing.
Lyddip
@lydiayhuang
Jan 27 2017 09:45 UTC
@Masd925 it is? let me try
@Masd925 oh woa..yeah it's totally working now. omg. I have looked at this problem for 1 hr when I already had the code. I'm probably going to go sing a song now
@Masd925 thanks!
devpaaji
@devpaaji
Jan 27 2017 09:48 UTC
@Masd925

Return the provided character as the first element in each array.

For example, for the input GCG, return [["G", "C"], ["C","G"],["G", "C"]]

The character and its pair are paired up in an array, and all the arrays are grouped into one encapsulating array.

i am attempting DNA paring

function pairElement(str) {

  var spt = str.split("");
  var newArr = [];
  for(var i = 0; i < spt.length; i++)
   {

   }
  return newArr;
}

pairElement("GCG");
Markus Kiili
@Masd925
Jan 27 2017 09:49 UTC
@lydiayhuang Built-in methods have some logic in them. So make checks only if it doesn't work.
devpaaji
@devpaaji
Jan 27 2017 09:49 UTC
split gives me G, C, G
ake each character, get its pair, and return the results as a 2d array.
Lyddip
@lydiayhuang
Jan 27 2017 09:50 UTC
@Masd925 yeah but it wasn't working..I may have mixed it up with another challenge. I'm not crazy I swear.
Markus Kiili
@Masd925
Jan 27 2017 09:53 UTC
@lydiayhuang Most crazy persons tell me just that ;) Just keep learning...
Lyddip
@lydiayhuang
Jan 27 2017 09:53 UTC
@Masd925 hahaha, you suck!
@Masd925 thanks anyway
laytu
@laytu
Jan 27 2017 09:53 UTC
hey
where should i put the += can someone show me an example
Markus Kiili
@Masd925
Jan 27 2017 09:54 UTC
@laytu i=i+1 is the same as i+=1
devpaaji
@devpaaji
Jan 27 2017 09:55 UTC
var a = 4;
a = a + 1; // 5

//
a+= 1; // 5
@laytu
laytu
@laytu
Jan 27 2017 09:55 UTC
thanks
Lyddip
@lydiayhuang
Jan 27 2017 09:58 UTC
@Masd925 hey are you still there? I have a super simple question this time...and I'm 99% sure it's not working.
Markus Kiili
@Masd925
Jan 27 2017 09:59 UTC
@lydiayhuang I'm here.
Lyddip
@lydiayhuang
Jan 27 2017 09:59 UTC
function removeOddValues(obj) {
    var odd = {};

    for ( var key in obj ) {
        if (obj[key] % 2 === 1) {
            delete obj[key];
        }
        return odd; 
    }
  // your code here
}


var obj = {
  a: 2,
  b: 3,
  c: 4
};
removeOddValues(obj);
console.log(obj); // --> { a: 2, c: 4 }
@Masd925 sooo I'm not deleting any values..? why?
@Masd925 CLUELESS
Markus Kiili
@Masd925
Jan 27 2017 10:00 UTC
@lydiayhuang Usually you return the result object after the loop block.
Lyddip
@lydiayhuang
Jan 27 2017 10:00 UTC
@Masd925 omg. yeah hold on
@Masd925 ok um, that totally worked. thanks..
@Masd925 I am going to come back with a harder problem..
devpaaji
@devpaaji
Jan 27 2017 10:04 UTC
@lydiayhuang if you are not aware
the delete keyword delets properties in proto as wel
var Emp = { };
Object.defineProperty(Emp, 'company', {configurable: false, value: 'xyz'});

var emp1 = Object.create(Emp);

delete emp1.company;

console.log(emp1.company); // outputs 'xyz'
Lyddip
@lydiayhuang
Jan 27 2017 10:06 UTC
@devpaaji ok thanks
devpaaji
@devpaaji
Jan 27 2017 10:07 UTC
var x = 1;
var output = (function(){
    delete x;
    return x;
  })();

  console.log(output);
var x = { foo : 1};
var output = (function(){
    delete x.foo;
    return x.foo;
  })();

  console.log(output);
Lyddip
@lydiayhuang
Jan 27 2017 10:08 UTC
@Masd925 ok a little stuck on this one
function removeArrayValues(obj) {
    var deleted = {}; 


    for ( var key in obj ) {
        if ( obj[key] === array[i]) {
            delete obj[key]; 
        }
    }
    return deleted; 
}

var obj = {
  a: [1, 3, 4],
  b: 2,
  c: ['hi', 'there']
}
removeArrayValues(obj);
console.log(obj); // --> { b: 2 }
@Masd925 how do I code to check if the objet has an array?
@Masd925 or is an array?
devpaaji
@devpaaji
Jan 27 2017 10:09 UTC
@lydiayhuang can you tell what is going on the code i posted
on which one will delete work and why
Markus Kiili
@Masd925
Jan 27 2017 10:10 UTC
@devpaaji What do you mean by the delete keyword delets properties in _proto_ as wel. delete deletes the own property. Inherited properties are not affected.
devpaaji
@devpaaji
Jan 27 2017 10:11 UTC
The delete operator doesn’t delete prototype property.
Markus Kiili
@Masd925
Jan 27 2017 10:12 UTC
@devpaaji Ok. You just said it wrong. The code snipplet tells it well what is happening.
devpaaji
@devpaaji
Jan 27 2017 10:13 UTC
var Employee = {
  company: 'xyz'
}
var emp1 = Object.create(Employee);
delete emp1.company
console.log(emp1.company);
here, emp1 object has company as its prototype propert
emp1 object doesn’t have company as its own property. You can test it console.log(emp1.hasOwnProperty('company')); //output : false.
Yuriy
@yureev
Jan 27 2017 10:15 UTC
А на русском кто-то понимает?
Lyddip
@lydiayhuang
Jan 27 2017 10:15 UTC
@Masd925 hm...so how do I detect if an object has an array?
Markus Kiili
@Masd925
Jan 27 2017 10:16 UTC
@lydiayhuang Test for x being an array is Array.isArray(x)
Lyddip
@lydiayhuang
Jan 27 2017 10:16 UTC
ok
@Masd925 let me try
@Masd925 ok totally worked, thanks!
Arvind Lairenjam
@arvind00
Jan 27 2017 10:17 UTC
hi, need some help. I am not able to figure out which line is causing the error in the code below:
function rot13(str) { // LBH QVQ VG!
  arr = str.split('');
  re = /[a-zA-Z]/g;
  newArr = arr.map(function(val){
    if(re.test(val))
    {
       var iCode = val.charCodeAt(0); 
       iDifference = iCode - 13;
       if(iDifference < 65){iDifference =(65+26)-(65-iDifference);}
       return String.fromCharCode(iDifference);
    }else {return val;}
  });
  return newArr.join('');
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");
Alberto Xhani
@albertoxh
Jan 27 2017 10:19 UTC
guys can anyone help me i have to make a mad libs tyoe game??
Arvind Lairenjam
@arvind00
Jan 27 2017 10:22 UTC
can anyone throw me some light on the above code?
heroiczero
@heroiczero
Jan 27 2017 10:22 UTC
@albertoxh make sure you append sting and variables with + operator
Tariyel Hamidov
@tariellaelius
Jan 27 2017 10:23 UTC
@arvind00 the problem must be in the calculation of the code values
Alberto Xhani
@albertoxh
Jan 27 2017 10:24 UTC
@heroiczero which strings?
Arvind Lairenjam
@arvind00
Jan 27 2017 10:25 UTC
@tariellaelius when I debug it, the re.test() is false for the letters like B , E. Not able to grasp y it is false.
heroiczero
@heroiczero
Jan 27 2017 10:25 UTC
@albertoxh var string = "hello " + customer + " how are you doing?" like so but with mad lib variables
C.A. Reis
@drcharlie98
Jan 27 2017 10:27 UTC
hi, my weather app is not updating information, the key is not working. I wonder if I could get some help? ty
David Beczuk
@dbeczuk
Jan 27 2017 10:27 UTC
Hello guys can anyone please explain to me why the following code does not output the returned JSON data to my global variable?
 var crd = {};
var weather = {};
var xhttp = new XMLHttpRequest();
// xhttp.addEventListener('load', getResponse);
xhttp.open('GET', 'http://freegeoip.net/json/', true);
xhttp.onreadystatechange = (function() {
  if(xhttp.readyState === XMLHttpRequest.DONE && xhttp.status === 200) {
    crd = JSON.parse(xhttp.responseText);
  };
});

xhttp.send();
Arvind Lairenjam
@arvind00
Jan 27 2017 10:30 UTC
hi the deciphering is working for alternate letters like first letter, third letter and so on. Anyone has any idea?
function rot13(str) { // LBH QVQ VG!
  arr = str.split('');
  re = /[a-zA-Z]/g;
  newArr = arr.map(function(val){
    if(re.test(val))
    {
       var iCode = val.charCodeAt(0); 
       iDifference = iCode - 13;
       if(iDifference < 65){iDifference =(65+26)-(65-iDifference);}
       return String.fromCharCode(iDifference);
    }else {return val;}
  });
  return newArr.join('');
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");
optimistic5
@optimistic5
Jan 27 2017 10:36 UTC

Hi. I'm on https://www.freecodecamp.com/challenges/accessing-objects-properties-with-variables
this is my code, what is wrong, why it doesn't work?


// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = 16;       // Change this Line
var player = testObj[playerNubmer];   // Change this Line

I don't really get this task.

Stephen James
@sjames1958gm
Jan 27 2017 10:36 UTC
@arvind00 Weird removing the g from the regex seems to make it work?
@optimistic5 typo in the last line
@optimistic5 Nubmer vs Number
Alberto Xhani
@albertoxh
Jan 27 2017 10:37 UTC
@heroiczero ah ok i got it thanks!
optimistic5
@optimistic5
Jan 27 2017 10:38 UTC
@sjames1958gm aha, great! thanks
Stephen James
@sjames1958gm
Jan 27 2017 10:38 UTC
@dbeczuk Do you see any errors in the devtools console? looks ok
crd will only be set after the response comes back.
optimistic5
@optimistic5
Jan 27 2017 10:38 UTC
@sjames1958gm thank you
strange. no brownie today.
Stephen James
@sjames1958gm
Jan 27 2017 10:39 UTC
No, camperbot has left the building
VilfredSikker
@VilfredSikker
Jan 27 2017 10:40 UTC
hey people I need a tip for Testing Objects for Properties. I'm stuck and can't figure it out
Jeff Shapiro
@Jeff-Shapiro
Jan 27 2017 10:40 UTC
Hey @sjames1958gm
Stephen James
@sjames1958gm
Jan 27 2017 10:40 UTC
@Jeff-Shapiro Hey, long time
optimistic5
@optimistic5
Jan 27 2017 10:40 UTC
@sjames1958gm why not. the weather is great outside :smile:
Arvind Lairenjam
@arvind00
Jan 27 2017 10:41 UTC
@sjames1958gm ok will try
Jeff Shapiro
@Jeff-Shapiro
Jan 27 2017 10:41 UTC
@sjames1958gm How's life in south Canada?
Stephen James
@sjames1958gm
Jan 27 2017 10:41 UTC
@Jeff-Shapiro Good a little chilly.
@Jeff-Shapiro Other than our crazy new President
Jeff Shapiro
@Jeff-Shapiro
Jan 27 2017 10:41 UTC
Enjoying being a Trumpster I take it
Stephen James
@sjames1958gm
Jan 27 2017 10:41 UTC
@arvind00 I have no idea why that is happening.
Arvind Lairenjam
@arvind00
Jan 27 2017 10:42 UTC
yes me too. I tried without g and it works
@sjames1958gm Thanks