These are chat archives for FreeCodeCamp/HelpJavaScript

23rd
Mar 2017
john94
@lpy1994
Mar 23 2017 00:00
@GRLaux then send it again, :+1:
Greg Laux
@GRLaux
Mar 23 2017 00:01
function lookUpProfile(firstName, prop){
// Only change code below this line

 if (firstName.firstName === firstName && firstname.prop === prop){
   return contacts.firstName(prop);
 }
  else if (firstName.firstName === firstName && firstname.prop != prop){
    return "No such property";
  }
  else {
    return "No such contact";
  }
Hi Folks. I'm working on this one ... I know its incorrect and would like to figure it out if someone would point me in the right direction
Adam
@GoingAllTheWayUp
Mar 23 2017 00:01
simon game not haveing luck preventing user input during operations. could someone point me in a direction?
Bryan Reese
@breese8009
Mar 23 2017 00:02
@GRLaux ur else if isnt checking property
and ur if isnt either
u need a loop
rayraynomics
@rayraynomics
Mar 23 2017 00:02
can anyone help me out with the Convert Celsius to Fahrenheit challenge? I'm a little confused
Bryan Reese
@breese8009
Mar 23 2017 00:03
@rayraynomics yea post ur code
rayraynomics
@rayraynomics
Mar 23 2017 00:03

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

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

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

that's all i have for now lol
Greg Laux
@GRLaux
Mar 23 2017 00:03
ok @breese8009 - thank you! I knew it was them.
CamperBot
@camperbot
Mar 23 2017 00:03
grlaux sends brownie points to @breese8009 :sparkles: :thumbsup: :sparkles:
:cookie: 333 | @breese8009 |http://www.freecodecamp.com/breese8009
Bryan Reese
@breese8009
Mar 23 2017 00:04
@rayraynomics have u tried anything?
rayraynomics
@rayraynomics
Mar 23 2017 00:04
I have but I'm lost. Wait, let me try something out first then ill get back to you @breese8009
Bryan Reese
@breese8009
Mar 23 2017 00:04
@rayraynomics u need to set Fahrenheit = to the algo they provide
rayraynomics
@rayraynomics
Mar 23 2017 00:06
Yea i got it haha. Thanks tho
i just needed to read it throughly
*rookie mistake
Bryan Reese
@breese8009
Mar 23 2017 00:07
@rayraynomics :thumbsup:
monkeyfingerz
@monkeyfingerz
Mar 23 2017 00:12
@Manish-Giri can you explain to me the logic behind a for loop inside a for loop?
Alex G
@glazey132
Mar 23 2017 00:19
hey guys
last problem on caesars cipher. my code seems to be removing spaces and special characters
function rot13(str) { 
  //split str into an array of chars
  var codedChars = [];
  var output = str.split('');

  //iterate through the array of chars and change them to charCode
  for (var j = 0; j < output.length; j++){
    codedChars.push(output[j].charCodeAt(0));
  }

  //iterate through the array of char code and apply the cipher
  for (var i = 0; i < codedChars.length; i++) {
   if (codedChars[i] >= 65 && codedChars[i] <=90) {
     if (codedChars[i] >= 78) {
       codedChars[i] = String.fromCharCode((codedChars[i] + 13) - 26);
     }

     else if (codedChars[i] < 78) {
       codedChars[i] = String.fromCharCode(codedChars[i] +13);
     }
   }
     else if (codedChars[i] < 65 || codedChars > 90) {
       codedChars[i] = str.charAt[i];
     }

  }
  codedChars = codedChars.join("");

    return codedChars;

}                     
// Change the inputs below to test
rot13("SERR CVMMN!");
Riadh
@KWFE
Mar 23 2017 00:23
hello
Greg Duncan
@GregatGit
Mar 23 2017 00:25
@glazey132 small thing but >= 65 is just > 64
Alex G
@glazey132
Mar 23 2017 00:27
@GregatGit i end up with the same result when I change that to 64. isnt that the same thing?
above 64 or greater than or equal to 65
Joshua Jerrick
@JoshuaJerrick
Mar 23 2017 00:27
I need help with Basic JavaScript: Divide one Decimal by Another with JavaScript
here is my current code
var quotient = 4.4 / 2; // Fix this line
Siddarth Krishnan
@siddarthk123
Mar 23 2017 00:28

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

}

// Only change code above this line
}

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

Hello
I need help with this.
Joshua Jerrick
@JoshuaJerrick
Mar 23 2017 00:29
What seems to be the problem?
Hamoud Khatar
@skhamoud
Mar 23 2017 00:30
Hey guys can someone help me ? I'm having a hard time navigating to a route programatically using an keypress eventhandler in React-router v4 , I'm trying something like this which doesn't work
  " lot of other stuff "
  handleSearch(e) {
    let term = this.searchTextInput.value;
    if (e.key === "Enter" && term) this.props.onSearch();
    history.pushState('/whereIWantToGo')
}
Alex G
@glazey132
Mar 23 2017 00:30
where do characters like spaces and exclamation points fall in unicode? I guess the numbers I'm ciphering are probably the best bet to fix my code
@GregatGit
@JoshuaJerrick send me a link to your problem and ill look it over
Siddarth Krishnan
@siddarthk123
Mar 23 2017 00:37
I do not know what approach to take
to solve the problem
I need help with the approach.
So can anyone help me out?

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

}

// Only change code above this line
}

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

So what do i do?
Can anyone help me on this?
acarosell1
@acarosell1
Mar 23 2017 00:43
function translatePigLatin(str) {

  if ((str.substr(0,1) !== ("a" || "e" || "i" || "o"|| "u")) && (str.substr(1,1) !== ("a" || "e" || "i" || "o"|| "u"))){

      return str.substr(2) + str.substr(0,1) + str.substr(1,1) +"ay"; 

} else if ((str.substr(0,1) !== ("a" || "e" || "i" || "o"|| "u")) && (str.substr(1,1) === ("a" || "e" || "i" || "o"|| "u"))){ 

      return str.substr(1) + str.substr(0,1) + "ay";

} else if (str.substr(0,1) === ("a" || "e" || "i" || "o"|| "u")){

      return str + "way"; 

}

}
translatePigLatin("eight");
Hello. I am working on the Pig Latin challenge in the Intermediate Algorithm Scripting and I can not determine why the argument "eight" produces "ghteiay" in the dev console. I am passing all of the other tests.
Luke Pighetti
@lukepighetti
Mar 23 2017 00:47
has anyone had codepen quit running javascript for no reason?
i know that question makes no sense but im at a loss
Siddarth Krishnan
@siddarthk123
Mar 23 2017 00:49
Can anyone help me with my issue?
please.

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

}

// Only change code above this line
}

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

acarosell1
@acarosell1
Mar 23 2017 00:55
@siddarthk123 You are going to need a for loop with some if and else if statements and you will use the hasOwnProperty() function.
Siddarth Krishnan
@siddarthk123
Mar 23 2017 00:57
yeah
so would it be like
for(int i = 0; i<=3; i++){
and then
can you tell me what the answer would bE?
or make me understand
the answer.
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:03
So
acarosell1
@acarosell1
Mar 23 2017 01:03
@siddarthk123 You have an array of objects and need to iterate through the array. The for loop should iterate through the length of the array which is contacts.length. The for loop should look like : for (i=0; i < contacts.length; i++) { }. Within the curly braces you will need to make your if and if else and else statements with comparison operators.
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:03
can you lead me towards the answer
acarosell
Greg Duncan
@GregatGit
Mar 23 2017 01:04
@glazey132 hey Alex, did you fix that issue - I had a keyboard malfunction
@glazey132 I noted that before they joined on your last line the spaces and ! were undefined
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:05
greg
would one be.
if contacts[i].hasOwnProperty(firstName.firstName)?
would it be like that?
Greg Duncan
@GregatGit
Mar 23 2017 01:10
@siddarthk123 no if (contacts[i].hasOwnProperty(firstName){
acarosell1
@acarosell1
Mar 23 2017 01:10
@siddarthk123 contacts[i].hasOwnProperty(prop) - This is what I have as one part of my first if statement connected to another part by "&&".
Greg Duncan
@GregatGit
Mar 23 2017 01:12
@siddarthk123 but you already know it has that prop - so if (contacts[i].firstName = firstName)
@siddarthk123 then you check for the prop
OuRyoShin
@DJQTDJ
Mar 23 2017 01:14
@/all i need some help
how to check which device is visited ? pc or smartphone or others?
i need some code in php or javaScript ...
J Patrick Lanigan
@planigan
Mar 23 2017 01:16
@DJQTDJ: google 'javascript navigator.userAgent' and see if that gets you furthur
Greg Duncan
@GregatGit
Mar 23 2017 01:17
@glazey132 you are also using else and else if statement incorrectly -
OuRyoShin
@DJQTDJ
Mar 23 2017 01:17
@planigan userAgent? ok i got it
Abdullah Anis
@Abdullah996
Mar 23 2017 01:17
javascript guru any one??
online
acarosell1
@acarosell1
Mar 23 2017 01:18
@siddarthk123 You have to check if firstName is an actual contacts firstName and the given property (prop) is a property of that contact in one if statement and you would do that by connecting with the logical and operator &&.
Abdullah Anis
@Abdullah996
Mar 23 2017 01:18
Sir plz assist me to remove boolean false from an array
var new1 = [7, "ate", "", false, 9];
if(new1[3]===false)
{
    new1[3]=new1[3].replace("false",'');

    }
OuRyoShin
@DJQTDJ
Mar 23 2017 01:19
@planigan navigator.userAgent is just detect the broswer , i need to find out which device....
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:19

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i<= 3 ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i].prop;

if(contacts[i].firstName != firstName)
return "Name not found";

if(!contacts[i].hasOwnProperty(prop))
return "Property not found";
}

}

would it be something ike this?
Abdullah Anis
@Abdullah996
Mar 23 2017 01:20
siddarth idhr bhi help kerde thori
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:20

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i<= 3 ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i].prop;

if(contacts[i].firstName != firstName)
return "Name not found";

if(!contacts[i].hasOwnProperty(prop))
return "Property not found";
}

}

Abdullah Anis
@Abdullah996
Mar 23 2017 01:20

siddarth
Sir plz assist me to remove boolean false from an array
var new1 = [7, "ate", "", false, 9];
if(new1[3]===false)
{

    new1[3]=new1[3].replace("false",'');

    }

https://www.freecodecamp.com/challenges/falsy-bouncer

J Patrick Lanigan
@planigan
Mar 23 2017 01:21
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:21
J Patrick
Can you help me?

We have an array of objects representing different people in our contacts lists.

A lookUpProfile function that takes firstName and a property (prop) as arguments has been pre-written for you.

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

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

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

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

Run tests (ctrl + enter)
Reset Help Bug

"Kristian", "lastName" should return "Vos"
"Sherlock", "likes" should return ["Intriguing Cases", "Violin"]
"Harry","likes" should return an array
"Bob", "number" should return "No such contact"
"Akira", "address" should return "No such property"

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i<= 3 ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i].prop;

if(contacts[i].firstName != firstName)
return "Name not found";

if(!contacts[i].hasOwnProperty(prop))
return "Property not found";
}

}

// Only change code above this line

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

this is my solution
what it wrong with it?
OuRyoShin
@DJQTDJ
Mar 23 2017 01:25
@planigan thanks bro
CamperBot
@camperbot
Mar 23 2017 01:25
djqtdj sends brownie points to @planigan :sparkles: :thumbsup: :sparkles:
:cookie: 327 | @planigan |http://www.freecodecamp.com/planigan
acarosell1
@acarosell1
Mar 23 2017 01:25
@siddarthk123 Your first if statement looks good. You need your curly braces however. Plus, "i" in your conditional should be contacts.length. Your second if statement should test whether contacts[i].firstName == firstName and if this boolean is true should return no such property. Your final return is "no such contact."
J Patrick Lanigan
@planigan
Mar 23 2017 01:26
@siddarthk123: you're code looks correct, but you're returning the wrong value in the case that the name is not found.
Abdullah Anis
@Abdullah996
Mar 23 2017 01:26

@acarosell1
Sir plz assist me to remove boolean false from an array
var new1 = [7, "ate", "", false, 9];
if(new1[3]===false)
{

    new1[3]=new1[3].replace("false",'');

    }

https://www.freecodecamp.com/challenges/falsy-bouncer

J Patrick Lanigan
@planigan
Mar 23 2017 01:27
@siddarthk123: just look at the strings you are returning and compare against what you are supposed to be returning.
@DJQTDJ: yw
Greg Duncan
@GregatGit
Mar 23 2017 01:29
@glazey132 this is your problem codedChars[i] = str.charAt[i]; it should be the same as the other lines - just not adding 13
acarosell1
@acarosell1
Mar 23 2017 01:29
@Abdullah996 I used the filter function.
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:29
I still do not get it
J Patrick Lanigan
@planigan
Mar 23 2017 01:29
@Abdullah996: look into Array.prototype.filter and use the array items as the test for falsey
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:29
J patrick
can u help me more.
J Patrick Lanigan
@planigan
Mar 23 2017 01:31
@siddarthk123: "Name not found" should be "No such contact", and "Property not found" should be "No such property"
Joseph
@revisualize
Mar 23 2017 01:34
@siddarthk123 Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
Abdullah Anis
@Abdullah996
Mar 23 2017 01:35
Thank you @planigan @acarosell1 @revisualize For assist
CamperBot
@camperbot
Mar 23 2017 01:35
abdullah996 sends brownie points to @planigan and @acarosell1 and @revisualize :sparkles: :thumbsup: :sparkles:
:cookie: 262 | @acarosell1 |http://www.freecodecamp.com/acarosell1
:cookie: 328 | @planigan |http://www.freecodecamp.com/planigan
:star2: 3574 | @revisualize |http://www.freecodecamp.com/revisualize
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:35

