These are chat archives for FreeCodeCamp/HelpJavaScript

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

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
@Lumexralph yea i do this request but i dont know how its work
Zhafarina Ungku
@inagreen
Jan 05 2017 00:02
Can anyone shed a light on this
kulagowskim
@kulagowskim
Jan 05 2017 00:03
@Lumexralph JSON.stringify do something?
Wayne Bunch
@waynebunch
Jan 05 2017 00:03
@Lumexralph well thanks anyway!
CamperBot
@camperbot
Jan 05 2017 00:03
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
@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
@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
@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
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
good evening coders!
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:07
@kulagowskim 1
@Lumexralph no way xD
Christopher Richards
@way3edgyentertainment
Jan 05 2017 00:08
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
@way3edgyentertainment prop is a variable you can't use dot method use [ ]
Christopher Richards
@way3edgyentertainment
Jan 05 2017 00:10
thank you @Lumexralph
CamperBot
@camperbot
Jan 05 2017 00:10
way3edgyentertainment sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Diego Mayer
@Chrono79
Jan 05 2017 00:10
@way3edgyentertainment your loop won't run more than once
Zhafarina Ungku
@inagreen
Jan 05 2017 00:10
@way3edgyentertainment Thanks Chris exactly what I was looking for. Instead I was focusing on the while loop
CamperBot
@camperbot
Jan 05 2017 00:10
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
@inagreen you can use a while loop if you want too
kulagowskim
@kulagowskim
Jan 05 2017 00:12
@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
@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
@kulagowskim yes, it removes the first element so arr becomes [2, 3]
kulagowskim
@kulagowskim
Jan 05 2017 00:13
@Lumexralph damn dude thx!
CamperBot
@camperbot
Jan 05 2017 00:13
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
@kulagowskim cool
kulagowskim
@kulagowskim
Jan 05 2017 00:13
@Lumexralph how i can give you point?
Stephen James
@sjames1958gm
Jan 05 2017 00:14
@kulagowskim You already did
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:14
@kulagowskim you've already :wink:
kulagowskim
@kulagowskim
Jan 05 2017 00:14
i don't know how but ok :P
it's automaticaly?
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:16
@kulagowskim yes
cassv
@cassv24
Jan 05 2017 00:16
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
@Nuoz thanks
CamperBot
@camperbot
Jan 05 2017 00:17
kmcrayton7 sends brownie points to @nuoz :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for nuoz
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:18
@cassv24 yes
Ken
@kenbbetter
Jan 05 2017 00:18

