These are chat archives for FreeCodeCamp/HelpJavaScript

5th
Jan 2017
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:00 UTC
@kulagowskim you've done it, or is there any question?
Diego Mayer
@Chrono79
Jan 05 2017 00:00 UTC
@luizanyn if you have to return a boolean, generally it isn't
kulagowskim
@kulagowskim
Jan 05 2017 00:01 UTC
@Lumexralph how its work :D
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:01 UTC
@nghm what do you want to know?
@kulagowskim you want to know how it works?
Zhafarina Ungku
@inagreen
Jan 05 2017 00:02 UTC

Hey guys, I am really struggling with Lesson 217 Javascript Profile Lookup. Profile Lookup
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"


kulagowskim
@kulagowskim
Jan 05 2017 00:02 UTC
@Lumexralph yea i do this request but i dont know how its work
Zhafarina Ungku
@inagreen
Jan 05 2017 00:02 UTC
Can anyone shed a light on this
kulagowskim
@kulagowskim
Jan 05 2017 00:03 UTC
@Lumexralph JSON.stringify do something?
Wayne Bunch
@waynebunch
Jan 05 2017 00:03 UTC
@Lumexralph well thanks anyway!
CamperBot
@camperbot
Jan 05 2017 00:03 UTC
waynebunch sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 649 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:04 UTC
@kulagowskim arr is an array push(item) is a method that puts the the value as the last element of an array, item is added to array arr...... shift()is also a method of an array that removes the first element of array arr and returns it
@waynebunch :+1:
Diego Mayer
@Chrono79
Jan 05 2017 00:04 UTC
@inagreen there are several ifs there, try creating an if/else structure
My advice, review all past object related challenges if you don't know how to do some of those things
contacts is an array, so you'll need a loop to go through the contacts
kulagowskim
@kulagowskim
Jan 05 2017 00:06 UTC
@Lumexralph if i have array a = [1,2,3,4] and i doing on it a.shift() i get [2,3,4] or [1] ?
Zhafarina Ungku
@inagreen
Jan 05 2017 00:07 UTC
Hi Diego, I guessed as much but I actually tried to focus on using while loop and hasOwnProperty but not getting past addressing the properties of the object in the array
Bryan Reese
@breese8009
Jan 05 2017 00:07 UTC
good evening coders!
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:07 UTC
@kulagowskim 1
@Lumexralph no way xD
Christopher Richards
@way3edgyentertainment
Jan 05 2017 00:08 UTC
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i=0;i<contacts.length;i++){
if(firstName==contacts[i].firstName){
if(contacts[i].hasOwnProperty(prop)){
return contacts[i].prop;
}else{
return "No such property";
}
}else{
return "No such contact";
}
}
// Only change code above this line
}
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:09 UTC
@way3edgyentertainment prop is a variable you can't use dot method use [ ]
Christopher Richards
@way3edgyentertainment
Jan 05 2017 00:10 UTC
thank you @Lumexralph
CamperBot
@camperbot
Jan 05 2017 00:10 UTC
way3edgyentertainment sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Diego Mayer
@Chrono79
Jan 05 2017 00:10 UTC
@way3edgyentertainment your loop won't run more than once
Zhafarina Ungku
@inagreen
Jan 05 2017 00:10 UTC
@way3edgyentertainment Thanks Chris exactly what I was looking for. Instead I was focusing on the while loop
CamperBot
@camperbot
Jan 05 2017 00:10 UTC
inagreen sends brownie points to @way3edgyentertainment :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for way3edgyentertainment
api offline
Diego Mayer
@Chrono79
Jan 05 2017 00:11 UTC
@inagreen you can use a while loop if you want too
kulagowskim
@kulagowskim
Jan 05 2017 00:12 UTC
@Lumexralph arr = [1,2,3] | arr.shift() give me [1] | but new arr is [2,3] yes?
Zhafarina Ungku
@inagreen
Jan 05 2017 00:12 UTC
@Chrono79 Im gonna try this as well I think I wasnt using the right syntax when pinpointing to specific prop of the object in the array too
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:12 UTC
@kulagowskim yes, it removes the first element so arr becomes [2, 3]
kulagowskim
@kulagowskim
Jan 05 2017 00:13 UTC
@Lumexralph damn dude thx!
CamperBot
@camperbot
Jan 05 2017 00:13 UTC
kulagowskim sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 650 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:13 UTC
@kulagowskim cool
kulagowskim
@kulagowskim
Jan 05 2017 00:13 UTC
@Lumexralph how i can give you point?
Stephen James
@sjames1958gm
Jan 05 2017 00:14 UTC
@kulagowskim You already did
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:14 UTC
@kulagowskim you've already :wink:
kulagowskim
@kulagowskim
Jan 05 2017 00:14 UTC
i don't know how but ok :P
it's automaticaly?
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:16 UTC
@kulagowskim yes
cassv
@cassv24
Jan 05 2017 00:16 UTC
hi I have a question, how can I match the first uppercase character of each word in a string with regex?
Kim Crayton
@kmcrayton7
Jan 05 2017 00:17 UTC
@Nuoz thanks
CamperBot
@camperbot
Jan 05 2017 00:17 UTC
kmcrayton7 sends brownie points to @nuoz :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for nuoz
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:18 UTC
@cassv24 yes
Ken
@kenbbetter
Jan 05 2017 00:18 UTC

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

function checkObj(checkProp) {
  // Your Code Here
  if (myObj.hasOwnProperty("checkProp")=== true);{
return myObj[checkProp];
  }
  else {
  return "Not Found"; 
 }
}


