These are chat archives for FreeCodeCamp/HelpJavaScript

21st
Aug 2016
Stephen James
@sjames1958gm
Aug 21 2016 00:00
@Neralizer Not SLATAN :)
Christian
@Neralizer
Aug 21 2016 00:00
haha I would have loved to have Ibra on the team, or Sadio Mane, just some variety
right now it's just Giroud and Welbeck, and Welbeck isn't back until Christmas
Chelsea actually has depth in Costa and Batschuyi or however you spell it
function mutation(arr) {
  if (arr[0].indexOf(arr[1]['']) !== -1){
    return true;
  }
  else {
   return false; 
  }

}

mutation(["hello", "hey"]);
anyway, am I on the right track with the bracket notation?
Stephen James
@sjames1958gm
Aug 21 2016 00:02
@Neralizer Yeah Bats... has been crucial in two goals
Diego Mayer
@Chrono79
Aug 21 2016 00:02
@Neralizer ['']?
Christian
@Neralizer
Aug 21 2016 00:03
searching the characters for the second string in the array
Stephen James
@sjames1958gm
Aug 21 2016 00:03
@Neralizer You are going to need a loop over arr[1] using arr[1][i]
friscodisco
@friscodisco
Aug 21 2016 00:03
@Salim-K the challenge is asking for you to immediately exit and return undefined if your inputs a or b are less than zero...so you will need to create an if statement with the early return.
Christian
@Neralizer
Aug 21 2016 00:07
@sjames1958gm do I need to loop over arr[1] to iterate through the characters?
because I don't see how indexOf comes into play there
Stephen James
@sjames1958gm
Aug 21 2016 00:08
@Neralizer Once you have the individual characters then you can use arr[1].indexOf
Christian
@Neralizer
Aug 21 2016 00:08
okay, sounds good
I'll be back
Salim K.
@Salim-K
Aug 21 2016 00:09
thanks @friscodisco ... yeah I proceeded that way and wonder what to return :)
CamperBot
@camperbot
Aug 21 2016 00:09
salim-k sends brownie points to @friscodisco :sparkles: :thumbsup: :sparkles:
:cookie: 305 | @friscodisco |http://www.freecodecamp.com/friscodisco
friscodisco
@friscodisco
Aug 21 2016 00:10
@Salim-K you want to return undefined with no quotes around undefined, as it is a reserved keyword and not a string
so if it is less than 0, you want to return undefined, or else the rest of the code on line 13 will be free to run
Salim K.
@Salim-K
Aug 21 2016 00:12
thank you @friscodisco , I was complicating things
CamperBot
@camperbot
Aug 21 2016 00:12
salim-k sends brownie points to @friscodisco :sparkles: :thumbsup: :sparkles:
:warning: salim-k already gave friscodisco points
Christian
@Neralizer
Aug 21 2016 00:33
@sjames1958gm are you still there?
function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){

  }
  return arr;
}

mutation(["hello", "hey"]);
is my loop on the right track?
Stephen James
@sjames1958gm
Aug 21 2016 00:33
@Neralizer YEs
@Neralizer and yes
Christian
@Neralizer
Aug 21 2016 00:34
okay, so I'm iterating through the characters of the second string in the array
and I need to check if every character is in arr[0]?
sorry, I'm struggling with this one
function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){
    if (arr[1][i] == arr[0]) {
      return true;
    }
    else {
      return false;
    }
  }

}

mutation(["hello", "hey"]);
Stephen James
@sjames1958gm
Aug 21 2016 00:38
@Neralizer Remember we were going to use indexOf
Christian
@Neralizer
Aug 21 2016 00:38
shoot yeah

function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){
    if (arr[0].indexOf[i] !== -1) {
      return true;
    }
    else {
      return false;
    }
  }

}

mutation(["hello", "hey"]);
Christian
@Neralizer
Aug 21 2016 00:43
if i is in the first array...
return true?
jeanelleyy
@jeanelleyy
Aug 21 2016 00:45
Hi all. Can someone help me figure out why this doesn't convert <> but converts strings when they're separate?
function convertHTML(str) {
  // &colon;&rpar;
  str=str.replace(/[\&\\<\>\'\"]+/gi,function(match){
    switch(match){
      case "&":
        return "&amp;";
      case "<":
        return "&lt;";
      case ">":
        return "&gt;";
      case "'":
        return "&apos;";
      case '"':
        return "&quot;";
      default:
        return match;
    }
  });
  return str;
}

convertHTML("<>");
Stephen James
@sjames1958gm
Aug 21 2016 00:48
@Neralizer This is the a most common mistake - you cannot return true until all the letters are checked.
@jeanelleyy Because the + will match multiple characters try removing that
Christian
@Neralizer
Aug 21 2016 00:50
do I need to check the letters of the first array as well?
Stephen James
@sjames1958gm
Aug 21 2016 00:50
@Neralizer No this is a one-way check.
Christian
@Neralizer
Aug 21 2016 00:50
what do you mean by that
@sjames1958gm
Stephen James
@sjames1958gm
Aug 21 2016 00:51
@Neralizer You are only checking arr[1] in arr[0] not the other way around.
jeanelleyy
@jeanelleyy
Aug 21 2016 00:51
@sjames1958gm oh that makes sense. thank you!
CamperBot
@camperbot
Aug 21 2016 00:51
jeanelleyy sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2756 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 21 2016 00:51
@jeanelleyy :+1:
Christian
@Neralizer
Aug 21 2016 00:52
okay
I get that
isn't that what I'm doing though? checking if the characters in arr 1 are in arr 0?
AnshulDawar
@anshuldawar
Aug 21 2016 00:56

function bouncer(arr) {
// Don't show a false ID to this bouncer.
arr = arr.filter(Falsybouncer);
return arr;
}
function Falsybouncer(value)
{
if(value===""||value===false||value===null||value===0||value==isNaN||value===undefined)
return false;
return true;
}

bouncer([7, "ate", "", false, 9]);

whats wrong with this code?
Diego Mayer
@Chrono79
Aug 21 2016 00:59
@anshuldawar value==isNaN is wrong
Use value!=value
AnshulDawar
@anshuldawar
Aug 21 2016 01:00
@Chrono79 so what should i use?
Christian
@Neralizer
Aug 21 2016 01:00
@anshuldawar check your operator
Stephen James
@sjames1958gm
Aug 21 2016 01:02
@Neralizer You asked if you had to check the letters of the first array, maybe I misunderstood.
I thought you meant characters in the first array in the second.
Christian
@Neralizer
Aug 21 2016 01:04
no, I'm wondering if I need to nest loop statements to iterate through the characters in the first array
in this case "hello"
@sjames1958gm
Stephen James
@sjames1958gm
Aug 21 2016 01:05
@Neralizer The indexOf is an implicit loop.
arr[0].indexOf(arr[1][i])
Christian
@Neralizer
Aug 21 2016 01:06
I thought that would work, but I tried it and got an error
cannot read property 0 of undefined
Stephen James
@sjames1958gm
Aug 21 2016 01:06
@Neralizer Let me see.
Christian
@Neralizer
Aug 21 2016 01:07

function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){
    if (arr[0].indexOf[1][i] !== -1) {
      return true;
    }
    else {
      return false;
    }
  }

}

mutation(["hello", "hey"]);
Diego Mayer
@Chrono79
Aug 21 2016 01:07
@Neralizer indexOf[1] where is arr there?
AnshulDawar
@anshuldawar
Aug 21 2016 01:07
i use boolean in the place of if(statement) thanks @Neralizer @Chrono79
CamperBot
@camperbot
Aug 21 2016 01:07
anshuldawar sends brownie points to @neralizer and @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 285 | @neralizer |http://www.freecodecamp.com/neralizer
:star2: 1860 | @chrono79 |http://www.freecodecamp.com/chrono79
Stephen James
@sjames1958gm
Aug 21 2016 01:07
@Neralizer indexOf is a function and you are treating it like an array - also you need to use arr[1][i]
Diego Mayer
@Chrono79
Aug 21 2016 01:08
@anshuldawar that's a better way, but knowing how to test for NaN is a plus ;)
Christian
@Neralizer
Aug 21 2016 01:08
good call @Chrono79
Joseph
@revisualize
Aug 21 2016 01:08
~~
Christian
@Neralizer
Aug 21 2016 01:08
getting closer
@sjames1958gm indexOf is a method, I believe
I'm using the link they gave to us
specifically the checking occurrences section
Stephen James
@sjames1958gm
Aug 21 2016 01:10
@Neralizer a method is a function defined on an object - so you still call it as a function - arr[0].indexOf(arr[1][i])
Christian
@Neralizer
Aug 21 2016 01:10
oh okay
i get you
Stephen James
@sjames1958gm
Aug 21 2016 01:10
@Neralizer That is the right section of that page
Christian
@Neralizer
Aug 21 2016 01:12
I'm still missing "hello" "hey" return false, "mary" "army" return true, and a few others
but that catch on the arr[1][i] was big

function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){
    if (arr[0].indexOf(arr[1][i]) !== -1) {
      return true;
    }
    else {
      return false;
    }
  }

}

mutation(["hello", "hey"]);
I just don't get what's off with it now
Stephen James
@sjames1958gm
Aug 21 2016 01:13
@Neralizer Let's consider the case "hello" "hey" what happens on the first pass through the loop when arr[1][i] = "h"?
Christian
@Neralizer
Aug 21 2016 01:14
true
jamesmillerho
@jamesmillerho
Aug 21 2016 01:14
arr[1] = "hey";
arr[1][0] = "h"
arr[0].indexOf(arr[1][0]) !== -1)
true
Stephen James
@sjames1958gm
Aug 21 2016 01:14
@Neralizer true is what it is doing, but true is wrong
@Neralizer You cannot return true (exitting the function) until all the letters are checked.
Try reversing your condition (change !== to ===) and only return false inside the loop.
@Neralizer if with no else
Christian
@Neralizer
Aug 21 2016 01:16
still no go

function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){
    if (arr[0].indexOf(arr[1][i]) === -1) {
      return false;
    }

  }

}

mutation(["hello", "hey"]);
Stephen James
@sjames1958gm
Aug 21 2016 01:17
@Neralizer So anytime that I find a letter that is bad, I return false. What is only way that the loop can finish?
jamesmillerho
@jamesmillerho
Aug 21 2016 01:17
@Neralizer toLowerCaser()
Stephen James
@sjames1958gm
Aug 21 2016 01:18
@Neralizer @jamesmillerho (you will need to toLowerCase the values) but that is not key to this issue.
Christian
@Neralizer
Aug 21 2016 01:18
i thought it was this

function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){
    if (arr[0].indexOf(arr[1][i]) === -1) {
      return false;
    }
    if (arr[0].indexOf(arr[1][i]) !== -1){
      return true;
    }
  }

}

mutation(["hello", "hey"]);
Stephen James
@sjames1958gm
Aug 21 2016 01:19
@Neralizer No, that just went back to where we were. If you only have the return false, then when the loop completes all the letters are good
Then, and only then, should you return true.
Christian
@Neralizer
Aug 21 2016 01:21
I don't get that
@sjames1958gm let me go back to this top
anytime I find a letter that is bad, i return false. what is the only way that the loop can finish
the only way the loop finishes is if no bad letters are found
then it returns true @sjames1958gm
no?
Stephen James
@sjames1958gm
Aug 21 2016 01:23
yes, but outside the loop
Christian
@Neralizer
Aug 21 2016 01:24
function mutation(arr) {
  for (var i = 0; i < arr[1].length; i++){
    if (arr[0].indexOf(arr[1][i]) === -1) {
      return false;
    }

  }
  return true;
}