// 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
hi camps
Ken
@kenbbetter
Jan 05 2017 00:19
why here cannot use else? How to fix my code
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:19
@kenbbetter checkProp is a variable not a string
Stephen James
@sjames1958gm
Jan 05 2017 00:19
@cassv24 "This Is A Test".match(/( [A-Z])|(^[A-Z])/g)
Kim Crayton
@kmcrayton7
Jan 05 2017 00:19
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
@kenbbetter "checkProp" is a string in the function call - it should be the variable
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:20
@kmcrayton7 assign the strings to result for each cases
cassv
@cassv24
Jan 05 2017 00:20
@sjames1958gm great (y)
Stephen James
@sjames1958gm
Jan 05 2017 00:20
@kmcrayton7 See that return answer; at the end - you need to set answer to the string value
mitron6
@mitron6
Jan 05 2017 00:20
@kenbbetter if (myObj.hasOwnProperty("checkProp")=== true);{ remove the semicolon here.
Ken
@kenbbetter
Jan 05 2017 00:21
that part works..
only have problem in "Not Found"
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:21
@mitron6 he needs to make checkProp a variable there and === true is not needed @kenbbetter
Kim Crayton
@kmcrayton7
Jan 05 2017 00:21
@Lumexralph @sjames1958gm I understand what you are saying but how?
andercodder
@andercodder
Jan 05 2017 00:21

// 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
@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
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
@kmcrayton7 like this answer = "alpha" ditto for the remaining cases
Stephen James
@sjames1958gm
Jan 05 2017 00:23
@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

// 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
ok good
@sjames1958gm thanks
CamperBot
@camperbot
Jan 05 2017 00:24
andercodder sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5169 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ken
@kenbbetter
Jan 05 2017 00:24
@sjames1958gm i move the === true but do not how to put the "Not found" into
Kim Crayton
@kmcrayton7
Jan 05 2017 00:24
@Lumexralph @sjames1958gm thank you. I've been trying to figure out what to do with var answer = '' ";
CamperBot
@camperbot
Jan 05 2017 00:24
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
@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
@kenbbetter checkProp in hasOwnProperty function should be a variable not string and remove the ;
Ken
@kenbbetter
Jan 05 2017 00:26
var myObj = {
  top: "hat",
  bottom: "pants"
};
myObj.hasOwnProperty("top");    // true
myObj.hasOwnProperty("middle"); // false
Stephen James
@sjames1958gm
Jan 05 2017 00:26
@kenbbetter add return "Not Found"; in an else or simply after the return you hvae
Ken
@kenbbetter
Jan 05 2017 00:26
@sjames1958gm
why here is top not top?
``top ``
Kim Crayton
@kmcrayton7
Jan 05 2017 00:26
@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
@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
you made me confused
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:27
@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
@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

// 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
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
@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

// 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
@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
@kenbbetter remove the semicolon at the end of the if parentheses()
Ken
@kenbbetter
Jan 05 2017 00:32
@sjames1958gm thanks
CamperBot
@camperbot
Jan 05 2017 00:32
kenbbetter sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5171 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ken
@kenbbetter
Jan 05 2017 00:32
@Lumexralph thanks
CamperBot
@camperbot
Jan 05 2017 00:32
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
@sjames1958gm @Chrono79 Ah, thanks. I see what you both mean now.
CamperBot
@camperbot
Jan 05 2017 00:33
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
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

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
@rusdie what's the formula?
Stephen James
@sjames1958gm
Jan 05 2017 00:35
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
@rusdie Your formula is incorrect.
rusdie
@rusdie
Jan 05 2017 00:35
the didnt give any
they told me to create from scratch
challange 139
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:36
@way3edgyentertainment return no such contacts after the loop is done looking through contacts
Stephen James
@sjames1958gm
Jan 05 2017 00:36
@rusdie The formula is in the second paragraph
Ogundele Olumide
@Lumexralph
Jan 05 2017 00:37
@rusdie you can also search the formula
TheBillyTowers
@TheBillyTowers
Jan 05 2017 00:37
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
@TheBillyTowers "I am a\"double quoted\" string inside of \"double quotes\"."; /
rusdie
@rusdie
Jan 05 2017 00:39
celsius*9/5+32 = fahrenheit
like that ?
Jason Luboff
@JLuboff
Jan 05 2017 00:39
@rusdie Flip it around and you're good
rusdie
@rusdie
Jan 05 2017 00:39
but still they say invalid assignment left-hand side
what code is missing
Jason Luboff
@JLuboff
Jan 05 2017 00:39
Hence why I'm telling you to flip it around
rusdie
@rusdie
Jan 05 2017 00:39
flip ?
Jason Luboff
@JLuboff
Jan 05 2017 00:39
fahrenheit should be on the left, not the right
rusdie
@rusdie
Jan 05 2017 00:40
ah
i will try
Johnny
@JohnnyBizzel
Jan 05 2017 00:40
@rusdie To test 82 degrees F = 28 degrees C
rusdie
@rusdie
Jan 05 2017 00:40
thanks all
Thanks a lot
:smile:
Johnny
@JohnnyBizzel
Jan 05 2017 00:41
@rusdie You mean thanks to @JLuboff ? And @sjames1958gm
CamperBot
@camperbot
Jan 05 2017 00:41
: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
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
@rusdie How do you assign the value of 7 to a variable num? ... var num = 7;
andercodder
@andercodder
Jan 05 2017 00:41
i am not understanding
Joseph
@revisualize
Jan 05 2017 00:42
@andercodder String concatenation with variables parameters
Johnny
@JohnnyBizzel
Jan 05 2017 00:42
@andercodder Learn about parameters and arguments and you cannot fail
rusdie
@rusdie
Jan 05 2017 00:42
still noobs
hahahha ask the pro
itsthomas
@itsthomas
Jan 05 2017 00:43
What is the difference between String Concatenation vs. String Interpolation?
Joseph
@revisualize
Jan 05 2017 00:43
@rusdie Don't ask the pro. Become the pro.
rusdie
@rusdie
Jan 05 2017 00:44
good advice my bro
Joseph
@revisualize
Jan 05 2017 00:44
@itsthomas Let me google that. It will take me a few seconds to find you an answer.
itsthomas
@itsthomas
Jan 05 2017 00:45
@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
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
@itsthomas I have no idea.
mitron6
@mitron6
Jan 05 2017 00:51
@itsthomas Neither
itsthomas
@itsthomas
Jan 05 2017 00:51
@mitron6 what are they then?
String Concatenation?
Jason Luboff
@JLuboff
Jan 05 2017 00:52
@itsthomas The first is a string concatenated and the second is a string and a variable
Joseph
@revisualize
Jan 05 2017 00:52
@itsthomas The top one is string concatenation.
itsthomas
@itsthomas
Jan 05 2017 00:54
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
@itsthomas Your two code blocks do NOT ouput the same thing.
That is String Concatenation.
Jason Luboff
@JLuboff
Jan 05 2017 00:54
Ya, they are incorrectly calling it interpolation
Joseph
@revisualize
Jan 05 2017 00:55
Codecademy is wrong.
itsthomas
@itsthomas
Jan 05 2017 00:56
@JLuboff Thanks
CamperBot
@camperbot
Jan 05 2017 00:56
itsthomas sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 566 | @jluboff |http://www.freecodecamp.com/jluboff
itsthomas
@itsthomas
Jan 05 2017 00:56
@revisualize the output fot both is the same. I just tested again.
Joseph
@revisualize
Jan 05 2017 00:57
@itsthomas
blob
They do NOT output the same thing.
Dylan Hsiao
@greedylan
Jan 05 2017 00:57
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
@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
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
@andercodder result = + isn't correct.
@andercodder remove the +
andercodder
@andercodder
Jan 05 2017 01:04
ok
@revisualize i got say you arethe men
very thank you
Johnny
@JohnnyBizzel
Jan 05 2017 01:05
@andercodder You may not need the last space
Ken
@kenbbetter
Jan 05 2017 01:05

// 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
@revisualize very thank you!! :D
CamperBot
@camperbot
Jan 05 2017 01:05
johnnybizzel sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2837 | @revisualize |http://www.freecodecamp.com/revisualize
Ken
@kenbbetter
Jan 05 2017 01:05
Accessing Nested Objects
Joseph
@revisualize
Jan 05 2017 01:06
@JohnnyBizzel I really should start making projects and getting my shit together.
Johnny
@JohnnyBizzel
Jan 05 2017 01:06
@revisualize Nah, this is so much fun :joy:
Ken
@kenbbetter
Jan 05 2017 01:07
what is wrong with my code??
Joseph
@revisualize
Jan 05 2017 01:07
@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
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
var myStr="firstLine\n\secondLine\thirdLine\r";
rusdie
@rusdie
Jan 05 2017 01:08
stuck again my friend help me
Joseph
@revisualize
Jan 05 2017 01:08
@rusdie firstLine is not the same as FirstLine
RyanWng
@RyanWng
Jan 05 2017 01:08
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
@rusdie your strings are wrong
@RhinoTek use an if
Joseph
@revisualize
Jan 05 2017 01:09
@RhinoTek .hasOwnProperty() outputs a boolean. Do you know what a boolean value is?
Ken
@kenbbetter
Jan 05 2017 01:09
@revisualize my also have space in it, isn't?
rusdie
@rusdie
Jan 05 2017 01:09
i know my string is the problem
Ken
@kenbbetter
Jan 05 2017 01:09
Nice to see you again. btw,
@revisualize
rusdie
@rusdie
Jan 05 2017 01:10
how should i write it ?
Joseph
@revisualize
Jan 05 2017 01:10
@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
@revisualize camelCase overdose ;)
rusdie
@rusdie
Jan 05 2017 01:11
var myStr="FirstLine\n\SecondLine\ThirdLine\r";
Joseph
@revisualize
Jan 05 2017 01:11
@rusdie Great.
rusdie
@rusdie
Jan 05 2017 01:11
still nothing dude
Ken
@kenbbetter
Jan 05 2017 01:11
what you give to me, is same as i write... @revisualize
Joseph
@revisualize
Jan 05 2017 01:11
Now you're escaping the carriage-return in the wrong spot.
rusdie
@rusdie
Jan 05 2017 01:11
\n not make any new line
Diego Mayer
@Chrono79
Jan 05 2017 01:11
@rusdie some escaped sequence is misplaced there
RhinoTek
@RhinoTek
Jan 05 2017 01:11
@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