// Test your code by modifying these values
checkObj("house");
Testing Objects for Properties
andercodder
@andercodder
Jan 05 2017 00:18 UTC
hi camps
Ken
@kenbbetter
Jan 05 2017 00:19 UTC
why here cannot use else? How to fix my code
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:19 UTC
@kenbbetter checkProp is a variable not a string
Stephen James
@sjames1958gm
Jan 05 2017 00:19 UTC
@cassv24 "This Is A Test".match(/( [A-Z])|(^[A-Z])/g)
Kim Crayton
@kmcrayton7
Jan 05 2017 00:19 UTC
Working on Switch Statement and I don't see where I'm making my mistake:
function caseInSwitch(val) {
  var answer = "";
  switch (val) {
    case 1 : 
      console.log("alpha");
      break;
    case 2 : 
      console.log("beta"); 
      break;
    case 3 : 
      console.log("gamma");
      break;
    case 4 :
      console.log("delta");
      break;
  }
  return answer;  
}
caseInSwitch(1);
Stephen James
@sjames1958gm
Jan 05 2017 00:19 UTC
@kenbbetter "checkProp" is a string in the function call - it should be the variable
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:20 UTC
@kmcrayton7 assign the strings to result for each cases
cassv
@cassv24
Jan 05 2017 00:20 UTC
@sjames1958gm great (y)
Stephen James
@sjames1958gm
Jan 05 2017 00:20 UTC
@kmcrayton7 See that return answer; at the end - you need to set answer to the string value
mitron6
@mitron6
Jan 05 2017 00:20 UTC
@kenbbetter if (myObj.hasOwnProperty("checkProp")=== true);{ remove the semicolon here.
Ken
@kenbbetter
Jan 05 2017 00:21 UTC
that part works..
only have problem in "Not Found"
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:21 UTC
@mitron6 he needs to make checkProp a variable there and === true is not needed @kenbbetter
Kim Crayton
@kmcrayton7
Jan 05 2017 00:21 UTC
@Lumexralph @sjames1958gm I understand what you are saying but how?
andercodder
@andercodder
Jan 05 2017 00:21 UTC

// Setup
var myStr = "Jello World";

// Only change code below this line
myStr = "Hello World";
myStr[0] = "Hello World"; // Fix Me

Stephen James
@sjames1958gm
Jan 05 2017 00:22 UTC
@kmcrayton7 Use assignment instead of console.log()
@andercodder You need to remove the line with myStr[0] that line causes
a severe enough error that the tests do not run
andercodder
@andercodder
Jan 05 2017 00:22 UTC
someone help me why i get the error TypeError: Cannot assign to read only property '0' of string 'Hello World'
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:23 UTC
@kmcrayton7 like this answer = "alpha" ditto for the remaining cases
Stephen James
@sjames1958gm
Jan 05 2017 00:23 UTC
@andercodder That is the essence of the challenge - you cannot set the individual characters
of a string they are read-only so when you try to assign to myStr[0] TypeError
Ken
@kenbbetter
Jan 05 2017 00:23 UTC

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

function checkObj(checkProp) {
// Your Code Her
if (myObj.hasOwnProperty("checkProp"));
return myObj[checkProp];

}

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


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

function checkObj(checkProp) {
  // Your Code Her
  if (myObj.hasOwnProperty("checkProp"));
return myObj[checkProp];

}


// Test your code by modifying these values
checkObj("pet");
andercodder
@andercodder
Jan 05 2017 00:23 UTC
ok good
@sjames1958gm thanks
CamperBot
@camperbot
Jan 05 2017 00:24 UTC
andercodder sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5169 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ken
@kenbbetter
Jan 05 2017 00:24 UTC
@sjames1958gm i move the === true but do not how to put the "Not found" into
Kim Crayton
@kmcrayton7
Jan 05 2017 00:24 UTC
@Lumexralph @sjames1958gm thank you. I've been trying to figure out what to do with var answer = '' ";
CamperBot
@camperbot
Jan 05 2017 00:24 UTC
kmcrayton7 sends brownie points to @lumexralph and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 651 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 5170 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jan 05 2017 00:24 UTC
@kenbbetter You made neither of the changes recommended
use checkProp not "checkProp" and remove that trailing semicolon
@kmcrayton7 For many of the challenges they will provide the return variable with var and return
all you need to do is assign to the variable in your code.
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:25 UTC
@kenbbetter checkProp in hasOwnProperty function should be a variable not string and remove the ;
Ken
@kenbbetter
Jan 05 2017 00:26 UTC
var myObj = {
  top: "hat",
  bottom: "pants"
};
myObj.hasOwnProperty("top");    // true
myObj.hasOwnProperty("middle"); // false
Stephen James
@sjames1958gm
Jan 05 2017 00:26 UTC
@kenbbetter add return "Not Found"; in an else or simply after the return you hvae
Ken
@kenbbetter
Jan 05 2017 00:26 UTC
@sjames1958gm
why here is top not top?
``top ``
Kim Crayton
@kmcrayton7
Jan 05 2017 00:26 UTC
@sjames1958gm this is what confuses me a lot of the time. I'm never sure what to change when they provide content
Stephen James
@sjames1958gm
Jan 05 2017 00:27 UTC
@kenbbetter because it is a variable passed to the function.
@kmcrayton7 If they have comments with don't change below or above then those should be heeded - otherwise you
should have free reign - later challenges give you less and less of that help
Ken
@kenbbetter
Jan 05 2017 00:27 UTC
you made me confused
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:27 UTC
@kenbbetter because it's a valid property in myObj, here you're dealing with a variable/parameter checkProp from your function
@kenbbetter use checkProp not "checkProp"
Stephen James
@sjames1958gm
Jan 05 2017 00:28 UTC
@kenbbetter
var myObj = {
  top: "hat",
  bottom: "pants"
};
var topvar = "top"
myObj.hasOwnProperty("top");    // true
myObj.hasOwnProperty(topvar);    // true
myObj.hasOwnProperty("middle"); // false
Ken
@kenbbetter
Jan 05 2017 00:29 UTC

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

function checkObj(checkProp) {
  // Your Code Her
  if (myObj.hasOwnProperty(checkProp));
return myObj[checkProp];
 else {
   return "Not Found";
 }
}


// Test your code by modifying these values
checkObj("pet");
is this what you mean?
@sjames1958gm
Christopher Richards
@way3edgyentertainment
Jan 05 2017 00:31 UTC
function lookUpProfile(firstName, prop){
  for(var i=0;i<contacts.length;i++){
    if(contacts[i].firstName==firstName){
      if(contacts[i].hasOwnProperty(prop)){
        return contacts[i][prop];
        }else{
          return "No such property";
        }
    }else{
      return "No such contact";
    }
  }
}
Stephen James
@sjames1958gm
Jan 05 2017 00:31 UTC
@kenbbetter Yes, but you need to remove that ';' at the end of the 'if' line
@way3edgyentertainment How can you return no such contact without first looking through all the contacts.
Ken
@kenbbetter
Jan 05 2017 00:32 UTC

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

function checkObj(checkProp) {
  // Your Code Her
  if (myObj.hasOwnProperty(checkProp));
return myObj[checkProp]
 else 
   return "Not Found";

}


// Test your code by modifying these values
checkObj("gift");
Diego Mayer
@Chrono79
Jan 05 2017 00:32 UTC
@way3edgyentertainment your loop still won't run more than once (return exits the loop and the function)
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:32 UTC
@kenbbetter remove the semicolon at the end of the if parentheses()
Ken
@kenbbetter
Jan 05 2017 00:32 UTC
@sjames1958gm thanks
CamperBot
@camperbot
Jan 05 2017 00:32 UTC
kenbbetter sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5171 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ken
@kenbbetter
Jan 05 2017 00:32 UTC
@Lumexralph thanks
CamperBot
@camperbot
Jan 05 2017 00:32 UTC
kenbbetter sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 652 | @lumexralph |http://www.freecodecamp.com/lumexralph
Christopher Richards
@way3edgyentertainment
Jan 05 2017 00:33 UTC
@sjames1958gm @Chrono79 Ah, thanks. I see what you both mean now.
CamperBot
@camperbot
Jan 05 2017 00:33 UTC
way3edgyentertainment sends brownie points to @sjames1958gm and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 5172 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 3044 | @chrono79 |http://www.freecodecamp.com/chrono79
Ken
@kenbbetter
Jan 05 2017 00:33 UTC
i am going to have a look...
I find, when solve a single challenge it is easy,
when need to combine several knowledge
mess up
rusdie
@rusdie
Jan 05 2017 00:34 UTC

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit =9/5+32 celsius ;

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

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

pls give me a proper way to write this code
damn always eror
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:35 UTC
@rusdie what's the formula?
Stephen James
@sjames1958gm
Jan 05 2017 00:35 UTC
9/5+32 celsius this is not valid syntax and doesn't match the formula C * 9/5 + 32
Jason Luboff
@JLuboff
Jan 05 2017 00:35 UTC
@rusdie Your formula is incorrect.
rusdie
@rusdie
Jan 05 2017 00:35 UTC
the didnt give any
they told me to create from scratch
challange 139
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:36 UTC
@way3edgyentertainment return no such contacts after the loop is done looking through contacts
Stephen James
@sjames1958gm
Jan 05 2017 00:36 UTC
@rusdie The formula is in the second paragraph
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:37 UTC
@rusdie you can also search the formula
TheBillyTowers
@TheBillyTowers
Jan 05 2017 00:37 UTC
Variable myStr should contain the string: I am a "double quoted" string inside "double quotes". var myStr = "I am a\"double quoted\" string inside of \"double quotes\"."; /
Johnny
@JohnnyBizzel
Jan 05 2017 00:39 UTC
@TheBillyTowers "I am a\"double quoted\" string inside of \"double quotes\"."; /
rusdie
@rusdie
Jan 05 2017 00:39 UTC
celsius*9/5+32 = fahrenheit
like that ?
Jason Luboff
@JLuboff
Jan 05 2017 00:39 UTC
@rusdie Flip it around and you're good
rusdie
@rusdie
Jan 05 2017 00:39 UTC
but still they say invalid assignment left-hand side
what code is missing
Jason Luboff
@JLuboff
Jan 05 2017 00:39 UTC
Hence why I'm telling you to flip it around
rusdie
@rusdie
Jan 05 2017 00:39 UTC
flip ?
Jason Luboff
@JLuboff
Jan 05 2017 00:39 UTC
fahrenheit should be on the left, not the right
rusdie
@rusdie
Jan 05 2017 00:40 UTC
ah
i will try
Johnny
@JohnnyBizzel
Jan 05 2017 00:40 UTC
@rusdie To test 82 degrees F = 28 degrees C
rusdie
@rusdie
Jan 05 2017 00:40 UTC
thanks all
Thanks a lot
:smile:
Johnny
@JohnnyBizzel
Jan 05 2017 00:41 UTC
@rusdie You mean thanks to @JLuboff ? And @sjames1958gm
CamperBot
@camperbot
Jan 05 2017 00:41 UTC
:warning: could not find receiver for rusdie
johnnybizzel sends brownie points to @rusdie and @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 565 | @jluboff |http://www.freecodecamp.com/jluboff
andercodder
@andercodder
Jan 05 2017 00:41 UTC
please can someone help me

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("cat", "little", "hit", "slowly");

Joseph
@revisualize
Jan 05 2017 00:41 UTC
@rusdie How do you assign the value of 7 to a variable num? ... var num = 7;
andercodder
@andercodder
Jan 05 2017 00:41 UTC
i am not understanding
Joseph
@revisualize
Jan 05 2017 00:42 UTC
@andercodder String concatenation with variables parameters
Johnny
@JohnnyBizzel
Jan 05 2017 00:42 UTC
@andercodder Learn about parameters and arguments and you cannot fail
rusdie
@rusdie
Jan 05 2017 00:42 UTC
still noobs
hahahha ask the pro
itsthomas
@itsthomas
Jan 05 2017 00:43 UTC
What is the difference between String Concatenation vs. String Interpolation?
Joseph
@revisualize
Jan 05 2017 00:43 UTC
@rusdie Don't ask the pro. Become the pro.
rusdie
@rusdie
Jan 05 2017 00:44 UTC
good advice my bro
Joseph
@revisualize
Jan 05 2017 00:44 UTC
@itsthomas Let me google that. It will take me a few seconds to find you an answer.
itsthomas
@itsthomas
Jan 05 2017 00:45 UTC
@revisualize I tried to google it, but couldn’t find anything which explains the difference.
I <3 that google thing. It makes me look smarter than I am.
itsthomas
@itsthomas
Jan 05 2017 00:50 UTC
Are the following both "string interpolation"?:
var favoriteAnimal = "Horse";
console.log("My favorite animal: “  +  favoriteAnimal);
var favoriteAnimal = "Horse";
console.log("My favorite animal: " , favoriteAnimal);
The result is the same.
Joseph
@revisualize
Jan 05 2017 00:50 UTC
@itsthomas I have no idea.
mitron6
@mitron6
Jan 05 2017 00:51 UTC
@itsthomas Neither
itsthomas
@itsthomas
Jan 05 2017 00:51 UTC
@mitron6 what are they then?
String Concatenation?
Jason Luboff
@JLuboff
Jan 05 2017 00:52 UTC
@itsthomas The first is a string concatenated and the second is a string and a variable
Joseph
@revisualize
Jan 05 2017 00:52 UTC
@itsthomas The top one is string concatenation.
itsthomas
@itsthomas
Jan 05 2017 00:54 UTC
One of the lession in CodeAcademy about JavaScript explains that the first one is string interpolation:
We can use the + operator from earlier to interpolate (insert) a variable into a string, like this:

var myPet = 'armadillo';
console.log('I own a pet ' + myPet + '.'); 
// Output: 'I own a pet armadillo.’
Joseph
@revisualize
Jan 05 2017 00:54 UTC
@itsthomas Your two code blocks do NOT ouput the same thing.
That is String Concatenation.
Jason Luboff
@JLuboff
Jan 05 2017 00:54 UTC
Ya, they are incorrectly calling it interpolation
Joseph
@revisualize
Jan 05 2017 00:55 UTC
Codecademy is wrong.
itsthomas
@itsthomas
Jan 05 2017 00:56 UTC
@JLuboff Thanks
CamperBot
@camperbot
Jan 05 2017 00:56 UTC
itsthomas sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 566 | @jluboff |http://www.freecodecamp.com/jluboff
itsthomas
@itsthomas
Jan 05 2017 00:56 UTC
@revisualize the output fot both is the same. I just tested again.
Joseph
@revisualize
Jan 05 2017 00:57 UTC
@itsthomas
blob
They do NOT output the same thing.
Dylan Hsiao
@greedylan
Jan 05 2017 00:57 UTC
why does it return "cannot read property 'length' of null
" when i plug str = "california"?
function translatePigLatin(str) {
  var vowels = /[aeiou]/g;

  if(str[0].match(vowels).length > 0){
    var arr = str.split("");
    var newArr = arr.push("w", "a", "y");
    return arr.join("");
  }else{
    return true;
  }
}
translatePigLatin("eight");
Jason Luboff
@JLuboff
Jan 05 2017 01:00 UTC
@greedylan What happens if you don't have a vowel? You'd be returning 0, can't get length of 0
andercodder
@andercodder
Jan 05 2017 01:02 UTC
guys
i did this

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

// Your code above this line
return result;
}

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

and i got this
Joseph
@revisualize
Jan 05 2017 01:04 UTC
@andercodder result = + isn't correct.
@andercodder remove the +
andercodder
@andercodder
Jan 05 2017 01:04 UTC
ok
@revisualize i got say you arethe men
very thank you
Johnny
@JohnnyBizzel
Jan 05 2017 01:05 UTC
@andercodder You may not need the last space
Ken
@kenbbetter
Jan 05 2017 01:05 UTC

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

// Only change code below this line

var gloveBoxContents = myStorage.car["inside"].glove box; // Change this line
Johnny
@JohnnyBizzel
Jan 05 2017 01:05 UTC
@revisualize very thank you!! :D
CamperBot
@camperbot
Jan 05 2017 01:05 UTC
johnnybizzel sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2837 | @revisualize |http://www.freecodecamp.com/revisualize
Ken
@kenbbetter
Jan 05 2017 01:05 UTC
Accessing Nested Objects
Joseph
@revisualize
Jan 05 2017 01:06 UTC
@JohnnyBizzel I really should start making projects and getting my shit together.
Johnny
@JohnnyBizzel
Jan 05 2017 01:06 UTC
@revisualize Nah, this is so much fun :joy:
Ken
@kenbbetter
Jan 05 2017 01:07 UTC
what is wrong with my code??
Joseph
@revisualize
Jan 05 2017 01:07 UTC
@kenbbetter Look. "glove box" has a space in it.
@kenbbetter Doing this.
myStorage.car["inside"].glove box;
It doesn't know if you're looking for the "glove" property
RhinoTek
@RhinoTek
Jan 05 2017 01:08 UTC
I am completely lost and have no idea what they are looking for.
js
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

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


  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");
rusdie
@rusdie
Jan 05 2017 01:08 UTC
var myStr="firstLine\n\secondLine\thirdLine\r";
rusdie
@rusdie
Jan 05 2017 01:08 UTC
stuck again my friend help me
Joseph
@revisualize
Jan 05 2017 01:08 UTC
@rusdie firstLine is not the same as FirstLine
RyanWng
@RyanWng
Jan 05 2017 01:08 UTC
Hi, everyone, I am wondering how onSubmit event handler is working? here is the JSFiddle link: https://jsfiddle.net/fvst3kgj/
I simply create a form with calling onSubmit in <form>.
Then I have two buttons, one of which is <input type ="submit"> and another is <button>SB</button>
Clicking on both buttons will invoke onSubmit but I think the 'SB' button should not be working. I don't know why 'SB' button will do the work.
Any help will be appreciated, thanks !
Diego Mayer
@Chrono79
Jan 05 2017 01:08 UTC
@rusdie your strings are wrong
@RhinoTek use an if
Joseph
@revisualize
Jan 05 2017 01:09 UTC
@RhinoTek .hasOwnProperty() outputs a boolean. Do you know what a boolean value is?
Ken
@kenbbetter
Jan 05 2017 01:09 UTC
@revisualize my also have space in it, isn't?
rusdie
@rusdie
Jan 05 2017 01:09 UTC
i know my string is the problem
Ken
@kenbbetter
Jan 05 2017 01:09 UTC
Nice to see you again. btw,
@revisualize
rusdie
@rusdie
Jan 05 2017 01:10 UTC
how should i write it ?
Joseph
@revisualize
Jan 05 2017 01:10 UTC
@rusdie Correctly.
@rusdie
firstLine is not the same as FirstLine
secondLine is not the same as SecondLine
thirdLine is not the same as ThirdLine
Strings are immutable and case sensitive.
Diego Mayer
@Chrono79
Jan 05 2017 01:11 UTC
@revisualize camelCase overdose ;)
rusdie
@rusdie
Jan 05 2017 01:11 UTC
var myStr="FirstLine\n\SecondLine\ThirdLine\r";
Joseph
@revisualize
Jan 05 2017 01:11 UTC
@rusdie Great.
rusdie
@rusdie
Jan 05 2017 01:11 UTC
still nothing dude
Ken
@kenbbetter
Jan 05 2017 01:11 UTC
what you give to me, is same as i write... @revisualize
Joseph
@revisualize
Jan 05 2017 01:11 UTC
Now you're escaping the carriage-return in the wrong spot.
rusdie
@rusdie
Jan 05 2017 01:11 UTC
\n not make any new line
Diego Mayer
@Chrono79
Jan 05 2017 01:11 UTC
@rusdie some escaped sequence is misplaced there
RhinoTek
@RhinoTek
Jan 05 2017 01:11 UTC
@revisualize No, please won't you inform me? Instead of trying to passive aggressively call me an idiot you could try helping
Diego Mayer
@Chrono79
Jan 05 2017 01:12 UTC

@RhinoTek

@RhinoTek use an if

rusdie
@rusdie
Jan 05 2017 01:12 UTC
i got it thanks @revisualize @Chrono79
CamperBot
@camperbot
Jan 05 2017 01:12 UTC
rusdie sends brownie points to @revisualize and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3045 | @chrono79 |http://www.freecodecamp.com/chrono79
:star2: 2838 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 05 2017 01:13 UTC
@RhinoTek How am I passively aggressively calling you an idiot? I never said that. I asked a question. I asked a question to help you. Not belittle you.. If you feel belittle or slighted. That's on you bro.
I have no way of knowing what you know. I don't know what lessons you skipped. I have no way of being able to know. I have to make some slight assumptions and ask questions to offer you the swiftest assistance as possible.
Ken
@kenbbetter
Jan 05 2017 01:13 UTC
@revisualize bro
reply me bro call me idiot plz
@revisualize i am seeking for your help bro
Joseph
@revisualize
Jan 05 2017 01:13 UTC
@kenbbetter Sorry.
Ken
@kenbbetter
Jan 05 2017 01:13 UTC
hahaha
Joseph
@revisualize
Jan 05 2017 01:13 UTC
@kenbbetter If your properties have spaces in them you cannot use dot notation. You have to use bracket notation.
Ken
@kenbbetter
Jan 05 2017 01:13 UTC
i said what you ask me to do, is same as i write
oh
Johnny
@JohnnyBizzel
Jan 05 2017 01:14 UTC
@kenbbetter Did you try ["glove box"]
Diego Mayer
@Chrono79
Jan 05 2017 01:14 UTC
@kenbbetter you don't need to use the bracket notation with inside, but, you should use it with "glove box": https://www.freecodecamp.com/challenges/accessing-objects-properties-with-bracket-notation
Dylan Hsiao
@greedylan
Jan 05 2017 01:15 UTC
@revisualize @JLuboff thank you
CamperBot
@camperbot
Jan 05 2017 01:15 UTC
greedylan sends brownie points to @revisualize and @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 567 | @jluboff |http://www.freecodecamp.com/jluboff
:star2: 2839 | @revisualize |http://www.freecodecamp.com/revisualize
Ken
@kenbbetter
Jan 05 2017 01:15 UTC
@Chrono79 but that is the requirement of this challenge
Diego Mayer
@Chrono79
Jan 05 2017 01:16 UTC
@kenbbetter no, it says you have to use both, but you used them not where it's needed
.inside and ["inside"] are both valid
.glove box is not valid
["glove box"] is valid
Sarah Chima
@sayrah901
Jan 05 2017 01:16 UTC
@RhinoTek hasOwnProperty returns true or false . So u have to create a variable that stores the returned boolean value. This variable can be used to create conditional statements.
Ken
@kenbbetter
Jan 05 2017 01:16 UTC
var gloveBoxContents = myStorage.car.inside.["glove box"]; // Change this line
@Chrono79 @JohnnyBizzel is this what you mean?
Joseph
@revisualize
Jan 05 2017 01:17 UTC
@kenbbetter remove the . before the bracket notation.
Diego Mayer
@Chrono79
Jan 05 2017 01:17 UTC
@kenbbetter almost ;)
Ken
@kenbbetter
Jan 05 2017 01:17 UTC
At before , i was confused about why there is [" "]
now i know it,
Diego Mayer
@Chrono79
Jan 05 2017 01:18 UTC
:+1:
Johnny
@JohnnyBizzel
Jan 05 2017 01:18 UTC
@kenbbetter And use http://pythontutor.com/javascript.html#mode=edit to check it
Ken
@kenbbetter
Jan 05 2017 01:18 UTC
thanks a lot and appreciate @Chrono79 @revisualize @JohnnyBizzel
CamperBot
@camperbot
Jan 05 2017 01:18 UTC
kenbbetter sends brownie points to @chrono79 and @revisualize and @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1092 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
:star2: 3046 | @chrono79 |http://www.freecodecamp.com/chrono79
:star2: 2840 | @revisualize |http://www.freecodecamp.com/revisualize
Johnny
@JohnnyBizzel
Jan 05 2017 01:18 UTC
@kenbbetter ;)
Ken
@kenbbetter
Jan 05 2017 01:21 UTC
at before, i thought if there is many level, then the second level use [" "]
sad sad, bad bad, thanks
Ben Carp
@carpben
Jan 05 2017 01:31 UTC
Hi everyone! Hope all is well. I would like some guidance - the challenge is to convert the first letter of each word in a sentence. I think I saw such a command in an earlier lesson, but can quite find it.
Aaron Bell
@awb715
Jan 05 2017 01:31 UTC
has the twitch.tv api broke?
Ben Carp
@carpben
Jan 05 2017 01:31 UTC
touppercase() converts all chars to uppercase.
Aaron Bell
@awb715
Jan 05 2017 01:31 UTC
i havent been on in 2 weeks and my app stopped working
mert
@avogadromert
Jan 05 2017 01:32 UTC