mutation(["hello", "hey"]);
Anthony Drane
@Antiaccess
Aug 21 2016 01:24
Can anyone see why this isn't working?
singleVal = array.reduce(function(previousVal, currentVal){
  return previousVal - currentVal;
});
for reducing an array
Stephen James
@sjames1958gm
Aug 21 2016 01:25
Yes!, now it won't pass all because of case sensitivity.
You can add the following at the top and keep the rest
arr[0] = arr[0].toLowerCase()
arr[1] = arr[1].toLowerCase()
Anthony Drane
@Antiaccess
Aug 21 2016 01:25
it seems to get the right number outcome, but won't pass the test
Stephen James
@sjames1958gm
Aug 21 2016 01:26
@Antiaccess Which challenge.
Anthony Drane
@Antiaccess
Aug 21 2016 01:26
condense arrays with reduce (javascript basics)
Stephen James
@sjames1958gm
Aug 21 2016 01:26
@Antiaccess Read the instructions below the example on the left carefully - you missed one key word.
Christian
@Neralizer
Aug 21 2016 01:27
aaaaamazing
we got it
thanks @sjames1958gm
CamperBot
@camperbot
Aug 21 2016 01:27
neralizer sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2757 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 21 2016 01:27
@Neralizer Yes we did.
Christian
@Neralizer
Aug 21 2016 01:27
thanks @jamesmillerho
CamperBot
@camperbot
Aug 21 2016 01:27
neralizer sends brownie points to @jamesmillerho :sparkles: :thumbsup: :sparkles:
:cookie: 385 | @jamesmillerho |http://www.freecodecamp.com/jamesmillerho
Anthony Drane
@Antiaccess
Aug 21 2016 01:27
@sjames1958gm oh it was sum >.<
thanks
Christian
@Neralizer
Aug 21 2016 01:28
so I still don't get why I had to get true out of the loop
Joseph
@revisualize
Aug 21 2016 01:28
What the hell is a factory?
Stephen James
@sjames1958gm
Aug 21 2016 01:28
@Neralizer That part of checking for failure inside the loop and return true after the loop is common enough that there is an array function called .every to handle it.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every
@Antiaccess :+1: :checkered_flag:
@revisualize A factory is an object that generates other objects.
Christian
@Neralizer
Aug 21 2016 01:29
sick, I'm bookmarking it for later
my brain is fried
thanks again, this one really rocked me
Stephen James
@sjames1958gm
Aug 21 2016 01:29
@Neralizer What do you teach? Is school starting soon for you?
Mike
@MikeJSchorah
Aug 21 2016 01:30
function rot13(str) { // LBH QVQ VG!
  for (var i = 0; i < str.length; i++) {
    var tempChar = String.fromCharCode(str.charCodeAt(i)+13);
  }
  if (tempChar > 26) {
    tempChar === 
  }
  return tempChar;
}
  return str;
}
I know that this code is completely mangled, but could someone please help with Caesars Cipher?
Christian
@Neralizer
Aug 21 2016 01:30
I teach English actually, which is why I might struggle with these challenges lol
but I also teach comp sci, so I should be better at this. Thankfully, this javascript is taught in AP, and I only teach the intro course
html5, css, scratch. these I can handle
jamesmillerho
@jamesmillerho
Aug 21 2016 01:31
@MikeJSchorah A-M charCode +13
but N-Z charCode - 13
Mike
@MikeJSchorah
Aug 21 2016 01:31
Really? This JavaScript i taught in AP? Which JavaScript?
Christian
@Neralizer
Aug 21 2016 01:33
yeah, code.org sponsors curriculum which is used country wide now. my class handles basic if/then, while, functions, but I'm not sure what AP handles
Stephen James
@sjames1958gm
Aug 21 2016 01:33
@MikeJSchorah Mike, if you are going to have a loop, you probably need all the code inside it.
  • start with str.charCodeAt(i) - maybe assign that to a var inside your loop.
    Then check that it is between A and M and add 13, or N and Z subtract 13
    Then build a new string with the String.fromCharCode() of that variable.
    Here is a bonus - put these at the top of your code, then these variables can be used so you don't have
    to know the char code for A, M or Z
    var A = "A".charCodeAt(0);
    var M = "M".charCodeAt(0);
    var Z = "Z".charCodeAt(0);
Mike
@MikeJSchorah
Aug 21 2016 01:33
I breezed through Free Code Camp's intro to JavaScript course, but these algorithms are KILLING ME... and I'm only doing the intro to algorithms... :[
Christian
@Neralizer
Aug 21 2016 01:34
I know @MikeJSchorah , same here. A lot of the time, the intro to javascript is easy because we are just copying to learn, but the beauty of the algorithms is that it forces us to go back to the things we breezed through to make sure we really understand them
thus the "learning by doing" philosophy this website adopts, which is really solid in my opinion
Mike
@MikeJSchorah
Aug 21 2016 01:35
I didn't copy anything in FCC's intro to Javascript, but I have experience with JavaScript elsewhere
I got every problem right on the first try for the first 2/3s of it
There is just a lot of things that I haven't seen before. It seems like JavaScript is a very broad language. Not once did I think I saw getElementById in the FCC challenges that I have completed so far... Nothing about the DOM, forms, etc. Alot of it seems new for me...
Christian
@Neralizer
Aug 21 2016 01:37
haha no, sorry @MikeJSchorah , not accusing you of cheating, I mean a lot of the time they give you an example in the code, like ourArr or something, and then you have to do the same thing with myArr
which is a lot easier than, here's your algorithm, good luck
RAMIRAK
@RAMIRAK
Aug 21 2016 01:39
anyone else have any troubles with the JS Escaping Literal Quotes in Strings problem
Mike
@MikeJSchorah
Aug 21 2016 01:39
Oh yeah, lol. But when I mean I breezed through Intro to JavaScript, I mean I completed it in about 2 hours... lol. But, like I said, I have experience elsewhere. These algorithms are taking about 2-3 hours spread across a day or two.
RAMIRAK
@RAMIRAK
Aug 21 2016 01:41
i tossed this in and with wont let me pass var myStr = "I am a \"double quoted\" string inside \"double quotes\". ";
jamesmillerho
@jamesmillerho
Aug 21 2016 01:41
finished polishing my algorithm solutions :)
Stephen James
@sjames1958gm
Aug 21 2016 01:42
@RAMIRAK Make sure you didn't delete any spaces when adding \
@RAMIRAK Hmm, looks find - maybe refresh the page.
jamesmillerho
@jamesmillerho
Aug 21 2016 01:46
@MikeJSchorah algorithms are fun
Joseph
@revisualize
Aug 21 2016 01:48
Hello.
RAMIRAK
@RAMIRAK
Aug 21 2016 01:48
yah ! after refreshing it worked ... noticed after i reset the code the checked mark was still there ! thanks :) @sjames1958gm
jamesmillerho
@jamesmillerho
Aug 21 2016 01:48
@MikeJSchorah you will soon find that you are replacing your old 20-lines solution with a 3-5 lines, or even 1line
like magic
@revisualize learned an insane solution to sum all primes today

@revisualize

function sumPrimes(num){
  var sum = 0;
  for(var i=2; i<=num; i++){
    if(!Array(i+1).join(1).match(/^(11+)\1+$/)){
      sum+=i;}
  }
  return sum;
}

sumPrimes(10);

don't ask me how

Joseph
@revisualize
Aug 21 2016 01:59
I haven't worked on that lesson yet.
Yeyo Selso Poche
@Naxell
Aug 21 2016 02:00
guys where can i get mor info about javascript....coz sometime i dont understand some statement
please......
Jay Song
@gnosyaj
Aug 21 2016 02:02

In JavaScript, String values are immutable, which means that they cannot be altered once created.

For example, the following code:

var myStr = "Bob";
myStr[0] = "J";
cannot change the value of myStr to "Job", because the contents of myStr cannot be altered. Note that this does not mean that myStr cannot be changed, just that the individual characters of a string literal cannot be changed. The only way to change myStr would be to assign it with a new string, like this:

var myStr = "Bob";
myStr = "Job";
Instructions
Correct the assignment to myStr to achieve the desired effect.

// Setup
var myStr = "Jello World";

// Only change code below this line
myStrxamarin/xamarin-android@a16673d = "H"; // Fix Me

friscodisco
@friscodisco
Aug 21 2016 02:10
woah
LOL
friscodisco
@friscodisco
Aug 21 2016 02:10
inception
lol
pahosler
@pahosler
Aug 21 2016 02:10
right!
Yeyo Selso Poche
@Naxell
Aug 21 2016 02:11
is there another diferent that those pages....
jamesmillerho
@jamesmillerho
Aug 21 2016 02:11
@Naxell lol
@Naxell just follow freecodecamp roadmap
friscodisco
@friscodisco
Aug 21 2016 02:12
Yeyo Selso Poche
@Naxell
Aug 21 2016 02:12
@jamesmillerho are you kidding me or something...
jamesmillerho
@jamesmillerho
Aug 21 2016 02:13
@Naxell yes the exercises will tell you which pages to read
there are links
Yeyo Selso Poche
@Naxell
Aug 21 2016 02:14
@friscodisco lol....
@friscodisco good joke
jamesmillerho
@jamesmillerho
Aug 21 2016 02:19
Joseph
@revisualize
Aug 21 2016 02:20
Okay, I need a little assistance.
Jedwards40
@Jedwards40
Aug 21 2016 02:20

I am on the "Make Object Properties Private"

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

Can someone tell me why, when for the set method, I have to use the literal spelling of set as a property.
This makes no sense to me so any reasonable answer will help

Joseph
@revisualize
Aug 21 2016 02:20

I'm trying to tackle this problem:

function convertHTML(str) {
  // &colon;&rpar;
  var htmlChars = {
      "<": "&lt;",
      ">": "&gt;",
      "'": "&apos;",
      '"': "&quot;",
      "&": "&amp;"
   };
  var regex = "/" + Object.keys(htmlChars).join("") + "/g+";
  return str.replace(regex, (x) => htmlChars[x]);;
}

convertHTML("Dolce & Gabbana");

I'm clearly doing something wrong.

Dylan
@dhcodes
Aug 21 2016 02:21
@revisualize is this a challenge?
Joseph
@revisualize
Aug 21 2016 02:21
@dhcodes Yes.
Dylan
@dhcodes
Aug 21 2016 02:22
i'mma check it out
jamesmillerho
@jamesmillerho
Aug 21 2016 02:22
@revisualize try return regex and you will know why it doesn't work
Diego Mayer
@Chrono79
Aug 21 2016 02:23
@revisualize those aren't valid property names
Joseph
@revisualize
Aug 21 2016 02:23
'/<>\'"&/g+'
John
@tertiaryidentifier
Aug 21 2016 02:24
any idea why my fahrenheit / celsius won't toggle?
Joseph
@revisualize
Aug 21 2016 02:24
Is that my problem?
@Chrono79 Thanks. I'll look into how to correct that.
CamperBot
@camperbot
Aug 21 2016 02:24
revisualize sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1861 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Aug 21 2016 02:25
@revisualize you could simply use a switch
Joseph
@revisualize
Aug 21 2016 02:25
hashtag-lame
But, yeah.
John
@tertiaryidentifier
Aug 21 2016 02:25
you may have to click through my link for full functionality
Joseph
@revisualize
Aug 21 2016 02:25
That switch could become really really really large.
Diego Mayer
@Chrono79
Aug 21 2016 02:26
chained replaces is another option
or using 2 arrays (or arrays with subarrays, one element being the char you need to replace and another the replacement)
Joseph
@revisualize
Aug 21 2016 02:27
Yeah, I think I'll have to do that.
John
@tertiaryidentifier
Aug 21 2016 02:30
any ideas folks?
jamesmillerho
@jamesmillerho
Aug 21 2016 02:30
@tertiaryidentifier can't even acquire weather
John
@tertiaryidentifier
Aug 21 2016 02:30
@jamesmillerho, do not press enter, click the submit button
Gerren Jackson
@gerrenjj
Aug 21 2016 02:30
// Setup
var testObj = {
  "an entree": "hamburger",
  "my side": "veggies",
  "the drink": "water"
};

// Only change code below this line

testObj["an entree"]; // hamburger
testObj["the drink"]; // water
John
@tertiaryidentifier
Aug 21 2016 02:31
@jamesmillerho also you have to click through to codepen for full functionality
Gerren Jackson
@gerrenjj
Aug 21 2016 02:31
can anyone tell me whats wrong with this please?
Accessing Objects Properties with Bracket Notation
Instructions
Read the values of the properties "an entree" and "the drink" of testObj using bracket notation and assign them to entreeValue and drinkValue respectively.
jamesmillerho
@jamesmillerho
Aug 21 2016 02:32
@tertiaryidentifier $('#cels').hide();
$('#fahr').show();

cels & #fahr do not exist

Gary Siu
@GarySiu
Aug 21 2016 02:32
@gerrenjj You're accessing the values correctly but you haven't assigned them to variables
John
@tertiaryidentifier
Aug 21 2016 02:32
@jamesmillerho , where did you get that message?
jamesmillerho
@jamesmillerho
Aug 21 2016 02:33
@tertiaryidentifier I just read your code
Joseph
@revisualize
Aug 21 2016 02:33
@Chrono79 Well, I had an idea that I thought was good. And... Sadly, it didn't pan out. LOL.
jamesmillerho
@jamesmillerho
Aug 21 2016 02:33
@tertiaryidentifier your code don't have any element that has th id "cels" or "fahr" how can you call them
Gerren Jackson
@gerrenjj
Aug 21 2016 02:33
@GarySiu I followed the example so I cannot tell how to assign them to variables
Stephen James
@sjames1958gm
Aug 21 2016 02:33
@revisualize var regex = new RegExp("[" + Object.keys(htmlChars).join("") + "]", "g");
John
@tertiaryidentifier
Aug 21 2016 02:34
@jamesmillerho , #cels and #fahr are written on line 63 + 64ish of javascript,
 $('.blockyInfo').append('<h2 id="cels">'+celsius+' degrees celsius </h2>');
        $('.blockyInfo').append('<h2 id="fahr">'+fahr+' degrees fahrenheit </h2>');