@RhinoTek

@RhinoTek use an if

rusdie
@rusdie
Jan 05 2017 01:12
i got it thanks @revisualize @Chrono79
CamperBot
@camperbot
Jan 05 2017 01:12
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
@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
@revisualize bro
reply me bro call me idiot plz
@revisualize i am seeking for your help bro
Joseph
@revisualize
Jan 05 2017 01:13
@kenbbetter Sorry.
Ken
@kenbbetter
Jan 05 2017 01:13
hahaha
Joseph
@revisualize
Jan 05 2017 01:13
@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
i said what you ask me to do, is same as i write
oh
Johnny
@JohnnyBizzel
Jan 05 2017 01:14
@kenbbetter Did you try ["glove box"]
Diego Mayer
@Chrono79
Jan 05 2017 01:14
@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
@revisualize @JLuboff thank you
CamperBot
@camperbot
Jan 05 2017 01:15
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
@Chrono79 but that is the requirement of this challenge
Diego Mayer
@Chrono79
Jan 05 2017 01:16
@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
@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
var gloveBoxContents = myStorage.car.inside.["glove box"]; // Change this line
@Chrono79 @JohnnyBizzel is this what you mean?
Joseph
@revisualize
Jan 05 2017 01:17
@kenbbetter remove the . before the bracket notation.
Diego Mayer
@Chrono79
Jan 05 2017 01:17
@kenbbetter almost ;)
Ken
@kenbbetter
Jan 05 2017 01:17
At before , i was confused about why there is [" "]
now i know it,
Diego Mayer
@Chrono79
Jan 05 2017 01:18
:+1:
Johnny
@JohnnyBizzel
Jan 05 2017 01:18
@kenbbetter And use http://pythontutor.com/javascript.html#mode=edit to check it
Ken
@kenbbetter
Jan 05 2017 01:18
thanks a lot and appreciate @Chrono79 @revisualize @JohnnyBizzel
CamperBot
@camperbot
Jan 05 2017 01:18
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
@kenbbetter ;)
Ken
@kenbbetter
Jan 05 2017 01:21
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
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
has the twitch.tv api broke?
Ben Carp
@carpben
Jan 05 2017 01:31
touppercase() converts all chars to uppercase.
Aaron Bell
@awb715
Jan 05 2017 01:31
i havent been on in 2 weeks and my app stopped working
mert
@avogadromert
Jan 05 2017 01:32

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
@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
@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
@carpben simpler depends entirely on your knowledge on regexp
mert
@avogadromert
Jan 05 2017 01:36
@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
@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
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
@thomasfadams add ; at the end and refresh the browser
Joseph
@revisualize
Jan 05 2017 01:44
/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
@revisualize Yes, thanks!
CamperBot
@camperbot
Jan 05 2017 01:47
avogadromert sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2841 | @revisualize |http://www.freecodecamp.com/revisualize
Jake
@neozane1
Jan 05 2017 01:55
hello world
CamperBot
@camperbot
Jan 05 2017 01:55

welcome to FreeCodeCamp @neozane1!

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