var myVar = 87;

// Only change code below this line
var My = varyes + 1;
varyes= 87; does anyone kknow why the increment ++ of that is not working, thanks!

Diego Mayer
@Chrono79
Jan 05 2017 01:33 UTC
@carpben you need a loop or something similar and then you have to build a new string with the capitalized initial plus the rest of the word
@avogadromert why are you using other vars?
varyes is not even defined in your first line
Ben Carp
@carpben
Jan 05 2017 01:35 UTC
@Chrono79 Yes, I thought of this option, but a quick search reveals there is a simpler solution, involoving str replacement using regularexpersion such as /something/.
Diego Mayer
@Chrono79
Jan 05 2017 01:36 UTC
@carpben simpler depends entirely on your knowledge on regexp
mert
@avogadromert
Jan 05 2017 01:36 UTC
@Chrono79 could you tell me what to basically change there cause i think im just thinking to complicated.
Diego Mayer
@Chrono79
Jan 05 2017 01:37 UTC
@avogadromert see the example on i and read the instructions carefully, you only need one line and use myVar and ++
Thomas Adams
@thomasfadams
Jan 05 2017 01:43 UTC
having trouble with escape sequences. I need to type out this: FirstLine
\SecondLine\
ThirdLine
So I typed this:
var myStr = "FirstLine\n\SecondLine\\rThirdLine"
But it's saying it doesnt work
Diego Mayer
@Chrono79
Jan 05 2017 01:44 UTC
@thomasfadams add ; at the end and refresh the browser
Joseph
@revisualize
Jan 05 2017 01:44 UTC
/collapse

@avogadromert

var num = 5;
num = num + 1; // 6
num += 1; // 7
num++; // 8

See how the one for getting num from 7 to 8 doesn't use the assignment operator (=)?

mert
@avogadromert
Jan 05 2017 01:47 UTC
@revisualize Yes, thanks!
CamperBot
@camperbot
Jan 05 2017 01:47 UTC
avogadromert sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2841 | @revisualize |http://www.freecodecamp.com/revisualize
Jake
@neozane1
Jan 05 2017 01:55 UTC
hello world
CamperBot
@camperbot
Jan 05 2017 01:55 UTC

welcome to FreeCodeCamp @neozane1!

Jake
@neozane1
Jan 05 2017 01:55 UTC
how is everyone tonight
Kelechi Chinaka
@ke1echi
Jan 05 2017 01:56 UTC
welcome @neozane1
Sara Dorris
@saralee233
Jan 05 2017 01:57 UTC

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

// Only change code below this line.

function functionWithArgs(a, b) {
  console.log("a + b");
}
functionWithArgs(1,2);
functionWithArgs(7,9);
the check points mention those numbers so that is why i put them there but I really have no idea where those numbers specifically came from
Jake
@neozane1
Jan 05 2017 01:57 UTC
can anyone help me with multi nested loops and thanks @kelechichinaka
CamperBot
@camperbot
Jan 05 2017 01:57 UTC
neozane1 sends brownie points to @kelechichinaka :sparkles: :thumbsup: :sparkles:
:cookie: 270 | @kelechichinaka |http://www.freecodecamp.com/kelechichinaka
Diego Mayer
@Chrono79
Jan 05 2017 01:58 UTC
@saralee233 "a + b" is a string, to actually do a math operation remove the quotes
Kelechi Chinaka
@ke1echi
Jan 05 2017 01:58 UTC
lets see what you have @neozane1
Stephen James
@sjames1958gm
Jan 05 2017 01:59 UTC
@neozane1 Hi
Sara Dorris
@saralee233
Jan 05 2017 01:59 UTC
@Chrono79 thanks!
CamperBot
@camperbot
Jan 05 2017 01:59 UTC
saralee233 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3047 | @chrono79 |http://www.freecodecamp.com/chrono79
Jake
@neozane1
Jan 05 2017 01:59 UTC

ok heres the problem 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]]);

im susposed to create nested for loops to multiply the arrays
Diego Mayer
@Chrono79
Jan 05 2017 02:00 UTC
@neozane1 see the example code on how to write 2 nested loops
Jake
@neozane1
Jan 05 2017 02:00 UTC

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

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

Diego Mayer
@Chrono79
Jan 05 2017 02:00 UTC
@neozane1 the inner loop is not ok
Jake
@neozane1
Jan 05 2017 02:01 UTC
ok what did i miss
Diego Mayer
@Chrono79
Jan 05 2017 02:01 UTC
@neozane1 look specially at this j<arr.length
Dylan Hsiao
@greedylan
Jan 05 2017 02:01 UTC

is following the correct way to create a Regexp for consonant? english letters only but without vowels

var consonant = /a-z&&[^aeiou]/

@Chrono79 how do we do it ?

Diego Mayer
@Chrono79
Jan 05 2017 02:02 UTC
@greedylan not
Jake
@neozane1
Jan 05 2017 02:02 UTC
ok thanks @Chrono79
CamperBot
@camperbot
Jan 05 2017 02:02 UTC
neozane1 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3048 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jan 05 2017 02:03 UTC
is that for pig latin? @greedylan
Dylan Hsiao
@greedylan
Jan 05 2017 02:04 UTC
@Chrono79 YES
Sara Dorris
@saralee233
Jan 05 2017 02:04 UTC