for(var i = 0; i<= 3 ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i].likes;

if(contacts[i].firstName != firstName)
return "No such contact";

if(!contacts[i].hasOwnProperty(prop))
return "No such property";
}

}

this is my code now.
What is wrong now?
i fixed that part.
J Patrick Lanigan
@planigan
Mar 23 2017 01:39
@siddarthk123: as @revisualize pointed out, prop can't be used like contacts[i].prop, rather, to use a variable as the named property, contacts[i][prop]
Cory Bowles
@cbconsulting
Mar 23 2017 01:40

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

absolutely drawing a blank on this one
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:41

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i<= 3 ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i][prop];

if(contacts[i].firstName != firstName)
return "No such contact";

if(!contacts[i].hasOwnProperty(prop))
return "No such property";
}

}

ok I did that.
Cory Bowles
@cbconsulting
Mar 23 2017 01:41
would like to pair program on this on
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:41
But I am still getting an error.
"Kristian", "lastName" should return "Vos"
"Sherlock", "likes" should return ["Intriguing Cases", "Violin"]
"Harry","likes" should return an array
I am still not meeting these objectives.
for some reason.
Why is that?
Cory
Can you help me with this?
or Somebody.
Cory Bowles
@cbconsulting
Mar 23 2017 01:45
let me see what i can do
so you are working with arrays and loops
and what part of the map does this problem exist on
Gabriel Moreno
@esclavosoy
Mar 23 2017 01:46
Can someone help me? I'm stuck on the "Word Blank" lesson. Does anyone have any suggestions?
Cory Bowles
@cbconsulting
Mar 23 2017 01:46
word blank
oh i rember the word blank on e
what is the issue
@esclavosoy hey i did this on e
Gabriel Moreno
@esclavosoy
Mar 23 2017 01:48
I'm not quite sure what it expects from me. I'm suppose to make sentence but I'm not sure how.
Mac
@itchick85
Mar 23 2017 01:48
Assignment with a Returned Value what's wrong with this? Processed = processArg (7);
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:48
this is the lookupProfile
lookUpProfile
coding
challenge.
Cory Bowles
@cbconsulting
Mar 23 2017 01:49
I am looking at that one @siddarthk123
@esclavosoy remember the + myNoun +
gives you a the placment of word
so the function is called wordBlanks( ....................) inside the () is where those keywords
represent the dog, big, ran, quickly
@esclavosoy basically it is word sensitive
*correction space sensitive
to pass this one
Gabriel Moreno
@esclavosoy
Mar 23 2017 01:51
@truepalyer6 Yes I remember that. Let me try something out
Dgzmnfernando
@Dgzmnfernando
Mar 23 2017 01:52

Hello, for the Increment a Number with JavaScript 'm having trouble figuring out what I'm doing wrong var myVar = 87;

// Only change code below this line
myVar = ++myVar;

Adam
@GoingAllTheWayUp
Mar 23 2017 01:52
im stumped and I am not sure how to go about preventing the pads from being pressed and activated while my code plays back the squence with function playLine()? codepen
Cory Bowles
@cbconsulting
Mar 23 2017 01:53
@siddarthk123 hey so i am looking at this example here
Adam
@GoingAllTheWayUp
Mar 23 2017 01:53
@Dgzmnfernando myVar++
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:53
cory
Did you get it?
Cory Bowles
@cbconsulting
Mar 23 2017 01:54
at where specifically is things not making sense can you send examplke cdoide so i can see the errors
sample code
my bad
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:54

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i<= 3 ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i][prop];

if(contacts[i].firstName != firstName)
return "No such contact";

if(!contacts[i].hasOwnProperty(prop))
return "No such property";
}

}

this is my code.

We have an array of objects representing different people in our contacts lists.

A lookUpProfile function that takes firstName and a property (prop) as arguments has been pre-written for you.

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

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

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

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

Run tests (ctrl + enter)
Reset Help Bug

Johnny
@JohnnyBizzel
Mar 23 2017 01:55
@siddarthk123 everyone gets this one wrong.
First , why do you only loop to 3?
Gabriel Moreno
@esclavosoy
Mar 23 2017 01:55
@truepalyer6 I tried wordBlanks(myNoun + myAdjective + myVerb + myAdverb); but that didn't do it.
Cory Bowles
@cbconsulting
Mar 23 2017 01:55
getting closer
Dgzmnfernando
@Dgzmnfernando
Mar 23 2017 01:56
@GoingAllTheWayUp i tried that but it keeps telling me that i have to change the myVar = myVar
Johnny
@JohnnyBizzel
Mar 23 2017 01:56
@esclavosoy IdontnormalywritesentenceslikethisbutIammakingapoint
Cory Bowles
@cbconsulting
Mar 23 2017 01:56
@esclavosoy what happen to strings
Johnny
@JohnnyBizzel
Mar 23 2017 01:56
@siddarthk123 the current code you wrote will not check all the collection
Dgzmnfernando
@Dgzmnfernando
Mar 23 2017 01:57

@GoingAllTheWayUp
var myVar = 87;

// Only change code below this line
myVar = myVar++ + 1;

this is what i got so far and it wont let me pass

Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:57
but
that's not the point
there's something wrong with my logic
what is it?
Adam
@GoingAllTheWayUp
Mar 23 2017 01:57
@Dgzmnfernando no need to set myVar to itself, just use myVar++;
Cory Bowles
@cbconsulting
Mar 23 2017 01:57
meaning wordBlanks(" something suppose to be here" + myNoun "something here" + myAdjective) etc
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:57
Can someone help me out?
Gabriel Moreno
@esclavosoy
Mar 23 2017 01:57
@truepalyer6 Ok thanks I'll try that ouy.
CamperBot
@camperbot
Mar 23 2017 01:57
esclavosoy sends brownie points to @truepalyer6 :sparkles: :thumbsup: :sparkles:
:cookie: 205 | @truepalyer6 |http://www.freecodecamp.com/truepalyer6
jacob
@bjh2012
Mar 23 2017 01:57
Hi, everyone. I'm trying to figure out which challenges I need to reference in order to solve the "Profile Lookup" challenge. I'm guessing "Iterate through an array with a for loop" and "Testing Objects for Properties", but after that i'm lost
Johnny
@JohnnyBizzel
Mar 23 2017 01:57
@Dgzmnfernando MyVariable++;(will increment a number by 1)
Cory Bowles
@cbconsulting
Mar 23 2017 01:57
@siddarthk123 this one is a fun one
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:58
Can you teach me it?
Cory Bowles
@cbconsulting
Mar 23 2017 01:58
i trying to word this the best i can
Johnny
@JohnnyBizzel
Mar 23 2017 01:58
@siddarthk123 I did
Adam
@GoingAllTheWayUp
Mar 23 2017 01:58
@siddarthk123 } else if {}
Cory Bowles
@cbconsulting
Mar 23 2017 01:58
aww @JohnnyBizzel you did
better explanation
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:58
Johnnny
How did you?
Adam
@GoingAllTheWayUp
Mar 23 2017 01:58
@siddarthk123 I think chaining them would help logicly
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:58
is my code wrong?
Johnny
@JohnnyBizzel
Mar 23 2017 01:58
@siddarthk123 the current code you wrote will not check all the collection
@siddarthk123 everyone gets this one wrong.
First , why do you only loop to 3?
:eyes:
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:59
so.
Johnny
@JohnnyBizzel
Mar 23 2017 01:59
:astonished:
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:59
I have to make it go to 4?
Johnny
@JohnnyBizzel
Mar 23 2017 01:59
@siddarthk123 why?
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:59
cause there 4
objecta
Cory Bowles
@cbconsulting
Mar 23 2017 01:59
that is the big question so you know what you looping through
Johnny
@JohnnyBizzel
Mar 23 2017 01:59
@siddarthk123 bad programming
Siddarth Krishnan
@siddarthk123
Mar 23 2017 01:59
i do make it go through all the
objects
0,1,2,3
Adrian Borcea
@bacpiano
Mar 23 2017 01:59
yes
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:00
and it stops at 4.
Adrian Borcea
@bacpiano
Mar 23 2017 02:00
here
Johnny
@JohnnyBizzel
Mar 23 2017 02:00
@siddarthk123 You are making an inflexible function
Adam
@GoingAllTheWayUp
Mar 23 2017 02:00
you're if statements are all willy nilly
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:00
Its still not working.
Johnny
@JohnnyBizzel
Mar 23 2017 02:00
@GoingAllTheWayUp Who are you talking to?
Cory Bowles
@cbconsulting
Mar 23 2017 02:00
@JohnnyBizzel thumbs up
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:00
Johnny
Its still not working.
Johnny
@JohnnyBizzel
Mar 23 2017 02:01
@siddarthk123 What isn't?
Did you stop the early return from the loop?
Cory Bowles
@cbconsulting
Mar 23 2017 02:01
@JohnnyBizzel this is the errors he is getting
acarosell1
@acarosell1
Mar 23 2017 02:01
@siddarthk123 Your second if statement should test if (contacts[i].firstName == firstName). If so, then there is no such property.
Cory Bowles
@cbconsulting
Mar 23 2017 02:01
"Kristian", "lastName" should return "Vos"
"Sherlock", "likes" should return ["Intriguing Cases", "Violin"]
"Harry","likes" should return an array
Johnny
@JohnnyBizzel
Mar 23 2017 02:02
@truepalyer6 I know how to do it - you can find 2 solutions on my website
Cory Bowles
@cbconsulting
Mar 23 2017 02:03
@JohnnyBizzel i stumped myself
Johnny
@JohnnyBizzel
Mar 23 2017 02:03
@siddarthk123 you need to fix this:
for(var i = 0; i<= 3 ; i++){
Dick Tonye
@SimpletechSolution
Mar 23 2017 02:03
hello guys, Please little help with my Golf code challenge. Here's my code:
Johnny
@JohnnyBizzel
Mar 23 2017 02:03
FORE! :golf:
Dick Tonye
@SimpletechSolution
Mar 23 2017 02:03
function golfScore(par, strokes) {
// Only change code below this line
if (strokes >= par + 3){
return "Go Home!";
}else if(strokes == par + 2){
return "Double Bogey";
}else if(strokes == par + 1){
return "Bogey";
}else if(strokes == par){
return "Par";
}else if(strokes == 1){
return "Hole-in-one!";
}else if(strokes == par - 1){
return "Birdle";
}else if(strokes <= par - 2){
return "Eagle";
}else{
return "Change Me";
}
Johnny
@JohnnyBizzel
Mar 23 2017 02:03
Straight down the middle...
@SimpletechSolution Seems like you know what you are doing
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:06
"Bob", "number" should return "No such contact"
Cory Bowles
@cbconsulting
Mar 23 2017 02:06
@JohnnyBizzel so
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i = 0; i<= 5 ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i][prop];
if(contacts[i].firstName == firstName)
return "No such contact";
if(!contacts[i].hasOwnProperty(prop))
return "No such property";
}
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:06
now I am not meeting this case.
Dick Tonye
@SimpletechSolution
Mar 23 2017 02:06
@JohnnyBizzel but I think I'm missing something
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:06

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i< contacts.length ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i][prop];

if(contacts[i].firstName == firstName)
return "No such property";

if(!contacts[i].hasOwnProperty(prop))
return "No such contact";
}

}