// 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
can anyone help me with multi nested loops and thanks @kelechichinaka
CamperBot
@camperbot
Jan 05 2017 01:57
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
@saralee233 "a + b" is a string, to actually do a math operation remove the quotes
Kelechi Chinaka
@ke1echi
Jan 05 2017 01:58
lets see what you have @neozane1
Stephen James
@sjames1958gm
Jan 05 2017 01:59
@neozane1 Hi
Sara Dorris
@saralee233
Jan 05 2017 01:59
@Chrono79 thanks!
CamperBot
@camperbot
Jan 05 2017 01:59
saralee233 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3047 | @chrono79 |http://www.freecodecamp.com/chrono79
Jake
@neozane1
Jan 05 2017 01:59

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
@neozane1 see the example code on how to write 2 nested loops
Jake
@neozane1
Jan 05 2017 02:00

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
@neozane1 the inner loop is not ok
Jake
@neozane1
Jan 05 2017 02:01
ok what did i miss
Diego Mayer
@Chrono79
Jan 05 2017 02:01
@neozane1 look specially at this j<arr.length
Dylan Hsiao
@greedylan
Jan 05 2017 02:01

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
@greedylan not
Jake
@neozane1
Jan 05 2017 02:02
ok thanks @Chrono79
CamperBot
@camperbot
Jan 05 2017 02:02
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
is that for pig latin? @greedylan
Dylan Hsiao
@greedylan
Jan 05 2017 02:04
@Chrono79 YES
Sara Dorris
@saralee233
Jan 05 2017 02:04

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
@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
// 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
@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
and how would i do it with a var
Diego Mayer
@Chrono79
Jan 05 2017 02:05
@JohnnyBizzel i modifier is your friend ;)
Dylan Hsiao
@greedylan
Jan 05 2017 02:06
@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
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
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
neozane1 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: neozane1 already gave chrono79 points
Sara Dorris
@saralee233
Jan 05 2017 02:09
I fixed it...dumb question
Diego Mayer
@Chrono79
Jan 05 2017 02:10
:+1:
Dylan Hsiao
@greedylan
Jan 05 2017 02:13
@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
@greedylan in that case you should list all the consonants. They're 21 after all
Margaret
@Margaret2
Jan 05 2017 02:19
@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
10-4.. ill give it a go. Thanks @Margaret2
CamperBot
@camperbot
Jan 05 2017 02:20
scoutsnknives sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:star2: 1009 | @margaret2 |http://www.freecodecamp.com/margaret2
David Halls
@DavidHalls
Jan 05 2017 02:25
having trouble with this challenge
can any fellow coders help me
David Halls
@DavidHalls
Jan 05 2017 02:36
@keewhy whats the prob bob?
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 02:37
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
@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
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
@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
var myStr = " \"FirstLine\"\n \'SecondLine'\ \r\"ThirdLine"; is my current code for that challenge.
Stephen James
@sjames1958gm
Jan 05 2017 02:45
@keewhy YOu should only have one pair of quotes for the entire string remove the spaces
mert
@avogadromert
Jan 05 2017 02:47
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
I tried that originally but with spaces. Silly me. Thank you my friend!.
Dylan Hsiao
@greedylan
Jan 05 2017 02:50
@Chrono79 got it thank you
CamperBot
@camperbot
Jan 05 2017 02:50
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
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
@xcbyers show your code
Cody Byers
@xcbyers
Jan 05 2017 02:51
I currently have: var myStr ='FirstLine\n\SecondLine\"\rThirdLine"'; // Change this line
Diego Mayer
@Chrono79
Jan 05 2017 02:51
@xcbyers delete the double quotes
David Halls
@DavidHalls
Jan 05 2017 02:52
@keewhy you get it figured out man?
Cody Byers
@xcbyers
Jan 05 2017 02:53
Ah so in these instances it just reads off the slashes
Thanks @Chrono79
CamperBot
@camperbot
Jan 05 2017 02:53
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
@Byzgig Yes i have thank you .
CamperBot
@camperbot
Jan 05 2017 02:53
keewhy sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @byzgig |http://www.freecodecamp.com/byzgig
Daniel
@doodleslr
Jan 05 2017 02:58
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
@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
so the general rule is mostly to always declare variables with var to avoid those problems later?
eeflores
@eeflores
Jan 05 2017 03:04
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
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
doodleslr sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:cookie: 896 | @eeflores |http://www.freecodecamp.com/eeflores
eeflores
@eeflores
Jan 05 2017 03:07
you're welcome
Anthony Ramirez
@tonylasarna
Jan 05 2017 03:14
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
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
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
firstname and prop arent strings
John Nunns
@johnnunns
Jan 05 2017 03:20
why set product equal to 1??
RaffertyH
@RaffertyH
Jan 05 2017 03:21
Comparison with the Greater Than Or Equal To Operator......I'm stuck lol
Devan Beanz
@dd-beanz
Jan 05 2017 03:22
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
It seems really simple and I feel dub for not understading it
Devan Beanz
@dd-beanz
Jan 05 2017 03:22
Not quite understanding why that code would not work
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:23
@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
would map be sufficient for iterating through?
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:24
not really
use a for loop
Devan Beanz
@dd-beanz
Jan 05 2017 03:24
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
yes
Devan Beanz
@dd-beanz
Jan 05 2017 03:25
Ok thank you HeebieGeeBee!
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:26
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
why the = sign? @keewhy
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:27
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
and sentences usually start with capital letters
eeflores
@eeflores
Jan 05 2017 03:27
@keewhy change += to +
oh, nevermind
myStr += "secondSentence";
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:29
tried that didnt work
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:30
it says over several lines
John Nunns
@johnnunns
Jan 05 2017 03:31
does anyone have experience with the nesting for loops?
Sam Houlahan
@Sam-Houlahan
Jan 05 2017 03:31
I think its to do with the spacing trying to fix now.
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:32
@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
@keewhy and yeah, possibly put a space after the first full stop on the first string ...
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:33
whats the problem @johnnunns
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:38
ok well i go back to laying down then
John Nunns
@johnnunns
Jan 05 2017 03:48
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
thats alright
you have a nest loop
nested
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:49