how do i assign 5 to oopsGlobal with out using the var ```
// Declare your variable here
var myGlobal = 10;

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

// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}

Johnny
@JohnnyBizzel
Jan 05 2017 02:05 UTC
@greedylan I checked for Vowel with this basic regex:
     // test regex for Vowel:
      var patt = /A|a|E|e|I|i|O|o|U|u/;
Sara Dorris
@saralee233
Jan 05 2017 02:05 UTC
// Declare your variable here
var myGlobal = 10;

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

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
Diego Mayer
@Chrono79
Jan 05 2017 02:05 UTC
@greedylan I would test for vowels and in the else do what you need to do for consonants
Sara Dorris
@saralee233
Jan 05 2017 02:05 UTC
and how would i do it with a var
Diego Mayer
@Chrono79
Jan 05 2017 02:05 UTC
@JohnnyBizzel i modifier is your friend ;)
Dylan Hsiao
@greedylan
Jan 05 2017 02:06 UTC
@Chrono79 yes I actually pass the test but im just curious how we write for the consonant. messing with regex101.com but no clue
Diego Mayer
@Chrono79
Jan 05 2017 02:07 UTC
if you're sure they're only letters, then /[^aeiou]/i is fine (i modifier is optional because all tests are lowercase)
Jake
@neozane1
Jan 05 2017 02:09 UTC
thanks @Chrono79 i just realized i didnt put a j<arr[i].length in and fixed it lol
CamperBot
@camperbot
Jan 05 2017 02:09 UTC
neozane1 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: neozane1 already gave chrono79 points
Sara Dorris
@saralee233
Jan 05 2017 02:09 UTC
I fixed it...dumb question
Diego Mayer
@Chrono79
Jan 05 2017 02:10 UTC
:+1:
Dylan Hsiao
@greedylan
Jan 05 2017 02:13 UTC
@Chrono79 I know. but what if the str has symbol and stuff lol. sorry I am just curious and want to get to the bottom of it :)
Diego Mayer
@Chrono79
Jan 05 2017 02:18 UTC
@greedylan in that case you should list all the consonants. They're 21 after all
Margaret
@Margaret2
Jan 05 2017 02:19 UTC
@scoutsnknives the idea is to add up the variables to make a "sentence", so like
"My " + myAdjective + " " + myNoun results in "My big dog"
you at least need to have spaces between the words
scoutsnknives
@scoutsnknives
Jan 05 2017 02:20 UTC
10-4.. ill give it a go. Thanks @Margaret2
CamperBot
@camperbot
Jan 05 2017 02:20 UTC
scoutsnknives sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:star2: 1009 | @margaret2 |http://www.freecodecamp.com/margaret2
having trouble with this challenge
can any fellow coders help me
David Halls
@DavidHalls
Jan 05 2017 02:36 UTC
@keewhy whats the prob bob?
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 02:37 UTC
I believe my code or wrong or this challenge is bugged
have tried numerous ways cant seem to get her to work
David Halls
@DavidHalls
Jan 05 2017 02:38 UTC
@keewhy you can't just copy the instructions, you need to look at the table above
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 02:41 UTC
first time ive had to use the help section . I do not see instructions for linking the code :(.
Margaret
@Margaret2
Jan 05 2017 02:42 UTC
@keewhy you have to copy and paste, the button with the M on it (in the chat box) has formatting help
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 02:44 UTC
var myStr = " \"FirstLine\"\n \'SecondLine'\ \r\"ThirdLine"; is my current code for that challenge.
Stephen James
@sjames1958gm
Jan 05 2017 02:45 UTC
@keewhy YOu should only have one pair of quotes for the entire string remove the spaces
mert
@avogadromert
Jan 05 2017 02:47 UTC
Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.
hi guys I got stuck with this one could anyone help
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 02:48 UTC
I tried that originally but with spaces. Silly me. Thank you my friend!.
Dylan Hsiao
@greedylan
Jan 05 2017 02:50 UTC
@Chrono79 got it thank you
CamperBot
@camperbot
Jan 05 2017 02:50 UTC
greedylan sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3049 | @chrono79 |http://www.freecodecamp.com/chrono79
Cody Byers
@xcbyers
Jan 05 2017 02:51 UTC
Hey all- can someone give me a quick hand with "Escape Sequences in Strings"? I have 3 of the criteria but it doesn't trigger the no spacing & "proper escape sequences"
Diego Mayer
@Chrono79
Jan 05 2017 02:51 UTC
@xcbyers show your code
Cody Byers
@xcbyers
Jan 05 2017 02:51 UTC
I currently have: var myStr ='FirstLine\n\SecondLine\"\rThirdLine"'; // Change this line
Diego Mayer
@Chrono79
Jan 05 2017 02:51 UTC
@xcbyers delete the double quotes
David Halls
@DavidHalls
Jan 05 2017 02:52 UTC
@keewhy you get it figured out man?
Cody Byers
@xcbyers
Jan 05 2017 02:53 UTC
Ah so in these instances it just reads off the slashes
Thanks @Chrono79
CamperBot
@camperbot
Jan 05 2017 02:53 UTC
xcbyers sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3050 | @chrono79 |http://www.freecodecamp.com/chrono79
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 02:53 UTC
@Byzgig Yes i have thank you .
CamperBot
@camperbot
Jan 05 2017 02:53 UTC
keewhy sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @byzgig |http://www.freecodecamp.com/byzgig
Daniel
@doodleslr
Jan 05 2017 02:58 UTC
Hey going through js beginner, is there any reason or benefit to assigning variables without using var? The walkthrough i'm at literally says to declare all variables with var as a general good practice then to pass this section i can't use var.
does not using var create the variable as global no matter what?
eeflores
@eeflores
Jan 05 2017 03:01 UTC
@doodleslr yeah you can accidentally create a global within a function and it can have unintended side effects
@doodleslr I've seen a situation here where a global was accidentally created within a function and reused, having a value set from a previous call
Daniel
@doodleslr
Jan 05 2017 03:03 UTC
so the general rule is mostly to always declare variables with var to avoid those problems later?
eeflores
@eeflores
Jan 05 2017 03:04 UTC
I think it's a good habit to get into ... tracking down the scope of variables can be tricky if there's lots of globals
Daniel
@doodleslr
Jan 05 2017 03:06 UTC
yeah, that sounds like an easy way to skip a lot of headache, thanks for the help @eeflores !
CamperBot
@camperbot
Jan 05 2017 03:06 UTC
doodleslr sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:cookie: 896 | @eeflores |http://www.freecodecamp.com/eeflores
eeflores
@eeflores
Jan 05 2017 03:07 UTC
you're welcome
Anthony Ramirez
@tonylasarna
Jan 05 2017 03:14 UTC
done :D

function isLess(a, b) {
// Fix this code
switch (a==b)
{
case a<b :
return false;
case b<a :
return true;
}
}

// Change these values to test
isLess(10, 15);

Devan Beanz
@dd-beanz
Jan 05 2017 03:19 UTC
for the profile lookup JS challenge why does
function lookUpProfile(firstName, prop){
if(contacts.hasOwnProperty(firstName)){
if(contacts.hasOwnProperty(firstName.prop)){
return contacts.firstName.prop;
}else{
return "No such property";
}
}else{
return "No such contact";
}
}
this not work
take into account that the if loops are nested
John Nunns
@johnnunns
Jan 05 2017 03:20 UTC
little bit confused on the nesting for loops problem

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
Jan 05 2017 03:20 UTC
firstname and prop arent strings
John Nunns
@johnnunns
Jan 05 2017 03:20 UTC
why set product equal to 1??
RaffertyH
@RaffertyH
Jan 05 2017 03:21 UTC
Comparison with the Greater Than Or Equal To Operator......I'm stuck lol
Devan Beanz
@dd-beanz
Jan 05 2017 03:22 UTC
Yes they are not strings but they should be able to be returned and looked up by .hasOwnProperty and also should be able to be returned
RaffertyH
@RaffertyH
Jan 05 2017 03:22 UTC
It seems really simple and I feel dub for not understading it
Devan Beanz
@dd-beanz
Jan 05 2017 03:22 UTC
Not quite understanding why that code would not work
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:23 UTC
@dd-beanz youre also not iterating through the arrays
theres quite a lot wrong with your code
> is greater than and === is equal to
Devan Beanz
@dd-beanz
Jan 05 2017 03:23 UTC
would map be sufficient for iterating through?
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:24 UTC
not really
use a for loop
Devan Beanz
@dd-beanz
Jan 05 2017 03:24 UTC
Okay, so for that problem there needs to be iteration and also checks for hasOwnProperty I am guessing?
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:24 UTC
yes
Devan Beanz
@dd-beanz
Jan 05 2017 03:25 UTC
Ok thank you HeebieGeeBee!
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:26 UTC
var myStr = "This is the first sentence." += "this is the second sentence." ; Where am i going wrong here guys. Thanks.
John Nunns
@johnnunns
Jan 05 2017 03:27 UTC
why the = sign? @keewhy
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:27 UTC
Build myStr over several lines by concatenating these two strings:
"This is the first sentence. " and "This is the second sentence." using the += operator.
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:27 UTC
and sentences usually start with capital letters
eeflores
@eeflores
Jan 05 2017 03:27 UTC
@keewhy change += to +
oh, nevermind
myStr += "secondSentence";
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:29 UTC
tried that didnt work
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:30 UTC
it says over several lines
John Nunns
@johnnunns
Jan 05 2017 03:31 UTC
does anyone have experience with the nesting for loops?
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:31 UTC
I think its to do with the spacing trying to fix now.
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:32 UTC
@keewhy you need to write code over a few lines
so the first line will be something like myStr = "This is the first sentence. "
then you have to do another line where you add the second line to the existing myStr variable
think how you would do that using +=
eeflores
@eeflores
Jan 05 2017 03:33 UTC
@keewhy and yeah, possibly put a space after the first full stop on the first string ...
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:33 UTC
whats the problem @johnnunns
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:38 UTC
ok well i go back to laying down then
John Nunns
@johnnunns
Jan 05 2017 03:48 UTC
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for(var i =0; i<arr.length; i++){
    for(var j = 0; j<arr.length[i]; j++){
      console.log(product*arr[i][j]);
    }
  }



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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
@HeebieGeeBee
I'm way off I feel
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:49 UTC
thats alright
you have a nest loop
nested
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:49 UTC

// Declarations
var studlyCapvar = 10;
var properCamelcase = "A String";
var titleCaseover = 9000;
// Assignments

studlyCapvar = 10;
properCamelcase = "A String";
titleCaseover = 9000;

dont know whats wrong
John Nunns
@johnnunns
Jan 05 2017 03:49 UTC
right
which to be honest I'm confused why I'd even be nesting a loop. Just something you have to do when it's a multi array?
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:50 UTC
guys whats wrong with my code?
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:51 UTC
yes @johnnunns
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:51 UTC
its level 126
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:51 UTC
what do you even want to do? @Farzan-Hashmi
RaffertyH
@RaffertyH
Jan 05 2017 03:51 UTC
properCamelCase lol
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:51 UTC
:worried:
so funny
RaffertyH
@RaffertyH
Jan 05 2017 03:52 UTC
:)
Hey i suck i just noticed it lol
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:52 UTC
dont worry we all do
even me a 12 year old
anyway can i get the correct answer?
Adnen rebai
@arebai
Jan 05 2017 03:55 UTC
hello can any one explain why my code don't work in code pen and work in server http://novisdev.com/FreeCodeCamp/index.html
TsegayeT
@TsegayeT
Jan 05 2017 04:00 UTC
Hi, can you guys can look through my front end development website project and give me feedback? I would greatly appreciate it thanks!
http://codepen.io/Segayet7/pen/PzmJJY
Rasmus Dybmose
@rasmus-dybmose
Jan 05 2017 04:02 UTC
anyone knows how to solve Factorialize a Number?
Ammy3165
@Ammy3165
Jan 05 2017 04:10 UTC
@arebai , what's the error?
babajide odusola
@cesarecaravaggio
Jan 05 2017 04:11 UTC
2 days later
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line

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

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Manish Giri
@Manish-Giri
Jan 05 2017 04:13 UTC
@rasmus-dybmose there are many ways to do it, have you tried something?
John Nunns
@johnnunns
Jan 05 2017 04:14 UTC
@Manish-Giri
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for(var i =0; i<arr.length; i++){
    for(var j = 0; j<arr.length[i]; j++){
      product.push(arr[i][j]);
    }
  }



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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Not sure how far off I am but I'm really not grasping the concept here
Manish Giri
@Manish-Giri
Jan 05 2017 04:15 UTC
@johnnunns product is a number, you can't use .push() on a number. But you're close.
Chris Burros
@cburros
Jan 05 2017 04:15 UTC
@cesarecaravaggio Without looking at the challenge, I believe it wants you to create a sentence using the arguments that are passed to the function. You may try making multiple variables. And review string concatenation.
Rasmus Dybmose
@rasmus-dybmose
Jan 05 2017 04:15 UTC
@Manish-Giri
i tryed a for loob. but i endet up finding a solution on google :(
Manish Giri
@Manish-Giri
Jan 05 2017 04:15 UTC
@johnnunns instead of using .push(), you need to multiply product with the current number in the nested loop
babajide odusola
@cesarecaravaggio
Jan 05 2017 04:15 UTC
@cburros i figured it out, it just took me 2 nights to do it haha
Chris Burros
@cburros
Jan 05 2017 04:16 UTC
@cesarecaravaggio Good job sticking with it.
Manish Giri
@Manish-Giri
Jan 05 2017 04:16 UTC
@johnnunns _____* arr[i][j];
John Nunns
@johnnunns
Jan 05 2017 04:16 UTC
yeah I wrote out console.log(product*arr[i][j] initially but still missed it
babajide odusola
@cesarecaravaggio
Jan 05 2017 04:17 UTC
thanks to @revisualize and the information he linked to me on functions. @cburros thx it feels good haha.
CamperBot
@camperbot
Jan 05 2017 04:17 UTC
cesarecaravaggio sends brownie points to @revisualize and @cburros :sparkles: :thumbsup: :sparkles:
:cookie: 285 | @cburros |http://www.freecodecamp.com/cburros
:star2: 2843 | @revisualize |http://www.freecodecamp.com/revisualize
Manish Giri
@Manish-Giri
Jan 05 2017 04:17 UTC
not console log
product*arr[i][j]is an expression, it returns a number
store the result back in product
@johnnunns
John Nunns
@johnnunns
Jan 05 2017 04:18 UTC

function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for(var i =0; i<arr.length; i++){
    for(var j = 0; j<arr.length[i]; j++){
      product*arr[i][j];
    }
  }
Chris Burros
@cburros
Jan 05 2017 04:18 UTC
Thanks @cesarecaravaggio
CamperBot
@camperbot
Jan 05 2017 04:18 UTC
cburros sends brownie points to @cesarecaravaggio :sparkles: :thumbsup: :sparkles:
:cookie: 99 | @cesarecaravaggio |http://www.freecodecamp.com/cesarecaravaggio
John Nunns
@johnnunns
Jan 05 2017 04:18 UTC
writing it this way shows a syntax error
Manish Giri
@Manish-Giri
Jan 05 2017 04:18 UTC
store the result back in product
product = product * arr[i][j];
John Nunns
@johnnunns
Jan 05 2017 04:19 UTC
so like product = product*arr[i][j]??
Manish Giri
@Manish-Giri
Jan 05 2017 04:19 UTC
yes
Chris Burros
@cburros
Jan 05 2017 04:19 UTC
@johnnunns try *=
John Nunns
@johnnunns
Jan 05 2017 04:20 UTC
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for(var i =0; i<arr.length; i++){
    for(var j = 0; j<arr.length[i]; j++){
     product = product*arr[i][j];
    }
  }



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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
still returning "1"
Chris Burros
@cburros
Jan 05 2017 04:20 UTC
@johnnunns don't initialize your product variable.
John Nunns
@johnnunns
Jan 05 2017 04:21 UTC
where it says var product = 1?
because that wasn't my doing
Chris Burros
@cburros
Jan 05 2017 04:21 UTC
Oh, my bad. Sorry I'm tired
Manish Giri
@Manish-Giri
Jan 05 2017 04:21 UTC
j<arr.length[i]
is wrong
John Nunns
@johnnunns
Jan 05 2017 04:21 UTC
@cburros no problem, I was confused by it though
Manish Giri
@Manish-Giri
Jan 05 2017 04:22 UTC
it should belength of arr[i]
@johnnunns
John Nunns
@johnnunns
Jan 05 2017 04:22 UTC
haha that was it! thanks @Manish-Giri
CamperBot
@camperbot
Jan 05 2017 04:22 UTC
johnnunns sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3559 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 05 2017 04:23 UTC
:+1:
Chris Burros
@cburros
Jan 05 2017 04:24 UTC
I see now why it initalized it to one.
Ammy3165
@Ammy3165
Jan 05 2017 04:26 UTC
hi, i got in a switch function and the Reference Error: a is not defined. What to do now?
Manish Giri
@Manish-Giri
Jan 05 2017 04:27 UTC
code?
John Nunns
@johnnunns
Jan 05 2017 04:41 UTC

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


function lookUpProfile(firstName, prop){
// Only change code below this line
if(contacts.firstName === true &&contacts.prop === true){
  return contacts;
} else if( contacts.firstName===false){
  return "No such contact";
} else {
  return "No such property";
}
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
am I far off here>?
Johnathan Mullen
@MrJkmullen
Jan 05 2017 04:42 UTC
Hey anybody really good with jasmine testing with javascript?
Ben Carp
@carpben
Jan 05 2017 04:48 UTC
Hi everyone, not sure why the code marked in blue fails to deliver. Any ideas?
blob
Coy Sanders
@coymeetsworld
Jan 05 2017 04:51 UTC
@carpben Strings are immutable, you can't change a character inside of it
Ben Carp
@carpben
Jan 05 2017 04:53 UTC
yes I know. but I didn't change the content of a string, but an element in an array. name[0]=name[0].toUpperCase();
on the right hand we get 'B', and then we change the first object of the array.
Coy Sanders
@coymeetsworld
Jan 05 2017 04:54 UTC
name isn't an array
you set it to a string: name = 'Ben';
Ben Carp
@carpben
Jan 05 2017 04:55 UTC
OOPS
Joseph
@revisualize
Jan 05 2017 04:55 UTC
@johnnunns contacts is an array
John Nunns
@johnnunns
Jan 05 2017 04:56 UTC
yeah I wasn't exactly sure how to return that
Joseph
@revisualize
Jan 05 2017 04:56 UTC
@johnnunns Let's say we have an array:
var contacts = [ "A" , "H" , "S" , "K" ];
How do you access "H"?
John Nunns
@johnnunns
Jan 05 2017 04:56 UTC
contacts[1]
Joseph
@revisualize
Jan 05 2017 04:56 UTC

@johnnunns Let's say you have an object.

// var name = "Happy";
var myFriend = {
        "firstName": "Happy",
        "lastName": "Feet",
        "number": "-i",
        "likes": ["rhythm", "dancing", "soul"]
    }

How do you access the firstName of myFriend?

Ammy3165
@Ammy3165
Jan 05 2017 04:57 UTC
hi, pls look this problem

function switchOfStuff(val) {
var answer = "";
// Only change code below this line

switch(val){
case 1:
if(val=="a"){
return "apple";
}break;
case 2:
if(val=="b"){
return "bird";
}break;
case 3:
if(val=="c"){
return "cat";
}break;
default:
if(val== "d"){
return "stuff";
}
}

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

// Change this value to test
switchOfStuff(a);

Manish Giri
@Manish-Giri
Jan 05 2017 04:58 UTC
@Ammy3165 you should review the structure of switch/case
John Nunns
@johnnunns
Jan 05 2017 04:58 UTC
is it the same way??
Joseph
@revisualize
Jan 05 2017 04:58 UTC
variable in the function call.
Ammy3165
@Ammy3165
Jan 05 2017 04:58 UTC
I got error message, a is not defined
Coy Sanders
@coymeetsworld
Jan 05 2017 04:58 UTC
there shouldn't be if statements in side your switch statement @Ammy3165, take a look at how to construct case/switch statements again
Joseph
@revisualize
Jan 05 2017 04:58 UTC
@johnnunns No.
John Nunns
@johnnunns
Jan 05 2017 04:58 UTC
myFriend.firstName[]
Ammy3165
@Ammy3165
Jan 05 2017 04:58 UTC
thanks everybody
Joseph
@revisualize
Jan 05 2017 04:58 UTC
@johnnunns Not quite.
Coy Sanders
@coymeetsworld
Jan 05 2017 04:58 UTC
what you want to do inside of case/switch is set the answer variable, not return anything also.
Joseph
@revisualize
Jan 05 2017 04:59 UTC
@johnnunns You don't need the [] at the end.
@johnnunns Ready for the next question?
John Nunns
@johnnunns
Jan 05 2017 04:59 UTC
yes
Joseph
@revisualize
Jan 05 2017 04:59 UTC

@johnnunns Let's say we have an array:

var contacts = [ { f: "A" } , { f: "H" } , { f: "S" } , { f: "K" } ];

How do you output "H"?

John Nunns
@johnnunns
Jan 05 2017 05:00 UTC
hahaha. Let me take a stab at it.
what happens if you contacts[1] it??
mattcharlesh
@mattcharlesh
Jan 05 2017 05:01 UTC

Accessing Nested Objects .... What am I missing here?

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

// Only change code below this line

var gloveBoxContents = "myStorage.car.inside["glove box"]"; // Change this line

AhhMclean
@AhhMclean
Jan 05 2017 05:01 UTC
need help with for loops
Joseph
@revisualize
Jan 05 2017 05:01 UTC
@johnnunns { f: "H" }
John Nunns
@johnnunns
Jan 05 2017 05:01 UTC
not sure what the f: will actually do
AhhMclean
@AhhMclean
Jan 05 2017 05:01 UTC
function largestOfFour(arr) {

  var result = [];
  var value = 0;

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

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Joseph
@revisualize
Jan 05 2017 05:01 UTC

@johnnunns Let's say you have an object.

// var name = "Happy";
var myFriend = {
        "firstName": "Happy",
        "lastName": "Feet",
        "number": "-i",
        "likes": ["rhythm", "dancing", "soul"]
    }

How do you access the firstName of myFriend?

John Nunns
@johnnunns
Jan 05 2017 05:02 UTC
myFriend.firstName
AhhMclean
@AhhMclean
Jan 05 2017 05:02 UTC
it is saying on the final loop through before it returns result that cannot read property '0' of undefined (in reference to the 'j' in the if statement)
Joseph
@revisualize
Jan 05 2017 05:02 UTC

@johnnunns
Let's say we have an array:
var contacts = [ "A" , "H" , "S" , "K" ];
How do you access "H"?

Let's say we have an array:

var contacts = [ { f: "A" } , { f: "H" } , { f: "S" } , { f: "K" } ];

How do you output "H"?

mattcharlesh
@mattcharlesh
Jan 05 2017 05:02 UTC
How do I display my code in a black box like that?? :)
Joseph
@revisualize
Jan 05 2017 05:02 UTC
'''
CamperBot
@camperbot
Jan 05 2017 05:02 UTC
:bulb: to format code use backticks! ``` more info
AhhMclean
@AhhMclean
Jan 05 2017 05:02 UTC
"```" before and after
Joseph
@revisualize
Jan 05 2017 05:03 UTC
@johnnunns Then I'm going to ask...
What if f: was firstName: ?
John Nunns
@johnnunns
Jan 05 2017 05:03 UTC
contacts.f
hahaha interesting
Joseph
@revisualize
Jan 05 2017 05:04 UTC
@johnnunns What happened to the [1] ???
John Nunns
@johnnunns
Jan 05 2017 05:05 UTC
do I still need that?
Joseph
@revisualize
Jan 05 2017 05:05 UTC
YES!
Adnen rebai
@arebai
Jan 05 2017 05:05 UTC
John Nunns
@johnnunns
Jan 05 2017 05:05 UTC
oh right there's multiply contact.f's
contact[1].f
Joseph
@revisualize
Jan 05 2017 05:06 UTC
YAY@
@johnnunns Then I'm going to ask...
What if f: was firstName: ?
@johnnunns Go back to your lesson.
mattcharlesh
@mattcharlesh
Jan 05 2017 05:06 UTC
'''js
// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};
// Only change code below this line
var gloveBoxContents = "myStorage.car.inside["glove box"]"; // Change this line
CamperBot
@camperbot
Jan 05 2017 05:06 UTC
:bulb: to format code use backticks! ``` more info
mattcharlesh
@mattcharlesh
Jan 05 2017 05:06 UTC
'''
CamperBot
@camperbot
Jan 05 2017 05:06 UTC
:bulb: to format code use backticks! ``` more info
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:06 UTC

can someone give me a simpler explanation for this por favor?
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[3]; // equals [[10,11,12], 13, 14]
arr[3][0]; // equals [10,11,12]
arr[3][0][1]; // equals 11

how does that work???

mattcharlesh
@mattcharlesh
Jan 05 2017 05:07 UTC
'''js
hello
'''
CamperBot
@camperbot
Jan 05 2017 05:07 UTC
:bulb: to format code use backticks! ``` more info
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:08 UTC
how is arr[3][0] a set of values but arr[3][0][1] equals 11??
mattcharlesh
@mattcharlesh
Jan 05 2017 05:08 UTC
hello
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:09 UTC
@revisualize going to look over that now! th
thx @revisualize
CamperBot
@camperbot
Jan 05 2017 05:09 UTC
cesarecaravaggio sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: cesarecaravaggio already gave revisualize points
AhhMclean
@AhhMclean
Jan 05 2017 05:09 UTC
@revisualize (n)
Farah Soltane
@chokolate
Jan 05 2017 05:15 UTC
im on lesson "profile lookup" : The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.
how yu chek
jason-87
@jason-87
Jan 05 2017 05:18 UTC
does anyone know any other good code editors besides atom?
John Nunns
@johnnunns
Jan 05 2017 05:20 UTC

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


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