Joseph
@revisualize
Aug 21 2016 02:34
@sjames1958gm But, am I using correct property names?
pahosler
@pahosler
Aug 21 2016 02:34
@tertiaryidentifier you have to use ... I think it's called after, if you create id's in your javascript, lemme see if I can find a ref quickly
Joseph
@revisualize
Aug 21 2016 02:34
Can "<" be a property name?
Stephen James
@sjames1958gm
Aug 21 2016 02:34
@revisualize Yes. Any string can be.
John
@tertiaryidentifier
Aug 21 2016 02:34
thanks @pahsoler. I had a suspicion that was my problem, but I didn't really know what or how to call it
CamperBot
@camperbot
Aug 21 2016 02:34
tertiaryidentifier sends brownie points to @pahsoler :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for pahsoler
Joseph
@revisualize
Aug 21 2016 02:35
Really.
Stephen James
@sjames1958gm
Aug 21 2016 02:35
@revisualize I believe so.
John
@tertiaryidentifier
Aug 21 2016 02:37
merp. okay ... will plow through this reading haha. thanks @pahosler
CamperBot
@camperbot
Aug 21 2016 02:37
tertiaryidentifier sends brownie points to @pahosler :sparkles: :thumbsup: :sparkles:
:cookie: 363 | @pahosler |http://www.freecodecamp.com/pahosler
pahosler
@pahosler
Aug 21 2016 02:37
I just ran across it yesterday looking at something else :D
jamesmillerho
@jamesmillerho
Aug 21 2016 02:37
@tertiaryidentifier then I don't know. I create the element in html and it's easier to manipulate
John
@tertiaryidentifier
Aug 21 2016 02:37
maybe I can just create the ids in my html ... that would make like easier :D
Joseph
@revisualize
Aug 21 2016 02:37
@sjames1958gm FREAKING AWESOME!
It worked.
Stephen James
@sjames1958gm
Aug 21 2016 02:38
@revisualize :) :checkered_flag:
Joseph
@revisualize
Aug 21 2016 02:39
@sjames1958gm Thank you. That is awesome.
function convertHTML(str) {
  // &colon;&rpar;
  const htmlChars = {
      "<": "&lt;",
      ">": "&gt;",
      "'": "&apos;",
      '"': "&quot;",
      "&": "&amp;"
   };
  let regex = new RegExp("[" + Object.keys(htmlChars).join("") + "]", "g");
  return str.replace(regex, (x) => htmlChars[x]);
}
CamperBot
@camperbot
Aug 21 2016 02:39
revisualize sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2758 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
pahosler
@pahosler
Aug 21 2016 02:40
that's pretty cool actually @revisualize !
Joseph
@revisualize
Aug 21 2016 02:41
@pahosler Yeah, Because you could technically go through the whole list of &; characters and make a large object.
pahosler
@pahosler
Aug 21 2016 02:41
I wussed out on that one and just used switch/case
jamesmillerho
@jamesmillerho
Aug 21 2016 02:42
@sjames1958gm what do those square brackets do in new RegExp?
Joseph
@revisualize
Aug 21 2016 02:42
@sjames1958gm I didn't know about the new RegExp
jamesmillerho
@jamesmillerho
Aug 21 2016 02:42
lol magic again
Joseph
@revisualize
Aug 21 2016 02:42
@jamesmillerho Those are needed for regex magic
@jamesmillerho Let me get you the info.
Stephen James
@sjames1958gm
Aug 21 2016 02:43
@jamesmillerho Those are just the the regex brackets that make it an alternative just like /[a-z0-9]/
Joseph
@revisualize
Aug 21 2016 02:43

[xyz]
[a-c]
A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character.

For example, [abcd] is the same as [a-d]. They match the "b" in "brisket" and the "c" in "chop".