// 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
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
guys whats wrong with my code?
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:51
yes @johnnunns
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:51
its level 126
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 03:51
what do you even want to do? @Farzan-Hashmi
RaffertyH
@RaffertyH
Jan 05 2017 03:51
properCamelCase lol
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:51
:worried:
so funny
RaffertyH
@RaffertyH
Jan 05 2017 03:52
:)
Hey i suck i just noticed it lol
Farzan-Hashmi
@Farzan-Hashmi
Jan 05 2017 03:52
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
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
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
anyone knows how to solve Factorialize a Number?
Ammy3165
@Ammy3165
Jan 05 2017 04:10
@arebai , what's the error?
babajide odusola
@cesarecaravaggio
Jan 05 2017 04:11
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
@rasmus-dybmose there are many ways to do it, have you tried something?
John Nunns
@johnnunns
Jan 05 2017 04:14
@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
@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
@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
@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
@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
@cburros i figured it out, it just took me 2 nights to do it haha
Chris Burros
@cburros
Jan 05 2017 04:16
@cesarecaravaggio Good job sticking with it.
Manish Giri
@Manish-Giri
Jan 05 2017 04:16
@johnnunns _____* arr[i][j];
John Nunns
@johnnunns
Jan 05 2017 04:16
yeah I wrote out console.log(product*arr[i][j] initially but still missed it
babajide odusola
@cesarecaravaggio
Jan 05 2017 04:17
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
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
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

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
Thanks @cesarecaravaggio
CamperBot
@camperbot
Jan 05 2017 04:18
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
writing it this way shows a syntax error
Manish Giri
@Manish-Giri
Jan 05 2017 04:18
store the result back in product
product = product * arr[i][j];
John Nunns
@johnnunns
Jan 05 2017 04:19
so like product = product*arr[i][j]??
Manish Giri
@Manish-Giri
Jan 05 2017 04:19
yes
Chris Burros
@cburros
Jan 05 2017 04:19
@johnnunns try *=
John Nunns
@johnnunns
Jan 05 2017 04:20
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
@johnnunns don't initialize your product variable.
John Nunns
@johnnunns
Jan 05 2017 04:21
where it says var product = 1?
because that wasn't my doing
Chris Burros
@cburros
Jan 05 2017 04:21
Oh, my bad. Sorry I'm tired
Manish Giri
@Manish-Giri
Jan 05 2017 04:21
j<arr.length[i]
is wrong
John Nunns
@johnnunns
Jan 05 2017 04:21
@cburros no problem, I was confused by it though
Manish Giri
@Manish-Giri
Jan 05 2017 04:22
it should belength of arr[i]
@johnnunns
John Nunns
@johnnunns
Jan 05 2017 04:22
haha that was it! thanks @Manish-Giri
CamperBot
@camperbot
Jan 05 2017 04:22
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
:+1:
Chris Burros
@cburros
Jan 05 2017 04:24
I see now why it initalized it to one.
Ammy3165
@Ammy3165
Jan 05 2017 04:26
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
code?
John Nunns
@johnnunns
Jan 05 2017 04:41

//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
Hey anybody really good with jasmine testing with javascript?
Ben Carp
@carpben
Jan 05 2017 04:48
Hi everyone, not sure why the code marked in blue fails to deliver. Any ideas?
blob
Coy Sanders
@coymeetsworld
Jan 05 2017 04:51
@carpben Strings are immutable, you can't change a character inside of it
Ben Carp
@carpben
Jan 05 2017 04:53
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
name isn't an array
you set it to a string: name = 'Ben';
Ben Carp
@carpben
Jan 05 2017 04:55
OOPS
Joseph
@revisualize
Jan 05 2017 04:55
@johnnunns contacts is an array
John Nunns
@johnnunns
Jan 05 2017 04:56
yeah I wasn't exactly sure how to return that
Joseph
@revisualize
Jan 05 2017 04:56
@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
contacts[1]
Joseph
@revisualize
Jan 05 2017 04:56

@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
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
@Ammy3165 you should review the structure of switch/case
John Nunns
@johnnunns
Jan 05 2017 04:58
is it the same way??
Joseph
@revisualize
Jan 05 2017 04:58
variable in the function call.
Ammy3165
@Ammy3165
Jan 05 2017 04:58
I got error message, a is not defined
Coy Sanders
@coymeetsworld
Jan 05 2017 04:58
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
@johnnunns No.
John Nunns
@johnnunns
Jan 05 2017 04:58
myFriend.firstName[]
Ammy3165
@Ammy3165
Jan 05 2017 04:58
thanks everybody
Joseph
@revisualize
Jan 05 2017 04:58
@johnnunns Not quite.
Coy Sanders
@coymeetsworld
Jan 05 2017 04:58
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
@johnnunns You don't need the [] at the end.
@johnnunns Ready for the next question?
John Nunns
@johnnunns
Jan 05 2017 04:59
yes
Joseph
@revisualize
Jan 05 2017 04:59

@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
hahaha. Let me take a stab at it.
what happens if you contacts[1] it??
mattcharlesh
@mattcharlesh
Jan 05 2017 05:01

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
need help with for loops
Joseph
@revisualize
Jan 05 2017 05:01
@johnnunns { f: "H" }
John Nunns
@johnnunns
Jan 05 2017 05:01
not sure what the f: will actually do
AhhMclean
@AhhMclean
Jan 05 2017 05:01
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

@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
myFriend.firstName
AhhMclean
@AhhMclean
Jan 05 2017 05:02
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

@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
How do I display my code in a black box like that?? :)
Joseph
@revisualize
Jan 05 2017 05:02
'''
CamperBot
@camperbot
Jan 05 2017 05:02
:bulb: to format code use backticks! ``` more info
AhhMclean
@AhhMclean
Jan 05 2017 05:02
"```" before and after
Joseph
@revisualize
Jan 05 2017 05:03
@johnnunns Then I'm going to ask...
What if f: was firstName: ?
John Nunns
@johnnunns
Jan 05 2017 05:03
contacts.f
hahaha interesting
Joseph
@revisualize
Jan 05 2017 05:04
@johnnunns What happened to the [1] ???
John Nunns
@johnnunns
Jan 05 2017 05:05
do I still need that?
Joseph
@revisualize
Jan 05 2017 05:05
YES!
Adnen rebai
@arebai
Jan 05 2017 05:05
John Nunns
@johnnunns
Jan 05 2017 05:05
oh right there's multiply contact.f's
contact[1].f
Joseph
@revisualize
Jan 05 2017 05:06
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
'''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
:bulb: to format code use backticks! ``` more info
mattcharlesh
@mattcharlesh
Jan 05 2017 05:06
'''
CamperBot
@camperbot
Jan 05 2017 05:06
:bulb: to format code use backticks! ``` more info
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:06

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
'''js
hello
'''
CamperBot
@camperbot
Jan 05 2017 05:07
:bulb: to format code use backticks! ``` more info
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:08
how is arr[3][0] a set of values but arr[3][0][1] equals 11??
mattcharlesh
@mattcharlesh
Jan 05 2017 05:08
hello
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:09
@revisualize going to look over that now! th
thx @revisualize
CamperBot
@camperbot
Jan 05 2017 05:09
cesarecaravaggio sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: cesarecaravaggio already gave revisualize points
AhhMclean
@AhhMclean
Jan 05 2017 05:09
@revisualize (n)
Farah Soltane
@chokolate
Jan 05 2017 05:15
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
does anyone know any other good code editors besides atom?
John Nunns
@johnnunns
Jan 05 2017 05:20

//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

@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
// 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
@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
This message was deleted
babajide odusola
@cesarecaravaggio
Jan 05 2017 05:30
@TracesOfNuts great way to put it thank you
CamperBot
@camperbot
Jan 05 2017 05:30
cesarecaravaggio sends brownie points to @tracesofnuts :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @tracesofnuts |http://www.freecodecamp.com/tracesofnuts
TracesOfNuts
@TracesOfNuts
Jan 05 2017 05:31
@cesarecaravaggio glad to help!
Wesley Ibarra
@wesleyi1
Jan 05 2017 05:32
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
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
var myVar = 87++;
Vikash Saini
@Enigma10
Jan 05 2017 05:33
@fanaugen Hey Do you know plotly js
__mifflin__
@cdrainxv
Jan 05 2017 05:34
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
@jayisray cool! looks good
jayisray
@jayisray
Jan 05 2017 05:42
@TracesOfNuts Thanks!
CamperBot
@camperbot
Jan 05 2017 05:42
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
still having trouble
myVar = 88;
myVar = 87++;
nvm think i got it
mattcharlesh
@mattcharlesh
Jan 05 2017 05:47
@TracesOfNuts thanks!
CamperBot
@camperbot
Jan 05 2017 05:47
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
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
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
@way3edgyentertainment ?
Christopher Richards
@way3edgyentertainment
Jan 05 2017 05:51
@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
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
@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
@TracesOfNuts thanks, that did it.
CamperBot
@camperbot
Jan 05 2017 06:00
:cookie: 254 | @tracesofnuts |http://www.freecodecamp.com/tracesofnuts
way3edgyentertainment sends brownie points to @tracesofnuts :sparkles: :thumbsup: :sparkles:
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:00
@way3edgyentertainment glad to help!
Abhishek Saini
@sainiabhi
Jan 05 2017 06:02
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
@sainiabhi try putting all the var in the function
Aditya Singh
@adityavisen
Jan 05 2017 06:04
@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
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
@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
sumAll.PNG
Abhishek Saini
@sainiabhi
Jan 05 2017 06:06
@adityavisen thanks for sharing the solution but can you please tell the problem in my code
CamperBot
@camperbot
Jan 05 2017 06:06
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
I'm using the code: manNum = Math.max(...arr[i]);
Aditya Singh
@adityavisen
Jan 05 2017 06:07
@sainiabhi let me check
Ben Carp
@carpben
Jan 05 2017 06:07
geting a message spread/rest oerator only available in Es6
Abhishek Saini
@sainiabhi
Jan 05 2017 06:08
@TracesOfNuts cool it worked thanks
CamperBot
@camperbot
Jan 05 2017 06:08
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
Cff.PNG
@carpben
Joseph
@revisualize
Jan 05 2017 06:09
@johnnunns Still stuck?
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:09
@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
@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
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
@johnnunns NO!
Ben Carp
@carpben
Jan 05 2017 06:10
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
@johnnunns Look the code that I just saw was almost correct.
Abhishek Saini
@sainiabhi
Jan 05 2017 06:10
reduced the code too @TracesOfNuts
Joseph
@revisualize
Jan 05 2017 06:10
@johnnunns Can you answer some more questions with me?
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:10
@sainiabhi looks good!
John Nunns
@johnnunns
Jan 05 2017 06:11
@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
@carpben hi can you share your code?
Ben Carp
@carpben
Jan 05 2017 06:12
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
@johnnunns Umm.. Put your No such property back inside of your for loop.
John Nunns
@johnnunns
Jan 05 2017 06:12
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
@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
@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

@carpben hmm maybe its the

...

how bout trying

manNum = Math.max(arr[i]);
John Nunns
@johnnunns
Jan 05 2017 06:17
@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
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
@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
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
@grandmasterundead which one ?
Joseph
@revisualize
Jan 05 2017 06:18
@grandmasterundead Third Line is not the same as ThirdLine
grandmasterundead
@grandmasterundead
Jan 05 2017 06:18
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
@grandmasterundead Third Line is not the same as ThirdLine
Ben Carp
@carpben
Jan 05 2017 06:19
@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
@grandmasterundead backslash should be before \r not after to it
jainishpanchal
@jainishpanchal
Jan 05 2017 06:19
How to use escaped double quotes (\"). ?
grandmasterundead
@grandmasterundead
Jan 05 2017 06:19
yes but now i have to do that three lines into myVar
jainishpanchal
@jainishpanchal
Jan 05 2017 06:20
var myStr; // Change this line
I am a "double quoted" string inside "double quotes".
grandmasterundead
@grandmasterundead
Jan 05 2017 06:20
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
@grandmasterundead need \\ before and after SecondLine
ml3ha
@ml3ha
Jan 05 2017 06:21
Can someone help me understand how I can use a closure in my use case?
Joseph
@revisualize
Jan 05 2017 06:21
@grandmasterundead SecondLin is not the same as SecondLine
jainishpanchal
@jainishpanchal
Jan 05 2017 06:22
not yet
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:22
@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
yes but the ... should spread the elements of the array.
Joseph
@revisualize
Jan 05 2017 06:23
It does.
FCC gives you a warning.
It doesn't give you an ERROR
Just a warning.
grandmasterundead
@grandmasterundead
Jan 05 2017 06:24
@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
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
@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
@grandmasterundead :smile:
grandmasterundead
@grandmasterundead
Jan 05 2017 06:25
:D
Ben Carp
@carpben
Jan 05 2017 06:26
@revisualize and am I using the operator correctly? Why doesn't it work?
Joseph
@revisualize
Jan 05 2017 06:26
It does work.
Your other logic isn't correct.
mattcharlesh
@mattcharlesh
Jan 05 2017 06:26
// 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
@mattcharlesh You're trying to access an array element with a string.
Quotes define strings.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:28
@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
@revisualize Thanks Joseph
CamperBot
@camperbot
Jan 05 2017 06:29
mattcharlesh sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2846 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 05 2017 06:29
@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
@carpben share me your code if you managed to use the Math.max for that problem
Joseph
@revisualize
Jan 05 2017 06:30
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
@revisualize yea. i think its redundant
@revisualize thanks for highlighting!
CamperBot
@camperbot
Jan 05 2017 06:32
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
@TracesOfNuts are you relative a newbie like me?
Joseph
@revisualize
Jan 05 2017 06:33
I'm going to solve that one again. I have an idea.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:33
@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
@carpben most of us are i suppose ^^
Ben Carp
@carpben
Jan 05 2017 06:34
@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
@TracesOfNuts I just made another solution using the spread operator.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:35
@ghulamshabir yup. i though i needed to declare the length of the array
thought*
Ben Carp
@carpben
Jan 05 2017 06:36
@revisualize If you know the spread operator can you please refer to my question as well.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:36
@TracesOfNuts array length expands and shrinks by itself when you use push/shift and arr[i]=...
Joseph
@revisualize
Jan 05 2017 06:37
@carpben I'm sorry what question?
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:37
@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
how do make var a=b
Joseph
@revisualize
Jan 05 2017 06:37
@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

pls share it

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

Joseph
@revisualize
Jan 05 2017 06:38
But, @carpben hasn't solved it yet.
Ben Carp
@carpben
Jan 05 2017 06:38
@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
@TracesOfNuts try it yourself, you will learn in this way
Joseph
@revisualize
Jan 05 2017 06:38
@carpben I answered that.
Ben Carp
@carpben
Jan 05 2017 06:39
@revisualize where? here?
Joseph
@revisualize
Jan 05 2017 06:40
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
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
@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
@carpben Yes here.
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:41
@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
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
var myStr = "I am a \"double quoted\"string inside \"double quotes\".";
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:45
@amarg26 I said setGear should take a parameter and assign that to gear
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 06:45
space infront of string inside @jainishpanchal
Ben Carp
@carpben
Jan 05 2017 06:45
@revisualize but what about the message I get "Spread/rest operator is only available is es6"?
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:45
@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
I am having trouble with counting cards please help, and here is my code:
jainishpanchal
@jainishpanchal
Jan 05 2017 06:46
@HeebieGeeBee nothing work
Nathan Parsons
@Unlawfulspoon
Jan 05 2017 06:46

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
put a space infront of string @jainishpanchal
Joseph
@revisualize
Jan 05 2017 06:46
@carpben It is just a warning. It is NOT an error. You can use it.
Nathan Parsons
@Unlawfulspoon
Jan 05 2017 06:47
Cannot figure out how to add what card it is
HeebieGeeBee
@HeebieGeeBee
Jan 05 2017 06:47
@way3edgyentertainment youre told to make a count depending on what a card is
Nathan Parsons
@Unlawfulspoon
Jan 05 2017 06:47
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
@carpben Look.
jainishpanchal
@jainishpanchal
Jan 05 2017 06:48
@HeebieGeeBee thanks
CamperBot
@camperbot
Jan 05 2017 06:48
jainishpanchal sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 444 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Joseph
@revisualize
Jan 05 2017 06:48
@carpben
blob
I have the same warning. But, I solved it.
444!!!!!!!!!!!!!!!!
Joseph
@revisualize
Jan 05 2017 06:49
Warning isn't an error.
TracesOfNuts
@TracesOfNuts
Jan 05 2017 06:49

just need to throw in

/*jshint esversion: 6 */

at the top

Ben Carp
@carpben
Jan 05 2017 06:49
@revisualize THANKS!
CamperBot
@camperbot
Jan 05 2017 06:49
carpben sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2848 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 05 2017 06:49
@carpben I said that a LONG time ago.
Naveen
@hope4
Jan 05 2017 06:50
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
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
"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
@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
@ghulamshabir please help me how to solve Manipulating Complex Objects ,the problem in javascript
Ghulam Shabir
@ghulamshabir
Jan 05 2017 06:53
@hope4 what you have ?
amarg26
@amarg26
Jan 05 2017 06:54

```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
@ghulamshabir thx
CamperBot
@camperbot
Jan 05 2017 06:54
: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
@revisualize Thanks, I should have asked that questions a long long time ago.
CamperBot
@camperbot
Jan 05 2017 06:55
rsteen76 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2849 | @revisualize |http://www.freecodecamp.com/revisualize
Naveen
@hope4
Jan 05 2017 06:55
@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
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
Naveen
@hope4
Jan 05 2017 06:55
i am unable to figure it ,what exactly to do in it.
jainishpanchal
@jainishpanchal
Jan 05 2017 06:55
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
@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
@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
@ghulamshabir ok
Ben Carp
@carpben
Jan 05 2017 06:59
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
@ghulamshabir not working
?
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:00
@jainishpanchal post the code
jainishpanchal
@jainishpanchal
Jan 05 2017 07:00
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:00
@carpben what is i < i.length ?
@jainishpanchal you have not changed anything
jainishpanchal
@jainishpanchal
Jan 05 2017 07:01
@ghulamshabir
@ghulamshabir Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
\
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:02
@jainishpanchal yes i know the instructions but you are not doing anything with the code
Naveen
@hope4
Jan 05 2017 07:02
@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