// Change these values to test your function
lookUpProfile("Akira", "likes");
@revisualize
TracesOfNuts
@TracesOfNuts
Jan 05 2017 05:28 UTC

@cesarecaravaggio hmm.. just compare this two arrays:

arr1 = [a, b, c];
arr2 = [[X,Y,Z],[apple, banana]];

it is important to note that each element in an array are indexed starting from ZERO.
arr1[0] will return just 'b'
whereas arr2[0] will return the first element [X,Y,Z] of the main array which only consists of two elements i.e. [X,Y,Z] and [apple,banana]
therefore arr2[0][1] will check the 2nd element in array [X,Y,Z] which is just 'Y'

mattcharlesh
@mattcharlesh
Jan 05 2017 05:28 UTC
// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};
// Only change code below this line
var gloveBoxContents = "myStorage.car.inside["glove box"]"; // Change this line
Accessing Nested Objects
Can I get a hand here? :)
TracesOfNuts
@TracesOfNuts
Jan 05 2017 05:29 UTC
@mattcharlesh var gloveBoxContents = "myStorage.car.inside["glove box"]"; change this to var gloveBoxContents = myStorage.car.inside["glove box"];
i think
Liz Chen
@moist17
Jan 05 2017 05:29 UTC
This message was deleted
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:30 UTC
@TracesOfNuts great way to put it thank you
CamperBot
@camperbot
Jan 05 2017 05:30 UTC
cesarecaravaggio sends brownie points to @tracesofnuts :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @tracesofnuts |http://www.freecodecamp.com/tracesofnuts
TracesOfNuts
@TracesOfNuts
Jan 05 2017 05:31 UTC
@cesarecaravaggio glad to help!
Wesley Ibarra
@wesleyi1
Jan 05 2017 05:32 UTC
cant seemt to get this one...

var myVar = 87;

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

Instructions
Change the code to use the ++ operator on myVar.
Coy Sanders
@coymeetsworld
Jan 05 2017 05:32 UTC
you need to use the operator they specify @wesleyi1, not just set the value to another number
Wesley Ibarra
@wesleyi1
Jan 05 2017 05:33 UTC
var myVar = 87++;
Vikash Saini
@Enigma10
Jan 05 2017 05:33 UTC
@fanaugen Hey Do you know plotly js
__mifflin__
@cdrainxv
Jan 05 2017 05:34 UTC
var x = 1;
x = x + 1; // => x is now 2
x++; // => x is now 3
Notice how both ways end up doing the same thing… incrementing x by 1.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 05:42 UTC
@jayisray cool! looks good
jayisray
@jayisray
Jan 05 2017 05:42 UTC
@TracesOfNuts Thanks!
CamperBot
@camperbot
Jan 05 2017 05:42 UTC
jayisray sends brownie points to @tracesofnuts :sparkles: :thumbsup: :sparkles:
:cookie: 252 | @tracesofnuts |http://www.freecodecamp.com/tracesofnuts
Wesley Ibarra
@wesleyi1
Jan 05 2017 05:45 UTC
still having trouble
myVar = 88;
myVar = 87++;
nvm think i got it
mattcharlesh
@mattcharlesh
Jan 05 2017 05:47 UTC
@TracesOfNuts thanks!
CamperBot
@camperbot
Jan 05 2017 05:47 UTC
mattcharlesh sends brownie points to @tracesofnuts :sparkles: :thumbsup: :sparkles:
:cookie: 253 | @tracesofnuts |http://www.freecodecamp.com/tracesofnuts
Christopher Richards
@way3edgyentertainment
Jan 05 2017 05:48 UTC
on the palindrome challenge,
function palindrome(str) {
  forstr=str.toLowerCase();
  forstr.replace(/([^\w]*)/gi,'');
  strarr=forstr.split('');
  strarr.reverse();
  backstr=strarr.join('');
  if(forstr==backstr){
    return true;
  }
}
John Nunns
@johnnunns
Jan 05 2017 05:50 UTC
Very confused why the values below work but I not the others

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


function lookUpProfile(firstName, prop){
// Only change code below this line
for(i=0;i<contacts.length;i++){
  if(contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop) ){
  return contacts[i][prop];
} else if( contacts[i].firstName!== firstName){
  return "No such contact";
} else {
  return "No such property";
}
// Only change code above this line
}
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
Akira likes works. But when I change to Harry it brings up no such contact
TracesOfNuts
@TracesOfNuts
Jan 05 2017 05:51 UTC
@way3edgyentertainment ?
Christopher Richards
@way3edgyentertainment
Jan 05 2017 05:51 UTC
@johnnunns you'll want to move the no such contact return outside of the for loop
@TracesOfNuts I'm not sure how to get the replace to work with all special characters
John Nunns
@johnnunns
Jan 05 2017 05:52 UTC
I hope its not too difficult for me to understand the explanation @way3edgyentertainment
Just don't understand why I'd do that
I'm sure you're right
TracesOfNuts
@TracesOfNuts
Jan 05 2017 05:54 UTC
@way3edgyentertainment try using str.replace(/[^0-9a-z]/gi, '')
@TracesOfNuts you can also try doing this instead forstr=str.replace(/[^0-9a-z]/gi, '').toLowerCase();
Christopher Richards
@way3edgyentertainment
Jan 05 2017 06:00 UTC
@TracesOfNuts thanks, that did it.
CamperBot
@camperbot
Jan 05 2017 06:00 UTC
:cookie: 254 | @tracesofnuts |http://www.freecodecamp.com/tracesofnuts
way3edgyentertainment sends brownie points to @tracesofnuts :sparkles: :thumbsup: :sparkles:
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:00 UTC
@way3edgyentertainment glad to help!
Abhishek Saini
@sainiabhi
Jan 05 2017 06:02 UTC
Hi @all
I'm stuck in "Sum All Numbers in a Range" problem here is my code
var numInRange = 0;
var numOfRange = 0;
var accuStatus;
function sumAll(arr) {
  var maxNum = Math.max.apply(null, arr), minNum = Math.min.apply(null, arr);
  for(var i = minNum + 1; i < maxNum; i++){
    numInRange += i; 
  }
  arr.reduce(function(accumulator, currentValue, currentindex, array){
    numOfRange = accumulator + currentValue;
  });

  return numInRange + numOfRange;
}

sumAll([5, 9]);
result is coming correct but don't know it's not passing this solution
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:04 UTC
@sainiabhi try putting all the var in the function
Aditya Singh
@adityavisen
Jan 05 2017 06:04 UTC
@sainiabhi

@sainiabhi unction sumAll(arr) {

var x=Math.max(arr[0] ,arr[1]);
var y=Math.min(arr[0] ,arr[1]);
var temp=0;
for(var i=y;i<=x;i++)
{
temp=temp+i;

}

return (temp);
}

sumAll([1, 4]);

Ben Carp
@carpben
Jan 05 2017 06:05 UTC
Hi everyone, In this exercise https://www.freecodecamp.com/challenges/return-largest-numbers-in-arrays I tried using the spread method
Abhishek Saini
@sainiabhi
Jan 05 2017 06:06 UTC
@TracesOfNuts i can't do that as numInRange will throw 0 always if ideclare them in function
Aditya Singh
@adityavisen
Jan 05 2017 06:06 UTC
sumAll.PNG
Abhishek Saini
@sainiabhi
Jan 05 2017 06:06 UTC
@adityavisen thanks for sharing the solution but can you please tell the problem in my code
CamperBot
@camperbot
Jan 05 2017 06:06 UTC
sainiabhi sends brownie points to @adityavisen :sparkles: :thumbsup: :sparkles:
:cookie: 319 | @adityavisen |http://www.freecodecamp.com/adityavisen
Ben Carp
@carpben
Jan 05 2017 06:06 UTC
I'm using the code: manNum = Math.max(...arr[i]);
Aditya Singh
@adityavisen
Jan 05 2017 06:07 UTC
@sainiabhi let me check
Ben Carp
@carpben
Jan 05 2017 06:07 UTC
geting a message spread/rest oerator only available in Es6
Abhishek Saini
@sainiabhi
Jan 05 2017 06:08 UTC
@TracesOfNuts cool it worked thanks
CamperBot
@camperbot
Jan 05 2017 06:08 UTC
sainiabhi sends brownie points to @tracesofnuts :sparkles: :thumbsup: :sparkles:
:cookie: 256 | @tracesofnuts |http://www.freecodecamp.com/tracesofnuts
Aditya Singh
@adityavisen
Jan 05 2017 06:08 UTC
Cff.PNG
@carpben
Joseph
@revisualize
Jan 05 2017 06:09 UTC
@johnnunns Still stuck?
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:09 UTC
@sainiabhi glad to help! technically what you're doing is also correct. it's just that FCC checks everything in the function
Abhishek Saini
@sainiabhi
Jan 05 2017 06:09 UTC
@TracesOfNuts