pahosler
@pahosler
Aug 21 2016 02:44
square brackets are for things like [a-z0-9|A-Z|#$%] and the | are basically or's
landodewd
@landodewd
Aug 21 2016 02:44

I am having trouble with Increment a Number with JavaScript. Change the code to use the ++ operator on myVar.
var myVar = 87;

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

Gerren Jackson
@gerrenjj
Aug 21 2016 02:45
@GarySiu var myObj = { "Space Name": "Kirk", "More Space": "Spock" }; myObj["Space Name"]; // Kirk myObj['More Space']; // Spock
pahosler
@pahosler
Aug 21 2016 02:45
when you use RegExp() you don't need the / /
Joseph
@revisualize
Aug 21 2016 02:45
@landodewd
var num = 5;
num = num + 1; // 6
num += 1; // 7
num++; // 8
Gerren Jackson
@gerrenjj
Aug 21 2016 02:45
This message was deleted
Gary Siu
@GarySiu
Aug 21 2016 02:46
@gerrenjj I'm sorry, was there a question?
Gerren Jackson
@gerrenjj
Aug 21 2016 02:47
@GarySiu entreeValue should be a string
The value of entreeValue should be "hamburger"
drinkValue should be a string
The value of drinkValue should be "water"
You should use bracket notation twice
Stephen James
@sjames1958gm
Aug 21 2016 02:47
@landodewd Don't overthink this one. The example is replace i = i + 1 with i++
so you have myVar = myVar + 1 so replace this with ?
Gerren Jackson
@gerrenjj
Aug 21 2016 02:47

@GarySiu ```
// Setup
var testObj = {
"an entree": "hamburger",
"my side": "veggies",
"the drink": "water"
};

// Only change code below this line

testObj ["an entree"] = "hamburger";
testObj ["the drink"] = "water";
```

Joseph
@revisualize
Aug 21 2016 02:48
Why are you doing assignment?
Gerren Jackson
@gerrenjj
Aug 21 2016 02:48
@GarySiu var myObj = {
"Space Name": "Kirk",
"More Space": "Spock"
};
myObj["Space Name"]; // Kirk
myObj['More Space']; // Spock
@GarySiu mine looks no different from the example
Joseph
@revisualize
Aug 21 2016 02:49
if you're trying to do a comparison you need to use == or ===
landodewd
@landodewd
Aug 21 2016 02:49
@sjames1958gm I honestly have no idea.
Stephen James
@sjames1958gm
Aug 21 2016 02:50
@landodewd Replace myVar is just like i
revisualize @revisualize has to leave.
Gary Siu
@GarySiu
Aug 21 2016 02:50

@gerrenjj

Instructions
Read the values of the properties "an entree" and "the drink" of testObj using bracket notation and assign them to entreeValue and drinkValue respectively.

@gerrenjj You have not assigned anything to entreeValue or drinkValue
Stephen James
@sjames1958gm
Aug 21 2016 02:51
entreeValue = something
landodewd
@landodewd
Aug 21 2016 02:51
Thank you @sjames1958gm
CamperBot
@camperbot
Aug 21 2016 02:51
landodewd sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2759 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 21 2016 02:51
@landodewd :+1:
Nick Oliver
@NIOliver
Aug 21 2016 02:57

I'm looking for help with: https://www.freecodecamp.com/challenges/record-collection

I'm not sure what they're asking me to do.

Gary Siu
@GarySiu
Aug 21 2016 03:00
@NIOliver You're writing a function to update a JSON object
kimstopmik
@kimstopmik
Aug 21 2016 03:04
@NIOliver just read through the instructions again maybe, then follow them while coding. the text is already layed out that way that you can translate it into code more or less easily
@NIOliver If ... this ... then ... that. and so on :smile:
Nick Oliver
@NIOliver
Aug 21 2016 03:06
I'm
OK
The part that has me stuck is identifying the objects by id. I understand that they are xamarin/xamarin-android@a16673d, 1, 2, etc. in the array, but I'm not sure how to access them using an if statement
what the fuuuck
1
[1]
I meant that
kimstopmik
@kimstopmik
Aug 21 2016 03:09
ok
Gary Siu
@GarySiu
Aug 21 2016 03:11
@NIOliver Did you do the previous exercises?
kimstopmik
@kimstopmik
Aug 21 2016 03:11
@NIOliver how to access (multi-dimensional) arrays is shown for example here https://www.freecodecamp.com/challenges/access-multidimensional-arrays-with-indexes but you probably know already. now, think about what you have or will have as parameters in your called function. then think about how you can make sure that these parameters are compared with the actual key names in the array
Dylan
@dhcodes
Aug 21 2016 03:12
@Ekene96 the \ goes before the "
@Ekene96 also watch for typos
you have Iam
should be I am
Nick Oliver
@NIOliver
Aug 21 2016 03:12
@Ekene96 var myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line
Dylan
@dhcodes
Aug 21 2016 03:13
@NIOliver :(
Nick Oliver
@NIOliver
Aug 21 2016 03:13
@GarySiu Yeah, I've done them all one-by-one @kimstopmik for whatever reason, the previous examples are having me at a loss
@Ekene96 what you need to pay attention to is the placement of the \ in relation to the quotes
kimstopmik
@kimstopmik
Aug 21 2016 03:14
@NIOliver "having me at a loss" means you don't understand them?
Nick Oliver
@NIOliver
Aug 21 2016 03:14
@Ekene96 if you're trying to escape the quotation marks, you use the escape \ right before it
kimstopmik
@kimstopmik
Aug 21 2016 03:14
(no native speaker here :smile: )
Brian Schamp
@bschamp
Aug 21 2016 03:14
Trying to escape special characters. I think I am missing some backslashes but dont know where
var myStr = "FirstLine\nSecondLine\rThirdLine"; // Change this line
Nick Oliver
@NIOliver
Aug 21 2016 03:15
@kimstopmik Yes, it would be like, "have me at a loss for words." Which means that I am unable to even begin to describe what I am seeing.
kimstopmik
@kimstopmik
Aug 21 2016 03:15
@NIOliver oh okay, that's worse than expected :smile:
Nick Oliver
@NIOliver
Aug 21 2016 03:15
@bschamp link the exercise please
Nick Oliver
@NIOliver
Aug 21 2016 03:16
@kimstopmik well, I'm just explaining the idiomatic expression. In this case, I can understand what I am seeing on the page, I just don't know how to make what it is showing me apply to the challenge I am trying to accomplish
Dan
@MuskratDetective
Aug 21 2016 03:16

I don't understand how to do this at all: https://www.freecodecamp.com/challenges/testing-objects-for-properties

The example is nothing like what the instruction are telling me to do. I don't know what I'm missing

Nick Oliver
@NIOliver
Aug 21 2016 03:16
Does that make sense?
kimstopmik
@kimstopmik
Aug 21 2016 03:16
@NIOliver starting with which excercise exactly you're having a loss then?
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:17
Ekene96
@Ekene96
Aug 21 2016 03:17
Please your help is would be highly appreciated
kimstopmik
@kimstopmik
Aug 21 2016 03:17
@MuskratDetective "Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found"."
Nick Oliver
@NIOliver
Aug 21 2016 03:18
@bschamp you're missing some backslashes
kimstopmik
@kimstopmik
Aug 21 2016 03:18
@MuskratDetective to simply test it there's the example given
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:18
Having some trouble with testing for the missing prop of "tracks" and then adding the "tracks" array to my object.
kimstopmik
@kimstopmik
Aug 21 2016 03:19
@MuskratDetective but what you mean is probably the "if the property..." part. so, look at the word given there: "If". and this should tell you what to do inside the function then
Nick Oliver
@NIOliver
Aug 21 2016 03:19
@joehalvarson I'm on that one. I don't really know where to begin
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:19
else if (prop === "tracks" && collection[id].hasOwnProperty("tracks") === FALSE) {
var newArray = [];
collection[id][prop] = newArray;
collection[id][prop].push(value);
I'm not sure if my condition is failing or if the way I'm trying to add the array is failing. This is about the sixth iteration I've used.
Thanks @NIOliver
CamperBot
@camperbot
Aug 21 2016 03:20
joehalvarson sends brownie points to @nioliver :sparkles: :thumbsup: :sparkles:
:cookie: 99 | @nioliver |http://www.freecodecamp.com/nioliver
kimstopmik
@kimstopmik
Aug 21 2016 03:20
@NIOliver @joehalvarson did you guys follow and read through the given links again?
Nick Oliver
@NIOliver
Aug 21 2016 03:20
@kimstopmik I did, I read through them all. I think my brain is just overwhelmed at the moment.
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:21
I did and I can't seem to find the information that I'm looking for in any of the links.
kimstopmik
@kimstopmik
Aug 21 2016 03:21
@NIOliver @joehalvarson the important part which was giving me a headache there is to actually use the bracket notation. took a while til i understood this "rule"
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:21
Have read through many different tutorials on how to add an array to an object, but nothing seems to be working.
I'm using the bracket notation as near as I can tell.
Dan
@MuskratDetective
Aug 21 2016 03:21
@kimstopmik Ok, that helps. I will try to figure it out from here.
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:22
collection[id][prop] = [];
kimstopmik
@kimstopmik
Aug 21 2016 03:22
@MuskratDetective yeah, otherwise ask again. just trying to not give away too many hints here :smile:
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:22
Shouldn't that work to add the array? I've now tried to create a new array in a variable and then add the array through the variable, but that doesn't seem to be working.
kimstopmik
@kimstopmik
Aug 21 2016 03:22
@joehalvarson yes, that should create an empty array
Dan
@MuskratDetective
Aug 21 2016 03:23
@kimstopmik I appreciate that. I remember better if I struggle through it myself anyway.
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:23
Maybe my condition is incorrect?
kimstopmik
@kimstopmik
Aug 21 2016 03:23
@MuskratDetective yes, same for me :smile:
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:24
I appreciate you bringing up those questions though, @kimstopmik
kimstopmik
@kimstopmik
Aug 21 2016 03:24

collection[id].hasOwnProperty("tracks")
this may be wrong, but i am not sure
or
wait
can you post your whole code?
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:25
function updateRecords(id, prop, value) {
if (prop !== "tracks" && value !== "") {
collection[id][prop] = value;
} else if (prop === "tracks" && collection[id].hasOwnProperty("tracks") === FALSE) {
var newArray = [];
collection[id][prop] = newArray;
collection[id][prop].push(value);
}
return collection;
}
Diego Mayer
@Chrono79
Aug 21 2016 03:25
@bschamp SecondLine should be enclosed between backslashes, look at the last line of challenge instructions
kimstopmik
@kimstopmik
Aug 21 2016 03:27
@joehalvarson first part seems fine, trying to figure out the rest :smile:
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:27
Thanks for the help @kimstopmik !
CamperBot
@camperbot
Aug 21 2016 03:27
joehalvarson sends brownie points to @kimstopmik :sparkles: :thumbsup: :sparkles:
:cookie: 250 | @kimstopmik |http://www.freecodecamp.com/kimstopmik
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:27
I assume I can compare the return value of hasOwnProperty with False, right?
kimstopmik
@kimstopmik
Aug 21 2016 03:28
yes
Nick Oliver
@NIOliver
Aug 21 2016 03:28
I'm starting mine with
if (collection[id].hasOwnProperty(prop))
kimstopmik
@kimstopmik
Aug 21 2016 03:28
also, you can use "!" infront of it instead of " === false"
Nick Oliver
@NIOliver
Aug 21 2016 03:29
and I used console.log to debug so at least I know that works o_O
kimstopmik
@kimstopmik
Aug 21 2016 03:29
if(!collection[id].hasOwnProperty("tracks"))
like this, but well that's not what you asked for now :smile:
Brian Schamp
@bschamp
Aug 21 2016 03:30
@Chrono79 I am going backslash crazy. var myStr = "FirstLine\n\\SecondLine\\r\ThirdLine"; Is the output supposed to show the new line break and carriage return?
Nick Oliver
@NIOliver
Aug 21 2016 03:31
I think that should be right @bschamp
Diego Mayer
@Chrono79
Aug 21 2016 03:31
@bschamp No, the output won't show those, now you have too many, note that what you write here is not the same as the chat shows
Delete the one before ThirdLine
Nick Oliver
@NIOliver
Aug 21 2016 03:32
@bschamp you have a backslash in the wrong spot on the right side
kimstopmik
@kimstopmik
Aug 21 2016 03:32
var newArray = [];
collection[id][prop] = newArray;
tyl-er
@tyl-er
Aug 21 2016 03:32

Not sure what I'm doing wrong on "Make Unique Objects by Passing Parameters to our Constructor".

Instructions:
Alter the Car constructor to use parameters to assign values to the wheels, seats, and engines properties.

Then call your new constructor with three number arguments and assign it to myCar to see it in action.

var Car = function(wheels, seats, engines) {
//Change this constructor
this.wheels = 4;
this.seats = 5;
this.engines = 1;
};

//Try it out here
var myCar = new Car(3, 1, 2);

Nick Oliver
@NIOliver
Aug 21 2016 03:32
@bschamp it should be \\\r because you need to put the backslash BEFORE the r, not AFTER it
kimstopmik
@kimstopmik
Aug 21 2016 03:33
what happens if you change that line into
Diego Mayer
@Chrono79
Aug 21 2016 03:33
@bschamp when pasting code use backticks, so the chat won't change it
kimstopmik
@kimstopmik
Aug 21 2016 03:33
collection[id][prop] = [];
Diego Mayer
@Chrono79
Aug 21 2016 03:33
This message was deleted
CamperBot
@camperbot
Aug 21 2016 03:33
no wiki entry for: format
kimstopmik
@kimstopmik
Aug 21 2016 03:33
@joehalvarson :point_up:
Brian Schamp
@bschamp
Aug 21 2016 03:33
@Chrono79 @NIOliver It took it. Thanks! I don't understand the point if it doesn't change the output and displays all the backslashes anyways
CamperBot
@camperbot
Aug 21 2016 03:33
bschamp sends brownie points to @chrono79 and @nioliver :sparkles: :thumbsup: :sparkles:
:cookie: 100 | @nioliver |http://www.freecodecamp.com/nioliver
:star2: 1862 | @chrono79 |http://www.freecodecamp.com/chrono79
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:34
@kimstopmik removing my === FALSE and adding the bang seems to have solved it. I had actually already changed back to
collection[id][prop] = [];
kimstopmik
@kimstopmik
Aug 21 2016 03:34
would also be interesting what your output is actually @joehalvarson
@joehalvarson maybe because you wrote FALSE instead of false?
you can try it out
think javascript is strictly case sensitive
Nick Oliver
@NIOliver
Aug 21 2016 03:35
it is
Diego Mayer
@Chrono79
Aug 21 2016 03:35

@bschamp

var myStr = "FirstLine\n\\SecondLine\\\rThirdLine";
console.log(myStr);

Try that in repl.it

Joseph Halvarson
@joehalvarson
Aug 21 2016 03:35
Haha. Quite clever. You're right. It does need to be false.
kimstopmik
@kimstopmik
Aug 21 2016 03:35
so writing faLse, false and FALSE are three different things :smile:
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:35
Indeed they are.
Tricky beast this.
Thanks again @kimstopmik and @NIOliver
CamperBot
@camperbot
Aug 21 2016 03:36
joehalvarson sends brownie points to @kimstopmik and @nioliver :sparkles: :thumbsup: :sparkles:
:warning: joehalvarson already gave nioliver points
:warning: joehalvarson already gave kimstopmik points
kimstopmik
@kimstopmik
Aug 21 2016 03:36
ok, glad it worked out :smile:
and for the future just use the "!" in front
comparing to false and true is mostly unnecessary
Nick Oliver
@NIOliver
Aug 21 2016 03:36

@bschamp they are trying to teach you how to escape a backslash so that a backslash would show up while inside of a "string"

to escape a backslash inside of a string: "Inside of a string \\" would output: Inside of a string \

kimstopmik
@kimstopmik
Aug 21 2016 03:37
if it should be true, just leave the === true part out, if it should be false, just use the ! in front
Nick Oliver
@NIOliver
Aug 21 2016 03:37
@kimstopmik how do I give you brownie points? I didn't know you could do that
kimstopmik
@kimstopmik
Aug 21 2016 03:38
because the "hasOwnProperty" for example will already return true for the conditional, it doesn't need to be compared again with "true" just to give another true out then :smile:
@NIOliver just write thanks and the name :smile:
CamperBot
@camperbot
Aug 21 2016 03:38
kimstopmik sends brownie points to @nioliver :sparkles: :thumbsup: :sparkles:
:cookie: 101 | @nioliver |http://www.freecodecamp.com/nioliver
kimstopmik
@kimstopmik
Aug 21 2016 03:38
@NIOliver but what about your problem there? any progress?
Nick Oliver
@NIOliver
Aug 21 2016 03:38
thanks @kimstopmik
CamperBot
@camperbot
Aug 21 2016 03:38
nioliver sends brownie points to @kimstopmik :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @kimstopmik |http://www.freecodecamp.com/kimstopmik
Nick Oliver
@NIOliver
Aug 21 2016 03:39
ayyyyyyyyyyyyy there it is. I'm not having much progress on my end
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:39
All right! Passed!
Dan
@MuskratDetective
Aug 21 2016 03:39

@kimstopmik this is what I have so far, but I'm unsure how to return the property.


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

function checkObj(checkProp) {
  // Your Code Here
  if ('myObj') {
     myObj.hasOwnProperty("checkProp");
  return "I don't know what goes here";
  }
  else {
    return "Not Found";
  }
}

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

am I even on the right track?

Nick Oliver
@NIOliver
Aug 21 2016 03:39
I just need some time to look at this
return myObj.checkProp?
isn't that what you want to output, is the value of the property?
Dan
@MuskratDetective
Aug 21 2016 03:43
@NIOliver If you were talking to me, than yes, I want to output the value of the property, but return myObj.checkProp didn't work either. I don't know if what I'm missing here.
Nick Oliver
@NIOliver
Aug 21 2016 03:43
@MuskratDetective link me to the challenge
Ekene96
@Ekene96
Aug 21 2016 03:43
please help me fix this
kimstopmik
@kimstopmik
Aug 21 2016 03:43
@MuskratDetective you're on the right track
kimstopmik
@kimstopmik
Aug 21 2016 03:43
but some little mistakes there
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:44
@MuskratDetective Check the way you have your IF condition formatted.
kimstopmik
@kimstopmik
Aug 21 2016 03:44
@joehalvarson the condition you want to check needs to be inside the () of the if statement
Nick Oliver
@NIOliver
Aug 21 2016 03:44
There might be a string where there ought not to be one
kimstopmik
@kimstopmik
Aug 21 2016 03:44
now read again what the condition is that you want to check
"Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found"."
Ekene96
@Ekene96
Aug 21 2016 03:45
someone please
kimstopmik
@kimstopmik
Aug 21 2016 03:45
@joehalvarson sorry, wrong name
@MuskratDetective the condition you want to check needs to be inside the () of the if statement
kimstopmik
@kimstopmik
Aug 21 2016 03:46
it's like
if ("what is inside here is true") {
then do this inside here
}
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:46
@Ekene96 It looks like you added some additional words to the string.
kimstopmik
@kimstopmik
Aug 21 2016 03:46
so, just think about what you want to check for being true?
Nick Oliver
@NIOliver
Aug 21 2016 03:47
@MuskratDetective right now, your if statement is asking: if the string myObj is true
kimstopmik
@kimstopmik
Aug 21 2016 03:47
which condition, better said
""Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value."
looking inside the instructions again
Ekene96
@Ekene96
Aug 21 2016 03:47
@joehalvarson how do I fix it... I checked everyything looks good but
kimstopmik
@kimstopmik
Aug 21 2016 03:47
@MuskratDetective :point_up_2:
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:48
@Ekene96 You typed out backslash and carriage return.
@Ekene96 I think that's throwing off the passing check.
Ekene96
@Ekene96
Aug 21 2016 03:48
@joehalvarson let me see
kimstopmik
@kimstopmik
Aug 21 2016 03:48
@MuskratDetective when you got this, we can continue with the next part :smile:
Dan
@MuskratDetective
Aug 21 2016 03:48
@kimstopmik so it would be something like this? if ('myObj.hasOwnProperty("checkProp")')
kimstopmik
@kimstopmik
Aug 21 2016 03:49
@MuskratDetective right!
This message was deleted
SmoothMove2000
@SmoothMove2000
Aug 21 2016 03:49
rge
ge
g
e
g
Nick Oliver
@NIOliver
Aug 21 2016 03:49
@MuskratDetective but you need to kill those errant quotation marks
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:50
@Ekene96 And it doesn't want spaces between the words FirstLine, SecondLine, and ThirdLine.
Dan
@MuskratDetective
Aug 21 2016 03:50
@NIOliver ok
Iavor Dekov
@ivdekov
Aug 21 2016 03:50
This message was deleted
kimstopmik
@kimstopmik
Aug 21 2016 03:51
@MuskratDetective and now, i think you know generally what to do there inside the if part
Ekene96
@Ekene96
Aug 21 2016 03:51
can you show me @joehalvarson . I still can't figure it out.
kimstopmik
@kimstopmik
Aug 21 2016 03:52
@MuskratDetective try what comes to your mind first, then we maybe need to fix it a bit :smile:
Dan
@MuskratDetective
Aug 21 2016 03:52

@kimstopmik so how do I return the value? I've tried this and it didn't work.

return myObj.checkProp;

kimstopmik
@kimstopmik
Aug 21 2016 03:53
@MuskratDetective yes, this won't work. it's because the dot notation doesn't work there with the given parameter
Dan
@MuskratDetective
Aug 21 2016 03:54
@kimstopmik so I need to use bracket notation?
kimstopmik
@kimstopmik
Aug 21 2016 03:54
@MuskratDetective i cannot explain this too well but i'd say generally dot notation will only work if you have a concrete name to work with but here you got a parameter
like a variable
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:54
This message was deleted
CamperBot
@camperbot
Aug 21 2016 03:54
:bulb: to format code use backticks! ``` more info
kimstopmik
@kimstopmik
Aug 21 2016 03:54
@MuskratDetective yes
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:55

@Ekene96 You currently have

var myStr = "Firstlinenewline\n backlash\\ SecondLine backlash\\ rriage-return\r Thirdline";

You need to delete the words newline, backlash, rriage-rreturn and the spaces in between.

Dan
@MuskratDetective
Aug 21 2016 03:56
@kimstopmik so, this should work? return myObj["checkProp"];
kimstopmik
@kimstopmik
Aug 21 2016 03:57
@MuskratDetective so, when using variables or parameters to access an objects property, always use [] bracket notation. as far as i know for now. this is maybe not to 100% true.
Joseph Halvarson
@joehalvarson
Aug 21 2016 03:57
@Ekene96 The escape sequences you've entered are correct. Just remove those words and spaces and you should be good.
kimstopmik
@kimstopmik
Aug 21 2016 03:57
@MuskratDetective without the strings
the " " i mean
Norvin Burrus
@ndburrus
Aug 21 2016 03:59
@MuskratDetective this may be helpful: :sparkles:
Dan
@MuskratDetective
Aug 21 2016 03:59

this is what I have


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

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

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

but it's still not working. I appreciate your assistance on this, it's driving me crazy.

Ekene96
@Ekene96
Aug 21 2016 03:59
like this: @joehalvarson : var myStr = "Firstline\n\SecondLine\\rThirdline"; // Change this line
kimstopmik
@kimstopmik
Aug 21 2016 03:59
delete " " in the if statement
because you're working with a parameter here (I'd say)
it will replace the parameter checkProp with the string "gift"
Norvin Burrus
@ndburrus
Aug 21 2016 04:00
@Ekene96
var myStr = "Firstlinenewline\n remove backslash backlash\ SecondLine remove backslash backlash\ remove this rriage-return add backslash code \r capitalize Line Thirdline";
  • need capitalization - FirstLine
  • looks like some excess tex at the end
Joseph Halvarson
@joehalvarson
Aug 21 2016 04:00
Almost, you deleted two of the \ characters as well.
kimstopmik
@kimstopmik
Aug 21 2016 04:00
or better said: insert the "gift" string for checkProp
@MuskratDetective :point_up:
Dan
@MuskratDetective
Aug 21 2016 04:02
@kimstopmik Ah, thanks. I'm still confused about when to use quotes and when not to. This stuff can drive me nuts.
CamperBot
@camperbot
Aug 21 2016 04:02
muskratdetective sends brownie points to @kimstopmik :sparkles: :thumbsup: :sparkles:
:cookie: 252 | @kimstopmik |http://www.freecodecamp.com/kimstopmik
Joseph Halvarson
@joehalvarson
Aug 21 2016 04:02
@Ekene96 What the instruction is saying without saying it is to remove the words and replace with the characters. So, replace newline with \n like you did, and replace backslash with \, but because \ is a special escape character, you need two \
Norvin Burrus
@ndburrus
Aug 21 2016 04:03
@Ekene96 comment/s :point_up: updated :sparkles:
kimstopmik
@kimstopmik
Aug 21 2016 04:04
@MuskratDetective yes, it's tricky to understand in the first place. i also struggled with when to use the brackets notation first. but just look if you're using a parameter/variable because this will "turn into" the string that you've given it. so no need for making the parameter itself a string there
and the same for the brackets notation
as far as i know for now :smile:
tyl-er
@tyl-er
Aug 21 2016 04:06
Can I get some help with Make Unique Objects by Passing Parameters to our Constructor?
Ekene96
@Ekene96
Aug 21 2016 04:06
@joehalvarson and @ndburrus I appreciate your help but I don't know why I can't still not figure this out
Joseph Halvarson
@joehalvarson
Aug 21 2016 04:06
@Ekene96 What do you have now?
JC
@jcolsen
Aug 21 2016 04:06
Anyone got a hint towards starting https://www.freecodecamp.com/challenges/record-collection ? I've been alright up until now, but here I don't even know where to begin.
Ekene96
@Ekene96
Aug 21 2016 04:07
@joehalvarson var myStr = "Firstline\n \ SecondLine \ \r Thirdline";
Joseph Halvarson
@joehalvarson
Aug 21 2016 04:08
@Ekene96 You need to remove the spaces, you're missing two \ characters and as @ndburrus pointed out, Line needs to be capitalized in all three words.
@Ekene96 Your link looks good. You have the right characters, you just need to remove the spaces and capitalize Line where it isn't capitalized.
Norvin Burrus
@ndburrus
Aug 21 2016 04:11
@Ekene96 :sparkles:
ok, we need to take the given string, here:
"FirstLine newline backslash SecondLine backslash carriage-return ThirdLine" (ignore the spacing) and carefully replace the appropriate text (bold words) with the escape coding (use the Code/Output chart)...
...clear as mud?
kimstopmik
@kimstopmik
Aug 21 2016 04:18
not directly related to a challenge:
can someone explain how the .map() method works? when i would want to capitalize every element from an array (consisting of strings only), how would i do this with .map()?
upperStr.map(.toUpperCase());
trying something like this, but obviously not working :smile:
Joseph Halvarson
@joehalvarson
Aug 21 2016 04:20
@jcolsen Some tips, you'll need to write the conditions that it requests. When those conditions are met, then you'll need to set the values. Use the three arguments that are given in your conditions and to put the right values into the correct keys.

@jcolsen I just completed this one myself after what turned out to be getting stuck writing one of my conditions. Also, you'll be using a technique that it doesn't specify to test the presence of one of the values. Be sure to review the links of the previous lessons. That will be helpful.

This one ultimately took me a few days of going back to it and researching and trying different things.

Sorin Ruse
@sorinr
Aug 21 2016 04:23
@kimstopmik try: upperStr.toUpperCase().map();
JC
@jcolsen
Aug 21 2016 04:23
@joehalvarson thanks, yeah I'm stuck on day 3. I think I understand the conditions, but when I try to do stuff when conditions are met, I keep getting "is not a function".
CamperBot
@camperbot
Aug 21 2016 04:23
jcolsen sends brownie points to @joehalvarson :sparkles: :thumbsup: :sparkles:
:cookie: 217 | @joehalvarson |http://www.freecodecamp.com/joehalvarson
kimstopmik
@kimstopmik
Aug 21 2016 04:24
@jcolsen what helps for a start, is to follow the instructions properly while thinking how the words given there could translate into code. you got some "Ifs" and so on in the text, which you could try to translate into code.
@jcolsen you could post your code and tell us what exactly the error is
JC
@jcolsen
Aug 21 2016 04:26
I just reset it, again. Let me make a new attempt and post it.
kimstopmik
@kimstopmik
Aug 21 2016 04:27
TypeError: undefined is not a function
@sorinr
Sorin Ruse
@sorinr
Aug 21 2016 04:28
@kimstopmik what exactly do you want to achieve?
kimstopmik
@kimstopmik
Aug 21 2016 04:29
@sorinr just wanting to make the .map() work in this case with the .toUpperCase() used for every string inside the array
@ndburrus thanks! some more reading, MDN didn't help me too much in this case :smile:
CamperBot
@camperbot
Aug 21 2016 04:30
kimstopmik sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1734 | @ndburrus |http://www.freecodecamp.com/ndburrus
RaymundRyan
@RaymundRyan
Aug 21 2016 04:30
help me pls! i'm stuck
CamperBot
@camperbot
Aug 21 2016 04:30
no wiki entry for: me pls im stuck
kimstopmik
@kimstopmik
Aug 21 2016 04:30
@RaymundRyan link to challenge and tell us what exactly your problem is
RaymundRyan
@RaymundRyan
Aug 21 2016 04:32
here
kimstopmik
@kimstopmik
Aug 21 2016 04:33
@ndburrus third link looks nice, thanks again!
CamperBot
@camperbot
Aug 21 2016 04:33
kimstopmik sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: kimstopmik already gave ndburrus points
Norvin Burrus
@ndburrus
Aug 21 2016 04:33
@kimstopmik you're welcome! enjoy! :palm_tree:
kimstopmik
@kimstopmik
Aug 21 2016 04:36
@RaymundRyan first, read/work through the challenge before again https://www.freecodecamp.com/challenges/initializing-variables-with-the-assignment-operator
@RaymundRyan then make sure you understand how "initializing" works
Joseph
@revisualize
Aug 21 2016 04:37
I really do like my solution for convertHTML challenge.
kimstopmik
@kimstopmik
Aug 21 2016 04:37
@RaymundRyan then proceed to your challenge https://www.freecodecamp.com/challenges/understanding-uninitialized-variables and read through the instructions properly again
@RaymundRyan there it says to "Initialize the three variables a, b, and c with 5, 10, and "I am a" respectively", which you should know how it works now, after doing the challenge before again properly
@RaymundRyan if not, tell us what exactly the problem is :smile:
RaymundRyan
@RaymundRyan
Aug 21 2016 04:42
@kimstopmik Thanks a lot! I'm following the wrong example lol :D
CamperBot
@camperbot
Aug 21 2016 04:42
raymundryan sends brownie points to @kimstopmik :sparkles: :thumbsup: :sparkles:
:cookie: 253 | @kimstopmik |http://www.freecodecamp.com/kimstopmik
swapnildaddikar
@swapnildaddikar
Aug 21 2016 04:58
guys can someone tell me how to split the array into firther arrays for DNA testing
function pairElement(str) {
  var newarray=[];

 for(var x=0;x<str.length;x++)
    {

     newarray.push(str[x]);
      if( str[x]=="T")
        {
           newarray.push("A");

        }
      else if( str[x]=="A")
        {
          newarray.push("T");

        }
       else if( str[x]=="G")
        {
          newarray.push("C");
        }

       else if( str[x]=="C")
        {
          newarray.push("G");
        }

    }
  return newarray;







}

pairElement("ATCGA");
this is the code
Someone help pls :X
kimstopmik
@kimstopmik
Aug 21 2016 05:03
@RaymundRyan welcome :smile: working now?
BobbyB007
@BobbyB007
Aug 21 2016 05:08
Hello having some trouble with the word Blanks exercise. How do I access the words of the function input?

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";

result += wordBlanks.map;

return result;
}

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

sorry don't know how to do the code thing
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:09
u have to add your own words too like a fill in the blank
BobbyB007
@BobbyB007
Aug 21 2016 05:09
but I can't even get the words they give me.
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:10
myNoun, myAdjective, myVerb, myAdverb
BobbyB007
@BobbyB007
Aug 21 2016 05:10
though it would be something like wordBlanks2
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:10
the words which are passed
are stored in the above parameters
so dog is stored in myNoun
BobbyB007
@BobbyB007
Aug 21 2016 05:10
oh of course.
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:11
big in myAdjective
BobbyB007
@BobbyB007
Aug 21 2016 05:11
use the name.
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:11
and so on
so if u want to make a sentence with only those words
BobbyB007
@BobbyB007
Aug 21 2016 05:11
thank.. thought it was like an array or something. .
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:11
u can use result=myNoun + myAdjective+ myVerb+ myAdverb;
then return result
but that is not what is needed
in the exercise
BobbyB007
@BobbyB007
Aug 21 2016 05:12
@swapnildaddikar thaks
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:12
u have to use the words in a sentence of ur own
BobbyB007
@BobbyB007
Aug 21 2016 05:12
@swapnildaddikar thanks
CamperBot
@camperbot
Aug 21 2016 05:12
bobbyb007 sends brownie points to @swapnildaddikar :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for swapnildaddikar
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:12
np
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Aug 21 2016 05:17
```js
fak
var app = angular.module('WikiApp', ['ngAnimate']);
app.controller('MainCtrl', function($scope, $http, $timeout) {
  var form = $('form');
  var close = $('.eks');
  var input = $('input');
  var search = $("#search");
  var help = $("#help");

  $scope.results = [];

  close.on('click', function() {
    form.toggleClass('open');

    if (!form.hasClass('open') && $scope.searchTxt !== '' && typeof $scope.searchTxt !== 'undefined') {
        search.toggleClass('fullHeight')
      help.toggleClass('hide');
      $scope.searchTxt = '';
    } 
    $scope.results = [];
    $scope.$apply();
  })

  input.on('transitionend webkitTransitionEnd oTransitionEnd', function() {
    if (form.hasClass('open')) {
      input.focus();
    } else {
      return;
    }
  })

  $scope.search = function() {
    $scope.results = [];
    help.addClass('hide');
    search.removeClass('fullHeight');
    var title = input.val();
    var api = 'https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=';
    var cb = '&callback=JSON_CALLBACK';
    var page = 'https://en.wikipedia.org/?curid=';

    $http.jsonp(api + title + cb)
    .success(function(data) {
      var results = data.query.pages;
      angular.forEach(results, function(v,k)  {
        $scope.results.push({title: v.title, body: v.extract, page: page + v.pageid})
      })
    });
  }
});
Even after months of playing with js, I still don't understand how they create such things in codepen.io
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:22
@AleCx4 It's not pure JS or JQuery - its angular.js. Javascript framework.
Try to write it with JS and JQuery ;)
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Aug 21 2016 05:23
@Shimizo yup, I know its angular, I would not have any idea as to how could I do it with just plain js/jquery
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:24
@AleCx4 Here's my wikipedia viewer. http://codepen.io/Shimizo/pen/VjRrAw Don't look at the design, I just skill JS
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Aug 21 2016 05:25
@Shimizo looks great, I'll go through the code and if I got any questions Is it ok if I send you a message?
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:25
I know that I have some bugs in design, but my mentor doesn't look at design, just on JS. He wants to skill my JS and then give me job. ;)
@AleCx4 No problem!
Nick Oliver
@NIOliver
Aug 21 2016 05:26
The Record Collection exercise https://www.freecodecamp.com/challenges/record-collection is still kicking my butt.
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:27
@NIOliver Any code? ;)
Nick Oliver
@NIOliver
Aug 21 2016 05:28

``` function updateRecords(id, prop, value) {
if (collection[id].hasOwnProperty(prop) && collection[id][prop][value] !== "") { //check to see if id has the property and that the property isn't blank
collection[id][prop].push(value); //if it has the property, add the value
}
if (collection[id].hasOwnProperty(prop) && collection[id][prop][value] === "") { //check to see if id has the property and that the property is blank
collection[id].pop(prop); //since the property is blank, delete the property
}

return collection;
} ```

woops that didn't work as planned
Anthony Drane
@Antiaccess
Aug 21 2016 05:30
Hey guys, I've solved the reverse a string challenge, but I'm sure this isn't the most efficient way. Does anyone have any pointers for streamlining this code?
function reverseString(str) {
  strArray = [""];
  for (var i = 0; i<str.length;i++){
    strArray.push(str.charAt(i));
  }
  strArray = strArray.reverse();
  console.log(strArray);
  var reversed = "";
  for (var x=0; x<str.length;x++){
    reversed += strArray[x];
  }
  console.log(reversed);
  return reversed;
}

reverseString("hello");
minus the console.log tests
Nick Oliver
@NIOliver
Aug 21 2016 05:31
@Antiaccess how are you posting your code like that?
Anthony Drane
@Antiaccess
Aug 21 2016 05:31
click on the icon in the chat window
to the right
it has commands
Nick Oliver
@NIOliver
Aug 21 2016 05:31
is there supposed to be a popup of some sort?
because it doesn't work for me on firefox on xfce. probably have yet another thing configured incorrectly :D
Anthony Drane
@Antiaccess
Aug 21 2016 05:32
yes, you can also press ctrl + ^ (up) + M
try that
okay that doesn't even work for me
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:32
@NIOliver
I have something like this:
function updateRecords(id, prop, value) {
  var colid = collection[id];
  if(value !== "" && prop !== "tracks") {
    colid[prop] = value;
  }

  if(prop === "tracks" && value !== "") {
    colid.tracks.push(value);
  }

  if(value === "") {
    delete colid[prop];
  }

  return collection;
}
pahosler
@pahosler
Aug 21 2016 05:33
@Antiaccess
str = str.split('').reverse().join('')
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:33
But it doesnt work now, I dont know why! I passed it long time ago.
Anthony Drane
@Antiaccess
Aug 21 2016 05:33
@pahosler i'll look into that
Nick Oliver
@NIOliver
Aug 21 2016 05:34
@Shimizo huh its so close o_O
ashnel
@ashnel
Aug 21 2016 05:36
Would anyone be willing to help me with the weather app project by mentoring through it? Despite all the reading I've been doing I'm really struggling to understand APIs and would greatly appreciate the assistance.
Anthony Drane
@Antiaccess
Aug 21 2016 05:36
@pahosler cool, thanks for that. It works... just need to get my head around why
CamperBot
@camperbot
Aug 21 2016 05:36
antiaccess sends brownie points to @pahosler :sparkles: :thumbsup: :sparkles:
:cookie: 364 | @pahosler |http://www.freecodecamp.com/pahosler
Anthony Drane
@Antiaccess
Aug 21 2016 05:37
@pahosler does using the split command turn the whole thing into an array?
Chandrahas P
@Chan11
Aug 21 2016 05:37
Help || hi,i need to target a div element to create a table. whats problem.Codepen link below.
https://codepen.io/Chan11/pen/qNrANE
CamperBot
@camperbot
Aug 21 2016 05:37
no wiki entry for: hii need to target a div element to create a table whats problemcodepen link belowhttpscodepeniochan11penqnrane
pahosler
@pahosler
Aug 21 2016 05:37
split makes the string an array, reverse, well, reverses the array, join turns the array back into a string...
Anthony Drane
@Antiaccess
Aug 21 2016 05:37
very cool
thanks again
pahosler
@pahosler
Aug 21 2016 05:37
np
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:40
@NIOliver I found a bug and fixed it.
  if(prop === "tracks" && value !== "") {
    if(typeof colid.tracks === "undefined") {
      colid.tracks = [];
    }
    colid.tracks.push(value);
  }
Nick Oliver
@NIOliver
Aug 21 2016 05:40
thanks @Shimizo
CamperBot
@camperbot
Aug 21 2016 05:40
nioliver sends brownie points to @shimizo :sparkles: :thumbsup: :sparkles:
:cookie: 292 | @shimizo |http://www.freecodecamp.com/shimizo
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:41
@Antiaccess the string cannot be reversed directly
so we convert the string into an array becase an array can be reversed
now the reversed array can be joined to make a string which is the reverse of the original
Joseph
@revisualize
Aug 21 2016 05:41
@Shimizo @NIOliver How do you test objects for properties?
pahosler
@pahosler
Aug 21 2016 05:41
@Chan11 first you haven't loaded jQuery into your project, so you can't use it.... always check the debug screen in your browser so you can see what errors are logging
Nick Oliver
@NIOliver
Aug 21 2016 05:41
@Shimizo actually that still didn't solve my challenge :P
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:41

@NIOliver No problem, remember to use

typeof colid.tracks === "undefined"

Instead of

colid.tracks === undefined

Because in older browser you can overwrite 'undefined'

Nick Oliver
@NIOliver
Aug 21 2016 05:41
@revisualize I tried using objName.hasOwnProperty()
Joseph
@revisualize
Aug 21 2016 05:42
@NIOliver Nope It didn't. Because you're not testing the object for a property correctly.
@NIOliver Need to have something inside the ()
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:42
@NIOliver REally? Give me errors
@revisualize ah, my bad english. I didn't understand you, sorry! :D
Joseph
@revisualize
Aug 21 2016 05:43
Okay.
@NIOliver @Shimizo Who is working on the challenge?
Adrian Kopytko
@adriankopytko
Aug 21 2016 05:43
@NIOliver For me it's working well.
@revisualize - @NIOliver
Joseph
@revisualize
Aug 21 2016 05:43
Thanks.
@NIOliver I assure you .hasOwnProperty() works for the challenge.
Nick Oliver
@NIOliver
Aug 21 2016 05:44
if(colid.hasOwnProperty("tracks") === 'undefined') { var newTracks = ""; colid.push("tracks"[newTracks]); }
Chandrahas P
@Chan11
Aug 21 2016 05:44
@pahosler its not working,added Jquery.any problem in code
Joseph
@revisualize
Aug 21 2016 05:44
@NIOliver That is incorrect.
Nick Oliver
@NIOliver
Aug 21 2016 05:44
yeah I noticed
what am I missing here? :(
Joseph
@revisualize
Aug 21 2016 05:45
@NIOliver .hasOwnProperty(); returns a boolean value.
Nick Oliver
@NIOliver
Aug 21 2016 05:45
oh
Joseph
@revisualize
Aug 21 2016 05:45
Also, 'undefined' is a string not the undefined key word.
Nick Oliver
@NIOliver
Aug 21 2016 05:46
right
pahosler
@pahosler
Aug 21 2016 05:46
@Chan11 Uncaught ReferenceError: jQuery is not defined
Joseph
@revisualize
Aug 21 2016 05:47
@NIOliver Also, if you're doing this... var newTracks = ""; colid.push("tracks"[newTracks]); That is also incorrect.
Nick Oliver
@NIOliver
Aug 21 2016 05:48
shit
Joseph
@revisualize
Aug 21 2016 05:48
Sorry for the bad news?
Nick Oliver
@NIOliver
Aug 21 2016 05:49
No, I appreciate the feedback 100%
I tried,
if(!colid.hasOwnProperty("tracks")) {
```  }
wtf
if(!colid.hasOwnProperty("tracks")) {
colid.push("tracks");
}
and it is giving me TypeError: colid.push is not a function}
last I checked, push is definitely a function .__.
Joseph
@revisualize
Aug 21 2016 05:52
it is.
But, you're supposed to push the value.
Also, you're trying to push to the ID slot. Not to the nested object.
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:53
if it does not have the property of tracks u have to create tracks property which is an array
and then push value into it
dont get so hyped up over this challenge just calm down and write down all scenarios .. u wil do well :D
Nick Oliver
@NIOliver
Aug 21 2016 05:57
well what I'm trying to do is check if collection[id] has the tracks property. if it does not have the tracks property, then it should push a new tracks property onto the collection[id].
unfortunately, i can't seem to get that right
swapnildaddikar
@swapnildaddikar
Aug 21 2016 05:58
u have to make a property called tracks which is an array and push the value of the track into the track
and not push "tracks"
Nick Oliver
@NIOliver
Aug 21 2016 06:01
var tracks = [""];
colid.push(tracks); ??
no thats not it
pahosler
@pahosler
Aug 21 2016 06:04
@Chan11 you also need to add this... $(document).ready(function(){ don't forget the } at the end of the code. I got it to work in another place other than codepen, not sure what codepens issue is, but add the above to your code
also your code is creating 4 tables, is that what you are trying to do, or just 4 sets of tr/td tags?
Chandrahas P
@Chan11
Aug 21 2016 06:13
@pahosler where does it work. pls give me link. yes,need 4 tables
pahosler
@pahosler
Aug 21 2016 06:20
I really don't have a link I just copied bits into a w3c tryit yourself page
really it should work in codepen... not sure what's up with that
Anthony Drane
@Antiaccess
Aug 21 2016 06:27
can anyone tell me ONLY why I'm getting 'Cannot create property 'isANumber' on string 'e'' for the Palindrome assignment. Code:

function palindrome(str) {
  // Good luck!
  str = str.split('');
  var strLength = str.length;
  for (var i=0;i<strLength;i++){
    if (str[i] == " " || (str[i].isANumber = false) || (str[i].isAString = false)){
      str.remove(i);
      strLength -=1;
    }
  }
  str = str.join('');
  reverse = str.split('').reverse().join('');
    console.log(str + " ---- " + reverse);
  if (reverse === str){
    return true;
  } else {
  return false;
  }
}

palindrome("eye");
palindrome("almostomla");
Chandrahas P
@Chan11
Aug 21 2016 06:31
@pahosler thanks,its working. created table element inside div,& targeted table instead of div
CamperBot
@camperbot
Aug 21 2016 06:31
chan11 sends brownie points to @pahosler :sparkles: :thumbsup: :sparkles:
:cookie: 365 | @pahosler |http://www.freecodecamp.com/pahosler
arif hussain
@arifhussain0
Aug 21 2016 06:35
@Antiaccess first of all put == after isANumber condition
Anthony Drane
@Antiaccess
Aug 21 2016 06:35
i have tried that
oh guess not
thanks @arifhussain0 back to trying to solve it
CamperBot
@camperbot
Aug 21 2016 06:36
antiaccess sends brownie points to @arifhussain0 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for arifhussain0
Anthony Drane
@Antiaccess
Aug 21 2016 06:37
now it's saying str.remove() is not a funciton
yet it was working prior
AnshulDawar
@anshuldawar
Aug 21 2016 06:38
function destroyer(arr) {
// Remove all the values
var args = Array.prototype.slice.call(arguments, 1);
return args;
}
function filtered(value){
return value!=args;
}
var answer=arr.filter(filtered);
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
ERROR it says : arr is not defined
how can i access array inside destroyer
friesenet21
@friesenet21
Aug 21 2016 06:39
function findElement(arr, func) {
  var num = 0;
  return arr.filter(function(x){
    return func(x);
  }).slice(num,1).toString(); 
}

findElement([1, 3, 5, 9], function(num){ return num % 2 === 0; });
arif hussain
@arifhussain0
Aug 21 2016 06:40
write arr instead of Array @anshuldawar
and !== in rather than != in filtered
AnshulDawar
@anshuldawar
Aug 21 2016 06:44
still i get the same error i.e
ReferenceError: arr is not defined
friesenet21
@friesenet21
Aug 21 2016 06:44
hello I'm on Finders Keepers. This appears to pass the test. Is there anything obviously missing?
Abhijeet Phanse
@orionishere
Aug 21 2016 06:47
Hi guys, I'm at Understand String Immutability... I didn't understand the question... Can anyone help?
Anthony Drane
@Antiaccess
Aug 21 2016 06:51
What does everything in the square brackets mean in the following: str = str.replace(/[^0-9a-z]/gi, '');
specifically the ^
friscodisco
@friscodisco
Aug 21 2016 06:52
@orionishere if you take a string's length you will see for example 'bob'.length = 3 but if you try to change the string bob by accessing only the first element with bobxamarin/xamarin-android@a16673d you will be unable to, due to the immutability of strings in JS...however, one can re-assign the string to a different value.
that's bob[0]
not xamarin android blah blah
lol
that is also why people sometimes take a string, split it up into an Array, if they want to be able to manipulate the elements individually
Abhijeet Phanse
@orionishere
Aug 21 2016 06:54
lol... I got that part.... I just skipped over it while reading....
Also I understood the problem and solved it... Thanks @friscodisco anyways...
CamperBot
@camperbot
Aug 21 2016 06:55
orionishere sends brownie points to @friscodisco :sparkles: :thumbsup: :sparkles:
:cookie: 315 | @friscodisco |http://www.freecodecamp.com/friscodisco
friscodisco
@friscodisco
Aug 21 2016 06:59
@Antiaccess the ^ inside the first regex bracket means not or to exclude those
see here for reference: http://www.regexr.com
Anthony Drane
@Antiaccess
Aug 21 2016 06:59
@friscodisco awesome, i was hoping for a reference to read
@friscodisco cheers
Manish Jain
@manishbjain
Aug 21 2016 07:17
Hello Can someone guide me why I am getting this code wrong
Kristoforus Rua
@kru
Aug 21 2016 07:20

Hi all, I have a problem here.
It's nothing to do with FCC challenges.
I want to find 4-th li element inside the ul with classname list using jQuery, Javascript for loop, and filter function.

I can accompolish this using jQuery and Javascript for loop, but the browser always throw
app.js:29 Uncaught TypeError: el.filter is not a function
when I using filter...Here is my code:

```
document.addEventListener('DOMContentLoaded', function () {
// function correspondent to jQuery .hasClass, .addClass, .removeClass
function hasClass (el, className) {
return el.classList ? el.classList.contains(className) : new RegExp('\b' + className + '\b').test(el.className)
}

function addClass (el, className) {
if (el.classList) el.classList.add(className)
else if (!hasClass(el, className)) el.className += ' ' + className
}

function removeClass (el, className) {
if (el.classList) el.classList.remove(className)
else el.className = el.className.replace(new RegExp('\b'+ className+'\b', 'g'), '')
}

var el = document.querySelectorAll('ul.list li')

// addClass(el[4], 'clear')

var newEl = el.filter(function(item) {
// addClass 'clear' to 4th li element
})

console.log(newEl)

})

document.addEventListener('DOMContentLoaded', function () {
// function correspondent to jQuery .hasClass, .addClass, .removeClass
function hasClass (el, className) {
return el.classList ? el.classList.contains(className) : new RegExp('\b' + className + '\b').test(el.className)
}
function addClass (el, className) {
if (el.classList) el.classList.add(className)
else if (!hasClass(el, className)) el.className += ' ' + className
}
function removeClass (el, className) {
if (el.classList) el.classList.remove(className)
else el.className = el.className.replace(new RegExp('\b'+ className+'\b', 'g'), '')
}
var el = document.querySelectorAll('ul.list li')
// addClass(el[4], 'clear')
var newEl = el.filter(function(item) {
// addClass 'clear' to 4th li element
})
console.log(newEl)
})
AnshulDawar
@anshuldawar
Aug 21 2016 07:22

I dont understand why its not working
'''
function destroyer(arr) {
// Remove all the values

var filteredd = argumentsxamarin/xamarin-android@a16673d;
var args = Array.prototype.slice.call(arguments, 1);

function filtered(value){
return value!=args;
}

var answer=filteredd.filter(filtered);
return answer;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
'''

leykhins
@leykhins
Aug 21 2016 07:32
help

function switchOfStuff(val) {
var answer = "";
// Only change code below this line
switch (val){
case 1:
answer = "apple";
break;
case 2:
answer = "bird";
break;
case 3:
answer = "cat";
break;
default:
answer = "stuff";
}
// Only change code above this line
return answer;
}

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

friscodisco
@friscodisco
Aug 21 2016 07:37
@leykhins what is the name of that challenge
Joseph
@revisualize
Aug 21 2016 07:37
Okay, I got tired of staring at Visio. SUP????
@leykhins That looks correct. Hmm.. What's that lesson?
swapnildaddikar
@swapnildaddikar
Aug 21 2016 07:43
can someone help me with PIG LATIN challenge?
there is 1 condition im unable to understand
Darth Skywalker
@adityaparab
Aug 21 2016 07:48
@swapnildaddikar : Which is?
swapnildaddikar
@swapnildaddikar
Aug 21 2016 07:49
function translatePigLatin(str) {
var array= str.split("");

  if(array[0]=="a"||array[0]=="e"||array[0]=="i"||array[0]=="o"||array[0]=="u")
    {
  array.push("way");
    }
  else
    { array.push(array[0]);
        array.push("ay");

  array.shift();

    }
    return array.join("");

}

translatePigLatin("glove");
shud i add a special condition for "glove"
jst go throught that question once @adityaparab
Maltsev Victor
@Malvik0511
Aug 21 2016 07:53
Don`t understund how to link api openweathermap. Someone help me. https://codepen.io/malvik0511/pen/akxjRO
Egoscio
@Egoscio
Aug 21 2016 07:55
@swapnildaddikar Yucky if statement, might I suggest:
if (array[0].match(/a|e|i|o|u/))
pahosler
@pahosler
Aug 21 2016 07:56
@chan11 are you still here? got it working with the div, I saw you got it with a table tag... http://codepen.io/pahosler/pen/NAmVGG?editors=1111
swapnildaddikar
@swapnildaddikar
Aug 21 2016 07:56
havent come across match keyowrd but thanks :D
looks compact
@Egoscio
Egoscio
@Egoscio
Aug 21 2016 07:57
Yeah, regular expressions are fairly easy to use once you come across them, I'm not sure exactly when they start talking about it though.
pahosler
@pahosler
Aug 21 2016 07:58
before piglatin...
and there are whole books written about regex, they can be very complex
most of the regex stuff for FCC is very basic though
swapnildaddikar
@swapnildaddikar
Aug 21 2016 08:00
they have used the keyword in examples but never explained them ..... i didnt go reserahcing about it as it wasnt needed so far
pahosler
@pahosler
Aug 21 2016 08:00
@swapnildaddikar for things like match, replace, test, etc... you really have to look up regex on MDN, it'll come in very handy if you familiarize yourself with it
swapnildaddikar
@swapnildaddikar
Aug 21 2016 08:00
anyways thansks :D
pahosler
@pahosler
Aug 21 2016 08:01
they really don't get into explaining them, it's one of those subjects that FCC kinda leaves you on your own to research after it introduces them to you
swapnildaddikar
@swapnildaddikar
Aug 21 2016 08:01
yes
pahosler
@pahosler
Aug 21 2016 08:02
pigllatin challenge can be written in about three lines of short code btw
vtarun
@vtarun
Aug 21 2016 08:04
Hi , for javascript problem "Arguments Optional".. i dont know how to return function. Please help me how to proceed. Thanks
pahosler
@pahosler
Aug 21 2016 08:04
let's see if cbot is working yet
help arguments optional
CamperBot
@camperbot
Aug 21 2016 08:05
no wiki entry for: arguments optional
pahosler
@pahosler
Aug 21 2016 08:05
nope
@vtarun I struggled with that one myself
vtarun
@vtarun
Aug 21 2016 08:08
@pahosler i able to solve conditions, when 2 variable are passed or any one variable is not a number. But for return function , i dont know what to don
do
pahosler
@pahosler
Aug 21 2016 08:09
actually not that one but one do the line called drop elements
return function(
more?? okay
return function(num) {
            if (typeof(num) !== 'number') {
                return undefined;
            }
vtarun
@vtarun
Aug 21 2016 08:18
@pahosler thanks..
CamperBot
@camperbot
Aug 21 2016 08:18
vtarun sends brownie points to @pahosler :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @pahosler |http://www.freecodecamp.com/pahosler
Suzan Dpor
@kitty1
Aug 21 2016 08:32
acn anyone please tell me what this error:"cnnot read property split of undefined"
jamesmillerho
@jamesmillerho
Aug 21 2016 08:33
@kitty1 what's the whole code
Suzan Dpor
@kitty1
Aug 21 2016 08:33

@jamesmillerho function titleCase(str) {
var ar=[];
var br=[];
var cr;
ar=str.split(' ');
var i=ar.length;
while(i>0){
br=ar[i].split('');
br[0].touppercase();
ar[i]=br[i];
i--;
}
cr=ar.join();
return cr;
}

titleCase("I'm a little tea pot");

jamesmillerho
@jamesmillerho
Aug 21 2016 08:35
@kitty1 ar = str.split(""), so ar[i] is a single character
br=ar[i].split('') is meaningless
@kitty1 touppercase() is toUpperCase()
var ar= []; ar = str.split('')can be var ar = str.split('');
var i =ar.length <- array index begins from 0, so the last element of an array is ar.length-1
so cnnot read property split of undefined" because ar[ar.length] doesn't exist
Suzan Dpor
@kitty1
Aug 21 2016 08:41
@jamesmillerho yess your right i use i-- first and that error solved:-)
@jamesmillerho can you explain more about using "" insted of '' in split()??
jamesmillerho
@jamesmillerho
Aug 21 2016 08:48
@kitty1 they are just the same, we can use both " and ' because we need to wrap themselves,
eg: '"hello"'
or "McDonald's"
Suzan Dpor
@kitty1
Aug 21 2016 08:49
@jamesmillerho why is this-br=ar[i].split('')-meaningless?
jamesmillerho
@jamesmillerho
Aug 21 2016 08:51
@kitty1 :baby: okay, this is actually not
Falskry
@Falskry
Aug 21 2016 08:52
hi everybody, for the Golf Code exercise, my code works fine but the console won't validate it.
It says that 2 of the conditions are not completed, but when i test them, they are...
Any idea what to do?
function golfScore(par, strokes) {
  // Only change code below this line
  if (strokes==1) {return "Hole-in-one"}
  else if (strokes <= par-2) {return "Eagle"}
  else if (strokes == par-1) {return "Birdie"}
  else if ( strokes == par) {return "Par"}
   else if ( strokes == par+1) {return "Bogey"}
 else if ( strokes == par+2) {return "Double Bogey"}
 else if ( strokes >= par+3) {return "Go Home!"}



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

// Change these values to test
golfScore(5, 2);
Mark Todd
@Knochenmark
Aug 21 2016 08:53
@Falskry your last else if should be an "else" only
Falskry
@Falskry
Aug 21 2016 08:53
problem solved, thanks everyone and good luck to you all.
Mark Todd
@Knochenmark
Aug 21 2016 08:54
@Falskry and remove the last return statement
@Falskry the "Change Me" is of no use here
Falskry
@Falskry
Aug 21 2016 08:54
@Knochenmark thanks for the answer but not in this exercise, the problem was a missing "!" in the Hole in one.
thanks for the good will though :)
have a nice day
CamperBot
@camperbot
Aug 21 2016 08:54
falskry sends brownie points to @knochenmark :sparkles: :thumbsup: :sparkles:
:cookie: 438 | @knochenmark |http://www.freecodecamp.com/knochenmark
Hèlen Grives
@mesmoiron
Aug 21 2016 09:26
Has anyone experience with angular? I am trying to find out if one can have multiple functions in one controller; or that every function needs its own controller. Most beginner examples have just one function declaration. I am trying to do the random quote in angular.
Carlos Zavaleta
@nerdyamigo
Aug 21 2016 09:29
@mesmoiron it depends, what do the functions do?
llamatarianism
@llamatarianism
Aug 21 2016 09:31
@mesmoiron can you clarify what you mean by "multiple functions"
Hèlen Grives
@mesmoiron
Aug 21 2016 09:32
@volatileamigo lets say it must add, divide or subtract. Can I have in those functions in one controller. Each acting on an ng-click(). Does this make sense? I am working on a button; that I want to test. In order to do so I want to put 2 or more functions in one controller, because they act on the same $scope.
llamatarianism
@llamatarianism
Aug 21 2016 09:33
@mesmoiron sure, just add multiple functions to the scope object
$scope.add = (x, y) => x + y;
$scope.divide = (x, y) => x / y;
$scope.subtract = (x, y) => x - y;
Carlos Zavaleta
@nerdyamigo
Aug 21 2016 09:33
yea that's fine like llama said
Chandrahas P
@Chan11
Aug 21 2016 09:35
Anyone here ready to help me on Twitch tv project
Hèlen Grives
@mesmoiron
Aug 21 2016 09:35
@volatileamigo ok and then I can just call them by changing the reference in the ng-click? One more question. I am making the function by $scope.newQuote = function(){ document.getElementById("buttonQuote").click( alert("you have clicked"); }
Carlos Zavaleta
@nerdyamigo
Aug 21 2016 09:36
yup and okay
Hèlen Grives
@mesmoiron
Aug 21 2016 09:36
@volatileamigo @llamatarianism thank you
CamperBot
@camperbot
Aug 21 2016 09:36
mesmoiron sends brownie points to @volatileamigo and @llamatarianism :sparkles: :thumbsup: :sparkles:
:cookie: 245 | @volatileamigo |http://www.freecodecamp.com/volatileamigo
:star2: 1241 | @llamatarianism |http://www.freecodecamp.com/llamatarianism
jamesmillerho
@jamesmillerho
Aug 21 2016 09:53
is it better to learn react and ignore angular now? haven't learned them yet
Carlos Zavaleta
@nerdyamigo
Aug 21 2016 09:55
@jamesmillerho how good do you know javascript?
Subramanya Chakravarthy
@chakrihacker
Aug 21 2016 09:56
@jamesmillerho it is your choice to learn after all both are libraries
jamesmillerho
@jamesmillerho
Aug 21 2016 09:56
start learning since June this year, just finished (and actually understand) all algorithm exercises in FCC,
haven't learned ES6 yet but will @volatileamigo
Adithya Reddy
@tallpants
Aug 21 2016 09:57
what's up guys, how's it going
Carlos Zavaleta
@nerdyamigo
Aug 21 2016 09:58
@jamesmillerho if you feel like you know javascript well enough then yes, but if you don't then i would suggest to study a bit more. Angular and React are awesome but they use a lot abstraction so something might seem weird how they work
@jamesmillerho I would suggest Kyle Simpson YDKJS series is free on github
@jamesmillerho read that and after you read that I would recommend looking into frameworks
@adithyakreddy hey!
Chandrahas P
@Chan11
Aug 21 2016 10:00
Hi, something wrong in my code. If channels are offline ,my function must return string "offline". Here is my Codepen:
https://codepen.io/Chan11/pen/wWkQVE?editors=1111
jamesmillerho
@jamesmillerho
Aug 21 2016 10:00
@volatileamigo reading
@volatileamigo thanks
CamperBot
@camperbot
Aug 21 2016 10:00
jamesmillerho sends brownie points to @volatileamigo :sparkles: :thumbsup: :sparkles:
:cookie: 246 | @volatileamigo |http://www.freecodecamp.com/volatileamigo
Carlos Zavaleta
@nerdyamigo
Aug 21 2016 10:00
:D
Adithya Reddy
@tallpants
Aug 21 2016 10:01
This project was actually so annoying to do
this and the wikipedia thing
Carlos Zavaleta
@nerdyamigo
Aug 21 2016 10:01
hated the wikipedia viewer lol
im looking at code hold on
jamesmillerho
@jamesmillerho
Aug 21 2016 10:02
@adithyakreddy
if(data.stream==null){
return "offline";
I think it's $().html();
Adithya Reddy
@tallpants
Aug 21 2016 10:03
It's not my project, it's @Chan11 's
Can anyone tell me if there's any obvious bugs in my pomodoro clock
I know the design isn't great but I'm not really much of a designer
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:06
hey @adithyakreddy since you're on pomodoro, you passed already calculator, just one question did you used eval() for calculation ?
Adithya Reddy
@tallpants
Aug 21 2016 10:06
@AlexanderDom don't use eval(). It reduces the performance quite a bit
jamesmillerho
@jamesmillerho
Aug 21 2016 10:06
@adithyakreddy timer reset after pause and resume
Adithya Reddy
@tallpants
Aug 21 2016 10:07
jamesmillerho
@jamesmillerho
Aug 21 2016 10:07
@adithyakreddy opps, np
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:07
@adithyakreddy yes i know eval's evil :) ok gonna see how to do it
Chandrahas P
@Chan11
Aug 21 2016 10:07
@jamesmillerho hi, return statement brings control out of function,is'nt it. Why it is not returning string.
Adithya Reddy
@tallpants
Aug 21 2016 10:07
you can see the documentation for that here: http://mathjs.org/docs/getting_started.html
@AlexanderDom if you have trouble figuring it out you can check my source here https://codepen.io/adithyakreddy/pen/xOZarP. Lemme know if you need more help
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:09
@adithyakreddy thank's it's not that i'm blocked just don't why little bit lazy ^^
CamperBot
@camperbot
Aug 21 2016 10:09
alexanderdom sends brownie points to @adithyakreddy :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @adithyakreddy |http://www.freecodecamp.com/adithyakreddy
Adithya Reddy
@tallpants
Aug 21 2016 10:10
@AlexanderDom I know how you feel, that's my whole life :satisfied:
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:10
@Chan11 try to search if you data has stream not his value
at first
@adithyakreddy :)
jamesmillerho
@jamesmillerho
Aug 21 2016 10:11
@Chan11
if(data.stream==null){
        $('#name').html('<p>offline</p>');
@Chan11 try run it and you'll know to fix your code
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:12
and if(data.stream===null) because of null == undefined
Falskry
@Falskry
Aug 21 2016 10:12
I'm supposed to compare two numbers with "===" but i don't really understand how it's possible...
function isLess(a, b) {
  // Fix this code
  return a === b ;

}

// Change these values to test
isLess(10, 15);
Adithya Reddy
@tallpants
Aug 21 2016 10:12
You can just do if(!data.stream)
llamatarianism
@llamatarianism
Aug 21 2016 10:13
@Falskry no you're not
Adithya Reddy
@tallpants
Aug 21 2016 10:13
it'll check for all falsy values
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:13
yes you can but like i said
check if there stream ><
llamatarianism
@llamatarianism
Aug 21 2016 10:13
you're supposed to check if a is less than b
Falskry
@Falskry
Aug 21 2016 10:13
@llamatarianism can you be more specific please?
llamatarianism
@llamatarianism
Aug 21 2016 10:13
hence the name of the function
Falskry
@Falskry
Aug 21 2016 10:14
@llamatarianism well you know this is some form of comparison...
size comparison
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:14
return a smaller than b :D
llamatarianism
@llamatarianism
Aug 21 2016 10:15
I have no idea what you were trying to say just then but it doesn't really matter
you're checking if a and b are equal
you're supposed to check if a is less than b

you were supposed to edit this function:

function isLess(a, b) {
  // Fix this code
  if (a < b) {
    return true;
  } else {
    return false;
  }
}

to remove the if statement

Alexander Domikov
@AlexanderDom
Aug 21 2016 10:16
return a < b @llamatarianism it's enough
Falskry
@Falskry
Aug 21 2016 10:16
@llamatarianism just did that, you were right, I did not properly understand the exercise, thank you sensei.
CamperBot
@camperbot
Aug 21 2016 10:16
falskry sends brownie points to @llamatarianism :sparkles: :thumbsup: :sparkles:
:star2: 1242 | @llamatarianism |http://www.freecodecamp.com/llamatarianism
llamatarianism
@llamatarianism
Aug 21 2016 10:16
@AlexanderDom why are you telling me this
Falskry
@Falskry
Aug 21 2016 10:17
@AlexanderDom thank you too man :)
CamperBot
@camperbot
Aug 21 2016 10:17
falskry sends brownie points to @alexanderdom :sparkles: :thumbsup: :sparkles:
:cookie: 345 | @alexanderdom |http://www.freecodecamp.com/alexanderdom
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:17
you welcome @Falskry , @llamatarianism because like i said a < b return already a boolean value
jamesmillerho
@jamesmillerho
Aug 21 2016 10:17
lol
llamatarianism
@llamatarianism
Aug 21 2016 10:17
again
why are you telling me this
I'm not the one asking for help
I already know this
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:18
because you wrtitten a longer version thats all :)
ok ?
llamatarianism
@llamatarianism
Aug 21 2016 10:18
that wasn't the code I wrote
that was the code that was in the challenge to begin with
the whole point of the exercise is removing that if statement
jamesmillerho
@jamesmillerho
Aug 21 2016 10:18
function isLess(a, b) {
  // Fix this code
  if (Math.pow(a+100/2*Math.PI, 5) < Math.pow(b+100/2*Math.PI, 5)) {
    return true;
  } else {
    return false;
  }
}
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:18
alright alright
Alexander Domikov
@AlexanderDom
Aug 21 2016 10:25
@adithyakreddy but math.js use eval() too ^^
Sujal
@Sujal3757
Aug 21 2016 10:42
Thanks @Rafase282 @abhisekp @Hallaathrad @cloudb for your help with Algorithm: Return Largest Numbers in Arrays
CamperBot
@camperbot
Aug 21 2016 10:42
sujal3757 sends brownie points to @rafase282 and @abhisekp and @hallaathrad and @cloudb :sparkles: :thumbsup: :sparkles:
:cookie: 188 | @cloudb |http://www.freecodecamp.com/cloudb
:cookie: 515 | @hallaathrad |http://www.freecodecamp.com/hallaathrad
:star2: 2895 | @abhisekp |http://www.freecodecamp.com/abhisekp
:star2: 1358 | @rafase282 |http://www.freecodecamp.com/rafase282
Abhisek Pattnaik
@abhisekp
Aug 21 2016 10:43
OMG! yw! o/
Abhijeet Phanse
@orionishere
Aug 21 2016 10:46
Hi guys... M stuck at Word Blanks... Can't seem to pass the last two conditions... Can any1 help?
rybka02
@rybka02
Aug 21 2016 10:54
Anyone here?
Abhijeet Phanse
@orionishere
Aug 21 2016 10:55
@rybka02 ... Hey there....
rybka02
@rybka02
Aug 21 2016 10:55
You know much about jQuery clone command?
Abhijeet Phanse
@orionishere
Aug 21 2016 10:57
Well I've gone through beginner problems
So where exactly are you stuck?
Brendan Kinahan
@BKinahan
Aug 21 2016 10:58
@orionishere what code do you have for Word Blanks?
rybka02
@rybka02
Aug 21 2016 10:58
Say I have a div like this...
Abhijeet Phanse
@orionishere
Aug 21 2016 10:59
@BKinahan I reset my whole code again.... but I'll show you the code in a minute.....
Brendan Kinahan
@BKinahan
Aug 21 2016 10:59
:+1:
Norvin Burrus
@ndburrus
Aug 21 2016 11:00
@orionishere the exercise is asking for a sentence to be built using the 4 word types given. it may be easiest to begin by making a complete (spacing & punctuation) sentence, using the 4 words. to make sense, the complete sentence will require a few "filler" words. :sparkles:
rybka02
@rybka02
Aug 21 2016 11:01
<div id="container">
    <img id="image">
</div>

<script>
  var msg = $("#container").clone().removeAttr("id");
   msg.find("#image").attr("src", "default.png");
</script>
why doesnt it change?
Tauheed Issa
@tauheedissa
Aug 21 2016 11:01
Where can i practice javascript?
Abhisek Pattnaik
@abhisekp
Aug 21 2016 11:02
here
Tauheed Issa
@tauheedissa
Aug 21 2016 11:02
@rybka02 what is the name of the exercise?
Abhijeet Phanse
@orionishere
Aug 21 2016 11:02
@rybka02 I don't think I can help you with this...
rybka02
@rybka02
Aug 21 2016 11:03
It's not an exercise. It's a question.
Tauheed Issa
@tauheedissa
Aug 21 2016 11:03
@rybka02 Ok, i dont have any answer
best place to practice javascript code?
rybka02
@rybka02
Aug 21 2016 11:03
In console
Tauheed Issa
@tauheedissa
Aug 21 2016 11:04
console?
software?
rybka02
@rybka02
Aug 21 2016 11:04
2 places
What operating system u usuing?
Windows?
Tauheed Issa
@tauheedissa
Aug 21 2016 11:04
windows 10
rybka02
@rybka02
Aug 21 2016 11:04
You use google chrome?
Or firefox
Tauheed Issa
@tauheedissa
Aug 21 2016 11:05
chrome
rybka02
@rybka02
Aug 21 2016 11:05
Well you have a few choices....
Marina
@miss90
Aug 21 2016 11:05

can you help me with the task "Storing Values with the Assignment Operator"? My code is

var a = 7;
var b = 7;
~

The task is Assign the contents of a to variable b.

rybka02
@rybka02
Aug 21 2016 11:05
  1. You can download a text editor like Notepad++ or Sublime Text 3
  1. Download firebug add on and use firefox browser.
Tauheed Issa
@tauheedissa
Aug 21 2016 11:06
i want to practice it in real time
rybka02
@rybka02
Aug 21 2016 11:06
*2.
Tauheed Issa
@tauheedissa
Aug 21 2016 11:06
a = b;