@jainishpanchal

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

something like that

David Sroka
@donswavey
Jan 05 2017 07:03
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

@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
@hope4 remove second "gold": true
Naveen
@hope4
Jan 05 2017 07:04
@MaeStat still the error remains
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:05
@hope4 you should have two objects in the array like this [{...}, {...}]
Alex
@MaeStat
Jan 05 2017 07:05
@hope4 add a comma after first object
Naveen
@hope4
Jan 05 2017 07:06
thanq @ghulamshabir , @MaeStat
Alex
@MaeStat
Jan 05 2017 07:06
@hope4 yes, @ghulamshabir is rihgt
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:07
@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
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
thanks @ghulamshabir
CamperBot
@camperbot
Jan 05 2017 07:08
: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
i got the TypeError: arr is not a function
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:08
@uxsasukexnaruto remove () from arr
David Sroka
@donswavey
Jan 05 2017 07:08
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
@uxsasukexnaruto yes () are used for calling a function
Ha Nguyen
@uxsasukexnaruto
Jan 05 2017 07:09
@ghulamshabir thanks, got it
CamperBot
@camperbot
Jan 05 2017 07:09
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
@uxsasukexnaruto :smile:
Rahul Thakoor
@rahul-thakoor
Jan 05 2017 07:09
hello campers..
Alex
@MaeStat
Jan 05 2017 07:09
@rahul-thakoor hello
Rahul Thakoor
@rahul-thakoor
Jan 05 2017 07:09
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
@rahul-thakoor did you try without last " else if"? Just only "return..."?
official4code
@official4code
Jan 05 2017 07:14
myVar = myVar should be changed
Use the ++ operator(how is it done)
Alex
@MaeStat
Jan 05 2017 07:17
@rahul-thakoor try to paste "return "No such contact";" out of "for loop"
official4code
@official4code
Jan 05 2017 07:18
@uxsasukexnaruto :smile:
Alex
@MaeStat
Jan 05 2017 07:25
@rahul-thakoor try to paste "return "No such contact";" out of "for loop" it will work
Joseph
@revisualize
Jan 05 2017 07:25

@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
@MaeStat thx
CamperBot
@camperbot
Jan 05 2017 07:28
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
i will try it out
@MaeStat can you explain why my original code does not work?
sennator
@sennator2
Jan 05 2017 07:32
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
@rahul-thakoor may be last return breake out your for loop
Ghulam Shabir
@ghulamshabir
Jan 05 2017 07:34
arr = arr.slice(size, -1); is reducing your array
Alex
@MaeStat
Jan 05 2017 07:35
@rahul-thakoor and inerations over loop stoped
sennator
@sennator2
Jan 05 2017 07:36
@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