function sumAll(arr) {
  var numInRange = 0;
  var maxNum = Math.max.apply(null, arr), minNum = Math.min.apply(null, arr);
  for(var i = minNum; i <= maxNum; i++){
    numInRange += i; 
  }
  return numInRange;
}

sumAll([5, 9]);
John Nunns
@johnnunns
Jan 05 2017 06:09 UTC
had to do some looking at the record collection I did a while back. Now I'm just figuring out breaking the other statements away from the for loop
@revisualize
Joseph
@revisualize
Jan 05 2017 06:10 UTC
@johnnunns NO!
Ben Carp
@carpben
Jan 05 2017 06:10 UTC
Hi everyone,
In this exercise
https://www.freecodecamp.com/challenges/return-largest-numbers-in-arrays
I tried using the spread method
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max
I'm using the code: manNum = Math.max(...arr[i]);
geting a message spread/rest oerator only available in Es6
Is my syntax correct? (...arr[i]) ?
Why doesn't it work?
Joseph
@revisualize
Jan 05 2017 06:10 UTC
@johnnunns Look the code that I just saw was almost correct.
Abhishek Saini
@sainiabhi
Jan 05 2017 06:10 UTC
reduced the code too @TracesOfNuts
Joseph
@revisualize
Jan 05 2017 06:10 UTC
@johnnunns Can you answer some more questions with me?
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:10 UTC
@sainiabhi looks good!
John Nunns
@johnnunns
Jan 05 2017 06:11 UTC
@revisualize haha let me show you where I'm at now because I have 4 of 5 reading right

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


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

// Only change code above this line
}
}
// Change these values to test your function
lookUpProfile("Harry", "likes");
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:11 UTC
@carpben hi can you share your code?
Ben Carp
@carpben
Jan 05 2017 06:12 UTC
Here it is:

function largestOfFour(arr) {
// You can do this!
var maxNum;
for(i=0; i<i.length(); i++)
manNum = Math.max(...arr[i]);
return maxNum;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

Joseph
@revisualize
Jan 05 2017 06:12 UTC
@johnnunns Umm.. Put your No such property back inside of your for loop.
John Nunns
@johnnunns
Jan 05 2017 06:12 UTC
with akira likes
when it's inside the for loop it only tests right on the first contact
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:13 UTC
@johnnunns else does not take a condition remove the condtion and move that else part inside loop to connect it with first if
Joseph
@revisualize
Jan 05 2017 06:14 UTC
@johnnunns show me your code. (JUST THE FUNCTION!)
@johnnunns You do NOT need to continue pasting the contacts array. We don't want to see it.
*yawn*
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:17 UTC

@carpben hmm maybe its the

...

how bout trying

manNum = Math.max(arr[i]);
John Nunns
@johnnunns
Jan 05 2017 06:17 UTC
@revisualize sorry for spamming with contacts. But you can read my code inside where it guides you to write the code
grandmasterundead
@grandmasterundead
Jan 05 2017 06:17 UTC
hello, i don't understand an exercise and i have no idea how to solve it
it's this one : var myStr = "FirstLine\n\SecondLine\r\Third Line";
John Nunns
@johnnunns
Jan 05 2017 06:17 UTC
@revisualize I'm actually not enjoying your help anymore, thanks anyways bud. I'll figure it out myself
CamperBot
@camperbot
Jan 05 2017 06:17 UTC
johnnunns sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2844 | @revisualize |http://www.freecodecamp.com/revisualize
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:18 UTC
@grandmasterundead which one ?
Joseph
@revisualize
Jan 05 2017 06:18 UTC
@grandmasterundead Third Line is not the same as ThirdLine
grandmasterundead
@grandmasterundead
Jan 05 2017 06:18 UTC
escape sequences
Assign the following three lines of text into the single variable myStr using escape sequences.
FirstLine
\SecondLine\
ThirdLine
but i do not know how to do that
everything i;ve tried, in vain
Joseph
@revisualize
Jan 05 2017 06:18 UTC
@grandmasterundead Third Line is not the same as ThirdLine
Ben Carp
@carpben
Jan 05 2017 06:19 UTC
@TracesOfNuts This won't work as the max function needs to receive number parameters and not an array. I thought the ... somehow breaks it into the elements. That's what it should, but I might misunderstood the syntax.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:19 UTC
@grandmasterundead backslash should be before \r not after to it
jainishpanchal
@jainishpanchal
Jan 05 2017 06:19 UTC
How to use escaped double quotes (\"). ?
grandmasterundead
@grandmasterundead
Jan 05 2017 06:19 UTC
yes but now i have to do that three lines into myVar
jainishpanchal
@jainishpanchal
Jan 05 2017 06:20 UTC
var myStr; // Change this line
I am a "double quoted" string inside "double quotes".
grandmasterundead
@grandmasterundead
Jan 05 2017 06:20 UTC
the next one
var myStr = "FirstLine\nSecondLin\rThirdLine";
i've tried everything and i do not know how to do that
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:21 UTC
@grandmasterundead need \\ before and after SecondLine
ml3ha
@ml3ha
Jan 05 2017 06:21 UTC
Can someone help me understand how I can use a closure in my use case?
Joseph
@revisualize
Jan 05 2017 06:21 UTC
@grandmasterundead SecondLin is not the same as SecondLine
jainishpanchal
@jainishpanchal
Jan 05 2017 06:22 UTC
not yet
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:22 UTC
@carpben ah i see where's the problem. hmm. Math.max uses numbers as arguments but you're using array instead
Ben Carp
@carpben
Jan 05 2017 06:23 UTC
yes but the ... should spread the elements of the array.
Joseph
@revisualize
Jan 05 2017 06:23 UTC
It does.
FCC gives you a warning.
It doesn't give you an ERROR
Just a warning.
grandmasterundead
@grandmasterundead
Jan 05 2017 06:24 UTC
@revisualize aye, thanks, seems that i deleted a lot trying to make it work hehe :D @ghulamshabir it was confusing because I thought I had tot make them on three lines and in console it didn't show them on three lines.
CamperBot
@camperbot
Jan 05 2017 06:24 UTC
grandmasterundead sends brownie points to @revisualize and @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 2845 | @revisualize |http://www.freecodecamp.com/revisualize
:star2: 1621 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Joseph
@revisualize
Jan 05 2017 06:25 UTC
@carpben I used the spread operator when I solved that challenge the third time I did it.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:25 UTC
@grandmasterundead :smile:
grandmasterundead
@grandmasterundead
Jan 05 2017 06:25 UTC
:D
Ben Carp
@carpben
Jan 05 2017 06:26 UTC
@revisualize and am I using the operator correctly? Why doesn't it work?
Joseph
@revisualize
Jan 05 2017 06:26 UTC
It does work.
Your other logic isn't correct.
mattcharlesh
@mattcharlesh
Jan 05 2017 06:26 UTC
// Setup
var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];

// Only change code below this line

var secondTree = myPlants[1].list["1"]; // Change this line
Accessing Nested Arrays ...What did i miss?
Joseph
@revisualize
Jan 05 2017 06:27 UTC
@mattcharlesh You're trying to access an array element with a string.
Quotes define strings.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:28 UTC
@carpben ah. I'm not familiar with the ... syntax. this is what I did instead.
function largestOfFour(arr) {
  var i,j,newArr=[];
  newArr.length = arr.length;
  for (i = 0; i<arr.length; i++) {
    newArr[i] = 0;
    for (j = 0; j<arr[i].length; j++) {
      if (arr[i][j]>newArr[i]) {
        newArr[i]=arr[i][j];
      }
    }
  }
  return newArr;
}
mattcharlesh
@mattcharlesh
Jan 05 2017 06:29 UTC
@revisualize Thanks Joseph
CamperBot
@camperbot
Jan 05 2017 06:29 UTC
mattcharlesh sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2846 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 05 2017 06:29 UTC
@carpben Based on this code here: :point_up: January 4, 2017 10:12 PM Your issue is..
return statements cause functions to halt and return. If you're trying to do a return inside of a loop it will cause the function to halt and return the information that you specify.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:30 UTC
@carpben share me your code if you managed to use the Math.max for that problem
Joseph
@revisualize
Jan 05 2017 06:30 UTC
So, if your loop has a return statement inside of it.. It doesn't really loop.
Unless of course that return is inside of another conditional block.
@TracesOfNuts I have 3
@TracesOfNuts In your code: newArr.length = arr.length; doesn't do anything.
I don't think.
Maybe it does.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:32 UTC
@revisualize yea. i think its redundant
@revisualize thanks for highlighting!
CamperBot
@camperbot
Jan 05 2017 06:32 UTC
tracesofnuts sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2847 | @revisualize |http://www.freecodecamp.com/revisualize
Ben Carp
@carpben
Jan 05 2017 06:33 UTC
@TracesOfNuts are you relative a newbie like me?
Joseph
@revisualize
Jan 05 2017 06:33 UTC
I'm going to solve that one again. I have an idea.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:33 UTC
@TracesOfNuts your code is not efficient, you have unnecessary code newArr.length = arr.length; and newArr[i] = 0; you could have used a variable say var largest=0;
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:33 UTC
@carpben most of us are i suppose ^^
Ben Carp
@carpben
Jan 05 2017 06:34 UTC
@TracesOfNuts cool. Please be aware that your comparison will not necessarily return the max number, but might return a 0 instead.
Joseph
@revisualize
Jan 05 2017 06:35 UTC
@TracesOfNuts I just made another solution using the spread operator.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:35 UTC
@ghulamshabir yup. i though i needed to declare the length of the array
thought*
Ben Carp
@carpben
Jan 05 2017 06:36 UTC
@revisualize If you know the spread operator can you please refer to my question as well.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:36 UTC
@TracesOfNuts array length expands and shrinks by itself when you use push/shift and arr[i]=...
Joseph
@revisualize
Jan 05 2017 06:37 UTC
@carpben I'm sorry what question?
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:37 UTC
@TracesOfNuts cool. Please be aware that your comparison will not necessarily return the max number, but might return a 0 instead.
yup this is with assumption that the array consists of only positive integers.
official4code
@official4code
Jan 05 2017 06:37 UTC
how do make var a=b
Joseph
@revisualize
Jan 05 2017 06:37 UTC
@official4code How do you assign the value of 7 to a variable num? ... var num = 7;
Now if you want you can use a variable to store values.
Like in mathmatics. num + 3 = 10 What is the value of num?
var x = num + 3; ... That outputs 10
So, you can do several things with variables. But, you need to understand that variables hold values and variables can be used with other variables.
So, how do you assign the value of 5 to a variable x? ... x = 5; (Which is also overwriting the previous value of 10 from above.
How do you assign the value of x to a variable y?
Look at the way things are written. var y = x;
How do you assign the value of 42 to a variable answer? ... What is the answer?
Variables hold values. Just understand that.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:37 UTC

pls share it

@TracesOfNuts I just made another solution using the spread operator.

Joseph
@revisualize
Jan 05 2017 06:38 UTC
But, @carpben hasn't solved it yet.
Ben Carp
@carpben
Jan 05 2017 06:38 UTC
@revisualize I posted it here 10-15 minutes ago, and after not receving an answer I posted it in this thread: https://forum.freecodecamp.com/t/spread-operator/72770
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:38 UTC
@TracesOfNuts try it yourself, you will learn in this way
Joseph
@revisualize
Jan 05 2017 06:38 UTC
@carpben I answered that.
Ben Carp
@carpben
Jan 05 2017 06:39 UTC
@revisualize where? here?
Joseph
@revisualize
Jan 05 2017 06:40 UTC
It does work.
Your other logic isn't correct.
@carpben Based on this code here: :point_up: January 4, 2017 10:12 PM Your issue is..
return statements cause functions to halt and return. If you're trying to do a return inside of a loop it will cause the function to halt and return the information that you specify.
So, if your loop has a return statement inside of it.. It doesn't really loop.
Unless of course that return is inside of another conditional block.
amarg26
@amarg26
Jan 05 2017 06:40 UTC
var Car = function() {
  // this is a private variable
  var speed = 10;

  // these are public methods
  this.accelerate = function(change) {
    speed += change;
  };

  this.decelerate = function() {
    speed -= 5;
  };

  this.getSpeed = function() {
    return speed;
  };
};

var Bike = function() {

   var gear =1;
  this.getGear  = function() {
    gear = 2;
  };

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

};

var myCar = new Car();

var myBike = new Bike();
myBike.getGear();
myBike.setGear();
what is still needed ??
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:40 UTC
@ghulamshabir my solutions work. jsut trying to see if there are variations to solving the problem using different methods that im not aware of.
Joseph
@revisualize
Jan 05 2017 06:40 UTC
@carpben Yes here.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:41 UTC
@TracesOfNuts yes i know your solution works, but it will not hurt if you try to do it again with different methods
@amarg26 setGear should take a parameter and assign that to gear and getGear should just return gear. finally gear should be initialized with 0 not with 1
amarg26
@amarg26
Jan 05 2017 06:44 UTC
var Car = function() {
  // this is a private variable
  var speed = 10;

  // these are public methods
  this.accelerate = function(change) {
    speed += change;
  };

  this.decelerate = function() {
    speed -= 5;
  };

  this.getSpeed = function() {
    return speed;
  };
};

var Bike = function() {

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

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

};

var myCar = new Car();

var myBike = new Bike();
myBike.getGear();
myBike.setGear(4);
now ??
jainishpanchal
@jainishpanchal
Jan 05 2017 06:45 UTC
var myStr = "I am a \"double quoted\"string inside \"double quotes\".";
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:45 UTC
@amarg26 I said setGear should take a parameter and assign that to gear
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 06:45 UTC
space infront of string inside @jainishpanchal
Ben Carp
@carpben
Jan 05 2017 06:45 UTC
@revisualize but what about the message I get "Spread/rest operator is only available is es6"?
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:45 UTC
@amarg26 setGear should take a parameter and assign that to gear and getGear should just return gear. finally gear should be initialized with 0 not with 1
Nathan Parsons
@Unlawfulspoon
Jan 05 2017 06:46 UTC
I am having trouble with counting cards please help, and here is my code:
jainishpanchal
@jainishpanchal
Jan 05 2017 06:46 UTC
@HeebieGeeBee nothing work
Nathan Parsons
@Unlawfulspoon
Jan 05 2017 06:46 UTC

var count = 0;

function cc(card) {
// Only change code below this line
var answer = "" ;
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
answer = "Bet";
break;
case 10:
case 'J':
case 'Q':
case 'k':
case 'A':
answer = "Hold";
break;

}

return answer;
// 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');

HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 06:46 UTC
put a space infront of string @jainishpanchal
Joseph
@revisualize
Jan 05 2017 06:46 UTC
@carpben It is just a warning. It is NOT an error. You can use it.
Nathan Parsons
@Unlawfulspoon
Jan 05 2017 06:47 UTC
Cannot figure out how to add what card it is
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 06:47 UTC
@way3edgyentertainment youre told to make a count depending on what a card is
Nathan Parsons
@Unlawfulspoon
Jan 05 2017 06:47 UTC
I am Having trouble with the tutorial counting cards here is my code:

var count = 0;

function cc(card) {
// Only change code below this line
var answer = "" ;
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
answer = "Bet";
break;
case 10:
case 'J':
case 'Q':
case 'k':
case 'A':
answer = "Hold";
break;

}

return answer;
// 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');

Joseph
@revisualize
Jan 05 2017 06:48 UTC
@carpben Look.
jainishpanchal
@jainishpanchal
Jan 05 2017 06:48 UTC
@HeebieGeeBee thanks
CamperBot
@camperbot
Jan 05 2017 06:48 UTC
jainishpanchal sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 444 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Joseph
@revisualize
Jan 05 2017 06:48 UTC
@carpben
blob
I have the same warning. But, I solved it.
444!!!!!!!!!!!!!!!!
Joseph
@revisualize
Jan 05 2017 06:49 UTC
Warning isn't an error.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:49 UTC

just need to throw in

/*jshint esversion: 6 */

at the top

Ben Carp
@carpben
Jan 05 2017 06:49 UTC
@revisualize THANKS!
CamperBot
@camperbot
Jan 05 2017 06:49 UTC
carpben sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2848 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 05 2017 06:49 UTC
@carpben I said that a LONG time ago.
Naveen
@hope4
Jan 05 2017 06:50 UTC
Hello everyone ,how to solve Manipulating Complex Objects,sum in javascript
which is there is the map
Ryan Steen
@Rsteen76
Jan 05 2017 06:50 UTC
Can someone tell me a good way to debug the code on in the editor. i want to step through loops and watch what is happening?
official4code
@official4code
Jan 05 2017 06:50 UTC
"a should be assigned to b with ="(i still don't get, how do you do this).
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:52 UTC
@Unlawfulspoon just increment/decrement count in the switch depending on card's value then after the switch check if count value is higher than zero return count plush Bet otherwise count plus Hold
@official4code = works from right to left
Naveen
@hope4
Jan 05 2017 06:53 UTC
@ghulamshabir please help me how to solve Manipulating Complex Objects ,the problem in javascript
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:53 UTC
@hope4 what you have ?
amarg26
@amarg26
Jan 05 2017 06:54 UTC

```var Bike = function() {

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

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

};

var myCar = new Car();

var myBike = new Bike();
myBike.getGear();
gear=myBike.setGear(gear);
```

official4code
@official4code
Jan 05 2017 06:54 UTC
@ghulamshabir thx
CamperBot
@camperbot
Jan 05 2017 06:54 UTC
:star2: 1622 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
official4code sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ryan Steen
@Rsteen76
Jan 05 2017 06:55 UTC
@revisualize Thanks, I should have asked that questions a long long time ago.
CamperBot
@camperbot
Jan 05 2017 06:55 UTC
rsteen76 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2849 | @revisualize |http://www.freecodecamp.com/revisualize
Naveen
@hope4
Jan 05 2017 06:55 UTC
@ghulamshabir i am working as per the map,and am in java script theres a problem,it is manipulating complex objects
jainishpanchal
@jainishpanchal
Jan 05 2017 06:55 UTC
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
Naveen
@hope4
Jan 05 2017 06:55 UTC
i am unable to figure it ,what exactly to do in it.
jainishpanchal
@jainishpanchal
Jan 05 2017 06:55 UTC
Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Only remove the backslashes \ used to escape quotes.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:56 UTC
@amarg26 setGear should take a parameter for example like this
function f(param) {
  someVar = param;
}
@jainishpanchal replace double quotes around the string with single quotes and then just remove backslashes \
Alex
@MaeStat
Jan 05 2017 06:57 UTC
@hope4 just copy the object above and change names and i.e.
@hope4 it's enought what you should to do
jainishpanchal
@jainishpanchal
Jan 05 2017 06:58 UTC
@ghulamshabir ok
Ben Carp
@carpben
Jan 05 2017 06:59 UTC
I can't understand this. For some reason I use a simple console.log(i) sentence, and it doesn't show in the console.
blob
jainishpanchal
@jainishpanchal
Jan 05 2017 06:59 UTC
@ghulamshabir not working
?
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:00 UTC
@jainishpanchal post the code
jainishpanchal
@jainishpanchal
Jan 05 2017 07:00 UTC
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:00 UTC
@carpben what is i < i.length ?
@jainishpanchal you have not changed anything
jainishpanchal
@jainishpanchal
Jan 05 2017 07:01 UTC
@ghulamshabir
@ghulamshabir Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
\
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:02 UTC
@jainishpanchal yes i know the instructions but you are not doing anything with the code
Naveen
@hope4
Jan 05 2017 07:02 UTC
@MaeStat it is popping out an error

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

// Add record here
];

Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:03 UTC

@jainishpanchal

'your string can have double" quotes " in it`

something like that

David Sroka
@donswavey
Jan 05 2017 07:03 UTC
im stuck as well, challenge Stand In Line

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

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Naveen
@hope4
Jan 05 2017 07:03 UTC

@ghulamshabir this is the code i have done
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}
{
"artist": "Joel",
"title": " Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}

// Add record here
];

Alex
@MaeStat
Jan 05 2017 07:03 UTC
@hope4 remove second "gold": true
Naveen
@hope4
Jan 05 2017 07:04 UTC
@MaeStat still the error remains
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:05 UTC
@hope4 you should have two objects in the array like this [{...}, {...}]
Alex
@MaeStat
Jan 05 2017 07:05 UTC
@hope4 add a comma after first object
Naveen
@hope4
Jan 05 2017 07:06 UTC
thanq @ghulamshabir , @MaeStat
Alex
@MaeStat
Jan 05 2017 07:06 UTC
@hope4 yes, @ghulamshabir is rihgt
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:07 UTC
@donswavey you have not added anything to the code. anyway you are supposed to add item to the end of arr then remove and return first element. you will need two array methods. previous lessons titles Manipulating Arrays with... might be helpful
Ha Nguyen
@uxsasukexnaruto
Jan 05 2017 07:08 UTC
for (var i = 0; i < arr.length; i++) {
for (var j = 0; j < arr[i].length; j++) {
product *= arr([i][j]);
}
}
David Sroka
@donswavey
Jan 05 2017 07:08 UTC
thanks @ghulamshabir
CamperBot
@camperbot
Jan 05 2017 07:08 UTC
:star2: 1623 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
donswavey sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
Ha Nguyen
@uxsasukexnaruto
Jan 05 2017 07:08 UTC
i got the TypeError: arr is not a function
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:08 UTC
@uxsasukexnaruto remove () from arr
David Sroka
@donswavey
Jan 05 2017 07:08 UTC
yea i know i didnt add anything, i did before but it was in a diff browser and all
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:08 UTC
@uxsasukexnaruto yes () are used for calling a function
Ha Nguyen
@uxsasukexnaruto
Jan 05 2017 07:09 UTC
@ghulamshabir thanks, got it
CamperBot
@camperbot
Jan 05 2017 07:09 UTC
uxsasukexnaruto sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 1624 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:09 UTC
@uxsasukexnaruto :smile:
Rahul Thakoor
@rahul-thakoor
Jan 05 2017 07:09 UTC
hello campers..
Alex
@MaeStat
Jan 05 2017 07:09 UTC
@rahul-thakoor hello
Rahul Thakoor
@rahul-thakoor
Jan 05 2017 07:09 UTC
i am trying to do the Profile Lookup challenge

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

}
// Only change code above this line
}

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


  }