Johnny
@JohnnyBizzel
Mar 23 2017 02:06
@truepalyer6 you need to change this:
for(var i = 0; i<= 5 ; i++){
@siddarthk123 for(var i = 0; i< contacts.length ; i++){ :+1:
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:06
I am just getting one error.
Yeah I got that.
Cory Bowles
@cbconsulting
Mar 23 2017 02:07
@JohnnyBizzel is the syntax wrong is what you are hinting
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:07
I did that.
Johnny
@JohnnyBizzel
Mar 23 2017 02:07
@siddarthk123 still returning early from the for loop
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:07

function lookUpProfile(firstName, prop){
// Only change code below this line

for(var i = 0; i< contacts.length ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i][prop];

if(contacts[i].firstName == firstName)
return "No such property";

if(!contacts[i].hasOwnProperty(prop))
return "No such contact";
}

}

acarosell1
@acarosell1
Mar 23 2017 02:07

function translatePigLatin(str) {

  if ((str.substr(0,1) !== ("a" || "e" || "i" || "o"|| "u")) && (str.substr(1,1) !== ("a" || "e" || "i" || "o"|| "u"))){

      return str.substr(2) + str.substr(0,1) + str.substr(1,1) +"ay"; 

} else if ((str.substr(0,1) !== ("a" || "e" || "i" || "o"|| "u")) && (str.substr(1,1) === ("a" || "e" || "i" || "o"|| "u"))){ 

      return str.substr(1) + str.substr(0,1) + "ay";

} else if (str.substr(0,1) === ("a" || "e" || "i" || "o"|| "u")){

      return str + "way"; 

}

}
translatePigLatin("eight");
Hello. I am working on the Pig Latin Intermediate Algorithm Scripting. Can anyone tell me why the argument "eight" is producing "ghteiay" in the dev console. I am passing all of the other tests. Thanks.
Johnny
@JohnnyBizzel
Mar 23 2017 02:07
@truepalyer6 It's bad practice. Best that you learn now before it becomes critical
Gabriel Moreno
@esclavosoy
Mar 23 2017 02:07
Doe anyone know if its possible to setup a javascript interpreter shell in Linux?
Johnny
@JohnnyBizzel
Mar 23 2017 02:08
@acarosell1 that is really hard to read!
Cory Bowles
@cbconsulting
Mar 23 2017 02:08
@JohnnyBizzel well are you saying loop it another way
Johnny
@JohnnyBizzel
Mar 23 2017 02:08
@truepalyer6 do as @siddarthk123 did
acarosell1
@acarosell1
Mar 23 2017 02:10
@siddarthk123 Your last if statement should be an else. Your second if statement should be an if else. You should have curly braces around your return statements. And your final return should be outside of the for loop.
Siddarth Krishnan
@siddarthk123
Mar 23 2017 02:10
Can you tell me why?
acarosell1
@acarosell1
Mar 23 2017 02:10
@JohnnyBizzel I see what you mean, but, it seemed to be working minus the final test.
Johnny
@JohnnyBizzel
Mar 23 2017 02:12
@acarosell1 this is the best way to test for a vowel as the 1st char:
if (str.charAt(0).match(/[aeiou]/)) {
acarosell1
@acarosell1
Mar 23 2017 02:14
@JohnnyBizzel OK. Is there any way you could navigate through what I have to determine why I am not passing the "eight" test?
Johnny
@JohnnyBizzel
Mar 23 2017 02:14
@acarosell1 can you explain what this does?
str.substr(2) + str.substr(0,1) + str.substr(1,1)
Tiffany
@tiffanymakes
Mar 23 2017 02:15
@SimpletechSolution code looks good, just change "Birdle" to "Birdie". And switch the places of your else if(strokes == 1) and else if(strokes == par) so that a "hole-in-one" takes priority over "par".
Gabriel Moreno
@esclavosoy
Mar 23 2017 02:16
@JohnnyBizzel Thanks I'll give that a shot.
CamperBot
@camperbot
Mar 23 2017 02:16
esclavosoy sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1542 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Mar 23 2017 02:16
@esclavosoy ;)
acarosell1
@acarosell1
Mar 23 2017 02:17
@JohnnyBizzel It take characters from second index point of the string through to the end of the string and adds the first and second characters to the end of the string.
Cory Bowles
@cbconsulting
Mar 23 2017 02:17
@JohnnyBizzel yep
lost
Riadh
@KWFE
Mar 23 2017 02:17
hey
Johnny
@JohnnyBizzel
Mar 23 2017 02:18
@truepalyer6 the test is to find the person in a collection (could be business cards in real life).
How would you check those?
@truepalyer6 Maybe you look at every card to see if you find the name. Then you check the details.
This is what is being simulated.
Dick Tonye
@SimpletechSolution
Mar 23 2017 02:19
@tiffanymakes thanks for that observation. It worked. *smiles
CamperBot
@camperbot
Mar 23 2017 02:19
simpletechsolution sends brownie points to @tiffanymakes :sparkles: :thumbsup: :sparkles:
:cookie: 320 | @tiffanymakes |http://www.freecodecamp.com/tiffanymakes
Cory Bowles
@cbconsulting
Mar 23 2017 02:20
@JohnnyBizzel i am tracking but it seem bob and number shoul return no such contact
and i am not typing something right here
Johnny
@JohnnyBizzel
Mar 23 2017 02:20
@truepalyer6 Because there is no card for "Bob" - but you need to check them all to come to this conclusion don't you?
Cory Bowles
@cbconsulting
Mar 23 2017 02:21
yes
Tiffany
@tiffanymakes
Mar 23 2017 02:21
@SimpletechSolution no problem! Sometimes you just need a second pair of eyes.
Cory Bowles
@cbconsulting
Mar 23 2017 02:21
wow
Johnny
@JohnnyBizzel
Mar 23 2017 02:22
:astonished:
kravhen
@kravhen
Mar 23 2017 02:22
I can't figure out why my scrollspy won't change the active class to the other nav-links as i scroll down! I got scrollspy to work when i click the links, and figured out what data-offset does, but as i scroll down the active tag doesn't seem to change places im using bootstrap and the scrollspy guide from their docs, no javascript except to set scrollspy target $('body').scrollspy({ target: '#navigate' })
Johnny
@JohnnyBizzel
Mar 23 2017 02:22
я не знаю
Dick Tonye
@SimpletechSolution
Mar 23 2017 02:23
Definitely!
Cory Bowles
@cbconsulting
Mar 23 2017 02:24
@JohnnyBizzel so if some how i put it outside that last if outside the function
that deals with No such contact
bob and his mysterious number may return some how no such contact
Johnny
@JohnnyBizzel
Mar 23 2017 02:24
@truepalyer6 :+1:
Cory Bowles
@cbconsulting
Mar 23 2017 02:27
no luck with that
crazy
Johnny
@JohnnyBizzel
Mar 23 2017 02:27
@truepalyer6 what is your code now?
Cory Bowles
@cbconsulting
Mar 23 2017 02:27
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i = 0; i< contacts.length ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i][prop];
if(contacts[i].firstName == firstName)
return "No such property";
else if (!contacts[i].hasOwnProperty(prop))
return "No such contact";
}
i feel like i caught a anerisim
mild comma
Johnny
@JohnnyBizzel
Mar 23 2017 02:28
Can you format your code?
'''
CamperBot
@camperbot
Mar 23 2017 02:28
:bulb: to format code use backticks! ``` more info
Johnny
@JohnnyBizzel
Mar 23 2017 02:28
Khanh
@tuhoccode19934
Mar 23 2017 02:28
function largestOfFour(arr) {
  // You can do this!
  var a = [];
  for(var i = 0;i<arr.length;i++){

      arr[i].sort(function(a,b){
        return b-a;
      });
      a.push(arr[i][0]);

    }

  return a;

}
i think my code is wrong .. :(
Cory Bowles
@cbconsulting
Mar 23 2017 02:29
``function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i = 0; i< contacts.length ; i++){
if(contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop))
return contacts[i][prop];
if(contacts[i].firstName == firstName)
return "No such property";
else if (!contacts[i].hasOwnProperty(prop))
return "No such contact";
}```
Johnny
@JohnnyBizzel
Mar 23 2017 02:29
@truepalyer6 this is still inside teh for loop return "No such contact";
Khanh
@tuhoccode19934
Mar 23 2017 02:29
@truepalyer6 you should check for the firstName first.
Cory Bowles
@cbconsulting
Mar 23 2017 02:31
yes as i tryed and put it outside and stilled errored out
@JohnnyBizzel nevermind thank you soooooo mcuh
CamperBot
@camperbot
Mar 23 2017 02:32
truepalyer6 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1543 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Cory Bowles
@cbconsulting
Mar 23 2017 02:32
epic @JohnnyBizzel
just epic
still think i have more to learn in regards to loops
but it has passed
Johnny
@JohnnyBizzel
Mar 23 2017 02:32
@truepalyer6 Don't worry. Everyone asks for help with this one.
Khanh
@tuhoccode19934
Mar 23 2017 02:32
@truepalyer6 first if for check firstName . inside first if you check for prop :D
Johnny
@JohnnyBizzel
Mar 23 2017 02:33
@truepalyer6 :+1: :clap: :white_check_mark:
Cory Bowles
@cbconsulting
Mar 23 2017 02:33
thank you @tuhoccode19934
CamperBot
@camperbot
Mar 23 2017 02:33
truepalyer6 sends brownie points to @tuhoccode19934 :sparkles: :thumbsup: :sparkles:
:warning: @tuhoccode19934's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
Cory Bowles
@cbconsulting
Mar 23 2017 02:33
i now can go to bed in peace knowing the montior did not have to be thrown into the wall tonight
Johnny
@JohnnyBizzel
Mar 23 2017 02:34
@tuhoccode19934 what is wrong with your code?
Khanh
@tuhoccode19934
Mar 23 2017 02:36
@JohnnyBizzel i feel something wrong:-ss i check the solution in medium fcc but my code not in three way of there solution . It's working. (sorry my Eng so bad ) :(
Johnny
@JohnnyBizzel
Mar 23 2017 02:37
@tuhoccode19934 if it passes, it is good!
Khanh
@tuhoccode19934
Mar 23 2017 02:37
the sollution use two for-loop but i just use one :-s maybe it's a bug ?
Johnny
@JohnnyBizzel
Mar 23 2017 02:43
@tuhoccode19934 there are many ways to do this challenge
zippy
@ShaimaTheBlueberry
Mar 23 2017 02:58
how do you do the assignment called "Find the Length of a String"
doctor.Tsang
@Ken-twenty
Mar 23 2017 03:02
229

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

// Only change code above this line
}

zippy
@ShaimaTheBlueberry
Mar 23 2017 03:03
how do you Use Bracket Notation to Find the First Character in a String
Mike Bilyeu
@mbilyeu1
Mar 23 2017 03:04

Can anyone tell me what I'm doing wrong on the Caesars Cipher project?

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

for (var i = 0; i < str.length; i++){
codeNumArr[i] = str.charCodeAt(i);

if (codeNumArr[i] != 32){

codeNumArr[i] = codeNumArr[i] - 13;
}

}
for (var j = 0; j < codeNumArr.length; j++){

code[j] = String.fromCharCode(codeNumArr[j]);

}
code = code.join('');
return code;
}
// Change the inputs below to test
rot13("SERR YBIR?");

Danny Welstad
@GoonTwo
Mar 23 2017 03:08
need some help for a problem I'm working on. instruction are commented out. My work is below the comments., but inside the function.
function addCalculateDiscountPriceMethod(storeItem) {
  //add a method to the storeItem object called 'calculateDiscountPrice'
  //this method should multiply the storeItem's 'price' and 'discountPercentage' to get the discount
  //the method then subtracts the discount from the price and returns the discounted price
  //example:
  //price -> 20
  //discountPercentage -> .2
  //discountPrice = 20 - (20 * .2)
  storeItem.calculateDiscountPrice = function() {
    var discount = this.price*this.discountPercentage;
    return this.price - discount;
  };
}
handsomepan
@handsomepan
Mar 23 2017 03:24
someone can help me?
var myStr = "\ \t \b \r \n";
it dosen't work.
Tiffany
@tiffanymakes
Mar 23 2017 03:40
@handsomepan what are you trying to do?
Manish Giri
@Manish-Giri
Mar 23 2017 03:41
@dannywelstad what's the problem?
Tiffany
@tiffanymakes
Mar 23 2017 03:43
@mbilyeu1 check out http://www.asciitable.com/. You need to account for half of the alphabet becoming symbols. Like with G. Its char code is 71. 71-13=58. 58 gives you : instead of T.
Matthew
@IMDBLM
Mar 23 2017 03:46
I'm confused a little / lot with profile lookup. I understand I need to access a nested object, and I need to check for an object property. I believe there needs to be a while loop, but the examples are dealing with digits which is confusing. Here's what I have so far.

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


function lookUpProfile(firstName, prop){
// Only change code below this line
if (contacts.hasOwnProperty(firstName , prop)){
    return contacts(prop);
    } else return "No such property";

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Rereading the instructions I'm missing some other stuff I already see.
Mohammad Younis Malik
@myounism
Mar 23 2017 03:50
@IMDBLM Remember .hasOwnProperty() method
Matthew
@IMDBLM
Mar 23 2017 03:52
@myounism I have one there, but what's confusing is that I need to check for firstName and then check for the prop.
RandomJackie
@RandomJackie
Mar 23 2017 03:52
Hey everyone. I'm trying to write a function within an object but it just keeps telling me the function is undefined when I call it, after creating the object.
Mohammad Younis Malik
@myounism
Mar 23 2017 03:52
@IMDBLM oh i see.. you have already approached the solution that way.. but use a loop to iterate through all objects inside array
Matthew
@IMDBLM
Mar 23 2017 03:53
@myounism Right - I'm sorry but my confusion is the loop, because I can't seem to apply what I learned in the loop examples to this
Mohammad Younis Malik
@myounism
Mar 23 2017 03:53

function lookUpProfile(firstName, prop){
for (var x = 0; x < contacts.length; x++){

if (contacts[x].firstName === firstName) {
    if (contacts[x].hasOwnProperty(prop)) {
        return contacts[x][prop];
    } else {
        return "No such property";
    }
}

}
return "No such contact";
}

RandomJackie
@RandomJackie
Mar 23 2017 03:53
var Person = function(firstAndLast) {
function getFullName(){
return 0;
}
return firstAndLast;
};
var bob = new Person('Bob Ross');
bob.getFullName();
Matthew
@IMDBLM
Mar 23 2017 03:54
I wondered if I should nest an if!!
Mohammad Younis Malik
@myounism
Mar 23 2017 03:55
yes we should either nest if here or use && to collapse two if statements into one "if" statement.
@IMDBLM Above is the complete working solution
Matthew
@IMDBLM
Mar 23 2017 03:57
@myounism I'm going to spend some time looking at this. Thanks.
CamperBot
@camperbot
Mar 23 2017 03:57
imdblm sends brownie points to @myounism :sparkles: :thumbsup: :sparkles:
:cookie: 224 | @myounism |http://www.freecodecamp.com/myounism
Jason Landrian
@jlandrian
Mar 23 2017 03:57
Anyone have any good advice for the Seek and Destroy Basic Algorithm challenge? I am not quite sure how the arguments object is supposed to be used
RandomJackie
@RandomJackie
Mar 23 2017 04:05
Does anyone know why it would be giving me this error
zippy
@ShaimaTheBlueberry
Mar 23 2017 04:14
how do you pass the challenge Local scope and functions
Jason Landrian
@jlandrian
Mar 23 2017 04:15
@RandomJackie What's the error? It looks like it just returns 0
zippy
@ShaimaTheBlueberry
Mar 23 2017 04:15
@jlandrian can ya help
RandomJackie
@RandomJackie
Mar 23 2017 04:15
it says bob.getFullName is undefined
zippy
@ShaimaTheBlueberry
Mar 23 2017 04:15
bello
RandomJackie
@RandomJackie
Mar 23 2017 04:15
var Person = function(firstAndLast) {
function getFullName(){
return 0;
}
return firstAndLast;
};
var bob = new Person('Bob Ross');
bob.getFullName();
bob.getFullName is not a function?
Jason Landrian
@jlandrian
Mar 23 2017 04:16
the getFullName function looks like it's in the scope of the Person var
calling it outside might be causing it to come back undefined
RandomJackie
@RandomJackie
Mar 23 2017 04:18
I should put it outside of the Person function?
Johnny
@jtan3
Mar 23 2017 04:19
@jlandrian you need to turn your array into arguments . Then you can call it like how you would in an array.
Jason Landrian
@jlandrian
Mar 23 2017 04:19
@jtan3 I'll give it a shot. Thanks!
CamperBot
@camperbot
Mar 23 2017 04:19
jlandrian sends brownie points to @jtan3 :sparkles: :thumbsup: :sparkles:
:cookie: 352 | @jtan3 |http://www.freecodecamp.com/jtan3
Johnny
@jtan3
Mar 23 2017 04:20
@RandomJackie what is the name of the challenge?
Jason Landrian
@jlandrian
Mar 23 2017 04:20
@ShaimaTheBlueberry What's are you having trouble with?
RandomJackie
@RandomJackie
Mar 23 2017 04:21
Make a person
Khanh
@tuhoccode19934
Mar 23 2017 04:22
function destroyer(arr) {
  // Remove all the values

  var args = Array.prototype.slice.call(arguments);
  args.splice(0,1);
    var a =[];
  for(var i = 0 ;i<arr.length;i++){
    for(var j = 0; j < args.length;j++){
      if(arr[i]==args[j]){
        delete arr[i];
      }
    }
  }
  a = args.filter(function(value){
    return Boolean(value);
  });
return a;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
hi i dont know what i'm wrong with my code , anyone can help ?
Johnny
@jtan3
Mar 23 2017 04:22
@RandomJackie sorry i'm not on the advance algorithms yet
Khanh
@tuhoccode19934
Mar 23 2017 04:23
oh i know my wrong
RandomJackie
@RandomJackie
Mar 23 2017 04:24
thats ok
Jason Landrian
@jlandrian
Mar 23 2017 04:25
@RandomJackie I am also not that far along yet. Still on the Basic Algorithms (but almost on to JSON!)
Hey @tuhoccode19934 I'm on the same challenge. Don't you have to create a separate function to pass to filter?
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 04:34
hello guys I have a question about GitHUB
can someone teach me what is pull request and what is forking means
h1tag
@h1tag
Mar 23 2017 04:37
@pshiwakoti1 watch this
for your question, start from the 2nd one
Bryan Reese
@breese8009
Mar 23 2017 04:49
whooo can explain what context means in JS
You need to manipulate the context in which you're calling the `test()` function.
like this ^ for example
Ahmed Khaled
@PyKhaled
Mar 23 2017 04:50

function truncateString(str, num) {

  var newString;
  if (num <= 3) {

    newString = str.slice(0, num);
    return newString += "...";

  } else {

    newString = str.slice(0, (num-3));
    return newString += "...";

  }

}

truncateString("A-tisket a-tasket A green and yellow basket", 1);
it doesn't work
KiingRex
@KiingRex
Mar 23 2017 04:53
hello everyone, i'm starting the golf code and i'd like to know how i can define the par and strokes for the if statements?
Andrew Shieh
@andrewlikes
Mar 23 2017 04:53
@PyKhaled newString doesn't have any data
julio
@xntr888
Mar 23 2017 04:54
it may refer to the way youre calling your function see if there is workarround to call it
at least that how it sounds to me
Ahmed Khaled
@PyKhaled
Mar 23 2017 04:55
@xntr888 @andrewlikes I works fine with 4 cases and doesn't with 2 !
it *
c0d0er
@c0d0er
Mar 23 2017 04:55
@alpox thanks
CamperBot
@camperbot
Mar 23 2017 04:55
c0d0er sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 871 | @alpox |http://www.freecodecamp.com/alpox
julio
@xntr888
Mar 23 2017 04:57
there are missing values in your return statement
Andrew Shieh
@andrewlikes
Mar 23 2017 04:58
also your only condition is if "num <= 3"
it should be if str is greater than num AND num <=3
and other condition is just if str is greater than num
str.length
AKS
@amitkumarsarangi
Mar 23 2017 05:00

@JLuboff

@amitkumarsarangi When I click a color, it only barely blinks (very rapid) unless I hold it. Its also not detecting when I mess up? I can click a different color then I should and it doesn't stop me, lets me keep going

regarding the color blinking... that also happens with the project shown in freecodecamp... unless you hold the click it barely blinks... do you know how to solve this issue...???
regarding the messing up when selecting a different color ... it only shows when you have selected all n number of colors in nth step... that surely I have to rectify...

Mo.
@mokyox
Mar 23 2017 05:04
Hey everyone. I'm having trouble with the Make Object Properties lesson. I've set the private property using var but I'm not sure exactly what values to set for getGear. Any advice on this problem?
var Bike = function() {
var gear = 1; //private property, gear
  this.getGear = function() {

  };

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


};
Bryan Reese
@breese8009
Mar 23 2017 05:07
@mokkyun setGear needs to do somethin
Mo.
@mokyox
Mar 23 2017 05:08
@breese8009 Ah, it needs to change the gear right? And getGear needs to 'return' the value?
Bryan Reese
@breese8009
Mar 23 2017 05:09
@mokkyun correct!
Mo.
@mokyox
Mar 23 2017 05:09
@breese8009 Gotcha, lemme have another go at it. Thanks!
CamperBot
@camperbot
Mar 23 2017 05:09
mokkyun sends brownie points to @breese8009 :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @breese8009 |http://www.freecodecamp.com/breese8009
Bryan Reese
@breese8009
Mar 23 2017 05:09
@mokkyun right now get gear isnt doing anything, and set gear is returning var gear which is 1
julio
@xntr888
Mar 23 2017 05:10
gear+="helmet";?
Bryan Reese
@breese8009
Mar 23 2017 05:10
@xntr888 lol what?
julio
@xntr888
Mar 23 2017 05:10
hahahaha i dunno im just guessing
Edgar Pan
@edgaryp
Mar 23 2017 05:11
any hints for tic tac toe? read a lot of tutorials but still struggling to start coding.
Mo.
@mokyox
Mar 23 2017 05:12
@breese8009 So geGear needs to return the value and setGear takes the argument of 'gear'?
Josh Bourke
@Warmtinnie
Mar 23 2017 05:12
would any one be able to help me with the Stand in Line Module having a bit of trouble with this array
Mo.
@mokyox
Mar 23 2017 05:12
I think I'm missing something
Bryan Reese
@breese8009
Mar 23 2017 05:13
@edgaryp getGear() should return value of gear
Manish Giri
@Manish-Giri
Mar 23 2017 05:13
@Warmtinnie post your code..
julio
@xntr888
Mar 23 2017 05:14
@Warmtinnie

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

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

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

Edgar Pan
@edgaryp
Mar 23 2017 05:14
@breese8009 getGear()?
julio
@xntr888
Mar 23 2017 05:14
i think is this one right?
Bryan Reese
@breese8009
Mar 23 2017 05:15
@edgaryp getGear
:)
Edgar Pan
@edgaryp
Mar 23 2017 05:15
@breese8009 what's getGear?
AKS
@amitkumarsarangi
Mar 23 2017 05:16
@JohnnyBizzel Hey... How r u...
I created the simon game ... have a look... any feedback are welcome
http://codepen.io/amitkumarsarangi/full/zZjrGJ/
Bryan Reese
@breese8009
Mar 23 2017 05:16
@edgaryp its a method in this challenge
u can call it whatever u want...doesnt have to be getGear
Mo.
@mokyox
Mar 23 2017 05:17
I'm not sure what parameter goes into the function for this.SeatGear. It doesn't take the gear parameter, right? @breese8009
Bryan Reese
@breese8009
Mar 23 2017 05:18
@mokkyun create a param
Edgar Pan
@edgaryp
Mar 23 2017 05:18
@breese8009 I don't understand
Bryan Reese
@breese8009
Mar 23 2017 05:18
@edgaryp then go do some research.
Mo.
@mokyox
Mar 23 2017 05:19
@breese8009 Something like this?

var Bike = function() {
var gear = 1; //private property, gear

  this.setGear = function (changeGear) {
    gear += changeGear;
  };

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


};
Khanh
@tuhoccode19934
Mar 23 2017 05:19
function rot13(str) { // LBH QVQ VG!
  var a = str.split("");
  var b = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
  var c =[];
  for(var i =0;i<a.length;i++){
    if(b.indexOf(a[i])===-1){
      c.push(a[i]);
    }
    else{
      for(var j = 0 ; j < b.length;j++){
        if(a[i]===b[j]){
          if(j+13 >= b.length){
            c.push(b[j-13]);
          }
          c.push(b[j+13]);
        }
      }
    }
  }
  return c.join("");
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
i dont know why my code not working ? anyone help plz :(
Bryan Reese
@breese8009
Mar 23 2017 05:19
@mokkyun just set equal to
and ur solid :thumbsup:
@mokkyun not +=
just =
;)
Mo.
@mokyox
Mar 23 2017 05:21
@breese8009 Ah, gotcha! We gotta make a parameter that's equal to the private property we made so we can change it freely. Makes sense. Thanks dude!
CamperBot
@camperbot
Mar 23 2017 05:21
mokkyun sends brownie points to @breese8009 :sparkles: :thumbsup: :sparkles:
:warning: mokkyun already gave breese8009 points
julio
@xntr888
Mar 23 2017 05:21
@amitkumarsarangi it looks great and fun just speed it up to make it more challenging
Khanh
@tuhoccode19934
Mar 23 2017 05:21
anyone can help me ? :(
Bryan Reese
@breese8009
Mar 23 2017 05:22
@mokkyun thats right buddy
Jor
@joreyesl
Mar 23 2017 05:22
@tuhoccode19934 looks good, try refreshing the browser, sometimes it gets bugged.
Also instead of a loop, you can also use indexOf() in the else clause
AKS
@amitkumarsarangi
Mar 23 2017 05:23
@xntr888 thanks ... I think speeding up will make it much harder in later steps...
CamperBot
@camperbot
Mar 23 2017 05:23
amitkumarsarangi sends brownie points to @xntr888 :sparkles: :thumbsup: :sparkles:
:cookie: 191 | @xntr888 |http://www.freecodecamp.com/xntr888
Khanh
@tuhoccode19934
Mar 23 2017 05:24
@joreyesl i refreshed but still not working , i copy and paste to the consonle of chrome to check , it working :(
Josh Bourke
@Warmtinnie
Mar 23 2017 05:24
@xntr888 thanks for the help my computer crashed
CamperBot
@camperbot
Mar 23 2017 05:24
warmtinnie sends brownie points to @xntr888 :sparkles: :thumbsup: :sparkles:
:cookie: 192 | @xntr888 |http://www.freecodecamp.com/xntr888
Jor
@joreyesl
Mar 23 2017 05:25
@tuhoccode19934 weird, it passed the challenge on my end. Maybe there is something else causing it. Is there any other code there?
Khanh
@tuhoccode19934
Mar 23 2017 05:26
@joreyesl oh sorry i add "," in last return :((
thanks u so much :D
CamperBot
@camperbot
Mar 23 2017 05:26
tuhoccode19934 sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 659 | @joreyesl |http://www.freecodecamp.com/joreyesl
Jor
@joreyesl
Mar 23 2017 05:27
@tuhoccode19934 np :thumbsup:
Lance
@greze
Mar 23 2017 05:27
Hey, I think I've found a bug. I'm going through the algorithm challenges and on "Where do I belong," I can't submit my code. I've tried it on firefox and on chrome, same result. I went back to an earlier challenge and was able to submit an answer, though. Is anyone else having this issue?
Manish Giri
@Manish-Giri
Mar 23 2017 05:29
@greze post your code
Jor
@joreyesl
Mar 23 2017 05:29
@greze working fine on my end. Is the button not working, or is the browser freezing? Your code could be timing out.
Lance
@greze
Mar 23 2017 05:31

@Manish-Giri here's my code :
function getIndexToIns(arr, num) {
//sort the array from smallest to biggest
arr = arr.sort(function (a, b){
return a - b;
});
var lowestIndex = 0;
for (var i = 0; i < arr.length; i++) {
for (var j = 1; j < arr.length; i++)
if (arr[i] < num && arr[j] > num) {
lowestIndex = i;
}
}
return lowestIndex;
}

getIndexToIns([40, 60], 50);

but I get the unresponsive script error from my browser no matter I enter

Reginald Wright
@yungengine8
Mar 23 2017 05:31
trying to understand how to make code work
Jor
@joreyesl
Mar 23 2017 05:32
@greze for (var j = 1; j < arr.length; i++) should be using j++
Manish Giri
@Manish-Giri
Mar 23 2017 05:32
@greze for (var j = 1; j < arr.length; i++)
this isn't right.
Alan M.
@Am3ra
Mar 23 2017 05:33
@yungengine8 What have you tried?
Lance
@greze
Mar 23 2017 05:34

@joreyesl @Manish-Giri thanks for pointing that out. but I'm not able to run tests or anything, I get this error in my brower
A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.

Script: https://www.freecodecamp.com/c…C%2050)%3B%0A line 9312 > eval:12

CamperBot
@camperbot
Mar 23 2017 05:34
greze sends brownie points to @joreyesl and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 660 | @joreyesl |http://www.freecodecamp.com/joreyesl
:star2: 4878 | @manish-giri |http://www.freecodecamp.com/manish-giri
Reginald Wright
@yungengine8
Mar 23 2017 05:34
i found some stuff online but im not learning how to do this right
Manish Giri
@Manish-Giri
Mar 23 2017 05:34
@greze I'm thinking you've made an infinite loop?
Lance
@greze
Mar 23 2017 05:36
@Manish-Giri oh you might be right. Before I tried just returning a value to see if I got that same script error thing, and I did. but just now I tried my code with the for loop commented out and it I can run tests and stuff
Alan M.
@Am3ra
Mar 23 2017 05:36
@yungengine8 can you post your code?
Jor
@joreyesl
Mar 23 2017 05:39
@greze yea your stuck in an infinite loop. If your browser keeps freezing, you can try disabling auto-run so you can fix the infinite loop.
https://forum.freecodecamp.com/t/disable-code-auto-run-on-free-code-camp/19511
Lance
@greze
Mar 23 2017 05:40
@joreyesl ok, thanks! good to know.
CamperBot
@camperbot
Mar 23 2017 05:40
greze sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:warning: greze already gave joreyesl points
Manish Giri
@Manish-Giri
Mar 23 2017 05:43
@greze there's another way to solve that challenge, where you wouldn't need to use even one for loop..
Andrew Shieh
@andrewlikes
Mar 23 2017 05:44
I did that challenge with one return line :P
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 05:44
Hello guys I need some help in understanding GitHub
what is forking?
and PUll request
feelthewind
@Feelthewind
Mar 23 2017 05:44
I want to remove all the elements matching arguments in the array. But it doesn't work.
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 05:44
I just watched a video on Github but still not clear
feelthewind
@Feelthewind
Mar 23 2017 05:44

function destroyer(arr) {

return arr.filter(function(value) {
return value !== arguments1 && value !== arguments2;
});
}

destroyer(["tree", "hamburger", 53], "tree", 53);

Lance
@greze
Mar 23 2017 05:45
@Manish-Giri hmm, I'll keep that in mind. I'm actually at work right now though, should probably get back to that haha.
Manish Giri
@Manish-Giri
Mar 23 2017 05:45
@pshiwakoti1 forking is when you fork someone else's project on github, to your own account.
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 05:45
means
you are copying someone else's project
Jor
@joreyesl
Mar 23 2017 05:45
@pshiwakoti1 you are copying the project
Manish Giri
@Manish-Giri
Mar 23 2017 05:45
pull request is when you've made some changes to their project in your account and want to get it merged with their original project.
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 05:45
oh ok
do the original owner have to agree to merge?
Manish Giri
@Manish-Giri
Mar 23 2017 05:46
yes
Jor
@joreyesl
Mar 23 2017 05:46
yes
@pshiwakoti1 thats why its a request
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 05:46
ok guys thanks
Andrew Shieh
@andrewlikes
Mar 23 2017 05:46
@Feelthewind you have one parameter and you're dealing with 3 arguments, you need to turn them all into an array
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 05:46
now im clearer
so when you fork a project and make changes, do the original master gets changed too?
Andrew Shieh
@andrewlikes
Mar 23 2017 05:48
no that's why he explained pull requests to you
Jor
@joreyesl
Mar 23 2017 05:48
@pshiwakoti1 your master copy is what gets changed
Prakash Shiwakoti
@pshiwakoti1
Mar 23 2017 05:48
ok
Manish Giri
@Manish-Giri
Mar 23 2017 05:49

do the original master gets changed too?

only if your pull request is merged(accepted).

feelthewind
@Feelthewind
Mar 23 2017 05:50
@andrewlikes is there any way to solve it sending arguments this way?
Andrew Shieh
@andrewlikes
Mar 23 2017 05:51
what's (value)
Jor
@joreyesl
Mar 23 2017 05:53
@Feelthewind the arguments object changes depending on context. Using it inside the callback function like that you are actually using that anonymous function's arguments object, not the destroyer's arguments.
Andrew Shieh
@andrewlikes
Mar 23 2017 05:54
anyone here use jsfiddle?
Manish Giri
@Manish-Giri
Mar 23 2017 05:55
@andrewlikes I used to..
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 05:55
@Manish-Giri @joreyesl :wave:
Manish Giri
@Manish-Giri
Mar 23 2017 05:55
@HeebieGeeBee :wave:
Jor
@joreyesl
Mar 23 2017 05:55
@HeebieGeeBee morning
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 05:55
mornin
Andrew Shieh
@andrewlikes
Mar 23 2017 05:56
how do I add javascript to the console? console.log() isn't working
Manish Giri
@Manish-Giri
Mar 23 2017 05:56
you need to add an external resource
firebug something
add this
@andrewlikes
Jor
@joreyesl
Mar 23 2017 05:57
@andrewlikes console.log() doesnt work in the FCC console. You need to use the browser's console (F12). Or run your code on https://repl.it/languages/javascript
Andrew Shieh
@andrewlikes
Mar 23 2017 05:58
awesome it works thanks @Manish-Giri
CamperBot
@camperbot
Mar 23 2017 05:58
andrewlikes sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4879 | @manish-giri |http://www.freecodecamp.com/manish-giri
Andrew Shieh
@andrewlikes
Mar 23 2017 05:58
@joreyesl thanks for the info
CamperBot
@camperbot
Mar 23 2017 05:58
andrewlikes sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 661 | @joreyesl |http://www.freecodecamp.com/joreyesl
Manish Giri
@Manish-Giri
Mar 23 2017 05:59
@andrewlikes there's no way to have it permanently added in jsfiddle (kind of like a template), which is possible in codepen..which is why I've stopped using it.
Andrew Shieh
@andrewlikes
Mar 23 2017 06:01
ah I see what you mean. my friend told me to use jsfiddle to mess around with javascript
but yeah codepen seems more convenient
Manish Giri
@Manish-Giri
Mar 23 2017 06:02
codepen also has it's own problems
it usually doesn't show errors logged in the browser console
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:02
@andrewlikes replit probably better for just pure javascript
Jor
@joreyesl
Mar 23 2017 06:02
^ ditto
Andrew Shieh
@andrewlikes
Mar 23 2017 06:03
cool ill bookmark it
Manish Giri
@Manish-Giri
Mar 23 2017 06:04
I used to use jsbin
until it broke
jsbin/jsbin#3014
Jor
@joreyesl
Mar 23 2017 06:07
weird didn't get any errors. they fixed it?
Jim
@JLOSS1
Mar 23 2017 06:07
hey, anyone got a second? I'm about to throw my computer out the window because its making me feel like an idiot over this random quote machine challenge and api's.
Edward John
@eddmecha
Mar 23 2017 06:07
hi guys
i am stuck at backslashes

Instructions
Use backslashes to assign a string to the myStr variable so that if you were to print it to the console, you would see:

I am a "double quoted" string inside "double quotes".

what i wrote
var myStr = "I am a \"double quoted\" string inside \"double quotes\". " ;
Manish Giri
@Manish-Giri
Mar 23 2017 06:08
@joreyesl I'm still getting it
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:09
@JLOSS1 whats the problem?
Jor
@joreyesl
Mar 23 2017 06:09
@Manish-Giri RIP
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:10
@eddmecha you have a space after your period
Manish Giri
@Manish-Giri
Mar 23 2017 06:10
ww.png
Jim
@JLOSS1
Mar 23 2017 06:10
@HeebieGeeBee I thought I did the JS stuff correct. I've watched countless tutorials on youtube trying to understand json. Here's what I have so far on my pen...
https://codepen.io/jloss1/pen/mWXvbX
Jor
@joreyesl
Mar 23 2017 06:10
@eddmecha you have a space at the very end.
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:11
@JLOSS1 do you know how to look at your browsers console?
Jor
@joreyesl
Mar 23 2017 06:11
@Manish-Giri have you tried turning it on/off ;)
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:11
@JLOSS1 if you look at it you'll see error message
Manish Giri
@Manish-Giri
Mar 23 2017 06:11
lol
Jim
@JLOSS1
Mar 23 2017 06:11
erm shit I'm doing this on Edge. just a second
Jor
@joreyesl
Mar 23 2017 06:12
well there's your problem :p
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:12
@JLOSS1 well anyway you cant look at codepen in a https and then use an api thats just http
@JLOSS1 http://codepen.io/jloss1/pen/mWXvbX use this link for your codepen instead
or just change your link to http in the browser
Jim
@JLOSS1
Mar 23 2017 06:13
@HeebieGeeBee wait...wtf? it works fine in debug mode
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:14
@JLOSS1 well debug mode isnt running in that codepen envirnment
Jim
@JLOSS1
Mar 23 2017 06:14
ah gotcha.
that's weird. is there some sort of secure issue with the api or something?
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:15
some cross origin shit
Jim
@JLOSS1
Mar 23 2017 06:15
gotcha. that's lame
well damn. saved me from putting my coffee mug through my screen. thanks a million @HeebieGeeBee
CamperBot
@camperbot
Mar 23 2017 06:15
jloss1 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1118 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:16
its always good to look at the browser console
if you have problems
well even if you dont i guess
Jim
@JLOSS1
Mar 23 2017 06:16
hm thanks for the heads up.
interesting.
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:17
and codepens console wont throw the errors that the browser console will
Edward John
@eddmecha
Mar 23 2017 06:18
@HeebieGeeBee @joreyesl lol i didnt notice it,thanks!!
CamperBot
@camperbot
Mar 23 2017 06:18
eddmecha sends brownie points to @heebiegeebee and @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 662 | @joreyesl |http://www.freecodecamp.com/joreyesl
:star2: 1119 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Jim
@JLOSS1
Mar 23 2017 06:18
@HeebieGeeBee just saw that. it's got nothing.
I can't believe me it's taking me a good 20ish hours so far for this
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:21
its all learning
devpaaji
@devpaaji
Mar 23 2017 06:23
@HeebieGeeBee
can we write a function like this
Jim
@JLOSS1
Mar 23 2017 06:23
Yeah. for sure..
devpaaji
@devpaaji
Mar 23 2017 06:24
var helperFunction function() {


}();
or
var helperFunction = function(){


}();
Tom Świrski
@Swirio
Mar 23 2017 06:25
With =
devpaaji
@devpaaji
Mar 23 2017 06:26
@Swirio are you telling me about the function
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:26
whats the () at theend for?
devpaaji
@devpaaji
Mar 23 2017 06:26
ok
Markus Kiili
@Masd925
Mar 23 2017 06:26
@devpaaji That stores the return value.
Tom Świrski
@Swirio
Mar 23 2017 06:27
But if you want to run funtom you need to add ()
devpaaji
@devpaaji
Mar 23 2017 06:27
    var helloObj = {
        myProperty: 'I can see the light', 
        helloMethod: function(){
        var that = this; //store a reference to this (i.e. helloObj) in helloMethod scope
            var innerFunc = function(){
              // child function
              console.log(that.myProperty);
              console.log(this); 
            }  
    }
}
@Masd925 is this acceptable
or I need to add the () at the end of innerFunc
helloObj.helloMethod();
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:28
oh for an IFE?
devpaaji
@devpaaji
Mar 23 2017 06:28
@Swirio
I dont see anything egtting logged in here
i was trying to check test the values that printed on console
only when I add the () to the innerFunc I get the log values
one points to local obj
other to the window
@Masd925
Jor
@joreyesl
Mar 23 2017 06:31

@devpaaji

function outer() {
   function inner() {
      console.log("hello");
   }
}

outer();

will this log? cause that's basically what your helloMethod is doing. You have variable declarations, but you arent actually invoking the innerFunc

Markus Kiili
@Masd925
Mar 23 2017 06:32
@devpaaji Function expression just creates a function (object).
devpaaji
@devpaaji
Mar 23 2017 06:33
helloObj.innerFunc(); // not a function
Tom Świrski
@Swirio
Mar 23 2017 06:33
You made object nóg a function so this is why this won't work but i am not so sure
devpaaji
@devpaaji
Mar 23 2017 06:33
@Masd925
Tom Świrski
@Swirio
Mar 23 2017 06:34
Not*
Jor
@joreyesl
Mar 23 2017 06:34
@Masd925 mornin
Szymon
@eruditusfaber
Mar 23 2017 06:34
Hi, my weather project stoped working. Yesterday everything was ok and now JS doesn't work at all... ;/ Any ideas why?
Markus Kiili
@Masd925
Mar 23 2017 06:34
@devpaaji innerFunc is not a property of helloObj.
@joreyesl @HeebieGeeBee Morning.
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:35
@Masd925 mornin
devpaaji
@devpaaji
Mar 23 2017 06:35
@Masd925 innerFunc is a nested function inside the helloObj.helloMethod.
Markus Kiili
@Masd925
Mar 23 2017 06:36
@devpaaji Yeah, just a value of a variable inside the method.
devpaaji
@devpaaji
Mar 23 2017 06:36
so that variable stores a value called from the function
@Masd925
why do we have to immediately invoke it
does that become IIFE
even though not the correct way of writing
Ardigi
@Ardigi
Mar 23 2017 06:38
can anyone help with Assignment with a Returned Value?
i mean
Stand in Line
sorry
Markus Kiili
@Masd925
Mar 23 2017 06:39
@devpaaji var innerFunc = function(){...} makes a function and stores it on the variable. var innerFunc = (function(){...})(); runs the function and stores the return value.
kravhen
@kravhen
Mar 23 2017 06:39
@kravhen
my scrollspy is not updating and moving the Active class to different nav links as i scroll down and ive tried everything :( tried external and internal js links on codepen, tried putting it in <head>, tried puttin an explicit <body> with data attributes, or assigning the scrollspy attributes through document-ready jquery. Tried following simple scrollspy tutorials, out of ideas >.<
my pen https://codepen.io/kravhen/pen/aJEXxG
devpaaji
@devpaaji
Mar 23 2017 06:39
@Masd925
       var innerFunc = function(){
              // child function
              console.log(that.myProperty);
              console.log(this); 
            } (); // this is acceptable way of writing the code?
we are storing the function on the var and invoking it after
now this does give the result
when I call
helloObj.helloMethod();
Markus Kiili
@Masd925
Mar 23 2017 06:41
@devpaaji No function is stored there. Just the return value.
devpaaji
@devpaaji
Mar 23 2017 06:42
here function is not returning any value
justy logging
Markus Kiili
@Masd925
Mar 23 2017 06:42
Yes.
devpaaji
@devpaaji
Mar 23 2017 06:42
should nt it be undefined?
Markus Kiili
@Masd925
Mar 23 2017 06:42
It is.
Chris Cullen
@123xylem
Mar 23 2017 06:46
Cannot PUT /camps/58d0d912716f640fb25ca12f/comments/58d0d912716f640fb25ca132/

My form address:

<form  method="POST" action="/camps/<%=camp_id%>/comments/<%=comment.id%>/?_method=PUT">

My route (getter?):


 router.put("/:commentId",function(req,res){
        comment.findByIdAndUpdate(req.params.commentId,req.body.comment,function(err,foundComment){
            if(err){console.log(err)}
            else{
                res.redirect("/camps/"+req.params.id)}
        })
    })

My app.use has an appended address for the .put request:

 app.use("/camps/:id/comments",commentRoutes);

Any idea why this put request isnt working.. THe requests above it do work and the req knows its a put request and the address on the request seems to be good aswell but its acting like i didnt make the put request (getter?) at all

Markus Kiili
@Masd925
Mar 23 2017 06:46
@devpaaji You don't need the variable at all if you just wan't to run the code and there is no returning:
(function (){console.log("test");})();

void function (){console.log("test");}();
Either way is fine.
You need to use either parens or void so JS doesn't think it is a function declaration.
devpaaji
@devpaaji
Mar 23 2017 06:47
is this acceptable way of writing
Markus Kiili
@Masd925
Mar 23 2017 06:47
Yes.
devpaaji
@devpaaji
Mar 23 2017 06:47
var innerFunc function(){
              // child function
              console.log(that.myProperty);
              console.log(this); 
            } ();
Markus Kiili
@Masd925
Mar 23 2017 06:48
no
devpaaji
@devpaaji
Mar 23 2017 06:48
var innerFunc function()
thats what I was asking
noted
var innerFunc = function(){}(); from FE becomes IIFE?
@Masd925
Markus Kiili
@Masd925
Mar 23 2017 06:49
@devpaaji Right side makes a function and runs it immediately. IIFE
Maciej
@druidmaciek
Mar 23 2017 06:54
Hi i am trying to complete golf exercise(190) in javascipt all the test values return right resaults but there is a problem anyway

function golfScore(par, strokes) {
// Only change code below this line
if (strokes == 1) {
return "Hole-in-One!";
} else if (strokes <= par-2) {
return "Eagle";
} else if (strokes == par-1) {
return "Birdie";
} else if (strokes == par) {
return "par";
} else if (strokes == par+1) {
return "Bogey";
} else if (strokes == par+2) {
return "Double Bogey";
} else if (strokes >= par+3) {
return "Go Home!";
}
// Only change code above this line
}

// Change these values to test
golfScore(1, 1);

here is my code
Meghna
@meghna10bid
Mar 23 2017 06:55

```// Only change code below this line

var remainder = 2;
how to use the % operator here? Please, help me out

HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:55
@druidmaciek Par in the return par maybe
@meghna10bid do you know what a remainder is in division?
Meghna
@meghna10bid
Mar 23 2017 06:56
yes
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:57
ok so the modulo operator % finds the remainder of two numbers when divided so 11%3 is 2
do you understand that?
Meghna
@meghna10bid
Mar 23 2017 06:58
yes, but how to include it here
Manish Giri
@Manish-Giri
Mar 23 2017 06:58
@HeebieGeeBee got a minute?
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 06:59
@meghna10bid so the challenge just asks you do assign the value of two to the remainder variable using the modulo operator so remainder = 11%3 would mean remainder has a value of 2
@Manish-Giri sure
Manish Giri
@Manish-Giri
Mar 23 2017 06:59
@HeebieGeeBee run this and see if you get an error in the console..
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 07:00
@Manish-Giri nope
Manish Giri
@Manish-Giri
Mar 23 2017 07:00
ww.png
why only me :sob:
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 07:01
@Manish-Giri you using chrome?
Manish Giri
@Manish-Giri
Mar 23 2017 07:01
it works in incognito mode for me, but when I try it in the regular mode(while being logged in), it doesn't work
@HeebieGeeBee yeah
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 07:02
@Manish-Giri i cant even see anywhere you have a.split in your code
Manish Giri
@Manish-Giri
Mar 23 2017 07:02
@HeebieGeeBee other people have reported it as well - jsbin/jsbin#3010
Meghna
@meghna10bid
Mar 23 2017 07:02
@HeebieGeeBee thanks :smile:
CamperBot
@camperbot
Mar 23 2017 07:02
meghna10bid sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1120 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Manish Giri
@Manish-Giri
Mar 23 2017 07:02
@HeebieGeeBee yes exactly, no .split() in my code..
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 07:03
@Manish-Giri strange maybe some kind of bug with ppl with accounts or summin?
Tom Świrski
@Swirio
Mar 23 2017 07:03
Are you sure that you are tunningu good code?
Running
Manish Giri
@Manish-Giri
Mar 23 2017 07:05
@HeebieGeeBee this is where the error occurs -
j=a.split("\n")
www.png
it's a line in the jsbin code
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 07:08
yeah odd
something is bugging it
Manish Giri
@Manish-Giri
Mar 23 2017 07:09
cool
@HeebieGeeBee thx for verifying
CamperBot
@camperbot
Mar 23 2017 07:10
manish-giri sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1121 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Amaris
@amaristang
Mar 23 2017 07:18

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line

var myStr;

Meghna
@meghna10bid
Mar 23 2017 07:32
not getting what to do in the challenge- "Convert Celsius to Fahrenheit". Help me
Manish Giri
@Manish-Giri
Mar 23 2017 07:32
@meghna10bid have you looked up the formula?
Meghna
@meghna10bid
Mar 23 2017 07:33
ya
Manish Giri
@Manish-Giri
Mar 23 2017 07:37
@meghna10bid you have the celsius value in the celsius variable
using the formula, you need to convert it to the corresponding fahrenheit value and store in the fahrenheit variable.
Meghna
@meghna10bid
Mar 23 2017 07:39
in a way like this- var fahrenheit = 86; ??
Manish Giri
@Manish-Giri
Mar 23 2017 07:40
@meghna10bid you don't do the conversion yourself..
you just write the expression using the formula
JS does the conversion.
Meghna
@meghna10bid
Mar 23 2017 07:40
ok, let me do this. Thanks
mrdang
@khacquyetdang
Mar 23 2017 07:42
hi, i'm working on my tictactoe games
i cannot get my event fired
$("#playagainbtn").click(playAgain);
this code don't help me to reach the playAgain when i click on the button play again
mrdang
@khacquyetdang
Mar 23 2017 07:52
got the code work thank you
Edward John
@eddmecha
Mar 23 2017 07:53
guys its me again
i got stuck at java again
:'(

Instructions
Assign the following three lines of text into the single variable myStr using escape sequences.Here is the text with the escape sequences written out.

FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine

and i wrote
var myStr; 'FirstLine\n\SecondLine\\r ThirdLine'
i get typeError
var myStr; 'FirstLine\n\SecondLine\\r ThirdLine' is not a function
Sampea
@Sampea
Mar 23 2017 07:58
Hi there, I'm working on finding a Remainder in JavaScript. I'm finding it quite difficult this is my code:
var remainder; 11 % 3 = 2;
Edward John
@eddmecha
Mar 23 2017 07:59
@Sampea its should be var remainder = 11 % 3;
var remainder = 11 % 3 ;
marker1k
@marker1k
Mar 23 2017 08:08
@eddmecha var myStr = "FirstLine\n\SecondLine\\rThirdLine";
Edward John
@eddmecha
Mar 23 2017 08:09
@marker1k thanks..i managed to get it a few seconds ago.
CamperBot
@camperbot
Mar 23 2017 08:09
eddmecha sends brownie points to @marker1k :sparkles: :thumbsup: :sparkles:
:cookie: 217 | @marker1k |http://www.freecodecamp.com/marker1k
marker1k
@marker1k
Mar 23 2017 08:09
@eddmecha You welcome.
Maks Ushakov
@maks-ushakov
Mar 23 2017 08:20
http://codepen.io/projmaks/pen/yMKVYd
If switch to quotesondesign and press Get Quote it shows only one quot any time, but if i turn on dev tools it works normaly. how to catch and fix this bug?
Edward John
@eddmecha
Mar 23 2017 08:33
guys this Instructions
Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength.
and i wrote

var lastNameLength = 0;
var lastName = "eddmecha";

lastNameLength = lastName.lenght;

is it correct?
marker1k
@marker1k
Mar 23 2017 08:37
@eddmecha You can do just lastNameLength = lastName.length;
Edward John
@eddmecha
Mar 23 2017 08:37
oh means i just delete the rest
?
shahraizaamer
@shahraizaamer
Mar 23 2017 08:39
I'm stuck on convert celsius to farenheit excersice can anyone help??
marker1k
@marker1k
Mar 23 2017 08:39
@eddmecha
var lastName = "eddmecha";
var lastNameLength = lastName.length;
CamperBot
@camperbot
Mar 23 2017 08:39
:bulb: to format code use backticks! ``` more info
Edward John
@eddmecha
Mar 23 2017 08:40
@marker1k ahh i see there is a typo in "lenght"
thanks!!
marker1k
@marker1k
Mar 23 2017 08:41
@shahraizaamer Where have you stuck?
@eddmecha Ahah
shahraizaamer
@shahraizaamer
Mar 23 2017 08:43
I cant seem to make an expression for conversion
that actually works
marker1k
@marker1k
Mar 23 2017 08:44
@shahraizaamer Celsius times 9/5, plus 32:
celsius * 1.8 + 32;
shahraizaamer
@shahraizaamer
Mar 23 2017 08:44
i tried iy wont work
it
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:45
@shahraizaamer post your code that youve tried
marker1k
@marker1k
Mar 23 2017 08:45
Hmm, here is working code:

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

  var fahrenheit = celsius * 1.8 + 32;

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

// Change the inputs below to test your code
convertToF(30);
Edward John
@eddmecha
Mar 23 2017 08:45
@shahraizaamer var fahrenheit = celcius * 9 / 5 + 32 ;
also can
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:46
@eddmecha celsius*
@marker1k btw no need to declare the variable twice there
Edward John
@eddmecha
Mar 23 2017 08:47
@HeebieGeeBee lol yeah another typo
thanks for the heads up
CamperBot
@camperbot
Mar 23 2017 08:47
eddmecha sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1122 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
kharazzoro
@kharazzoro
Mar 23 2017 08:50
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr

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]]);
for (var i=0 ; i<multiplyAll[0].length;i++){
for(var s=0; s<multiplyAll[i].length; s++){

}
console.log(multiplyAll[i][s]);
}

plz how can i solve it

original

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

HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:52
@kharazzoro first off why arent you writing the code where it tells you to write the code
kharazzoro
@kharazzoro
Mar 23 2017 08:52

Instructions
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr
alright
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:52
@kharazzoro next, what do you think the purpose of doing a nested loop is?
kharazzoro
@kharazzoro
Mar 23 2017 08:53
multiply the field inside array
[1] [2] [3]
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:54
forget about that for now what is the purpose of doing a nested loop
in general
kharazzoro
@kharazzoro
Mar 23 2017 08:54
make loop inside loop
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:55
yes but why would we want to do that?
shahraizaamer
@shahraizaamer
Mar 23 2017 08:55

@HeebieGeeBee
function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
var fareheit = celsius *1.8 +32;

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

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

HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:55
@shahraizaamer check your spelling, and there no need to declare a variable twice
shahraizaamer
@shahraizaamer
Mar 23 2017 08:56
oka ill try
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:57
@kharazzoro ok, forget the nested loop, what is the purpose of doing a loop?
kharazzoro
@kharazzoro
Mar 23 2017 08:57
me want to accesses the content of array
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:57
yes so what does your i loop do?
kharazzoro
@kharazzoro
Mar 23 2017 08:57
length or specific contentent insipe loop
make loop its will count the number of loop
by the value I have give it
shahraizaamer
@shahraizaamer
Mar 23 2017 08:59
@HeebieGeeBee thank you
CamperBot
@camperbot
Mar 23 2017 08:59
shahraizaamer sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1123 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 08:59
ok so you use those iterations it access each element in the array right by arr[i] for example
kharazzoro
@kharazzoro
Mar 23 2017 08:59
yes
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:00
so then you have a nested loop
inside your i loop
whats does that enable you to do?
Žygimantas Jackūnas
@ZJackunas
Mar 23 2017 09:00
Hi everyone, can you help? what's wrong with this line?
var myStr = "FirstLine \n \ SecondLine \ \r ThirdLine"; // Change this line
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:00
@ZJackunas dont have any spaces
kharazzoro
@kharazzoro
Mar 23 2017 09:01
make multiple loop
or increase the number of loop
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:02
@kharazzoro ok, well if your nested loop iterates dependent on the length of each sub array
kharazzoro
@kharazzoro
Mar 23 2017 09:02
each one loop make many loop
Žygimantas Jackūnas
@ZJackunas
Mar 23 2017 09:02
i added spaces after FirstLine, after \n and so on
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:02
@ZJackunas you dont want to have any spaces at all
kharazzoro
@kharazzoro
Mar 23 2017 09:03
yes
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:03
@kharazzoro with the sub array, that enables you to iterate through each element in the sub array
marker1k
@marker1k
Mar 23 2017 09:03
@HeebieGeeBee Yes, thank you.
CamperBot
@camperbot
Mar 23 2017 09:03
marker1k sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1124 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Alvin Odhiambo
@Alvin2410
Mar 23 2017 09:03
guys whats the procedure of writing the code for the longest word in a string?
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:04
so when you do arr[i][s] on the first iteration this will mean you access the for element in the first sub array
Žygimantas Jackūnas
@ZJackunas
Mar 23 2017 09:04
@HeebieGeeBee Ty
CamperBot
@camperbot
Mar 23 2017 09:04
zjackunas sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1125 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:04
@kharazzoro do you understand that?
kharazzoro
@kharazzoro
Mar 23 2017 09:05
alright
I got it
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:05
@kharazzoro and the purpose of the function is to multiply every element of each sub array with the product variable and then return that variable
kharazzoro
@kharazzoro
Mar 23 2017 09:05
arr[i][s] this for first sub array
what about secand and third
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:06
@kharazzoro well no arr[0][0] is the first element of the first sub array
kharazzoro
@kharazzoro
Mar 23 2017 09:06
ok
arr[1][1]
secand
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:07
but on the first iteration of the loop arr[i][s] will be arr[0][0] on the second iteration it will be arr[0][1] and so on, this is the whole point of doing loops
kharazzoro
@kharazzoro
Mar 23 2017 09:08
[0][0] 0 [1]010[1] [22
Meghna
@meghna10bid
Mar 23 2017 09:08

```// Example
var firstNameLength = 0;
var firstName = "Ada";

firstNameLength = firstName.length;

// Setup
var lastNameLength = 8;
var lastName = "Lovelace";

// Only change code below this line.

lastNamelength = lastName.length;
please tell me what's wrong here

HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:09

@Alvin2410 in sudo code

split the array into words
some how iterate through each word to find its length
then return the length of the longest length

but there are many ways to do it

Alvin Odhiambo
@Alvin2410
Mar 23 2017 09:09
guys whats the procedure of finding the longest word in a string?
kharazzoro
@kharazzoro
Mar 23 2017 09:09
0 0 01 1 0 1 1 2 0 2 1 2 2
these all
Alvin Odhiambo
@Alvin2410
Mar 23 2017 09:10
@HeebieGeeBee ooh okay
kharazzoro
@kharazzoro
Mar 23 2017 09:10
prospect ??
because the arrau [1 2 ] [3 4] [ 5 6 7 ]
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:11
that will be what the varaibles i and s will be on all the iterations yes
@kharazzoro
Edward John
@eddmecha
Mar 23 2017 09:11
guys what does this mean?
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
Mar 23 2017 09:11
so in the loop you just have to do product *= arr[i][s] @kharazzoro
because every iteration of the loop it will access a new element and mulitply it with the product
kharazzoro
@kharazzoro
Mar 23 2017 09:13
multiplyAll[i]
result 3 ?
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:13
@kharazzoro no
kharazzoro
@kharazzoro
Mar 23 2017 09:14
first loop
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:14
multiplyAll is the name of the function
you shouldnt be writing that anywhere
kharazzoro
@kharazzoro
Mar 23 2017 09:14
multiplyAll([[1,2],[3,4],[5,6,7]]);
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:14
@kharazzoro i basically just told you the answer
kharazzoro
@kharazzoro
Mar 23 2017 09:14
array name also
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:15
no
kharazzoro
@kharazzoro
Mar 23 2017 09:15
ok
arr
is the name
multiplyAll([[1,2],[3,4],[5,6,7]]);
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:15
thats the function be called and have elements passed into the array
arr is the parameter of the fucntion
kharazzoro
@kharazzoro
Mar 23 2017 09:15
is the quantity
yes yes
sorry I was confuesed
thank you bro
I will fix it
and go back to you
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:16
k no worries
kharazzoro
@kharazzoro
Mar 23 2017 09:16
and check if i can solve it now
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:16
cool good luck
Jaco Ahmad
@jacoahmad
Mar 23 2017 09:17
yo guys how to do math inside a parameter of a boolean
example
function something(par1, par2){
 if(par1 <=  par2 + 2){
return "yay";
}
}
is it possible?
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:17
@jacoahmad yes
@jacoahmad well that example will work
how you phrased the question wa sa little weird though
kharazzoro
@kharazzoro
Mar 23 2017 09:20
ok bro
i wana ask you pls
i<arr.length
this now should be 3
length of array
of element inside array
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:21
@kharazzoro no that will be either true or false
kharazzoro
@kharazzoro
Mar 23 2017 09:21
and arr[i].length
Jaco Ahmad
@jacoahmad
Mar 23 2017 09:21

The instruction was to

<= par - 2    "Eagle"

I type

if(strokes <= par -2){
return "Eagle";
}

and it doesnt work ._.

kharazzoro
@kharazzoro
Mar 23 2017 09:21
should give me 3 also because 3rd part is [5 6 7]
Fabio Di Pane
@saylos
Mar 23 2017 09:21
Hello guys, finally I made this code work, but I suppose in a triky way. Do you have other ways? Could you show me other point of views? tks
function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  var sourceKeys = Object.keys(source);
  var count = 0;
  collection.forEach(function(obj){
  for(var j = 0; j<sourceKeys.length; j++){

    if (obj.hasOwnProperty(sourceKeys[j]) && obj[sourceKeys[j]] === source[sourceKeys[j]]){
      count ++;
      continue;
    } else {count = 0; break; }

    }
  if (count === sourceKeys.length){
    arr.push(obj);
    count = 0;
  }
  });

  return arr;
}

whatIsInAName([{ "a": 1, "b": 2 }, { "a": 1 }, { "a": 1, "b": 2, "c": 2 }], { "a": 1, "b": 2 });
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:22
@jacoahmad wheres all your code
kharazzoro
@kharazzoro
Mar 23 2017 09:22
alright what i understand know i<arr.length will count the 3 part inside array
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:22
@kharazzoro dont understand what youre asking poate all your code too
Jaco Ahmad
@jacoahmad
Mar 23 2017 09:22

function golfScore(par, strokes) {
  // Only change code below this line
  if (strokes = 1) {
    return "Hole-in-one!";
  } else if (strokes <= par - 2) {
    return "Eagle";
  } else if (strokes === par -1) {
    return "Birdie";
  } else if (strokes === par) {
    return "Par";
  } else if (strokes === par + 1) {
    return "Bogey";
  } else if (strokes === par + 2) {
    return "Double Bogey";
  } else {
    return "Go Home!";
  }
  // Only change code above this line
}

// Change these values to test
golfScore(4, 2);
kharazzoro
@kharazzoro
Mar 23 2017 09:23
and the log(arr[i][s]) will give me 3 because arr[i] 3 and s 3
?
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:23
@jacoahmad strokes === 1 not strokes = 1
kharazzoro
@kharazzoro
Mar 23 2017 09:24

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

}
product=console.log(arr[i][s]);
}
// Only change code above this line
return product;
}

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

this what i wrote
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:25
@kharazzoro product *= arr[i][s];
kharazzoro
@kharazzoro
Mar 23 2017 09:27

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

}
product*=arr[i][s];
}
// Only change code above this line
return product;
}

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

------------- null
!!
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:29
@kharazzoro whats the challege called?
kharazzoro
@kharazzoro
Mar 23 2017 09:30
multiplyAll([[1],[2],[3]]); should return 6
the result null
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:30
@kharazzoro what is the challenge called?
kharazzoro
@kharazzoro
Mar 23 2017 09:31
Nesting For Loops
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:32
@kharazzoro you should multiply product with the elements of the sub-arrays in the inner loop block
@HeebieGeeBee Hey Bro :smile:
kharazzoro
@kharazzoro
Mar 23 2017 09:32
product*=arr[i][s];
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:32
@kharazzoro product*=arr[i][s]; should be in the inner loop block
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:34
@Lumexralph yo
kharazzoro
@kharazzoro
Mar 23 2017 09:34
@HeebieGeeBee how I can give u point because u helped me bro
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:34
and yes that
@kharazzoro ^
kharazzoro
@kharazzoro
Mar 23 2017 09:34
how ?
because i saw someone evalute and give feedback after help
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:34
you say thank you whilst tagging the person you want to send cookies to
but its not that big of a deal
kharazzoro
@kharazzoro
Mar 23 2017 09:35
@HeebieGeeBee Thank you
CamperBot
@camperbot
Mar 23 2017 09:35
:star2: 1126 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
kharazzoro sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
kharazzoro
@kharazzoro
Mar 23 2017 09:35
Alright that cool
You are good teacher
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:36
lol didnt feel like it but youre welcome
kharazzoro
@kharazzoro
Mar 23 2017 09:37
product*=arr[i][s];
give me 5040
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:37
@Lumexralph how you been?
kharazzoro
@kharazzoro
Mar 23 2017 09:37
i solve it
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:37
@kharazzoro cool
kharazzoro
@kharazzoro
Mar 23 2017 09:37
but why give me 5040
curiousNoob
@curiousNoob
Mar 23 2017 09:37
about Alright that cool
about @kharazzoro
CamperBot
@camperbot
Mar 23 2017 09:38
:warning: no user found for kharazzoro
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:38
@kharazzoro becuase thats the answer
kharazzoro
@kharazzoro
Mar 23 2017 09:38
arr[i] shoule be 3 ?
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:38
@HeebieGeeBee been good bro, thanks.....you?
CamperBot
@camperbot
Mar 23 2017 09:38
lumexralph sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1127 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:38
@Lumexralph im alright
@kharazzoro why? the function is to multiply all the elements in the arrays
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:39
@HeebieGeeBee how's the day panning out?
Meghna
@meghna10bid
Mar 23 2017 09:39
// Setup
var myStr = "Jello World";

// Only change code below this line
var myStr = "Hello World";
myStr = "Hello World";
myStr[0] = "H"; // Fix Me
please tell me where I am getting wrong
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:39
@Lumexralph cold
curiousNoob
@curiousNoob
Mar 23 2017 09:40
@meghna10bid what do u want to achieve?
HeebieGeeBee
@HeebieGeeBee
Mar 23 2017 09:40
myStr = "Hello World"; this is the only line you need
curiousNoob
@curiousNoob
Mar 23 2017 09:40
@meghna10bid strings are immutable, you cant change string rather u have to create new one
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:40

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

// Your code above this line
return result;
}

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

please tell me what to do in this exercise
Meghna
@meghna10bid
Mar 23 2017 09:41
correct the assignment to myStr to achieve the desired effect
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:41
ive tried 1000x and can make any word. I just can't pass this
curiousNoob
@curiousNoob
Mar 23 2017 09:41
@meghna10bid myStr[0] = "H" assignment cant be done
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:41
@AbradolfLinclr you're to make a sentence with the parameters of your function separating them with spaces " ", then you assign it to result
curiousNoob
@curiousNoob
Mar 23 2017 09:42
@meghna10bid create new string and then use slice() method to get what you want
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:42
@Lumexralph can you give me an example?..
oh nvm i get it i think
Peeyush Gupta
@Piyush0601
Mar 23 2017 09:43
What is Escape Sequence and how i can use it?
in this what is carriage return?
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:45
@meghna10bid I just completed that , reset your code. I'm pretty sure all you gotta do is change the H to a j
Alvin Odhiambo
@Alvin2410
Mar 23 2017 09:45
guys how do i change the first character of a word to upper case?
Meghna
@meghna10bid
Mar 23 2017 09:46
@AbradolfLinclr can you tell me how to do it. Its coming up with error
homebrainbox
@homebrainbox
Mar 23 2017 09:47
Stuck with Condense arrays with reduce, can you check my code, please?
var singleVal = array.reduce(function(previousVal, currentVal) {
  return previousVal + currentVal;
});

singleVal = array;
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:48
@homebrainbox remove this line in your code singleVal = array;
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:48
@meghna10bid so don't change the setup... reset your code
homebrainbox
@homebrainbox
Mar 23 2017 09:49
@Lumexralph thanks buddy
CamperBot
@camperbot
Mar 23 2017 09:49
homebrainbox sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1360 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:49
@AbradolfLinclr myNoun + " " + myAdjective + " " +.........
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:49
@meghna10bid myStr[0] = "j";
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:49
@homebrainbox :+1:
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:49
@Lumexralph already got it but thanks anyway man
CamperBot
@camperbot
Mar 23 2017 09:49
abradolflinclr sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1361 | @lumexralph |http://www.freecodecamp.com/lumexralph
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:50
@meghna10bid uppercase J
Dan Couper
@DanCouper
Mar 23 2017 09:50
@Piyush0601 a string, certain things can't be typed, for example a new line, so a symbol is used, preceded by the escape character \ (so for a new line, you would type "first line\nsecond line, \n is the new line). And because strings are surrounded by quote marks, if you want to type a quote mark in the string, you need to tell js that you mean to do that, and escape it - "this is a string with a \"quote\" in it". But because the symbol uses a \, if you actually want to type \ you need to escape that as well: "this is a string with a backslash here: \\"
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:51
@meghna10bid did you get it?
Alvin Odhiambo
@Alvin2410
Mar 23 2017 09:52
guys how do i change the first character of a word to upper case?
Meghna
@meghna10bid
Mar 23 2017 09:52
@AbradolfLinclr i did the same but its coming up with an error- TypeError: Cannot assign to read only property '0' of string 'Jello World'
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:53
@meghna10bid send your screeen again, it took me like 5 attempts
reset it and then send it again
Meghna
@meghna10bid
Mar 23 2017 09:53
okay
Markus Kiili
@Masd925
Mar 23 2017 09:53
@Lumexralph @DanCouper Morning.
Peeyush Gupta
@Piyush0601
Mar 23 2017 09:54
@DanCouper and what is the carriage return here?
Dan Couper
@DanCouper
Mar 23 2017 09:54
🤗
Meghna
@meghna10bid
Mar 23 2017 09:54
@AbradolfLinclr its not working out
kim monzon
@kedomonzter
Mar 23 2017 09:55
@Alvin2410
String.prototype.capitalize = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);
}
var str = “test meow”;

str.capitalize(); // “Test Meow"
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 09:56
@meghna10bid i think the answer might just be myStr="Hello World"; delete the myStr[0]="H";
Peeyush Gupta
@Piyush0601
Mar 23 2017 09:57
@DanCouper thaks
Ogundele Olumide
@Lumexralph
Mar 23 2017 09:58
@Masd925 Good Morning
Dan Couper
@DanCouper
Mar 23 2017 09:58
:thumbsup: in practise escapes aren't needed a huge amount, mainly just if you want quotes or new lines
and JS template strings fix that anyway (in newer versions of JS)
Meghna
@meghna10bid
Mar 23 2017 09:59
@AbradolfLinclr this time it worked out. Thanks for your support :smile:
CamperBot
@camperbot
Mar 23 2017 09:59
meghna10bid sends brownie points to @abradolflinclr :sparkles: :thumbsup: :sparkles:
:cookie: 161 | @abradolflinclr |http://www.freecodecamp.com/abradolflinclr
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 10:01
@meghna10bid haha its cool, im only like 5 exercises ahead of you. That one gave me a rough time as well
Meghna
@meghna10bid
Mar 23 2017 10:02
@AbradolfLinclr but still you are helpful :smile:
Roger Castro
@castro2487
Mar 23 2017 10:03
hello to all
Meghna
@meghna10bid
Mar 23 2017 10:04
hi @castro2487
Roger Castro
@castro2487
Mar 23 2017 10:05
i need to code 3 excersices with Js and probe if work with test file that was send
how can i do this
because everything i made till now was with codepen
and with the browser or with the challenges
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 10:06
@meghna10bid let me know if you need anything else, I'll be on here till Jameson gets the best of me
naimatfz
@naimatfz
Mar 23 2017 10:09
FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
anybody? FirstLine newlinebackslash SecondLine backslash carriage-returnThirdLine
Michael Schmidt
@lafisrap
Mar 23 2017 10:10
Hej, I'm doing the Recipes/React project and I get a problem with Bootstrap. The accordeon I use is initially opened, I want it closed, and not use jQuery for it: $("#receipes").collapse("hide");
Ogundele Olumide
@Lumexralph
Mar 23 2017 10:10
@naimatfz just have you've written it, escape the characters
Michael Schmidt
@lafisrap
Mar 23 2017 10:10
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 10:11
FirstLine\n\SecondLine\\rThirdLine
@naimatfz
oops.. after that \n it should be
\n\
\\
this chat cuts out my slashes so hopefully you get it lol
FirstLine\n\\SecondLine\\\rThirdLine
naimatfz
@naimatfz
Mar 23 2017 10:13
got it thanks @mannanabbasi
CamperBot
@camperbot
Mar 23 2017 10:13
naimatfz sends brownie points to @mannanabbasi :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @mannanabbasi |http://www.freecodecamp.com/mannanabbasi
naimatfz
@naimatfz
Mar 23 2017 10:13
thanks @AbradolfLinclr
CamperBot
@camperbot
Mar 23 2017 10:13
naimatfz sends brownie points to @abradolflinclr :sparkles: :thumbsup: :sparkles:
:cookie: 166 | @abradolflinclr |http://www.freecodecamp.com/abradolflinclr
Peeyush Gupta
@Piyush0601
Mar 23 2017 10:15
thanks @AbradolfLinclr
CamperBot
@camperbot
Mar 23 2017 10:15
piyush0601 sends brownie points to @abradolflinclr :sparkles: :thumbsup: :sparkles:
:cookie: 168 | @abradolflinclr |http://www.freecodecamp.com/abradolflinclr
Peeyush Gupta
@Piyush0601
Mar 23 2017 10:17
i understand the way to use. BTW thanks again
Ankur sharma
@ankur1163
Mar 23 2017 10:20
I want to thank beautiful people here specially @sjames1958gm
I finished all 3 certificates
thanks awesome people here
79937549
@79937549
Mar 23 2017 10:22
#150 how
Roger Castro
@castro2487
Mar 23 2017 10:24
congratulations @ankur1163
how much time it takes to you?
Bhumesh Domala
@umeshgmrl
Mar 23 2017 10:26
Hi friends, I can't get the 'lat' and 'lon' values out of navigator function in Local Weather challenge..:( Please help me someone!!
tundeiness
@tundeiness
Mar 23 2017 10:26
hi guys the standInLine excercise isn't too clear. i understand that the argument arr and what it takes is testArr but the item argument is not clear, am i supposed to supply the values? or how does the compiler get the values?
Naimur
@naimur103
Mar 23 2017 10:26
plz help me! i m stuck at this step
Meghna
@meghna10bid
Mar 23 2017 10:27
@AbradolfLinclr sure! I'll let you know. So nice of you
Roger Castro
@castro2487
Mar 23 2017 10:27
@naimur103 paste your code
and lets check what is missing
Naimur
@naimur103
Mar 23 2017 10:27

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

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

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

what i have to insert i m not understanding!
Roger Castro
@castro2487
Mar 23 2017 10:28
have you read the problem description
Naimur
@naimur103
Mar 23 2017 10:29
yes! but i didn't understand..plz code this and give me solution
Roger Castro
@castro2487
Mar 23 2017 10:29
return should be fahrenheit, so you need to code in the space the editor tell the step to convert from celsius to fahrenheit
tundeiness
@tundeiness
Mar 23 2017 10:30
@naimur103 what do you really need?
Roger Castro
@castro2487
Mar 23 2017 10:31
the answer of what you need to do is in the description, specifically here:
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
Ankur sharma
@ankur1163
Mar 23 2017 10:31
@castro2487 7 months full dedication
Naimur
@naimur103
Mar 23 2017 10:31
yes i know this
Ankur sharma
@ankur1163
Mar 23 2017 10:31
its difficult, no doubt about it :)
Naimur
@naimur103
Mar 23 2017 10:31
but how i write this
Roger Castro
@castro2487
Mar 23 2017 10:31
amazing @ankur1163
need to multiply 9/5 to the fahrenheit
Naimur
@naimur103
Mar 23 2017 10:32
i need any one write my code! can anyoneZ?
Johnny
@JohnnyBizzel
Mar 23 2017 10:32
@amitkumarsarangi Works well, however I can press the wrong sequence and it doesn't fail immediately.
You only check the user response when they have pressed the same number of buttons I think:
if (simonArr.length === responseArr.length) { line 175
Roger Castro
@castro2487
Mar 23 2017 10:32
and add 32
Ankur sharma
@ankur1163
Mar 23 2017 10:33
hello @JohnnyBizzel
Roger Castro
@castro2487
Mar 23 2017 10:33
i made this:
var times = 1.8;
fahrenheit= celsius * times;
fahrenheit= fahrenheit + 32;
Jacoby Dueck
@dueckjp
Mar 23 2017 10:33
can someone help me
Roger Castro
@castro2487
Mar 23 2017 10:33
@naimur103
nickvdbuurt
@Nickvdbuurt
Mar 23 2017 10:33
@dueckjp tell me bro
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 10:34
@castro2487 try using the variables they gave you, dont make any new ones
Roger Castro
@castro2487
Mar 23 2017 10:34
ok @AbradolfLinclr
Yahia
@y-zaky
Mar 23 2017 10:34
hey guys i have a quick question
function Hero (name) {
var myguy = {
name: name,
position: "00",
health: 100,
damage: 5,
experience: 0 } ;
return myguy
}
i want the name to pass any 'name' argument
how do i input that into my function?
AbradolfLinclr
@AbradolfLinclr
Mar 23 2017 10:35
@meghna10bid race to the finish? what # you on?
tundeiness
@tundeiness
Mar 23 2017 10:35
@naimur103 you should have this: var Celsius; var fahrenheit = (Celsius * 9/5) + 32
nickvdbuurt
@Nickvdbuurt
Mar 23 2017 10:35
@bowssy88 missing a semicolon at your return
Yahia
@y-zaky
Mar 23 2017 10:36
if i write name: "name" then no matter what name is put in name is returned,, i want it to be so that if i put in greg for the name greg is returned....
tundeiness
@tundeiness
Mar 23 2017 10:36
@naimur103 you should have this: var Celsius; var fahrenheit = (Celsius * 9/5) + 32 ;
Naimur
@naimur103
Mar 23 2017 10:37
many many thanks :)
Yahia
@y-zaky
Mar 23 2017 10:37
anyone know the answer?
@Nickvdbuurt done but thats not what I'm looking or....
Markus Kiili
@Masd925
Mar 23 2017 10:37
@bowssy88 You wan't to return the passed name?
Yahia
@y-zaky
Mar 23 2017 10:37
@Masd925 yes
Javier Reinoso
@JavoFrola
Mar 23 2017 10:38
Hi guys, I do not understand how to do the "Stand in Line" JS excercise :(
Yahia
@y-zaky
Mar 23 2017 10:38
e.g. greg returns greg ... not name
Markus Kiili
@Masd925
Mar 23 2017 10:38
@bowssy88 return name;
Yahia
@y-zaky
Mar 23 2017 10:38
@Masd925 so delete name:name?
Markus Kiili
@Masd925
Mar 23 2017 10:38
@bowssy88 Not sure what you are trying to do here.
tundeiness
@tundeiness
Mar 23 2017 10:39
@JavoFrola same challenge here...the item parameter is the issue
Markus Kiili
@Masd925
Mar 23 2017 10:39
@JavoFrola Find out the two array methods you need and use them on arr and item.
Johnny
@JohnnyBizzel
Mar 23 2017 10:39
@ankur1163 HI!
Ankur sharma
@ankur1163
Mar 23 2017 10:39
thanks @Masd925
CamperBot
@camperbot
Mar 23 2017 10:39
ankur1163 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3642 | @masd925 |http://www.freecodecamp.com/masd925
Yahia
@y-zaky
Mar 23 2017 10:39
Screen Shot 2017-03-23 at 10.39.16.png
Ankur sharma
@ankur1163
Mar 23 2017 10:39
I finished all 3 certificates
Thank you very much
Yahia
@y-zaky
Mar 23 2017 10:40
this is the task .... @Masd925
Ankur sharma
@ankur1163
Mar 23 2017 10:40
I fulfilled my dream of becoming a coder
thanks @Masd925
CamperBot
@camperbot
Mar 23 2017 10:40
ankur1163 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:warning: ankur1163 already gave masd925 points
Ankur sharma
@ankur1163
Mar 23 2017 10:40
you helped me a lot
Yahia
@y-zaky
Mar 23 2017 10:40
@ankur1163 congrats ! we are all trying
Javier Reinoso
@JavoFrola
Mar 23 2017 10:40
yes
Ankur sharma
@ankur1163
Mar 23 2017 10:40
yes @bowssy88
Yahia
@y-zaky
Mar 23 2017 10:40
@ankur1163 dude can you help me lol
given you have the certificates
my function is simple (in screenshot above)
Markus Kiili
@Masd925
Mar 23 2017 10:41
@bowssy88 You need to return the object I think.
Yahia
@y-zaky
Mar 23 2017 10:41
@Masd925 what do you mean
Javier Reinoso
@JavoFrola
Mar 23 2017 10:41
but I do not know how to face it.
Jaco Ahmad
@jacoahmad
Mar 23 2017 10:42
it works like a charm @HeebieGeeBee
Markus Kiili
@Masd925
Mar 23 2017 10:42
@bowssy88 You call the function and pass in a name and it returns a hero object.
Javier Reinoso
@JavoFrola
Mar 23 2017 10:42
I supuse to push the item I want and shift the first item of the testArray?
Markus Kiili
@Masd925
Mar 23 2017 10:43
@JavoFrola Don't use testArr. Just arr and item.
Jaco Ahmad
@jacoahmad
Mar 23 2017 10:43
Thanks @HeebieGeeBee
CamperBot
@camperbot
Mar 23 2017 10:43
jacoahmad sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1128 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Javier Reinoso
@JavoFrola
Mar 23 2017 10:43
inside the function?
Markus Kiili
@Masd925
Mar 23 2017 10:43
Yes.
Javier Reinoso
@JavoFrola
Mar 23 2017 10:43
but expressed as a variable?
Markus Kiili
@Masd925
Mar 23 2017 10:44
@JavoFrola arr and item are the function parameters that hold the passed array and number from the function call. You use the parameters inside the function code. That way the function work on any passed arguments.
tundeiness
@tundeiness
Mar 23 2017 10:45
@JavoFrola @Masd925 declare item and arr[] inside the function without values?
Yahia
@y-zaky
Mar 23 2017 10:45
look
Screen Shot 2017-03-23 at 10.39.16.png
@Masd925
Screen Shot 2017-03-23 at 10.39.16.png
sorry
Screen Shot 2017-03-23 at 10.43.02.png
the second one
Markus Kiili
@Masd925
Mar 23 2017 10:45
@tundeiness Function parameters are already defined on the function declaration. You can just use them on the function code.
Yahia
@y-zaky
Mar 23 2017 10:45
third **
Markus Kiili
@Masd925
Mar 23 2017 10:46
@tundeiness When the function is called, the engine makes an execution context where the code is run and there parameters are variables that hold the passed argument values.
Yahia
@y-zaky
Mar 23 2017 10:46
can anyone help me :(
tundeiness
@tundeiness
Mar 23 2017 10:47
@Masd925 yes they are, but inside the function what value do I pass in?
Markus Kiili
@Masd925
Mar 23 2017 10:47
@tundeiness The challenge is to just write the function. FCC tests call the function under the hood.
Jacoby Dueck
@dueckjp
Mar 23 2017 10:47

// Setup
var testObj = {
"hat": "ballcap",
"shirt": "jersey",
"shoes": "cleats"
};

// Only change code below this line

var hatballcap = testObj.hat; //ballcap // Change this line
var shirtjersey = testObj.shirt; // jersey // Change this line

can someone help me make this run