// Only change code above this line
}
as soon as I as I add the last else if statement.. it breaks everything
Alex
@MaeStat
Jan 05 2017 07:13 UTC
@rahul-thakoor did you try without last " else if"? Just only "return..."?
official4code
@official4code
Jan 05 2017 07:14 UTC
myVar = myVar should be changed
Use the ++ operator(how is it done)
Alex
@MaeStat
Jan 05 2017 07:17 UTC
@rahul-thakoor try to paste "return "No such contact";" out of "for loop"
official4code
@official4code
Jan 05 2017 07:18 UTC
@uxsasukexnaruto :smile:
Alex
@MaeStat
Jan 05 2017 07:25 UTC
@rahul-thakoor try to paste "return "No such contact";" out of "for loop" it will work
Joseph
@revisualize
Jan 05 2017 07:25 UTC

@official4code

var num = 5;
num = num + 1; // 6
num += 1; // 7
num++; // 8

See how the one for getting num from 7 to 8 doesn't use the assignment operator (=)?

Rahul Thakoor
@rahul-thakoor
Jan 05 2017 07:28 UTC
@MaeStat thx
CamperBot
@camperbot
Jan 05 2017 07:28 UTC
rahul-thakoor sends brownie points to @maestat :sparkles: :thumbsup: :sparkles:
:cookie: 266 | @maestat |http://www.freecodecamp.com/maestat
Rahul Thakoor
@rahul-thakoor
Jan 05 2017 07:28 UTC
i will try it out
@MaeStat can you explain why my original code does not work?
sennator
@sennator2
Jan 05 2017 07:32 UTC
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var newArr = [];
for(var i = 0; i < arr.length; i += size)  {
     newArr.push(arr.slice(0, size));
  console.log(newArr);
     arr = arr.slice(size, -1);
    console.log(arr);
}
  return arr;
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4);
hi guys
i needsome help with chunky monkey
my array shrinks every itteration
but on the last one i have only 1 element left in array so slice doesn't count him in
Alex
@MaeStat
Jan 05 2017 07:34 UTC
@rahul-thakoor may be last return breake out your for loop
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:34 UTC
arr = arr.slice(size, -1); is reducing your array
Alex
@MaeStat
Jan 05 2017 07:35 UTC
@rahul-thakoor and inerations over loop stoped
sennator
@sennator2
Jan 05 2017 07:36 UTC
@ghulamshabir yeah but when i need to put just the last (element in this case 8) because beggining should be at 4
i mean it doesnt make an 8 into that last array it should go through
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:38 UTC
@sennator2 all you need is this line newArr.push(arr.slice(0, size)); just adjust the slice arguments to get you right chunks of the array
Dhwani
@Dhwani24
Jan 05 2017 07:53 UTC

Hey, can you help me out with this code: var myStr= "Firstline"\n \"SecondLine"\ \r"ThirdLine";

I'm supposed to make it look like:
FirstLine
\SecondLine\
ThirdLine

Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:54 UTC
@Dhwani24 remove spaces and quotes inside the string and Line with caps L in Firstline
Dhwani
@Dhwani24
Jan 05 2017 07:56 UTC

@ghulamshabir
var myStr= FirstLine \n \ SecondLine \ \r ThirdLine;
or
FirstLine\n\SecondLin\\rThirdLine;

It still doesn't work
Error Statement: myStr should have encoded text with the proper escape sequences and no spacing.

Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:57 UTC
you still have spaces in it
Dhwani
@Dhwani24
Jan 05 2017 07:57 UTC
@ghulamshabir Yeah, thanks :)
CamperBot
@camperbot
Jan 05 2017 07:57 UTC
dhwani24 sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 1625 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
sennator
@sennator2
Jan 05 2017 07:59 UTC
@ghulamshabir sorry but can you explain me this a bit
newArr.push(arr.slice(0, size));
i have to start at 0
and end with size
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:59 UTC
@sennator2 no
sennator
@sennator2
Jan 05 2017 08:01 UTC
@ghulamshabir no?
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:01 UTC
just think about size if size is 2 then you chunks of array of lengths 2. means first chunk with first two and second with third and fourth and so on
nhanly91
@nhanly91
Jan 05 2017 08:07 UTC
hi everyone, I want to add hashmap table from an array to an hash table object
jmbravo
@jmbravo
Jan 05 2017 08:08 UTC
hi all, I don't know what I have to do in the https://www.freecodecamp.com/challenges/stand-in-line ,any clue?
nhanly91
@nhanly91
Jan 05 2017 08:08 UTC
[ '1', 'vasya', '2', 'petya', '3', 'kolya', '4', 'limak', '5', 'illya' ]
I've tried for loop but it don't work
    for(var i = 0; i<inputHash.length; i+2){
        h[inputHash[i]]= inputHash[i+1];
    }
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:13 UTC
@nhanly91 try this
 for(var i = 0; i<inputHash.length-1; i++){
        h[i]= inputHash[i+1];
    }
Eliel Akinbami
@AkEliel32
Jan 05 2017 08:17 UTC

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

// Only change code above this line
}

Can someone pls help me with this? Dont know what is wrong
Its the profileLookUp challenge
Christian
@Cafam
Jan 05 2017 08:18 UTC
need help

ser Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

// Setup
var a;
var b = 2;

// Only change code below this line
b = a = 7;

Storing Values with the Assignment Operator
My code:
// Setup
var a;
var b = 2;
// Only change code below this line
b = a = 7;
jmbravo
@jmbravo
Jan 05 2017 08:20 UTC
@Cafam try this:

// Only change code below this line

a = 7;
b = a;

Christian
@Cafam
Jan 05 2017 08:21 UTC
@jmbravo thanks
CamperBot
@camperbot
Jan 05 2017 08:21 UTC
cafam sends brownie points to @jmbravo :sparkles: :thumbsup: :sparkles:
:cookie: 173 | @jmbravo |http://www.freecodecamp.com/jmbravo
Christian
@Cafam
Jan 05 2017 08:21 UTC
@jmbravo it worked
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:21 UTC
@nhanly91 as you have used keys in quotes like '1' , so the solution might not work, try removing quotes around the keys in inputHash
jmbravo
@jmbravo
Jan 05 2017 08:21 UTC
@Cafam you can't do b = a because "a" doesn't have value
Rameez Hashmi
@rameezh
Jan 05 2017 08:22 UTC
Fix the function isLess to remove the if/else statements.
function isLess(a, b) {
// Fix this code
if (a < b) {
return true;
} else {
return false;
}
}
Rameez Hashmi
@rameezh
Jan 05 2017 08:22 UTC
how to fix this
Christian
@Cafam
Jan 05 2017 08:22 UTC
@jmbravo ok
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:24 UTC
@rameezh remove all if-else structure just keep first return and the condtion of if
jmbravo
@jmbravo
Jan 05 2017 08:31 UTC

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

return item; // Change this line
}

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

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

Christian
@Cafam
Jan 05 2017 08:32 UTC

@jmbravo // Example
var ourVar = 19;

// Only change code below this line
var myVar = 9;

jmbravo
@jmbravo
Jan 05 2017 08:33 UTC
what do you need?
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:33 UTC
@jmbravo you are supposed add item to the end of arr them remove and return first element. you will need two array methods for this. the previous lessons titled Manipulating Arrays with... might be helpful
Christian
@Cafam
Jan 05 2017 08:34 UTC
@jmbravo Define a variable a with var and initialize it to a value of 9.
jmbravo
@jmbravo
Jan 05 2017 08:34 UTC
That's ok, isn't it? @Cafam
Christian
@Cafam
Jan 05 2017 08:35 UTC
no
jmbravo
@jmbravo
Jan 05 2017 08:35 UTC
could you please paste all the exercise?
@ghulamshabir thank you! I'll check it
CamperBot
@camperbot
Jan 05 2017 08:36 UTC
jmbravo sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 1626 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Christian
@Cafam
Jan 05 2017 08:36 UTC

@jmbravo Initializing Variables with the Assignment Operator
It is common to initialize a variable to an initial value in the same line as it is declared.

var myVar = 0;

Creates a new variable called myVar and assigns it an initial value of 0.

Instructions
Define a variable a with var and initialize it to a value of 9.

Greg Duncan
@GregatGit
Jan 05 2017 08:37 UTC
@Cafam yes very common
jmbravo
@jmbravo
Jan 05 2017 08:37 UTC

// Only change code below this line

var a = 9;

Christian
@Cafam
Jan 05 2017 08:38 UTC
@jmbravo ok
jmbravo
@jmbravo
Jan 05 2017 08:38 UTC
@Cafam they say "var a"
your code was good but you named the variable wrong @Cafam
Mahdiar Naufal
@mahdiarn
Jan 05 2017 08:52 UTC
hello guys
i'm having a trouble for reverse a string section
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:53 UTC
@mahdiarn what you have ?
Mahdiar Naufal
@mahdiarn
Jan 05 2017 08:53 UTC
i'm doing it using for loop ways, i want to know how to do it using prototype reverse way

@ghulamshabir i'm using this code :
function reverseString(str) {
var tes = "";
for (var i=str.length-1;i>=0;i--) {
tes += str[i];
}
return tes;
}

reverseString("hello");

can you help me how to solve it using split, join, and reverse?
Egbuna Chukwudi
@egbuna
Jan 05 2017 08:54 UTC
hey guys.. some issues with my Wiki viewer. 1) i want to get it remove the previous search each time a new search is started(will removing the class with javascript each time the search button is clicked help?).. 2) ive tried all the parameters given for the body/summary/extract/ to show but its still not working..
http://codepen.io/raynold/pen/RKwREB
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:55 UTC
@mahdiarn is that code working ?
Mahdiar Naufal
@mahdiarn
Jan 05 2017 08:55 UTC
it's working
@ghulamshabir but i want to solve it how the instructions want
@ghulamshabir by turning the string into an array then reverse it
Ogundele Olumide
@Lumexralph
Jan 05 2017 08:57 UTC
@mahdiarn do it as you've said it
@ghulamshabir good morning bro
Mahdiar Naufal
@mahdiarn
Jan 05 2017 08:57 UTC
@Lumexralph the problem is how to split a string into an arrays?
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:57 UTC
@mahdiarn the loop version is good to learn how loops can be used, if you want to do it using Array.prototype.reverse then convert the str to an array then reverse it then join it back to string
@Lumexralph good after noon
@mahdiarn str.split("") will return an array
Mahdiar Naufal
@mahdiarn
Jan 05 2017 08:59 UTC
@ghulamshabir okay it works, thanks for the help mr ghulam
CamperBot
@camperbot
Jan 05 2017 08:59 UTC
mahdiarn sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 1627 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ghulam Shabir
@ghulamshabir
Jan 05 2017 08:59 UTC
@mahdiarn :smile:
Ricardo Dahel
@Daahel
Jan 05 2017 09:01 UTC
Hello guys, I'm having trouble getting through challenge #144, here's my code:
Hello guys, I'm having trouble getting through challenge #144,
var myStr ='FirstLine\"\n\"\"\\"SecondLine\"\\"\"\r\"ThirdLine';// Change this line
I will appreciate any tips :c
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:02 UTC
please help
hey guys.. some issues with my Wiki viewer. 1) i want to get it remove the previous search each time a new search is started(will removing the class with javascript each time the search button is clicked help?).. 2) ive tried all the parameters given for the body/summary/extract/ to show but its still not working..
http://codepen.io/raynold/pen/RKwREB
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:03 UTC
@Daahel remove \" you don't need them you only need \\ for a backslash
@egbuna try .html instead of .append
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:05 UTC
@Daahel remove double quotes "" you need \n \\ \r \\ before and after SecondLine
Ricardo Dahel
@Daahel
Jan 05 2017 09:06 UTC
@ghulamshabir Omg I got it, thank you so much mate
CamperBot
@camperbot
Jan 05 2017 09:06 UTC
daahel sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 1628 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ricardo Dahel
@Daahel
Jan 05 2017 09:06 UTC
@Lumexralph Thanks bro
CamperBot
@camperbot
Jan 05 2017 09:06 UTC
daahel sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 653 | @lumexralph |http://www.freecodecamp.com/lumexralph
amarg26
@amarg26
Jan 05 2017 09:07 UTC

```var Bike = function() {

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

function setGear(gear) {
var g1= gear;
}

};

var myCar = new Car();

var myBike = new Bike();
myBike.getGear();
g1=myBike.setGear(gear);
```
TypeError:myBike .setGear is not a function

Ogundele Olumide
@Lumexralph
Jan 05 2017 09:08 UTC
@amarg26 because you didn't make it public to any instance of Bike... use this.setGear
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:08 UTC
@amarg26 use g1 as setGear parameter and assign to gear like this gear = g1
Rameez Hashmi
@rameezh
Jan 05 2017 09:09 UTC
Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.
how to do this
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:09 UTC
@ghulamshabir i only get one(1) result using .html
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:10 UTC
@rameezh you need to simplify that if-else structure so you only return the condition what is in the if
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:10 UTC
@rameezh use if control statement to check if a or b < 0, then return or return undefined anyone will work
Rameez Hashmi
@rameezh
Jan 05 2017 09:11 UTC
if(a<0 && b<0){
return undefined;
}
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:11 UTC
@rameezh no, use ||
Rameez Hashmi
@rameezh
Jan 05 2017 09:11 UTC
i use this statement but its now working
amarg26
@amarg26
Jan 05 2017 09:11 UTC

please fix this
```var Bike = function() {

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

this.setGear = function() {
var g1= gear;
};

};

var myCar = new Car();

var myBike = new Bike();
myBike.getGear();
g1=myBike.setGear(gear);```

Ogundele Olumide
@Lumexralph
Jan 05 2017 09:12 UTC
@armarg26 this.setgear doesn't have a parameter to set to gear
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:13 UTC
@egbuna oh i see, then you can use append. but before using .append set the elements to an empty string like this. .html("")
darkflikk
@darkflikk
Jan 05 2017 09:15 UTC
@egbuna still have any problems?
amarg26
@amarg26
Jan 05 2017 09:15 UTC
like this
this.setGear = function(gear) { var g1= gear; };
@Lumexralph
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:16 UTC
@amarg26 yeah, but set gear in Bike to gear parameter....or use another name for the parameter for unambiguity
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:16 UTC
@ghulamshabir i still get the same results as the first
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:17 UTC
@egbuna you sure you put the .html("") before .append ?
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:17 UTC
@darkflikk yes bro
@ghulamshabir yes i did
darkflikk
@darkflikk
Jan 05 2017 09:18 UTC
@egbuna so what do you need?
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:18 UTC
@amarg26 you're changing the value of var gear to the parameter of this.setGear when it's called
@amarg26 this { var g1= gear; } should be { gear = parameter from the setGear method; }
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:20 UTC
@darkflikk some issues with my Wiki viewer. 1) i want to get it remove the previous search each time a new search is started(will removing the class with javascript each time the search button is clicked help?).. 2) ive tried all the parameters given for the body/summary/extract/ to show but its still not working..
http://codepen.io/raynold/pen/RKwREB
Iqbal
@mibaldobaghi
Jan 05 2017 09:20 UTC
hi guys
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:21 UTC
@mibaldobaghi hey....good morning
Iqbal
@mibaldobaghi
Jan 05 2017 09:21 UTC
regarding tictactoe game, how do i change the content of a box and make it unchangeable
darkflikk
@darkflikk
Jan 05 2017 09:21 UTC
@egbuna hmmm, looks strange
Iqbal
@mibaldobaghi
Jan 05 2017 09:21 UTC
morning @Lumexralph or evening here
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:21 UTC
@mibaldobaghi anyone
amarg26
@amarg26
Jan 05 2017 09:22 UTC
@Lumexralph thanks a lot for detailed explanation.
CamperBot
@camperbot
Jan 05 2017 09:22 UTC
amarg26 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 654 | @lumexralph |http://www.freecodecamp.com/lumexralph
Iqbal
@mibaldobaghi
Jan 05 2017 09:22 UTC
I can use .one("click") to make my symbol appear only once but the ai might overwrite it
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:23 UTC
@amarg26 :+1:
darkflikk
@darkflikk
Jan 05 2017 09:23 UTC
@egbuna you have a strange mix there, you should start to organize your code better
sennator
@sennator2
Jan 05 2017 09:23 UTC
function mutation(arr) {
  var firstWord = arr[0].toLowerCase();
  var secondWord = arr[1].toLowerCase();
  for ( var i = 0; i < secondWord.length; i++ ){
   if (firstWord.indexOf(secondWord[i]) >= 0){
     return true;
   }
    else return false;

  }
}

mutation(["Alien", "line"]);
question
my if statement checks to first true
and then returns
darkflikk
@darkflikk
Jan 05 2017 09:25 UTC
@egbuna you should start with the ajax request and put all the parameters in your data object so one can see what parameters you send in the request
sennator
@sennator2
Jan 05 2017 09:25 UTC
how can i make it check every result
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:25 UTC
@sennator2 this will assume that if the first letter matches then the entire string is matched that's wrong
Ogundele Olumide
@Lumexralph
Jan 05 2017 09:25 UTC
@sennator2 your if statement will not finish the loop before it returns
sennator
@sennator2
Jan 05 2017 09:26 UTC
@Lumexralph i know that
how to change that
@ghulamshabir yup :D
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:26 UTC
@sennator2 if (firstWord.indexOf(secondWord[i]) >= 0){
return true;
} this is wrong
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:27 UTC
thought i did better this time :worried: @darkflikk
darkflikk
@darkflikk
Jan 05 2017 09:27 UTC
@egbuna it takes time, you can do it
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:27 UTC
@sennator2 think opposite of it. if first letter/any letter does not match then it's assumed that string will not match
sennator
@sennator2
Jan 05 2017 09:28 UTC
@ghulamshabir makes sense :)
@ghulamshabir thanks man
CamperBot
@camperbot
Jan 05 2017 09:28 UTC
sennator2 sends brownie points to @ghulamshabir :sparkles: :thumbsup: :sparkles:
:star2: 1629 | @ghulamshabir |http://www.freecodecamp.com/ghulamshabir
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:28 UTC
@sennator2 :smile:
darkflikk
@darkflikk
Jan 05 2017 09:29 UTC
@egbuna how about you write a quick regex to parse the URL parameters for the data object? :)
@egbuna are you up for that?
@egbuna are you still there?
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:35 UTC
@darkflikk sure, no harm in trying..
Rafa Huelin
@rafahuelin
Jan 05 2017 09:36 UTC
Good morning everybody!
Ghulam Shabir
@ghulamshabir
Jan 05 2017 09:36 UTC
@rafahuelin Good Morning :smile:
darkflikk
@darkflikk
Jan 05 2017 09:37 UTC
@egbuna you know how to start?
Egbuna Chukwudi
@egbuna
Jan 05 2017 09:39 UTC
@darkflikk not really..
darkflikk
@darkflikk
Jan 05 2017 09:42 UTC

@egbuna

https://