These are chat archives for FreeCodeCamp/HelpJavaScript

29th
Jan 2016
Bashar Sankari
@basssan
Jan 29 2016 00:00
@rphares i did two var fahrenheit= (0, -22);
rphares
@rphares
Jan 29 2016 00:00
@basssan -- not quite,
lets reset and try again :blush:
Bashar Sankari
@basssan
Jan 29 2016 00:01
ok
how how ??
rphares
@rphares
Jan 29 2016 00:01
all you need to do is assign the formula to var fahrenheit
so that we could put in any celsius temperature we wanted, and it would convert it...
so we can use celsius in our formula
what is the math way to write: the temperature in Celsius times 9/5, plus 32?
Ege Tuncoz
@etuncoz
Jan 29 2016 00:02
Hello everyone i got stuck on the Profile Lookup exercise. Here Im getting the result " No such property" where I actually shouldn't be getting. Here's the code:
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUp(fName, prop){

  for(var i=0;i<contacts.length;i++){

    if(fName == contacts[i].firstName){

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

}

}

    return "No such contact";


}


lookUp("Akira", "likes");
Bashar Sankari
@basssan
Jan 29 2016 00:03
@rphares what is it ?
i'am Dispersed
rphares
@rphares
Jan 29 2016 00:04
@basssan ,
* is the symbol for times, + is the symbol for plus...
celsius times 9/5 plus 32would be...?
Bashar Sankari
@basssan
Jan 29 2016 00:05
*+
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:05
hello everybodyyyyy
rphares
@rphares
Jan 29 2016 00:05
@etuncoz , sorry, I'm not ignoring you, I'm just terrible at explaining that one, i only get my solution, heh,
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:05
gotta question...
rphares
@rphares
Jan 29 2016 00:05
whats up, @MasterJDnc ?
Ege Tuncoz
@etuncoz
Jan 29 2016 00:06
@rphares heheh its fine
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:06
// Setup
var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];

// Only change code below this line

var secondTree = myPlants.trees[1]; // Change this line
Instructions : Retrieve the second tree from the variable myPlants using object dot and array bracket notation.
rphares
@rphares
Jan 29 2016 00:07
@MasterJDnc , so you are going in an okay direction,
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:07
no answers please
rphares
@rphares
Jan 29 2016 00:07
there are the two parts...
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:07
lol
ok
brb
Ege Tuncoz
@etuncoz
Jan 29 2016 00:07
lol
rphares
@rphares
Jan 29 2016 00:07
the --
oh, ok, lol
Ege Tuncoz
@etuncoz
Jan 29 2016 00:07
you're in it
rphares
@rphares
Jan 29 2016 00:07
okay, ill go look again at yours and see what i can try and hint at,
Ege Tuncoz
@etuncoz
Jan 29 2016 00:08
welp i'd love that
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:09
sorry @rphares i didn't mean to cut u off
i kind of want to figure it out but i feel sooooo...
whats the word
lost
lol
rphares
@rphares
Jan 29 2016 00:10
okay, to start, what is fName? @etuncoz ?
no worries--
@MasterJDnc , you need to index both parts, including which part of myPlants it is in...
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:10
yeah
rphares
@rphares
Jan 29 2016 00:10
myPlants[?].something[1]
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:11
i tried my Plants1.trees1;
rphares
@rphares
Jan 29 2016 00:11
oooh, thats almost there!
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:11
but nothingcame out of it the last time
i'll try it again
rphares
@rphares
Jan 29 2016 00:11
except, its not in trees...
look carefully,
where is the comma, where are the [].... pine doesn't go in trees, its in something else... @MasterJDnc
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:12
oh your goodddddddd
rphares
@rphares
Jan 29 2016 00:12
:)
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:12
these tricky little....
lol
rphares
@rphares
Jan 29 2016 00:12
congrats! happy coding~
Ege Tuncoz
@etuncoz
Jan 29 2016 00:12
@rphares its the parameter function takes to check firstnames of these contacts
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:12
i'm literally smiling at my laptop screen right now
Ege Tuncoz
@etuncoz
Jan 29 2016 00:12
x) i wish i was too
rphares
@rphares
Jan 29 2016 00:12
oh, lol, i didn't notice you'd changed that, @etuncoz
Jean-Alexander
@MasterJDnc
Jan 29 2016 00:12
@rphares thanks
CamperBot
@camperbot
Jan 29 2016 00:12
masterjdnc sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2107 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 29 2016 00:13
strange you have both firstName in your code and fname....
Jordan S.
@GlobalPioneers
Jan 29 2016 00:13

anyone able to help me out with this ? i believe what I'm missing is simple but i can't see it,
var myTotal = 0;

for (var i = 0; i < myArr.length; i++) {
myTotal += myArr[i];
}

i need to initialize total to 0 and declare it, only error message I'm getting
venit2
@venit2
Jan 29 2016 00:14
is there a var total?
sounds like it is check the var total, not myTotal
Ege Tuncoz
@etuncoz
Jan 29 2016 00:14
@rphares ye im kinda confused because both the parameter and other thing is named firstName. thats why i felt like i should change it
rphares
@rphares
Jan 29 2016 00:15
no need to change it ... @venit2 , you done profile lookup yet?
i have someone's pseudo-isn code if that might help? its not the way i did it, but it is more abstract then what i can say, I'm nt good at talking about ideas... @etuncoz
Ege Tuncoz
@etuncoz
Jan 29 2016 00:17
sure i'd appreciate any kind of help
rphares
@rphares
Jan 29 2016 00:17
k, maybe this will help,
lookup(firstname, prop) {

var foundPerson = false;
var foundProp = false;

for ( var i = 0; i < contacts.length; i++) { // that is not pseudocode
    // contacts[i] is going to refer to each person in the contact list for each loop iteration
    if ( contacts[i].firstName === firstName ) {
        // we have a contact with a matching name, record that fact
       foundPerson = true;
        if ( contacts[i].hasOwnProperty(prop) ) {
            return (whatever you're supposed to do if you find the property);
       } else {
            return (whatever you're supposed to return if there is a person without the property);
        }
    }
}
// if we get here, we did not find the contact with that first name, we can check
if ( foundPerson !== true ) {
    return (whatever you're supposed to return if you didn't find a contact);
}
}
Ege Tuncoz
@etuncoz
Jan 29 2016 00:18
alrighty @rphares thanks for your time!
CamperBot
@camperbot
Jan 29 2016 00:18
etuncoz sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2108 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 29 2016 00:18
(the colors are all off since there is so much commenting/not real code, but... :blush: )
sure thing, anytime! I'm sorry, I'm terrible at explain, i hope the hint stuff in there will make things clearer...
Charley B
@charleyblue
Jan 29 2016 00:19

For the given id in collection:

If value is non-blank (value !== "") and prop is not "tracks" then update or set the value for the prop.

var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {
var check = collection.hasOwnProperty(prop);
  if (check) {
    if (value !== "" && prop !== "tracks") {
      value = collection.id[prop][value];
    }
  }

  return collection;

What am I missing please to not complete the first section of this?

rphares
@rphares
Jan 29 2016 00:20
shoot... i forget who to thank, they want brownies when i use their hint.... @...ack!
Elizabeth Fine
@elizabethfinedev
Jan 29 2016 00:20
what kind of error are you getting charley
rphares
@rphares
Jan 29 2016 00:21
guy whose idea that is, if you see this send me your name so i can thank you... :pensive:
Charley B
@charleyblue
Jan 29 2016 00:21
@BananaHavana it is not adding the arguments to the object.
Ege Tuncoz
@etuncoz
Jan 29 2016 00:21
@charleyblue try accessing the collection with brackets because id is a variable
Charley B
@charleyblue
Jan 29 2016 00:22
like this...
```
```
function update(id, prop, value) {
var check = collection.hasOwnProperty(prop);
  if (check) {
    if (value !== "" && prop !== "tracks") {
      value = collection[id][prop][value];
    }
  }

  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
Still doesn't add artist: "ABBA" to the object
Ege Tuncoz
@etuncoz
Jan 29 2016 00:23
@charleyblue i would do collection[id][prop]=value;
lightwavvves
@lightwavvves
Jan 29 2016 00:24
I'm baffled by the Return Early Pattern for Functions... can someone help me please?
rphares
@rphares
Jan 29 2016 00:25
okeydoke-- what have you tried so far, @lightwavvves ?
lightwavvves
@lightwavvves
Jan 29 2016 00:25

if (a < 0 || b < 0) {

return "undefined";
}

rphares
@rphares
Jan 29 2016 00:25
oh, SOOO close
Charley B
@charleyblue
Jan 29 2016 00:25
That didn't work either...I am not getting something here!
rphares
@rphares
Jan 29 2016 00:25
so, undefined is a special value, @lightwavvves
"undefined" is just a string
lightwavvves
@lightwavvves
Jan 29 2016 00:25
yeah, not a string
as i originally interpreted
but i don't know what produces the undefined value
rphares
@rphares
Jan 29 2016 00:26
just remove the quotes :)
Charley B
@charleyblue
Jan 29 2016 00:26
Help please
CamperBot
@camperbot
Jan 29 2016 00:26

:point_right: bonfire no repeats please [wiki]

Problem Explanation:

  • This task requires us to look at each possible permutation of a string. This is best done using a recursion function. Being able to build a function which collects all permutations of a string is a common interview question, so there is no shortage of tutorials out there on how to do this, in many different code languages.
  • This task can still be daunting even after watching a tutorial. You will want to send each new use of the function 3 inputs: 1. a new string (or character array) that is being built, 2. a position in your new string that's going to be filled next, and 3. an idea of what characters (more specifically positions) from the original string have yet to be used. The pseudo code will look something like this:

    ```
    var str = ???;
    perm(current position in original string, what's been used in original string, current string build thus far){
    if(current string is finished) {
    print current string;
    }else{
    for(var i = 0; i < str.length; i++) {

    if(str[i] has not been used) {
      put str[i] into the current position;
      mark str[i] as used
      perm(current position in original string, what's been used in original string, current string build thus far)
      unmark str[i] as used because another branch in the tree for i + 1 will still likely use it;
    }

    }
    }
    }
    :pencil: read more about bonfire no repeats please on the FCC Wiki

Charley B
@charleyblue
Jan 29 2016 00:27
Please help?
Josue Escobar
@jees10
Jan 29 2016 00:27
help Return Early Pattern for Functions
CamperBot
@camperbot
Jan 29 2016 00:27

:point_right: waypoint return early pattern for functions [wiki]

Waypoint: Return Early Pattern for Functions

When a return statement is reached, the execution of the current function stops and control returns to the calling location.

Example

function myFun() {
  console.log("Hello");
  return "World";
  console.log("byebye")
}
myFun();

The above outputs "Hello" to the console, returns "World", but "byebye" is never output, because the function exits at the return statement.
:pencil: read more about waypoint return early pattern for functions on the FCC Wiki

lightwavvves
@lightwavvves
Jan 29 2016 00:27
wow. duh. thanks lol
rphares
@rphares
Jan 29 2016 00:27
anytime :)
Happy coding, @lightwavvves ~
lightwavvves
@lightwavvves
Jan 29 2016 00:28
thanks, you too :smile:
Charley B
@charleyblue
Jan 29 2016 00:28
I don't see what I am not seeing
Jocelyn
@jocelyn-ong
Jan 29 2016 00:29
@charleyblue show us your current code again?
rphares
@rphares
Jan 29 2016 00:30
@charleyblue , you will probably wanna start with a for loop...
Charley B
@charleyblue
Jan 29 2016 00:30
No
neither a hasOwnProperty either apparently
```
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    2468: {
      album: "1999",
      artist: "Prince",
      tracks: [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    1245: {
      artist: "Robert Palmer",
      tracks: [ ]
    },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {
//var check = collection.hasOwnProperty(prop);
  //if (check) {
    if (value !== "" && prop !== "tracks") {
       collection[id][prop] = value;
   // }
  }

  return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");
Charley B
@charleyblue
Jan 29 2016 00:32
Now it works but not with the hasOwnProperty method.
rphares
@rphares
Jan 29 2016 00:32
@jees10 , is that early release?
okay, two things, @jees10
first, you want to write just one conditional,
Jocelyn
@jocelyn-ong
Jan 29 2016 00:32
@charleyblue what about the hasOwnProperty method?
rphares
@rphares
Jan 29 2016 00:33
if (a is less than zero OR b is less than zero) @jees10
second, @jees10 , we need to tweak the return,
undefined is a special value,
"Undefined" is just a string
We want the first one, not a string :) @jees10
Charley B
@charleyblue
Jan 29 2016 00:35
Can any one explain why collection[id][prop]= value works but value = collection[id][prop] deos not?
rphares
@rphares
Jan 29 2016 00:35
you can do it the way you are, @charleyblue ...but you still need a for loop. you need to go through the contacts lists
Jocelyn
@jocelyn-ong
Jan 29 2016 00:35
@charleyblue the second one is assigning a value to the variable value
@charleyblue while the first is assigning the value to collection/[id/]/[prop/]
Keri Gannon
@kerianngannon
Jan 29 2016 00:36
I'm working on "Using Objects for Lookups" and here's what I've got so far
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot": "Frank"
  };

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

// Change this value to test
phoneticLookup("charlie");
rphares
@rphares
Jan 29 2016 00:36
good start, @kerianngannon ~
(and wb :) )
Keri Gannon
@kerianngannon
Jan 29 2016 00:36
Hi again, @rphares :smile:
rphares
@rphares
Jan 29 2016 00:36
we need to work on what result = should be next :)
Charley B
@charleyblue
Jan 29 2016 00:37
@jocelyn-ong when I use the hasOwnProperty method, the function does not add "artist: "ABBA"" to the object.
Keri Gannon
@kerianngannon
Jan 29 2016 00:37
result= lookup ?
Jocelyn
@jocelyn-ong
Jan 29 2016 00:37
@charleyblue how are you using it?
rphares
@rphares
Jan 29 2016 00:37
because atm, result = " ", and we are gonna return result.... so we want to set result = right before we return...
oooh, very close, @kerianngannon !
Keri Gannon
@kerianngannon
Jan 29 2016 00:37
result = var lookup?
rphares
@rphares
Jan 29 2016 00:37
result = lookup[??]
Kala Radl
@mossandboar
Jan 29 2016 00:38
looking for help on "wordblanks" madlibs . Do i start str with var or somethingelse?
rphares
@rphares
Jan 29 2016 00:38
the question marks are what we are looking for...
Keri Gannon
@kerianngannon
Jan 29 2016 00:38
result = lookup [val] ?
rphares
@rphares
Jan 29 2016 00:38
:)
@mossandboar , start with result =
and just build a sentence :)
Keri Gannon
@kerianngannon
Jan 29 2016 00:38
YAY! Thank you @rphares
CamperBot
@camperbot
Jan 29 2016 00:38
kerianngannon sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2109 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 29 2016 00:39
you can just concatenate the myNoun, myAdjective stuff, @mossandboar
congrats! so much easier when we are fresh-- awesome job and happy coding! :)
Kala Radl
@mossandboar
Jan 29 2016 00:40

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

// Your code above this line
return result;
}

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

rphares
@rphares
Jan 29 2016 00:40
@mossandboar , but remember you need to add in non-word characters inbetween the wrods/parameters :) you don't want the result to be 'bigdogranquickly`, so you will need to through in some spaces :)
Kala Radl
@mossandboar
Jan 29 2016 00:40
+
rphares
@rphares
Jan 29 2016 00:40
the sentence you re building goes in-between the two lines it says
// Your code below this line
// Your code above this line
example:
sentence=  "My" + " " + myNoun + " " + myAdjective....
except that is an example, you are NOT returning sentence, store it in what you are returning,
just add whatever you want, with some spaces in between :)
Kala Radl
@mossandboar
Jan 29 2016 00:43
thank you ...
Charley B
@charleyblue
Jan 29 2016 00:44
@rphares the only problem with that is that here we didn't get to for loops yet?
rphares
@rphares
Jan 29 2016 00:44
do you get it, @mossandboar ? sorry if that isn't clear...
?? @charleyblue , i dont understand your meaning...
Kala Radl
@mossandboar
Jan 29 2016 00:46
great help thank you...
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 00:47
This message was deleted
CamperBot
@camperbot
Jan 29 2016 00:47

:point_right: waypoint using objects for lookups [wiki]

Waypoint: Using Objects for Lookups

Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to "lookup" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.

Here is an example of a simple reverse alphabet lookup:

var alpha = {
  1:"Z",
  2:"Y",
  3:"X",
  4:"W",
  ...
  24:"C",
  25:"B",
  26:"A"
};
alpha[2]; // "Y"
alpha[24]; // "C"

:pencil: read more about waypoint using objects for lookups on the FCC Wiki

rphares
@rphares
Jan 29 2016 00:47
anytime, @mossandboar ~
@SwistakStyle , ar you calling the wiki or asking for help?
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 00:48
wanted to test wiki first but i dont know how to use it :D
rphares
@rphares
Jan 29 2016 00:48
ah-- we actually have a whole room for learning to use Cbot, @SwistakStyle , https://gitter.im/FreeCodeCamp/camperbotPlayground
Josue Escobar
@jees10
Jan 29 2016 00:48
thank you @rphares
CamperBot
@camperbot
Jan 29 2016 00:48
jees10 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
rphares
@rphares
Jan 29 2016 00:48
if you go there and type commands a long, long list will pop up to experiment with
CamperBot
@camperbot
Jan 29 2016 00:49
:star: 2110 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 29 2016 00:49
(pleae dont type that here, though, it'll spam the chat @SwistakStyle )
some of the commands are outdated,
but others are useful, especially help, explain, and wiki
and of course, the best ever... holler!
CamperBot
@camperbot
Jan 29 2016 00:49
holler back!
rphares
@rphares
Jan 29 2016 00:50
anytime :)
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 00:50
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
  result = {
    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta":"Denver",
    "echo": "Easy",
    "foxtrot":  "Frank"

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

// Change this value to test
phoneticLookup("charlie");
tried sth like this but dont have clue how it should work, cna u help me?
Jocelyn
@jocelyn-ong
Jan 29 2016 00:50
@SwistakStyle you're almost there
but you want result to just be one of the items
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 00:51
any tips ?
Jocelyn
@jocelyn-ong
Jan 29 2016 00:51
not the whole object
@SwistakStyle result should be calling object[key]
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 00:52
ye i got this when u said that i need one of the items
i realized that i didnt declared this
Jocelyn
@jocelyn-ong
Jan 29 2016 00:52
@SwistakStyle yup, so your {object} should probably be set to another variable name too
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 00:52
love u
@jocelyn-ong thanks
CamperBot
@camperbot
Jan 29 2016 00:52
swistakstyle sends brownie points to @jocelyn-ong :sparkles: :thumbsup: :sparkles:
:star: 447 | @jocelyn-ong | http://www.freecodecamp.com/jocelyn-ong
JackeL
@jackel27
Jan 29 2016 00:53
explain filter
CamperBot
@camperbot
Jan 29 2016 00:53

:point_right: waypoint filter arrays with filter [wiki]

Filter is a useful method that can filter out values that don't match a certain criteria.

var array = [1,2,3,4,5,6,7,8,9,10];
  // Only change code below this line.
array = array.filter(function(val) {
  return val <= 5;
});

:pencil: read more about waypoint filter arrays with filter on the FCC Wiki

JackeL
@jackel27
Jan 29 2016 00:53
explain map
CamperBot
@camperbot
Jan 29 2016 00:53

:point_right: bonfire map the debris [wiki]

Problem Explanation:

The first thing to do is to get familiar with what the program is for, for this I would suggest you check the Wikipedia link as that is very important and from where you can also get the formula for the conversion. The hardest part are finding the formula, implementing it and for some modifying objects by the key. However, something that is not very clear is the fact that your program has to be able to check for any number of objects in the array which is what is tested on the second part.

:pencil: read more about bonfire map the debris on the FCC Wiki

Samuel Torrejon
@samirthedeer
Jan 29 2016 00:54
Im looking for some help with escape sequences in strings, how can i assign backslash tab tab carriage-return new-line to a string?
rphares
@rphares
Jan 29 2016 00:54
@samirthedeer , you see the chart on the left?
we want to use the 'code' half,
so, for example, backslash would be \\
just write it out with the code part of the chart, no words :)
Samuel Torrejon
@samirthedeer
Jan 29 2016 00:57
my code looks like this
var myStr =" \ \t \t \r \n"; // Change this line
Charley B
@charleyblue
Jan 29 2016 00:57
ugh!
Keri Gannon
@kerianngannon
Jan 29 2016 00:57
I'm stuck on the "Testing Objects for Properties" waypoint. I know there's something wrong with my syntax, but I can't figure out what
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
 if (myObj.hasOwnProperty("gift" || "pet" || "bed")){
   return true; }

 else {
   return false}; // Your Code Here


}

// Test your code by modifying these values
checkObj("gift");
rphares
@rphares
Jan 29 2016 00:57
havnet double checked, but it looks like you have a space at the beginning, @samirthedeer , in between " and \
try deleting that while i pull up my answer to double check, @samirthedeer :)
Samuel Torrejon
@samirthedeer
Jan 29 2016 00:58
Thank you for the help! you helped me figured it out
rphares
@rphares
Jan 29 2016 00:59
awesome, congrats!
InspireHD
@InspireHD
Jan 29 2016 01:00
@rphares hello...whats uppppp!
rphares
@rphares
Jan 29 2016 01:00
WB, @InspireHD !! :)
InspireHD
@InspireHD
Jan 29 2016 01:00
I couldn't log in last night or I would have been here!
Samuel Torrejon
@samirthedeer
Jan 29 2016 01:00
thank you @rphares
CamperBot
@camperbot
Jan 29 2016 01:00
samirthedeer sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2111 | @rphares | http://www.freecodecamp.com/rphares
InspireHD
@InspireHD
Jan 29 2016 01:01
@kerianngannon your IF statement is on the right track, but think of it more like what you're trying to check
Keri Gannon
@kerianngannon
Jan 29 2016 01:01
I changed it, and here's what I have
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
 if (myObj.hasOwnProperty("gift")){
   return "pony"; }

  else if (myObj.hasOwnPropety("pet")){
    return "kitten";
  }

  else if (myObj.hasOwnProperty("bed")){
    return "sleigh";
  }
 else {
   return "Not Found";} // Your Code Here


}

// Test your code by modifying these values
checkObj("gift");
JackeL
@jackel27
Jan 29 2016 01:01
@kerianngannon js
function checkObj(checkProp) {
    if (myObj.hasOwnProperty(checkProp)) { // this is a boolean, you can pass in checkProp to this.
        return myObj[checkProp];
    } else {
        return "Not Found";
    }
InspireHD
@InspireHD
Jan 29 2016 01:02
@kerianngannon the lesson is that you want to test myObj for checkProp...so IF myObj.hasOwnProperty(what are you checking here?)
Enrique Cahua
@enriquecahua
Jan 29 2016 01:02
@kerianngannon your code should check for the variable checkProp, not the three given ones in the problem. When checkObj("checkProp") is called, it can be any named string
brittli
@brittli
Jan 29 2016 01:03
find constructor
JackeL
@jackel27
Jan 29 2016 01:04
@kerianngannon see my code above how I passed in checkProp to see if it is a property of myObj
Keri Gannon
@kerianngannon
Jan 29 2016 01:05
Ok, that makes sense. I didn't need to search for 3 separate strings, just the variable checkProp
Enrique Cahua
@enriquecahua
Jan 29 2016 01:05
I try not to post answers just hints but since there is one already up
 return myObj.hasOwnProperty(checkProp) ? myObj[checkProp] :"Not Found";
}
Keri Gannon
@kerianngannon
Jan 29 2016 01:05
Yeah, I prefer hints instead of answers
InspireHD
@InspireHD
Jan 29 2016 01:06
@kerianngannon the idea is that you're checking your object to see if whatever your input is is in there. THat way you only have to add to the object instead of continuing your chain of if/else statements
Keri Gannon
@kerianngannon
Jan 29 2016 01:06
I have 7 more JavaScript waypoints until I can get back to my projects :fire:
Enrique Cahua
@enriquecahua
Jan 29 2016 01:07
@kerianngannon GL!
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:10
one more question ;d
rphares
@rphares
Jan 29 2016 01:11
whats up?
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:11
got answer above Xd
god damn it :D it was so simple but i was trying to overcomplicate this
rphares
@rphares
Jan 29 2016 01:12
happens all the time--
congrats! :)
moukhtari
@moukhtari
Jan 29 2016 01:12
Hello guys
rphares
@rphares
Jan 29 2016 01:13
Hi, @bkasri :)
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:13
i tried to switch for objects but it wouldnt work for last one dunno why
hi @bkasri
how u doing ? @bkasri
Enrique Cahua
@enriquecahua
Jan 29 2016 01:14
@bkasri are you there??? pls respond
moukhtari
@moukhtari
Jan 29 2016 01:15
Pretty good actually @SwistakStyle
Oh hi @rphares how's it going man?
rphares
@rphares
Jan 29 2016 01:15
Good good, thanks :) You?
moukhtari
@moukhtari
Jan 29 2016 01:18
I'm nothing but thankful this week is almost over
I'll finally get the chance to start working on the basic algorithm challenges hihi
rphares
@rphares
Jan 29 2016 01:19
Woohoo! Congrats, you are zooming along :)
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:20
how long are u coding @bkasri ?
Amy Surrett
@CaptainShadow
Jan 29 2016 01:21

```function bouncer(arr) {
function Filter(value){
return value !== (null||false||""||0||NaN||undefined);
}
var step1 = arr.filter(Filter);
return arr;
}

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

Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:22
use Enter after ``` and before it @CaptainShadow
Amy Surrett
@CaptainShadow
Jan 29 2016 01:22
@SwistakStyle thanks. it usually works, i don't know why it didn't this time
CamperBot
@camperbot
Jan 29 2016 01:22
captainshadow sends brownie points to @swistakstyle :sparkles: :thumbsup: :sparkles:
:star: 216 | @swistakstyle | http://www.freecodecamp.com/swistakstyle
Amy Surrett
@CaptainShadow
Jan 29 2016 01:23
the fancy text, not the program. the code doesn't work and i haven't the slightest idea why
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:23
i usually type ``` enter so it makes space to paste code. edit your code.
and thanks its my first browni point :D
Amy Surrett
@CaptainShadow
Jan 29 2016 01:25
function bouncer(arr) {
  function Filter(value){
    return value !== (null||false||""||0||NaN||undefined);
  }
var step1 = arr.filter(Filter);
  return arr;
}

bouncer([7, "ate", "", false, 9]);
there we go.
Ryan
@ryanforever
Jan 29 2016 01:28
that doesn't work?
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:28
aye,but i cant help u there yet ;d.
Tennile Edwards
@telaed
Jan 29 2016 01:29
Good evening every one!
I've been working on the Search and Destroy bonfire and I've been stuck for 2 days.
Here is my code.

function destroyer(arr) {
var newArr = arguments[0];
var args = Array.prototype.slice.call(arguments);
args.splice(0,1);

function seek(value){
for (var i = 1; i < args.length; i++){
if(args[i] == value){
return false;
}
}
}
var retArr = newArr.filter(seek);
return retArr;

}

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

not sure what I'm doing wrong :(
Jocelyn
@jocelyn-ong
Jan 29 2016 01:30
bf search and destroy
CamperBot
@camperbot
Jan 29 2016 01:30
Sorry, can't find a bonfire called search and destroy. [ Check the map? ]
Tennile Edwards
@telaed
Jan 29 2016 01:30
sorry seek and destroy
Jocelyn
@jocelyn-ong
Jan 29 2016 01:30
bf seek and destroy
CamperBot
@camperbot
Jan 29 2016 01:30

:fire:Bonfire: Seek and Destroy :link:

function destroyer(arr) {
  // Remove all the values
  return arr;
}

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

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

more info:  bf details | bf links | hint

Ryan
@ryanforever
Jan 29 2016 01:31
@CaptainShadow the part where you list all of the elements you are trying to filter out seems to itself evaluate to undefined
Andrew Charlebois
@andrewchar
Jan 29 2016 01:32
function myTest(val) {
  if (val > 10) {
      return "Greater than 10";
  } else if (val < 5) {
      return "Smaller then 5";
  } else {
      return "Between 5 and 10";
  }
}
// Change this value to test
myTest(7);
how is this not working...
its giving an error on "myTest(0) should return "Smaller than 5""
InspireHD
@InspireHD
Jan 29 2016 01:32
@andrewchar if I remember right it wanted you to put it in the correct order
rphares
@rphares
Jan 29 2016 01:32
@andrewchar ,lets look at the order--
Amy Surrett
@CaptainShadow
Jan 29 2016 01:32
@ryanforever thanks, ill check it out
CamperBot
@camperbot
Jan 29 2016 01:32
captainshadow sends brownie points to @ryanforever :sparkles: :thumbsup: :sparkles:
:star: 268 | @ryanforever | http://www.freecodecamp.com/ryanforever
rphares
@rphares
Jan 29 2016 01:33
oh, wait-- you've turned some around, lol
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:34
it should be okay, mb try reload page
Ryan
@ryanforever
Jan 29 2016 01:34
@andrewchar just change "then" to "than" and you should be ok ;)
Jocelyn
@jocelyn-ong
Jan 29 2016 01:34
@telaed you didn't call a value into the seek function
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:34
yeee :D
hahaha typo xD
Andrew Charlebois
@andrewchar
Jan 29 2016 01:35
omg
lmfao
Ryan
@ryanforever
Jan 29 2016 01:35
@andrewchar your logic is fine; the tests are picky lol.
Andrew Charlebois
@andrewchar
Jan 29 2016 01:35
2 minutes staring going..... wth!!!!!
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:35
so perceptive @ryanforever
Andrew Charlebois
@andrewchar
Jan 29 2016 01:35
@ryanforever thanks
CamperBot
@camperbot
Jan 29 2016 01:35
andrewchar sends brownie points to @ryanforever :sparkles: :thumbsup: :sparkles:
:star: 269 | @ryanforever | http://www.freecodecamp.com/ryanforever
InspireHD
@InspireHD
Jan 29 2016 01:35
I'm having trouble with accessing nested arrays in JSON..the type and list words are throwing me off
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:36
@InspireHD show your code so we can help u
InspireHD
@InspireHD
Jan 29 2016 01:36

var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
}
];

// Only change code below this line

var secondTree = myPlants.trees0;

Tennile Edwards
@telaed
Jan 29 2016 01:36
@jocelyn-ong I called it the same way in Falsy Bouncer
InspireHD
@InspireHD
Jan 29 2016 01:36
I don't know how to post code....
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:36
use ``` before code and after so it will be formated
Tennile Edwards
@telaed
Jan 29 2016 01:37
Let me go back and double check my work...
rphares
@rphares
Jan 29 2016 01:37
@InspireHD , looking for pine?
InspireHD
@InspireHD
Jan 29 2016 01:37
yes

```var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
}
];

// Only change code below this line

var secondTree = myPlants.trees0;

rphares
@rphares
Jan 29 2016 01:37
so, you are going in the right direction, but we need two changes :)
InspireHD
@InspireHD
Jan 29 2016 01:37
sorry for F'ng up the chat screen haha
rphares
@rphares
Jan 29 2016 01:37
its okay, i remember this one, it comes up a lot :)
so, first, we need to index both parts,
InspireHD
@InspireHD
Jan 29 2016 01:37
it's just the "type" and "list" words are throwing me off since it doesn't follow the example
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:38
enter after this
InspireHD
@InspireHD
Jan 29 2016 01:38
oh before and after...doh
rphares
@rphares
Jan 29 2016 01:38
where in myPlants is it, myPlants[0] or myPlants[1] , @InspireHD ?
InspireHD
@InspireHD
Jan 29 2016 01:38
myPlants1
how do you get that gray box!
rphares
@rphares
Jan 29 2016 01:38
yep!
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:38
so decalre this and then go to other array
rphares
@rphares
Jan 29 2016 01:38
then the second part is that it isn't in trees...
look carefully at where the comma and [] are... what is it really in?, @InspireHD
Jocelyn
@jocelyn-ong
Jan 29 2016 01:39
@InspireHD use a single backtick `
InspireHD
@InspireHD
Jan 29 2016 01:39
omg..got it
rphares
@rphares
Jan 29 2016 01:40
yay! congrats!
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:40
var secondTree = myPlants.trees1.
now lets move to second part :D
gratz
InspireHD
@InspireHD
Jan 29 2016 01:40
seriously...i feel like I try every sort of combination and it doesn't work!
rphares
@rphares
Jan 29 2016 01:40
and @jocelyn-ong is right-- for grey, just one backtick
InspireHD
@InspireHD
Jan 29 2016 01:40
`myPlants1
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:40
had the same problem like 5 minutes ago ;d
InspireHD
@InspireHD
Jan 29 2016 01:40
didn'tw ork
rphares
@rphares
Jan 29 2016 01:40
you need BOTH halves, @InspireHD
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:40
var secondTree = myPlants.trees1.
rphares
@rphares
Jan 29 2016 01:40
nope--
its not in trees...
InspireHD
@InspireHD
Jan 29 2016 01:41
myPlants[1]
ahhhh
rphares
@rphares
Jan 29 2016 01:41
thats the first half, but you still need the second half,
InspireHD
@InspireHD
Jan 29 2016 01:41
myPlants[1].list[1];
rphares
@rphares
Jan 29 2016 01:41
:)
InspireHD
@InspireHD
Jan 29 2016 01:41
i swear i tried that!
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:41
ye
e
hahahah :D
rphares
@rphares
Jan 29 2016 01:41
congrats to both of you!
InspireHD
@InspireHD
Jan 29 2016 01:41
actually I probably did myPlants.trees.list
rphares
@rphares
Jan 29 2016 01:41
what often happens is we try something half right--
like myPlants.list[1]
and it doesn't work,
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:42
couldnt send correct answer cuz i have problems with that chat :D
InspireHD
@InspireHD
Jan 29 2016 01:42
i like the hints :)
rphares
@rphares
Jan 29 2016 01:42
so we think list[1] is wrong,
InspireHD
@InspireHD
Jan 29 2016 01:42
makes me still think about the problem and why it works
rphares
@rphares
Jan 29 2016 01:42
thats our goal :)
(when i can. when i know the answer but can't hint, i feel terrible :pensive: )
Asa Smith
@asasmith
Jan 29 2016 01:45
var letterCount = 0;

function findLongestWord(str) {

  var splitArray = str.split(' ');
    for(var i = 0; i < splitArray.length; i++){
      if(splitArray[i].length > letterCount){
        letterCount = splitArray[i].length;
      }

    }
 return letterCount;

}

findLongestWord("May the force be with you");
Says I'm passing all of the tests except for this one. Should return 5, which it does.
InspireHD
@InspireHD
Jan 29 2016 01:46
I think my brain just stopped working after reading the next lesson
record collection
oscar
@oscarg91
Jan 29 2016 01:47
hey sorry this might seem dumb but I'm stuck on the first one where it says "Use the var keyword to create a variable called myName."
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:48
var myName
oscar
@oscarg91
Jan 29 2016 01:48
// Example
var ourName;

// Define myName below this line
var myName;
InspireHD
@InspireHD
Jan 29 2016 01:48
@oscarg91 var is short for "variable" which initializes the variable
then you call it whatever you want..in this case it's myName
or it could be var oscar;
oscar
@oscarg91
Jan 29 2016 01:50
// Example
var ourName;
var myName;
// Define myName below this line

var Oscar;
Pandarati
@Pandarati
Jan 29 2016 01:50
@oscarg91 Thats not dumb. It happens man.. It happens. :)
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:50
@InspireHD im also at record collection ;p just took a break
oscar
@oscarg91
Jan 29 2016 01:50
its not working
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:50
```
// Example
var ourName;

// Define myName below this line
var myName;
```
InspireHD
@InspireHD
Jan 29 2016 01:50
@oscarg91 variables much start lowercase I think
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:50
is correct
rajesh304
@rajesh304
Jan 29 2016 01:51
whats wrong in this??
InspireHD
@InspireHD
Jan 29 2016 01:51
*must
rajesh304
@rajesh304
Jan 29 2016 01:51

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

// Only change code below this line

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

rphares
@rphares
Jan 29 2016 01:51
oh, pretty close, @rajesh304 !
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:51
@rajesh304 use formatin ```
rphares
@rphares
Jan 29 2016 01:51
you have our {} in the wrong spot...
InspireHD
@InspireHD
Jan 29 2016 01:52
@rajesh304 brackets are mainly used for words that have a space in them
Pandarati
@Pandarati
Jan 29 2016 01:52
help format code
CamperBot
@camperbot
Jan 29 2016 01:52
no wiki entry for: format code
Pandarati
@Pandarati
Jan 29 2016 01:52
:/
rphares
@rphares
Jan 29 2016 01:52
explain format
CamperBot
@camperbot
Jan 29 2016 01:52

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

rphares
@rphares
Jan 29 2016 01:52
;)
Pandarati
@Pandarati
Jan 29 2016 01:52
@rphares to the rescue! :P
oscar
@oscarg91
Jan 29 2016 01:52
// Example
var ourName;

// Define myName below this line

var myName;
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:53
@oscarg91 what's the issue?
oscar
@oscarg91
Jan 29 2016 01:53
i don't understand what its not working??
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:53
oscar its correct
reload page
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:53
^try that, it glitches sometimes
InspireHD
@InspireHD
Jan 29 2016 01:54
yeah i just tried it and it works
Control + Enter
I don't think I can do Record Collection tonight. My brain is fried. Worked 12 hours today
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:54
once i had that glitch i was so angry xdd was sure its correct but error ;p
oscar
@oscarg91
Jan 29 2016 01:54
ok thanks i reloaded the page and it worked thanks @SwistakStyle @prosdkr @InspireHD
CamperBot
@camperbot
Jan 29 2016 01:54
oscarg91 sends brownie points to @swistakstyle and @prosdkr and @inspirehd :sparkles: :thumbsup: :sparkles:
:star: 290 | @prosdkr | http://www.freecodecamp.com/prosdkr
:star: 219 | @swistakstyle | http://www.freecodecamp.com/swistakstyle
:star: 221 | @inspirehd | http://www.freecodecamp.com/inspirehd
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:55
@InspireHD you can show me your code, I'll take a look :)
rphares
@rphares
Jan 29 2016 01:55
thats a lot of hard work- congrats, @InspireHD ~
rajesh304
@rajesh304
Jan 29 2016 01:55
ok thnx guys :+1:
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:55
@InspireHD i will try this yet ;p
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:55
@rajesh304 No problem :)
InspireHD
@InspireHD
Jan 29 2016 01:56

``` if (value !== "" && prop !== "tracks"){

}
```

that's all I got so far
whhhy no format
Pandarati
@Pandarati
Jan 29 2016 01:56
@InspireHD You want to use shift+enter to properly format code.
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:56
type js after the `btw then shift enter
i do js, but maybe you don't have to idk
InspireHD
@InspireHD
Jan 29 2016 01:57
i tried that and all it did was kept making new lines
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:57
type three`
then js
then shift enter
Pandarati
@Pandarati
Jan 29 2016 01:57
@InspireHD Yeah the "```" should be on their own lines
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:57
then when you are done
shift enter to send
InspireHD
@InspireHD
Jan 29 2016 01:57
  if (value !== "" && prop !== "tracks"){

  }
Jonathan Mitchell
@Vanhealen
Jan 29 2016 01:57
So on freecodecamp we are basically using a built in editor that displays the output on the right side. If I wanted to do this offline are there any editors that allow this type of functionality?
InspireHD
@InspireHD
Jan 29 2016 01:57
ahhh i'm dumb
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:57
good :)
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 01:57
gratz
InspireHD
@InspireHD
Jan 29 2016 01:58
that's all i have so far
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:58
then your next step would be
 collection[id][prop] = value;
rajesh304
@rajesh304
Jan 29 2016 01:58
// Setup
var myPlants = [
  { 
    type: "flowers",
    list: [
      "rose",
      "tulip",
      "dandelion"
    ]
  },
  {
    type: "trees",
    list: [
      "fir",
      "pine",
      "birch"
    ]
  }  
];

// Only change code below this line

var secondTree = ""; // Change this line
Pandarati
@Pandarati
Jan 29 2016 01:58
@Vanhealen A popular IDE to use is sublime text
rajesh304
@rajesh304
Jan 29 2016 01:58
no worries just testing :smile:
Pandarati
@Pandarati
Jan 29 2016 01:59
@Vanhealen but you can google "WYSIWYG javascript editors". What You See Is What You Get
Syed Isam Hashmi
@prosdkr
Jan 29 2016 01:59
@InspireHD that help?
InspireHD
@InspireHD
Jan 29 2016 01:59
@prosdkr I don't even know what that means
Andrew Charlebois
@andrewchar
Jan 29 2016 02:00
This golf code exercise ughhhhhhh
InspireHD
@InspireHD
Jan 29 2016 02:00
  if (value !== "" && prop !== "tracks"){
    value = collection[id][prop];
  }
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:00
@InspireHD nononono
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:00
@andrewchar its simple just much typping
rphares
@rphares
Jan 29 2016 02:00
heh, yeah, a lot of people struggle with the golf one, its hard...
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:00
what you are doing is setting the collection property to the value
InspireHD
@InspireHD
Jan 29 2016 02:00
the golf code one was one of my favorite
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:01
@rphares really? I thought that was quite easy...
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:01
^same
rphares
@rphares
Jan 29 2016 02:01
we get it here in the room several times a day,
Andrew Charlebois
@andrewchar
Jan 29 2016 02:01
apparently im not understanding what numbers i need to be returning
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:02
I just used like, 10 if statements lol
rphares
@rphares
Jan 29 2016 02:02
record collection, stand in line, golf code, objects for lookup, return early...
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:02
hope I didnt do it wrong
rphares
@rphares
Jan 29 2016 02:02
heavy hitters, all
me too, @prosdkr ,
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:02
ah okay good
InspireHD
@InspireHD
Jan 29 2016 02:02
@prosdkr I guess I don't understand how I would have know that
rphares
@rphares
Jan 29 2016 02:02
but... its a common one to get stuck on
catmojo
@catmojo
Jan 29 2016 02:02

Need help plz....stuck on the Assignment with a Returned Value segment of javascript...i think im over thinking it but now done even know where to begin var processed = 0;

function process(num) {
return (num + 3) / 5;

rphares
@rphares
Jan 29 2016 02:02
oh, and word banks,
that trips people up a lot, too
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:02
record collection thats the point where im stuck now xD
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:02
@InspireHD yeah, try looking at it from a different viewpoint... sleep it off then come back the next day
rphares
@rphares
Jan 29 2016 02:03
well, you want to assign something to processed, right?
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:03
@SwistakStyle how so, need help?
catmojo
@catmojo
Jan 29 2016 02:03
i assigned 7
rphares
@rphares
Jan 29 2016 02:03
how did you assign 0 to processed at the beginning, @catmojo ?
catmojo
@catmojo
Jan 29 2016 02:03
to process
InspireHD
@InspireHD
Jan 29 2016 02:03
@prosdkr all of this is bending my brain into knots so I probably wouldn't have ever thought to use what you told me to do
rphares
@rphares
Jan 29 2016 02:03
not quite-- we don't want to assign 7 to it... we want to Call process with 7
Jonathan Mitchell
@Vanhealen
Jan 29 2016 02:03
@Pandarati Thank you, yes I use sublime text already but I have not used WYSIWYG yet. Any recommendations?
CamperBot
@camperbot
Jan 29 2016 02:03
vanhealen sends brownie points to @pandarati :sparkles: :thumbsup: :sparkles:
:star: 339 | @pandarati | http://www.freecodecamp.com/pandarati
rphares
@rphares
Jan 29 2016 02:04
and assign that to processed... @catmojo
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:04
@InspireHD haha well, I hope it helped you get on the right track :)
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:04
i just need time to think, its 3am im just reading chat right now ;p
rphares @rphares goes to double check that rphares is remembering the instructions right :)
catmojo
@catmojo
Jan 29 2016 02:04
so i call it using?
rphares
@rphares
Jan 29 2016 02:04
so, we can call something like this,
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:04
@catmojo the method name and then the parameter
methodName(num)
in your case
process(7)
catmojo
@catmojo
Jan 29 2016 02:04
sorry i have lost the plot staring at it for so long
rphares
@rphares
Jan 29 2016 02:05
myFunction(9)
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:05
@rphares well, it's process :P
rphares
@rphares
Jan 29 2016 02:05
except, you are not calling myFunction, you are calling...?
and you aren't calling it with 9, you are calling it with...?
InspireHD
@InspireHD
Jan 29 2016 02:05
@prosdkr yes...i'll stare at it some more. I added more, but it's not right. maybe tomorrow i'll have a fresher mind after i get sleep
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:05
i thought he said 7 lol, oh well
catmojo
@catmojo
Jan 29 2016 02:05
so i have to create a new function
rphares
@rphares
Jan 29 2016 02:05
@prosdkr -- i know that :)
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:06
@InspireHD trust me, programming doesnt come over night :smile:
rphares
@rphares
Jan 29 2016 02:06
trying not to say the answer, letting @catmojo get it :blush:
Jonathan Mitchell
@Vanhealen
Jan 29 2016 02:06
@Pandarati You can integrate this into sublime text editor?
catmojo
@catmojo
Jan 29 2016 02:06
i wish it did...lol
Pandarati
@Pandarati
Jan 29 2016 02:06
@Vanhealen I use brackets personally for Javascript, but I do more of Java programming. So, I'm not too familiar with alot of Javascript WYSIWYG
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:06
@rphares gotcha :P
Jonathan Mitchell
@Vanhealen
Jan 29 2016 02:06
@pndar
catmojo
@catmojo
Jan 29 2016 02:06
processed?
Matt Leonard
@matty22
Jan 29 2016 02:06
Any experts on closures around?
Jonathan Mitchell
@Vanhealen
Jan 29 2016 02:07
@Pandarati and Brackets has a live preview option I believe right?
matthew3454
@matthew3454
Jan 29 2016 02:07
I need help the Waypoint how to count Backwards with a For Loop. Can Someone help? Here's what I've got so far:
// Example
var ourArray = [];

for (var i = 10; i > 0; i -= 2) {
  ourArray.push(i);
}

// Setup
var myArray = [];

// Only change code below this line.
for (var i = 9; i <= 9 || i >=1 ; i -=2){
  myArray.push(i);
}
Pandarati
@Pandarati
Jan 29 2016 02:07
@Vanhealen Yeah yeah. It's pretty awesome.
and Free :P
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:07
@matthew3454 you are adding number it seems from ten in increments of two so your array will be "10, 8, 6, 4, 2, 0"
rphares
@rphares
Jan 29 2016 02:08
@catmojo , not quite-- Call the process function with an argument of 7
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:08
oh thats example of course its right lol
rphares
@rphares
Jan 29 2016 02:08
you want to call process with 7, @catmojo
matthew3454
@matthew3454
Jan 29 2016 02:08
@prosdkr okay. Should I use 1 instead of 2?
venit2
@venit2
Jan 29 2016 02:08
@matthew3454 you have an ||
Pandarati
@Pandarati
Jan 29 2016 02:08
@rphares are you a developer full time?
rphares
@rphares
Jan 29 2016 02:08
so if i call myFunction with 9, by writing myFunction(9).... how can you write what you want, @catmojo ?
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:08

@matthew3454

for (var i = 9; i <= 9 || i >=1 ; i -=2){
  myArray.push(i);
}

try getting rid of i<=9

and the ||
matthew3454
@matthew3454
Jan 29 2016 02:09
@prosdkr okay.
rphares
@rphares
Jan 29 2016 02:09
lol! @Pandarati , im a newbie! :blush:
InspireHD
@InspireHD
Jan 29 2016 02:09
@prosdkr !!!! i got another green check mark..i'm on the right track :)
venit2
@venit2
Jan 29 2016 02:09
@matthew3454 pick any number and tell me if it is true or false for this statement, it is <= 9 or it is >= 1?
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:09
@InspireHD nice dude ;p
@matthew3454 its always true
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:10
@venit2
you only need to count backwards, it can be as high as it needs to be
@prosdkr
for (var i = 9; i >=1 ; i -= 2){
myArray.push(i);
}
try that
whoops, mentioned myself lol
venit2
@venit2
Jan 29 2016 02:11
@prosdkr I know, i want him to solve his own problem of why it doesnt work, not him answer
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:11
oh wait
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:11
@prosdkr go sleep xDDD
matthew3454
@matthew3454
Jan 29 2016 02:11
@venit2 "3"
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:11
i thought you were him :'(
sorry
matthew3454
@matthew3454
Jan 29 2016 02:11
@venit2 3 is true
Pandarati
@Pandarati
Jan 29 2016 02:11
@Vanhealen Also, I have used eclipse for Java in the past. However, they have a version for Javascript. I'm 99.99% sure it works the same way. If you want the output to be shown like FFC, Eclipse is a really good one to go with.
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:11
thanks @swistakstyle xd
CamperBot
@camperbot
Jan 29 2016 02:11
sorry swistakstyle, you can't send brownie points to yourself! :sparkles: :sparkles:
Andrew Charlebois
@andrewchar
Jan 29 2016 02:12
in the golf exercise.. what does this mean <= par - 2 "Eagle"
should i know what a par is in numerical value?
venit2
@venit2
Jan 29 2016 02:12
@matthew3454 correct 3 is true, and you would want it to work, but pick a number that you know shouldn't work, and put it in that statement
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:12
@andrewchar par is a variable
rphares
@rphares
Jan 29 2016 02:12
you can use par in your code, @andrewchar , don't need to know the meaning :)
Matt Leonard
@matty22
Jan 29 2016 02:12

Working on Arguments Optional and not understanding Closures. Here's my code if anyone can help!

``

function add() {

  if (arguments.length == 2 && typeof arguments[0] == "number" && typeof arguments[1] == "number") {
    return arguments[0] + arguments[1];
  } else if (arguments.length == 2 && typeof arguments[0] !== "number" || typeof arguments[1] !== "number") {
    return undefined;
  } else if (arguments.length == 1) {
        var a = 2;
        return function add2(b) {
        return a += b;
      };

   } 

  return false;
}

add(2)(3);
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:12
@andrewchar u need to compare par-2 with other varisble
Andrew Charlebois
@andrewchar
Jan 29 2016 02:13
i know the numbers are not correct but is my syntax correct so far
function golfScore(par, strokes) {
  // Only change code below this line
  if (1 === 1) {
      return "Hole-in-one!";
  }  else if (2 == 2) {
      return "Eagle";
  } else if (3 == 3) {
      return "Birdie";
  } else if (4 == 4) {
      return "Par";
  } else if (5 == 5) {
      return "Bogey";
  } else if (6 == 6) {
      return "Double Gogey";
  } else if (7 >= 7) {
      return "Go Home!";
  }
  // Only change code above this line
}
matthew3454
@matthew3454
Jan 29 2016 02:13
@venit2 Do you mean for the decrement?
InspireHD
@InspireHD
Jan 29 2016 02:14
@prosdkr !!! I GOT IT!
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:14
@matty22 your method call in the bottom doesn't look right
your method declaration, the "add()" at the top is empty in the parentheses
so when you call "add()" you should be putting nothing in there
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:14
@andrewchar wuuut why u use == always not variables?
rphares
@rphares
Jan 29 2016 02:14
This message was deleted
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:14
@InspireHD good, I'm glad I was able to set you on the path :)
if (1 === 1) {
return "Hole-in-one!";
}
InspireHD
@InspireHD
Jan 29 2016 02:14
@prosdkr you did. Thank you! I probably wouldn't have gotten anywhere without that
CamperBot
@camperbot
Jan 29 2016 02:14
inspirehd sends brownie points to @prosdkr :sparkles: :thumbsup: :sparkles:
:star: 291 | @prosdkr | http://www.freecodecamp.com/prosdkr
venit2
@venit2
Jan 29 2016 02:14
@matthew3454 no, so this loop variable "i" is getting smaller... but you want it to stop at a point... pick a number smaller then where you want it to stop
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:14
1===1 will ALWAYS be true
rphares
@rphares
Jan 29 2016 02:14
i lied-- forgot which one you were on!
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:15
@andrewchar
oh wait
@InspireHD no problem budd :)
Matt Leonard
@matty22
Jan 29 2016 02:15
@prosdkr Those calls are what FCC provides as the test cases
venit2
@venit2
Jan 29 2016 02:15
@matthew3454 then test it in your condition for your loop ( i <= 9 || i >=1)
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:15
@matty22 sorry, I guess I haven't gotten that far
@matty22 might wanna ignore me :P
matthew3454
@matthew3454
Jan 29 2016 02:15
@venit2 okay I'll try 0?
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:16
@andrewchar try thinking about it as par-1 and par-2
venit2
@venit2
Jan 29 2016 02:16
@matthew3454 sure, we dont want 0, but does it pass your condition?
Sebastian Przesmycki
@SwistakStyle
Jan 29 2016 02:16
im done for today, goodnight ;*
matthew3454
@matthew3454
Jan 29 2016 02:16
@venit2 It does not.
venit2
@venit2
Jan 29 2016 02:16
is 0 <= 9 or 0 >= 1?
InspireHD
@InspireHD
Jan 29 2016 02:17
@prosdkr I'm not really sure what it ended up doing, but it works
rphares
@rphares
Jan 29 2016 02:17
@andrewchar , you don't want (if val == val), you want more like if strokes is less than (something to do with par) :)
venit2
@venit2
Jan 29 2016 02:17
@matthew3454 it does pass your condition
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:17
@InspireHD lol that's programming for you :P
matthew3454
@matthew3454
Jan 29 2016 02:17
@venit2 no
venit2
@venit2
Jan 29 2016 02:17
@matthew3454 0 is <= 9 that is true
Dien Dang
@diendang271
Jan 29 2016 02:17
Help me this challenges. Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined
CamperBot
@camperbot
Jan 29 2016 02:17
no wiki entry for: me this challenges modify the function abtest so that if a or b are less than 0 the function will immediately exit with a value of undefined
matthew3454
@matthew3454
Jan 29 2016 02:17
yes @venit2
venit2
@venit2
Jan 29 2016 02:17
an || is "or" once a condition is true, the whole statement is true
Dien Dang
@diendang271
Jan 29 2016 02:17

// Setup
function abTest(a, b) {
// Only change code below this line
if (a < 0 || b < 0) {
return a;
} else {
return b;
}

// Only change code above this line

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

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

rphares
@rphares
Jan 29 2016 02:18
This message was deleted
@lulzsecd , your condition is good!
but, you only need to return undefined
you don't need an else,
or a and b
Jacob Andra
@jacob4
Jan 29 2016 02:18
caesars cipher bonfire
bonfire caesars cipher
CamperBot
@camperbot
Jan 29 2016 02:19
Sorry, can't find a bonfire called caesars cipher. [ Check the map? ]
rphares
@rphares
Jan 29 2016 02:19
undefined is a special value, @lulzsecd
thats all you need to return~
Jacob Andra
@jacob4
Jan 29 2016 02:19
c'mon, camperbot!
Dien Dang
@diendang271
Jan 29 2016 02:19
@rphares Ok thanks
CamperBot
@camperbot
Jan 29 2016 02:19
lulzsecd sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2112 | @rphares | http://www.freecodecamp.com/rphares
Jacob Andra
@jacob4
Jan 29 2016 02:20
caesars cipher
rphares
@rphares
Jan 29 2016 02:20
anytime~
wiki cipher
CamperBot
@camperbot
Jan 29 2016 02:20

:point_right: bonfire caesars cipher [wiki]

Problem Explanation:

  • You need to write a function, which will take string encoded with
    Caesar cipher as a parameter and decode it.
  • The one used here is ROT13 where the value of the letter is
    shifted by 13 places.
    e.g. 'A' ↔ 'N', 'T' ↔ 'G'.
  • You have to shift it back 13 positions, such that 'N' ↔ 'A'.
:pencil: read more about bonfire caesars cipher on the FCC Wiki
Jacob Andra
@jacob4
Jan 29 2016 02:20
hint
CamperBot
@camperbot
Jan 29 2016 02:20
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
Jacob Andra
@jacob4
Jan 29 2016 02:21
@rphares thanks for helping me out there :)
CamperBot
@camperbot
Jan 29 2016 02:21
jacob4 sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2113 | @rphares | http://www.freecodecamp.com/rphares
venit2
@venit2
Jan 29 2016 02:21
@matthew3454 every number is <= 9 or it is >=1.... you need to figure out if you truly need both
matthew3454
@matthew3454
Jan 29 2016 02:21
@venit2 okay I'll only use the first one.
rphares
@rphares
Jan 29 2016 02:21
anytime :)
matthew3454
@matthew3454
Jan 29 2016 02:22
// Example
var ourArray = [];

for (var i = 10; i > 0; i -= 2) {
  ourArray.push(i);
}

// Setup
var myArray = [];

// Only change code below this line.

for (var i = 9; i <= 9; i -=2 ){
  myArray.push(i);
}
venit2
@venit2
Jan 29 2016 02:22
@matthew3454 do you want it to always be less then 9 or greater then 1?
@venit2 test your 0 again, does it pass?
matthew3454
@matthew3454
Jan 29 2016 02:24
@venit2 it passed. Thank you for your laxative.
CamperBot
@camperbot
Jan 29 2016 02:24
matthew3454 sends brownie points to @venit2 :sparkles: :thumbsup: :sparkles:
:star: 258 | @venit2 | http://www.freecodecamp.com/venit2
rphares
@rphares
Jan 29 2016 02:25
ummm... huh?
rphares @rphares is chuckling a lil...
jbtpa
@jbtpa
Jan 29 2016 02:26

In 'Storing Values with the Equal Operator' section, how do you Assign the contents of a to variable b?

// Setup
var a;
var b = 2;
var a=7;
var b=7;

// Only change code below this line

Jacob Andra
@jacob4
Jan 29 2016 02:26
var a = b @jbtpa
@jbtpa what is the goal?
or var b = a, depending...
rphares
@rphares
Jan 29 2016 02:28
second one...
jbtpa
@jbtpa
Jan 29 2016 02:28
@jacob4 already tried var a = b does not work.
Jacob Andra
@jacob4
Jan 29 2016 02:28
@jbtpa post entire code
rphares
@rphares
Jan 29 2016 02:28
thats the whole thing, @jacob4
Jacob Andra
@jacob4
Jan 29 2016 02:28
I feel like I need some context...
Spencer Kuzara
@kodaxx
Jan 29 2016 02:29
Something is severely broken in my code
rphares
@rphares
Jan 29 2016 02:29
@jbtpa , you need to assign the contents of a to b,
Spencer Kuzara
@kodaxx
Jan 29 2016 02:29
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line

  for (var a = 0; a < arr.length; a++) {
    for (var b = 0; b < arr[a].length; b++) {
     product = product * [b] * [a]; 
    }
  }
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:29
@jbtpa var a = b;
rphares
@rphares
Jan 29 2016 02:29
no,
i don't like giving answers, but since we are here...
var b = a;
@jbtpa , you are assigning it TO b :) you just had it backwards... :blush:
Cam
@CamMakoJ
Jan 29 2016 02:30
im working on the 'Counting Cards' lesson and have a switch/case setup that modifies my count correctly
jbtpa
@jbtpa
Jan 29 2016 02:30
@rphares Thanks, I also forgot the ;.
CamperBot
@camperbot
Jan 29 2016 02:30
jbtpa sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2114 | @rphares | http://www.freecodecamp.com/rphares
venit2
@venit2
Jan 29 2016 02:30
@kodaxx indexes have to be attached to an array...... array[index]
Cam
@CamMakoJ
Jan 29 2016 02:30
but underneath i am trying to do an if/else to return the count + string based on the value of count
rphares
@rphares
Jan 29 2016 02:30
congrats, @jbtpa ~
venit2
@venit2
Jan 29 2016 02:31
@kodaxx array the array name, and index is the number you are at
catmojo
@catmojo
Jan 29 2016 02:31
im sorry guys who answered me before...assignment problem in Js.... i only got this far, but its not right....process(7);
var processed = process;
rphares
@rphares
Jan 29 2016 02:31
sooo close
catmojo
@catmojo
Jan 29 2016 02:32
grrr
rphares
@rphares
Jan 29 2016 02:32
the last line of your code is where the process(7) goes, @catmojo
Spencer Kuzara
@kodaxx
Jan 29 2016 02:32
I don't understand, I'm trying to multiply all numbers with each other inside of a multi-dimensional array
rphares
@rphares
Jan 29 2016 02:32
processed = process(7)
@catmojo
you don't need to add two lines, just that one
catmojo
@catmojo
Jan 29 2016 02:33
good grief....i cant believe i stared at this for hours and it was the only one i didnt try... :(
thanks for putting me out of my misery @rphares
CamperBot
@camperbot
Jan 29 2016 02:33
catmojo sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2115 | @rphares | http://www.freecodecamp.com/rphares
Luis
@zdrifted
Jan 29 2016 02:33
Man this problem came out of nowhere. I don't understand how any of the previous material is building me up for this problem. "Convert Celsius to Fahrenheit"
rphares
@rphares
Jan 29 2016 02:33
its okay-- its a really important thing to get, so now its probably burned into you, @catmojo
anytime~
@Rushh , what have you got so far?
Dien Dang
@diendang271
Jan 29 2016 02:35
I am stuck with Counting Cards game,

var count = 0;

function cc(card) {
// Only change code below this line
if (card === 2 || card === 3 || card === 4 || card === 5 || card === 6) {
return '5 Bet';
} else if (card === 7 || card === 8 || card === 9){
return '0 Hold';
} else if (card === 10 || card === "J" || card === "Q" || card === "K"){
return '-5 Hold';
} else {
return '-1 Hold';
}

// Only change code above this line
}

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

catmojo
@catmojo
Jan 29 2016 02:35
haha.. yeah...burnt good @rphares thanks so much
CamperBot
@camperbot
Jan 29 2016 02:35
catmojo sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:warning: catmojo already gave rphares points
Luis
@zdrifted
Jan 29 2016 02:36
I'm just stuck on these directions
Spencer Kuzara
@kodaxx
Jan 29 2016 02:37
@lulzsecd First, you wouldn't need the logic for 7, 8, and 9, because if you need to add 0 to the count, you just wont add
You could leave it out altogether
Try using a switch statement @lulzsecd
rphares
@rphares
Jan 29 2016 02:38
@Rushh , first, Create a variable fahrenheit
@Rushh that var should = the formula from the directions,
Luis
@zdrifted
Jan 29 2016 02:38
Right but I'm not sure what to set it to. Oh ok.
rphares
@rphares
Jan 29 2016 02:38
@Rushh Celsius times 9/5, plus 32.
Luis
@zdrifted
Jan 29 2016 02:39
celsius*(9/5)+32 ?
JackeL
@jackel27
Jan 29 2016 02:39
ahhhhhh!!!!
anyone care to check out my inner outer for loops
rphares
@rphares
Jan 29 2016 02:39
yep :) (you don't need the parenthesis, but yes) @Rushh :)
JackeL
@jackel27
Jan 29 2016 02:40
I know there is another way to do this, but I just want to get my idea working.. :/
no bueno
function destroyer(arg1) {
    // Remove all the values that are as like as the 2nd argument
    var arrayArg = [];
    var arg1Array = [];
    var finalArray = [];
    for (var x = 1; x < arguments.length; x++) {
        arrayArg.push(arguments[x]);
    }
    arg1Array.push(arguments[0]);
    for (var i = 0; i < arg1Array[0].length; i++) {
        for (var k = 0; k < arrayArg.length; k++) {
            if ((arg1Array[0][i]) !== (arrayArg[k])) {
                finalArray.push(arg1Array[0][i]);
            }
        }
    }
    return finalArray;
}
destroyer([1, 2, 3, 4, 5, 6], 1, 6);  // outputs [1,2,2,3,3,4,4,5,5,6]  what in the....
Luis
@zdrifted
Jan 29 2016 02:42
Oh so the problem was that I put the var fahrenheit =... into the wrong area
thanks you @ rphares
Jonah Erlich
@jerlich97
Jan 29 2016 02:45
Can someone help me with Caesar's Cipher? This is what I have so far:
function rot13(str) { // LBH QVQ VG!
  var char = [];
  for(var i = 0; i < str.length; i++){
    if(str.charCodeAt(i) < 64 && str.charCodeAt(i) > 91){
    char[i] = str.charCodeAt(i) + 13;
      if(char[i] > 90){
        char[i] -= 25;
      }
    }
    else{
      char[i] = str.charCodeAt(i);
    }

  }
  str = String.fromCharCode(char);
  console.log(str);
  return str;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Ege Tuncoz
@etuncoz
Jan 29 2016 02:46

hey errrbody , how do i use the hasOwnProperty() function with a variable inside?

if(contacts.hasOwnProperty(prop))

prop here is a string such as "number".

is this correct usage
Andrew Conley
@aconman1287
Jan 29 2016 02:47
Can someone help with testing objects for properties? I feel like I should be using a switch and then an if/else statement but after a lot of attempts, I'm at a loss.
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  switch (checkProp) {
    case 1:
      myObj.hasOwnProperty("gift");
      break;
    case 2:
      myObj.hasOwnProperty("pet");
      break;
    case 3:
      myObj.hasOwnProperty("bed");
      break;
  }

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

// Test your code by modifying these values
checkObj("pet");
JackeL
@jackel27
Jan 29 2016 02:47
@etuncoz yes
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:48
@aconman1287 case 1 2 and 3 are not going to work
JackeL
@jackel27
Jan 29 2016 02:48
@etuncoz , basically if that prop exists, then return... ? :smile:
Syed Isam Hashmi
@prosdkr
Jan 29 2016 02:48
what you are putting in isn't a number :(
JackeL
@jackel27
Jan 29 2016 02:49
@aconman1287 you are passing in a argument, you do not need to list your strings in cases
Jonah Erlich
@jerlich97
Jan 29 2016 02:49
@aconman1287 You're completely overcomplicating the problem
@aconman1287 Think about what you would do if you werent given the names of the object's properties to check
Andrew Conley
@aconman1287
Jan 29 2016 02:51
@jerlich97 I would remove the switch and have an if/else that looks like this:
 if (myObj.hasOwnProperty(checkProp)) {
    return myObj.hasOwnProperty(checkProp);
 }// Your Code Here
  else {
    return "Not Found";
  }
}
...or something like that.
Jonah Erlich
@jerlich97
Jan 29 2016 02:51
That exactly it
@aconman1287 ^
Ege Tuncoz
@etuncoz
Jan 29 2016 02:52
@jackel27 i've been searching for errors for about an hour and it appears i've missed to add a simple [i] near contacts..i almost lost it
Andrew Conley
@aconman1287
Jan 29 2016 02:52
@jerlich97 It says that doesn't work. I have to still be missing something.
JackeL
@jackel27
Jan 29 2016 02:52
@etuncoz lol, glad you figured it out
Jonah Erlich
@jerlich97
Jan 29 2016 02:52
@aconman1287 Can you send the entirety of your code?
Ege Tuncoz
@etuncoz
Jan 29 2016 02:53
goodnight everyone
Andrew Conley
@aconman1287
Jan 29 2016 02:53
@jerlich97 :
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {


 if (myObj.hasOwnProperty(checkProp)) {
    return myObj.hasOwnProperty(checkProp);
 }
  else {
    return "Not Found";
  }
}

// Test your code by modifying these values
checkObj("house");
rphares
@rphares
Jan 29 2016 02:53
g.night, @etuncoz ~ rest well :)
JackeL
@jackel27
Jan 29 2016 02:53
@aconman1287 your return is incorrect
venit2
@venit2
Jan 29 2016 02:54
@aconman1287 what does .hasOwnProperty return?
Spencer Kuzara
@kodaxx
Jan 29 2016 02:54
@aconman1287 on the return.hasOwnProperty[checkProp]
Try to use brackets instead of parenthesis, I think that's the problem
JackeL
@jackel27
Jan 29 2016 02:54
@aconman1287 the if statement checks to see if myObj has property(this), what does your return statement say?
Jonah Erlich
@jerlich97
Jan 29 2016 02:54
@aconman1287 You need to return the property not if it exists
Spencer Kuzara
@kodaxx
Jan 29 2016 02:55
Actually the return line should be return myObj[checkProp]
JackeL
@jackel27
Jan 29 2016 02:55
@kodaxx trying to hint that towards him :)
Andrew Conley
@aconman1287
Jan 29 2016 02:56
Ohhh thanks everyone. haha
Spencer Kuzara
@kodaxx
Jan 29 2016 02:56
@jackel27 Doh! I knew that, my bad...
Jonah Erlich
@jerlich97
Jan 29 2016 02:56
Is anyone able to help with Caesar Cipher?
Andrew Conley
@aconman1287
Jan 29 2016 02:56
Wait. So how does myObj[checkProp] know to do that? I don't understand how checkProp is associated to the myObj properties.
Matt Leonard
@matty22
Jan 29 2016 02:57
Can anyone help me understand Closures? Here is my code for Arguments Optional:
function add() {

  if (arguments.length == 2 && typeof arguments[0] == "number" && typeof arguments[1] == "number") {
    return arguments[0] + arguments[1];
  } else if (arguments.length == 2 && typeof arguments[0] !== "number" || typeof arguments[1] !== "number") {
    return undefined;
  } else if (arguments.length == 1) {
        var a = 2;
        return function add2(b) {
        return a += b;
      };

   } 

  return false;
}

add(2)(3);
JackeL
@jackel27
Jan 29 2016 02:57
var myObj = {
    gift: "pony",
    pet: "kitten",
    bed: "sleigh"
};
Andrew Conley
@aconman1287
Jan 29 2016 02:57
Thanks to @jerlich97 @jackel27 @kodaxx
CamperBot
@camperbot
Jan 29 2016 02:57
aconman1287 sends brownie points to @jerlich97 and @jackel27 and @kodaxx :sparkles: :thumbsup: :sparkles:
:star: 269 | @jerlich97 | http://www.freecodecamp.com/jerlich97
:star: 226 | @kodaxx | http://www.freecodecamp.com/kodaxx
:star: 274 | @jackel27 | http://www.freecodecamp.com/jackel27
JackeL
@jackel27
Jan 29 2016 02:57
CheckProp is the name of the argument that gets passed into your function
Andrew Conley
@aconman1287
Jan 29 2016 02:58
@jackel27 so I could replace 'checkProp' throughout the code with 'x' and it would work the same?
JackeL
@jackel27
Jan 29 2016 02:59
checkObj("pet");
you assign pet to the argument name function checkObj(-->checkProp<--Here)
Spencer Kuzara
@kodaxx
Jan 29 2016 02:59
Can I get some help with my For Loops?
JackeL
@jackel27
Jan 29 2016 02:59
@aconman1287 yes :)
Spencer Kuzara
@kodaxx
Jan 29 2016 02:59
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line

  for (var a = 0; a < arr.length; a++) {
    for (var b = 0; b < arr[a].length; b++) {
     product = product * [b] * [a]; 
    }
  }
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Something is terrily wrong
I just don't understand the nested array for loops stuff
Andrew Conley
@aconman1287
Jan 29 2016 03:00
Ahhh @jackel27 Ok that makes more sense. I didn't realize that .hasOwnProperty() could be used that way based on the example. Thanks so much!
CamperBot
@camperbot
Jan 29 2016 03:00
aconman1287 sends brownie points to @jackel27 :sparkles: :thumbsup: :sparkles:
:warning: aconman1287 already gave jackel27 points
Spencer Kuzara
@kodaxx
Jan 29 2016 03:00
I'm trying to write a function to multiply all numbers in the multidimensional array listed below
Jocelyn
@jocelyn-ong
Jan 29 2016 03:00
@kodaxx you're almost there, just need to tweak your product assignment
Andrew Charlebois
@andrewchar
Jan 29 2016 03:01
I am really lost on the golf exercise. could anyone give me a sort of explanation as to how to figure it out.
Spencer Kuzara
@kodaxx
Jan 29 2016 03:01
@jocelyn-ong Do I tweak where it's placed or how it is written?
Andrew Charlebois
@andrewchar
Jan 29 2016 03:01
i know how to do the if else just what arguments i am using i have no idea
Jocelyn
@jocelyn-ong
Jan 29 2016 03:02
@andrewchar which part do you not quite understand?
JackeL
@jackel27
Jan 29 2016 03:02
@aconman1287 see this for example...
function add2numbers(a, b) {
    return " The answer is: " + (a + b);
}
add2numbers(1, 5); // prints:  The answer is: 6
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:03

@andrewchar 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(4, 4);

Jocelyn
@jocelyn-ong
Jan 29 2016 03:03
@kodaxx how it is written, because i assume you're trying to call the item in the array at index a or b, and not really a or b?
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:03
@andrewchar makes sense?
Cam
@CamMakoJ
Jan 29 2016 03:03
@zgjorge change the last return "change me"
Spencer Kuzara
@kodaxx
Jan 29 2016 03:04
@jocelyn-ong I tried this: product = product arr[a] arr[b] but I get an infinite loop warning
product = product arr[a] arr[b]
Jocelyn
@jocelyn-ong
Jan 29 2016 03:05
@kodaxx what's the name of the challenge?
JackeL
@jackel27
Jan 29 2016 03:05
@kodaxx how are you to multiply them?
Andrew Charlebois
@andrewchar
Jan 29 2016 03:05
apparently i was on the right track. i had no idea i could put something like par-2 inside.
i had this
function golfScore(par, strokes) {
  // Only change code below this line
   if (strokes ===1) {
      return "Hole-in-one!";
  }  else if (strokes - 2) {
      return "Eagle";
  } else if (strokes - 1) {
      return "Birdie";
  } else if (strokes === 0) {
      return "Par";
  } else if (strokes + 1) {
      return "Bogey";
  } else if (strokes + 2) {
      return "Double Gogey";
  } else if (strokes >= 3) {
      return "Go Home!";
  }
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:05
@andrewchar no problem, your welcome :D
Spencer Kuzara
@kodaxx
Jan 29 2016 03:06
@jocelyn-ong Nesting For Loops @jackel27 the * is there, it just made at arr[a] italicized instead because there is one on each side
product = product * arr[a][b];
Andrew Charlebois
@andrewchar
Jan 29 2016 03:06
@zgjorge thanks
CamperBot
@camperbot
Jan 29 2016 03:06
andrewchar sends brownie points to @zgjorge :sparkles: :thumbsup: :sparkles:
:star: 247 | @zgjorge | http://www.freecodecamp.com/zgjorge
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:07
@andrewchar no problem :D
Andrew Conley
@aconman1287
Jan 29 2016 03:08
@jackel27 haha I knew that. I definitely quickly overcomplicated that.
JackeL
@jackel27
Jan 29 2016 03:09
@kodaxx the nested may be wrong
@aconman1287 I do it all the time lol
Spencer Kuzara
@kodaxx
Jan 29 2016 03:09
I figured it out, I was not increasing var a - somehow it got deleted
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:09
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
   var lookup = {
     "alpha": "Adams",
     "bravo": "Boston",
     "charlie":"Chicago",
     "delta": "Denver",
     "echo": "Easy",
     "foxtrot":"Frank"
  };



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

// Change this value to test
phoneticLookup("charlie");
Spencer Kuzara
@kodaxx
Jan 29 2016 03:09
thanks @jocelyn-ong @jackel27
CamperBot
@camperbot
Jan 29 2016 03:09
kodaxx sends brownie points to @jocelyn-ong and @jackel27 :sparkles: :thumbsup: :sparkles:
:star: 449 | @jocelyn-ong | http://www.freecodecamp.com/jocelyn-ong
:star: 275 | @jackel27 | http://www.freecodecamp.com/jackel27
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:09
trying to figure out tablelookup
JackeL
@jackel27
Jan 29 2016 03:10
@kodaxx mine was a little different, but very similiar
  for (var i = 0; i<arr.length; i++){
  for (var j =0; j<arr[i].length;){

   product *= arr[i][j];
    j++;
  }
Bobby Rath
@bobbyrath
Jan 29 2016 03:10
blob
blob
JackeL
@jackel27
Jan 29 2016 03:10
lol, i put a j++ in
oops..
Spencer Kuzara
@kodaxx
Jan 29 2016 03:10
Lol, it's gotta be perfect!
Bobby Rath
@bobbyrath
Jan 29 2016 03:11
Anyone know how I can get playerNumber to show number 16?
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:12
sure, post again the code please
JackeL
@jackel27
Jan 29 2016 03:12
@kodaxx There we go lol
        for (var i = 0; i < arr.length; i++) {
            for (var j = 0; j < arr[i].length; j++) {
                product *= arr[i][j];
            }
        }
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:12
@bobbyrath post the code again please
Bobby Rath
@bobbyrath
Jan 29 2016 03:12
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber;       // Change this Line
var player = testObj[16];   // Change this Line
playerNumber needs to be a number using bracket notation
to access testObj
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:13
@bobbyrath I just resolved that one, whats the name of the exercise?
so i can go back and check my solution
Bobby Rath
@bobbyrath
Jan 29 2016 03:14
Accessing Objects Properties with Variables
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:15

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

// Only change code below this line;

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

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

// Only change code below this line;

var playerNumber=16;       // Change this Line
var player = testObj[playerNumber];   // Change this Line
Cam
@CamMakoJ
Jan 29 2016 03:15
@bobbyrath just assing the variable the value
Matt Leonard
@matty22
Jan 29 2016 03:16
Hoping someone new has joined who can help with understanding Closures for Arguments Optional Bonfire?
function add(number) {

  if (arguments.length == 2 && typeof arguments[0] == "number" && typeof arguments[1] == "number") {
    return arguments[0] + arguments[1];
  } else if (arguments.length == 2 && typeof arguments[0] !== "number" || typeof arguments[1] !== "number") {
    return undefined;
  } else if (arguments.length == 1) {
    var sum = number;
    var fn = function(secondNum) {
      sum += secondNum;
      return sum;
    };
    return fn;
  }

  return false;
}

add(2)(3);
CamperBot
@camperbot
Jan 29 2016 03:16
type bonfire name to get some info on that bonfire. And check HelpBonfires chatroom
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:16
@bobbyrath did you try it ? :D
Bobby Rath
@bobbyrath
Jan 29 2016 03:16
Yes, it worked, thanks! I didn't realize you had to pass playerNumber through player
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:17
@bobbyrath no problem :D your welcome :D
Luis
@zdrifted
Jan 29 2016 03:18
thank you @rphares
CamperBot
@camperbot
Jan 29 2016 03:18
rushh sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star: 2121 | @rphares | http://www.freecodecamp.com/rphares
rphares
@rphares
Jan 29 2016 03:18
whatever for, @Rushh ??
anytime! :)
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:20
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line
   var lookup = {
     "alpha": "Adams",
     "bravo": "Boston",
     "charlie":"Chicago",
     "delta": "Denver",
     "echo": "Easy",
     "foxtrot":"Frank"
  };



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

// Change this value to test
phoneticLookup("charlie");
trying to figure this out, using objects for lookups
Gabe
@Delekhan80
Jan 29 2016 03:21
Can anyone tell me they correct way to add objects into a JSON object?
Andrew Conley
@aconman1287
Jan 29 2016 03:22
@zgjorge So what you'll want to do is, below your lookup table, redefine what var result =
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:23
ok, let me try :D
dollyto
@dollyto
Jan 29 2016 03:23
Someone can explain me why this works?
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  function bouncer(value) {
    return value;
  }

  var filtered = arr.filter(bouncer);
  return filtered;
}

bouncer([7, "ate", "", false, 9]);
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:25
@aconman1287 so will be something like, var result = val;
?
Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string.
Cam
@CamMakoJ
Jan 29 2016 03:28
@zgjorge make sure to assign the result variable the value of what you lookup
using the table
@zgjorge sorry not table (json)
@zgjorge js result = lookup[val];
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:29
@CamMakoJ thank you
CamperBot
@camperbot
Jan 29 2016 03:29
zgjorge sends brownie points to @cammakoj :sparkles: :thumbsup: :sparkles:
:star: 214 | @cammakoj | http://www.freecodecamp.com/cammakoj
Cam
@CamMakoJ
Jan 29 2016 03:30
@zgjorge no worries :)
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:30
@zgjorge thanyou for the advice :)
@CamMakoJ gonna study a little bit more on that, thanks again
CamperBot
@camperbot
Jan 29 2016 03:30
zgjorge sends brownie points to @cammakoj :sparkles: :thumbsup: :sparkles:
:warning: zgjorge already gave cammakoj points
Cam
@CamMakoJ
Jan 29 2016 03:30
@zgjorge no worries thats a good idea!
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:31
@CamMakoJ any suggestion on where I cand find more info about "using objects for lookups" ? :D
*can
Cam
@CamMakoJ
Jan 29 2016 03:32
@zgjorge i really like the content at www.w3schools.com
@zgjorge they have great reference material
Jorge Alfonso Zendejas Garcia
@zgjorge
Jan 29 2016 03:33
@CamMakoJ ok, Ill take a look :+1:
Thomas Headle
@TGHeadle1371
Jan 29 2016 03:33
Alright, I need help modifying the bike constructor to have a private property called gear and two public methods called getGear and setGear
Andrew Charlebois
@andrewchar
Jan 29 2016 03:33
im not getting any errors on my code, not sure whats wrong...
function myTest(val) {
  var answer = "";
  // Only change code below this line
  switch (val) {
    case "alpha":
      myTest(1);
      break;
    case "beta":
      myTest(2);
      break;
    case "gamma":
      myTest(3);
      break;
    case "delta":
      myTest(4);
      break;
  }


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

// Change this value to test
myTest(1);
Thomas Headle
@TGHeadle1371
Jan 29 2016 03:33
var Car = function() {
  // this is a private variable
  var speed = 10;

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

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

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

var Bike = function() {

  // Only change code below this line.
var gear
};

var myCar = new Car();

var myBike = new Bike();
KWallac3
@KWallac3
Jan 29 2016 03:34
help testing object for properties
CamperBot
@camperbot
Jan 29 2016 03:34
no wiki entry for: testing object for properties
Andrew Charlebois
@andrewchar
Jan 29 2016 03:34
help Switch Statements
CamperBot
@camperbot
Jan 29 2016 03:34

:point_right: waypoint adding a default option in switch statements [wiki]

Waypoint: Adding a default option in Switch statements

In a switch statement you may not be able to specify all possible values as case statements. Instead, you can add the default statement which will be executed if no matching case statements are found. Think of it like the final else statement in an if/else chain.

A default statement should be the last case.

switch (num) {
  case value1:
    statement1
    break;
  case value2:
    statement2;
    break;
...
  default:
    defaultStatement;
}

:pencil: read more about waypoint adding a default option in switch statements on the FCC Wiki

KWallac3
@KWallac3
Jan 29 2016 03:36
what's the difference between < return myObj[checkProp];> and <return myObj.checkProp;>
Alex Rose
@thelyricalrose
Jan 29 2016 03:37
@andrewchar You don't seem to be returning the statements, could that be the problem?
JackeL
@jackel27
Jan 29 2016 03:39
@dollyto explain filter
Explain filter
CamperBot
@camperbot
Jan 29 2016 03:39

:point_right: waypoint filter arrays with filter [wiki]

Filter is a useful method that can filter out values that don't match a certain criteria.

var array = [1,2,3,4,5,6,7,8,9,10];
  // Only change code below this line.
array = array.filter(function(val) {
  return val <= 5;
});

:pencil: read more about waypoint filter arrays with filter on the FCC Wiki

bitgrower
@bitgrower
Jan 29 2016 03:39
explain roman numeral converter
CamperBot
@camperbot
Jan 29 2016 03:39
no wiki entry for: roman numerals
Alex Rose
@thelyricalrose
Jan 29 2016 03:40
@andrewchar js case "C": return "P"; break;
    case "D":
      return "Q";
      break;
JackeL
@jackel27
Jan 29 2016 03:41
@camperbot thanks
CamperBot
@camperbot
Jan 29 2016 03:41
jackel27 sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star: 1043 | @camperbot | http://www.freecodecamp.com/camperbot
cherielum
@cherielum
Jan 29 2016 03:41
has anybody done Assignment with a returned value?
Andrew Charlebois
@andrewchar
Jan 29 2016 03:41
@thelyricalrose not sure if i follow
cherielum
@cherielum
Jan 29 2016 03:41
What does "You should assign process to processed" mean? Apparently I don't get it.
venit2
@venit2
Jan 29 2016 03:41
@KWallac3 when you using .checkProp it thinks checkProp is a property name itself and not a variable
Andrew Charlebois
@andrewchar
Jan 29 2016 03:42
processed =process
KWallac3
@KWallac3
Jan 29 2016 03:42
@venit2 thank you.
CamperBot
@camperbot
Jan 29 2016 03:42
kwallac3 sends brownie points to @venit2 :sparkles: :thumbsup: :sparkles:
:star: 262 | @venit2 | http://www.freecodecamp.com/venit2
bitgrower
@bitgrower
Jan 29 2016 03:42
```js <script>
$(document).ready(function() {
$("#getMessage").on("click",function() {
$(".message").text("new message");
});
</script>
cherielum
@cherielum
Jan 29 2016 03:42

oh lol

var processed;

function process(processed) {
return (processed);
}

processed= process;

bitgrower
@bitgrower
Jan 29 2016 03:42
explain format
CamperBot
@camperbot
Jan 29 2016 03:42

:point_right: code formatting [wiki]

Inline code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

Code Block

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Thomas Headle
@TGHeadle1371
Jan 29 2016 03:42
Can anyone help me with Make Object Properties Private?
JackeL
@jackel27
Jan 29 2016 03:43
@TGHeadle1371 local vs global
Thomas Headle
@TGHeadle1371
Jan 29 2016 03:43
theres just one global and 2 locals

var Bike = function() {

  // Only change code below this line.
var gear = 10;
  this.getGear = function() {
    ;

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

};

var myCar = new Car();

var myBike = new Bike();
Alex Rose
@thelyricalrose
Jan 29 2016 03:45
@andrewchar Ok can you explain what your code is supposed to do
cherielum
@cherielum
Jan 29 2016 03:46

var processed=2;

var process;

function process(processed) {
return (processed);
}

var processed= process;

Andrew Charlebois
@andrewchar
Jan 29 2016 03:46
@thelyricalrose Instructions
Write a switch statement which tests val and sets answer for the following conditions:
1 - "alpha"
2 - "beta"
3 - "gamma"
4 - "delta"
bitgrower
@bitgrower
Jan 29 2016 03:46
test
cherielum
@cherielum
Jan 29 2016 03:46
I cannot figure out why this isn't working. i don't get the function. :worried:

var processed=2;

var process;

function process(processed) {
return (processed);
}

var processed= process;

bitgrower
@bitgrower
Jan 29 2016 03:46
<script>
  $(document).ready(function() {
    $("#getMessage").on("click",function() {
      $(".message").text("new message");
  });
</script>
somehow, the examples for this (Trigger Click Events with jQuery) don't seem to work for me ... I could use some help, please ...
Astha Sharma
@asthas
Jan 29 2016 03:47
@cherielum What exactly are you supposed to do in this challenge
@bitgrower Your function is correct
cherielum
@cherielum
Jan 29 2016 03:49
Instructions
Call the process function with an argument of 7 and assign its return value to the variable processed.
Gordon Davidescu
@gordondavidescu
Jan 29 2016 03:49
@bitgrower you're not passing anything to the function
Astha Sharma
@asthas
Jan 29 2016 03:49
Are you using the correct ids and the classname?
cherielum
@cherielum
Jan 29 2016 03:49
processed should have a value of 2
You should assign process to processed
Gordon Davidescu
@gordondavidescu
Jan 29 2016 03:49
even if that means process();
Thomas Headle
@TGHeadle1371
Jan 29 2016 03:50
@jackel27 I just don’t know what to put underneath the this.setGear = function() and if that’s even right
Syed Isam Hashmi
@prosdkr
Jan 29 2016 03:50

@bitgrower

<script>
  $(document).ready(function() {
    $("#getMessage").on("click",function() {
      $("#message").text("new message");
  });
</script>

Check if your message is a class or id
if it's an id use a # if it's a class use a .

Jacob Andra
@jacob4
Jan 29 2016 03:50

The following code is correct, yet seems wrong:

for(var i=0; i<str.length; i++){
        //Checks if character lies between A-Z
        if(str.charCodeAt(i) < 65 || str.charCodeAt(i) > 91) {
            nstr += String.fromCharCode(str.charCodeAt(i));
            continue;

The if(str.charCodeAt(i) < 65 || str.charCodeAt(i) > 91) portion of it appears to be only accepting ascii values less than 65 and greater than 91. Can anyone explain?

Astha Sharma
@asthas
Jan 29 2016 03:50
@cherielum remove var process you dont have to declare a function like that
cherielum
@cherielum
Jan 29 2016 03:51
@asthas ok
bitgrower
@bitgrower
Jan 29 2016 03:51

the instructions for the exercise: Let's make our "Get Message" button change the text of the element with the class message.

Before we can do this, we need to implement a click event inside of our $(document).ready() function by adding this code:

$("#getMessage").on("click", function(){

});

Alex Rose
@thelyricalrose
Jan 29 2016 03:51

@andrewchar right now you have your statements inverted

 switch(val)

Inputs the value (val) you are testing for

    case 1:
      return "alpha";
      break;

Your case says that "in the situation 1 is recieved output from this function "alpha"
then the break line insures nothing past that is executed for that case

cherielum
@cherielum
Jan 29 2016 03:51
but the function is confusing me. i'm supposed to use it?
rushi
@rush86999
Jan 29 2016 03:51
hi i am stuck on the palindrome challenge any help would help:

function palindrome(str) {
// Good luck!

var newStrArray = [];
var newStrlength = 0;

//clean out non-alpha numeric characters

var newStr = str.split(/\w+/).join('');
var newStr1 = '';
var newStr2 = '';

if ( newStr.length % 2) {

newStrlength = (newStr.length -1)/2;

newStr1 = newStr.splice(0, newStrlength -1);
newStr2 = newStr.splice(newStrlength-1, newStr.length);

  if (newStr1== newStr2.split('').reverse().join('')) {
    return true;
  } else {
    return false;
  }

}

else {
newStrlength = (newStr.length)/2;

newStr1 = newStr.splice(0, newStrlength -1);
newStr2 = newStr.splice(newStrlength-1, newStr.length);

  if (newStr1== newStr2.split('').reverse().join('')) {
    return true;
  } else {
    return false;
  }

}
return true;
}

palindrome("eye");

Astha Sharma
@asthas
Jan 29 2016 03:51
@jacob4 You have to check for characters between A-Z
JackeL
@jackel27
Jan 29 2016 03:51
@TGHeadle1371 What challenge is that?
Astha Sharma
@asthas
Jan 29 2016 03:52
@jacob4 their ascii value lies between 65 -90
Thomas Headle
@TGHeadle1371
Jan 29 2016 03:52
@jackel27 Make object properties private
Alex Rose
@thelyricalrose
Jan 29 2016 03:52
@andrewchar right now your testing for the "alpha" instead of returning it when val = =1
*you're
Astha Sharma
@asthas
Jan 29 2016 03:53
if(str.charCodeAt(i) >= 65 || str.charCodeAt(i) <= 90)
@jacob4
@cherielum Did it work?
cannelflow
@cannelflow
Jan 29 2016 03:54
@0x0936 thank you
CamperBot
@camperbot
Jan 29 2016 03:54
cannelflow sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star: 989 | @0x0936 | http://www.freecodecamp.com/0x0936
Jacob Andra
@jacob4
Jan 29 2016 03:54
@asthas yes, I understand. The code I posted actually checks for A-Z characters. Yet, it looks like it should do the opposite. That's why I'm so confused
cherielum
@cherielum
Jan 29 2016 03:54
var processed=2;
var process;
process= processed;
didnt work
Jacob Andra
@jacob4
Jan 29 2016 03:54
@asthas it's right code that seems so wrong :)
Robert Richey
@0x0936
Jan 29 2016 03:55
@cannelflow very welcome!
Jacob Andra
@jacob4
Jan 29 2016 03:55
I was hoping someone could help me understand
Alex Rose
@thelyricalrose
Jan 29 2016 03:55
@rush86999 the first thing you have to do is make everything lowercase as it says that case should not matter but your code will still treat upper and lowercase as different values
cherielum
@cherielum
Jan 29 2016 03:55
@asthas but it did say "processed=2" just not "you shoudl assign process to processed"
JackeL
@jackel27
Jan 29 2016 03:55
@TGHeadle1371 Brb
Astha Sharma
@asthas
Jan 29 2016 03:55
@cherielum Send me the name of the challenge
bitgrower
@bitgrower
Jan 29 2016 03:55
hmmm ... well ... I reset the code, entered the code suggested above, (using a "." because it's a class -- and it's going to a phone mockup -- where I get the following message "SyntaxError: Unexpected end of input"
Astha Sharma
@asthas
Jan 29 2016 03:56
@cherielum processed = process();
because process is a function
bitgrower
@bitgrower
Jan 29 2016 03:56
which would suggest there's an unterminated string
Astha Sharma
@asthas
Jan 29 2016 03:57
@jacob4 You are solving the ceasar cipher problem?
Jacob Andra
@jacob4
Jan 29 2016 03:57
@asthas yes
Astha Sharma
@asthas
Jan 29 2016 03:57
ok
cherielum
@cherielum
Jan 29 2016 03:57

@asthas i did this

var processed=2;
var process;
processed= process();

and got

var processed=2;
var process;
processed= process();
Astha Sharma
@asthas
Jan 29 2016 03:58
The problem says that if there is a capital letter add 13 to its ascii value and then return the corresponding decoded string
cherielum
@cherielum
Jan 29 2016 03:58
type error: process is no a function
Astha Sharma
@asthas
Jan 29 2016 03:58
@cherielum reset your code first
cherielum
@cherielum
Jan 29 2016 03:58
ok
rushi
@rush86999
Jan 29 2016 03:59
@thelyricalrose okay afterwards?
can i use regex? with split
Astha Sharma
@asthas
Jan 29 2016 03:59
@jacob4 If it is a space or special character then leave it as it is
cherielum
@cherielum
Jan 29 2016 03:59
@asthas now it says processed= NaN
Astha Sharma
@asthas
Jan 29 2016 04:00
have you reset the code?
cherielum
@cherielum
Jan 29 2016 04:00
yeah
Astha Sharma
@asthas
Jan 29 2016 04:00
Send me the snippet?
cherielum
@cherielum
Jan 29 2016 04:00
what's a snippet
Alex Rose
@thelyricalrose
Jan 29 2016 04:00
@rush86999 Afterwards you need to remove non-alphanumeric characters
Astha Sharma
@asthas
Jan 29 2016 04:00
code
cherielum
@cherielum
Jan 29 2016 04:00

```// Example
var changed = 0;

function change(num) {
return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function process(num) {
return (num + 3) / 5;
}

// Only change code below this line

var processed=2;
var process;
processed= process();
```

Alex Rose
@thelyricalrose
Jan 29 2016 04:01
@rush86999 You can use a regex but I would use it with replace to replace all the characters with whitespace
rushi
@rush86999
Jan 29 2016 04:01
@thelyricalrose isn't this it? newStr = newStr.split(/\w+/).join('');
cherielum
@cherielum
Jan 29 2016 04:01
// Example
var changed = 0;

function change(num) {
  return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function process(num) {
  return (num + 3) / 5;
}

// Only change code below this line

var processed=2;
var process;
processed= process();
@asthas
rushi
@rush86999
Jan 29 2016 04:01
\w+ function would only return alpha numeric no?
cherielum
@cherielum
Jan 29 2016 04:02
processed should have a value of 2
You should assign process to processed
Astha Sharma
@asthas
Jan 29 2016 04:03
processed = process(7);
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:03
HELP!!!! in bonfire-mutations, i thought i had the answer(after working at it for 24 hours), but it never worked, i looked at the answer , that didn'twork either, WHAT IS WRONG ?!?
function mutation(arr) {
  var a = arr[0].toLowerCase();
  var b = arr[1].toLowerCase();
  for( i = 0; i < b.length;i++ ){
    if (a.indexOf(b[i]) < 0){return false;
       }else{return true;}
  }

}

mutation(["hello", "hey"]);
CamperBot
@camperbot
Jan 29 2016 04:03
no wiki entry for: in bonfire-mutations i thought i had the answerafter working at it for 24 hours but it never worked i looked at the answer that didntwork either what is wrong function mutationarr var a arr0tolowercase var b arr1tolowercase for i 0 i blengthi if aindexofbi 0return false elsereturn true mutationhello hey
cherielum
@cherielum
Jan 29 2016 04:03
@asthas omg it worked
rushi
@rush86999
Jan 29 2016 04:03
@thelyricalrose can you show me an example of replace here?
Astha Sharma
@asthas
Jan 29 2016 04:03
@cherielum That's all
cherielum
@cherielum
Jan 29 2016 04:03
so adding () makes it a function?
aka an equation to be used?
Astha Sharma
@asthas
Jan 29 2016 04:03
@jacob4 Did you get it?
@cherielum Finally
:)
cherielum
@cherielum
Jan 29 2016 04:04
THANKS.
haha youre the best.
Alex Rose
@thelyricalrose
Jan 29 2016 04:04
@rush86999
  str = str.replace(regex goes here, "");
the first argument dictates what you replace and the second what you replace it with
rushi
@rush86999
Jan 29 2016 04:06
@thelyricalrose so \s* ?
Alex Rose
@thelyricalrose
Jan 29 2016 04:07
\s matches whitespace \W in the regex captures all non alpha-numeric characters besides _
@rush86999
rushi
@rush86999
Jan 29 2016 04:07
oh i see
@thelyricalrose so \W is better
JackeL
@jackel27
Jan 29 2016 04:07
@eeflores better :) okay, I will go through it again.
Astha Sharma
@asthas
Jan 29 2016 04:08
@yonichanowitz you have to use argument object for this
eeflores
@eeflores
Jan 29 2016 04:08
@jackel27 ok
Alex Rose
@thelyricalrose
Jan 29 2016 04:08
@rush86999 for this situation yes
rushi
@rush86999
Jan 29 2016 04:08
@thelyricalrose var newStr = newStr.replace(/\W*/, ''); ?
Jacob Andra
@jacob4
Jan 29 2016 04:08
@asthas yes, I've finally made sense of it :) Thanks!
CamperBot
@camperbot
Jan 29 2016 04:08
jacob4 sends brownie points to @asthas :sparkles: :thumbsup: :sparkles:
:star: 288 | @asthas | http://www.freecodecamp.com/asthas
Astha Sharma
@asthas
Jan 29 2016 04:09
@jacob4 Congrats! You are about to finish the first set of assignments
bitgrower
@bitgrower
Jan 29 2016 04:09
thanks @prosdkr
CamperBot
@camperbot
Jan 29 2016 04:09
bitgrower sends brownie points to @prosdkr :sparkles: :thumbsup: :sparkles:
:star: 299 | @prosdkr | http://www.freecodecamp.com/prosdkr
Jacob Andra
@jacob4
Jan 29 2016 04:09
@asthas how far are you?
Astha Sharma
@asthas
Jan 29 2016 04:09
I completed my portfolio project
Alex Rose
@thelyricalrose
Jan 29 2016 04:09
@rush86999 You should probably make it global with a g before the comma
Astha Sharma
@asthas
Jan 29 2016 04:10
Looks well on my browser but codepen stinks!
It made my beautiful portfolio looked crap
bitgrower
@bitgrower
Jan 29 2016 04:10
thanks @gordondavidescu @asthas
CamperBot
@camperbot
Jan 29 2016 04:10
bitgrower sends brownie points to @gordondavidescu and @asthas :sparkles: :thumbsup: :sparkles:
:star: 363 | @gordondavidescu | http://www.freecodecamp.com/gordondavidescu
:star: 289 | @asthas | http://www.freecodecamp.com/asthas
Jacob Andra
@jacob4
Jan 29 2016 04:10
@asthas yeah, i finally just registered a domain to park my portfolio on :)
1234Matt
@1234Matt
Jan 29 2016 04:10
hi does your waypoints working?
Astha Sharma
@asthas
Jan 29 2016 04:10
I'll be using github hosting
rushi
@rush86999
Jan 29 2016 04:10
@thelyricalrose //clean out non-alpha numeric characters
str = str.toLowerCase();
var newStr = str.replace(/\W*/g, '');
Astha Sharma
@asthas
Jan 29 2016 04:11
No code pen please
Jacob Andra
@jacob4
Jan 29 2016 04:11
@asthas cool
Astha Sharma
@asthas
Jan 29 2016 04:11
:)
Alex Rose
@thelyricalrose
Jan 29 2016 04:11
@rush86999 and add something so that it captures underscores as well as the other stuff like /\W|_|/g,
The | | allows you to add conditions as optional @rush86999 I don't know if it's the best way to do it here but it worked for me
rushi
@rush86999
Jan 29 2016 04:12
why are there |_| two of the bars not one? is this how you do it?
James
@dev15firkin
Jan 29 2016 04:13
function palindrome(str) {
  var str1 = str.replace(/([^\w]*)/g, '').toLowerCase();
  if (str1 === str1.split('').reverse().join('')){
  return true;}
  else {
    return false;
  }
}



palindrome("1 eye for of 1 eye.");
Alex Rose
@thelyricalrose
Jan 29 2016 04:14
@rush86999 one works, I just happened to put an extra
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:14
@asthas , what's an argument object?
James
@dev15firkin
Jan 29 2016 04:15
so I'm on the palindrome bonfire, and I am unsure how to proceed from here. This code gets me everything but the last condition
Syed Isam Hashmi
@prosdkr
Jan 29 2016 04:15
@dev15firkin Send me your code I can help
James
@dev15firkin
Jan 29 2016 04:15

@prosdkr ```js
function palindrome(str) {
var str1 = str.replace(/([^\w]*)/g, '').toLowerCase();
if (str1 === str1.split('').reverse().join('')){
return true;}
else {
return false;
}
}

palindrome("1 eye for of 1 eye.");
```

Here is the link to it
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:15
@dev15firkin , you have to put a lot of conditions in the regex statement that exclude most of the symbols
Alex Rose
@thelyricalrose
Jan 29 2016 04:16
@dev15firkin You have to get the _ as well
\W doesn't capture that
rajesh304
@rajesh304
Jan 29 2016 04:16

why cant i use" collection.id.prop =value " after first IF
```// Setup
var collection = {
2548: {
album: "Slippery When Wet",
artist: "Bon Jovi",
tracks: [
"Let It Rock",
"You Give Love a Bad Name"
]
},
2468: {
album: "1999",
artist: "Prince",
tracks: [
"1999",
"Little Red Corvette"
]
},
1245: {
artist: "Robert Palmer",
tracks: [ ]
},
5439: {
album: "ABBA Gold"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value)
{

if(value!=="" && prop!=="tracks")
{
collection[id][prop] = value ;

}else if(value!=="" && prop=="tracks")
{

collection[id].tracks.push(value);
}else
{

  delete collection[id][prop];
}

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");

Astha Sharma
@asthas
Jan 29 2016 04:16
@yonichanowitz Well there is a simpler way to do it also
Syed Isam Hashmi
@prosdkr
Jan 29 2016 04:16
@dev15firkin lemme look one sec
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:16
@asthas then why doesn't the answer say that!?!!?
erin-hebert
@erin-hebert
Jan 29 2016 04:17
I am so utterly confused on "Make Object Properties Private" Can someone either explain or point me towards where I can go back and rehash the info I so obviously didn't retain?
James
@dev15firkin
Jan 29 2016 04:17
@thelyricalrose i was under the impression that \w took care of all the non-alphanumeric characters
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:17
@asthas what is the simpler way
Syed Isam Hashmi
@prosdkr
Jan 29 2016 04:17
var str1 = str.replace(/([^\w]*)/g, '').toLowerCase();
take out the periods too @dev15firkin
Alex Rose
@thelyricalrose
Jan 29 2016 04:17
I thought so too, but for some reason it doesn't
Astha Sharma
@asthas
Jan 29 2016 04:17
@yonichanowitz You have to work your if logic
@yonichanowitz You are very close to the answer
James
@dev15firkin
Jan 29 2016 04:18
@thelyricalrose I had passed this before writing out a long and horrible looking piece of code
Astha Sharma
@asthas
Jan 29 2016 04:19
@yonichanowitz Ahind use charAt() within indexOf
@yonichanowitz hint
Ben Codrington
@bencodrington
Jan 29 2016 04:19
function queue(arr, item) {
  // Your code here
  arr.append(item);
  removed = arr.shift(item);
  return removed;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Does anyone know why I would be getting a RangeError from this?
Alex Rose
@thelyricalrose
Jan 29 2016 04:20
@dev15firkin shrug all I know is that \W doesn't seem to grab _'s for whatever reason
Astha Sharma
@asthas
Jan 29 2016 04:20
@bencodrington used push() method instead of append
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:20
@asthas if you use charAt() its not acurate enough
Ben Codrington
@bencodrington
Jan 29 2016 04:21
@asthas thanks, but after trying that change I'm getting the same error.
CamperBot
@camperbot
Jan 29 2016 04:21
bencodrington sends brownie points to @asthas :sparkles: :thumbsup: :sparkles:
:star: 290 | @asthas | http://www.freecodecamp.com/asthas
Astha Sharma
@asthas
Jan 29 2016 04:21
@bencodrington refresh the browser window
James
@dev15firkin
Jan 29 2016 04:21
@thelyricalrose so it's grabbing the other nonalphanumerics?
Cam
@CamMakoJ
Jan 29 2016 04:21
trying to add an object to a JSON
and struggling
Ben Codrington
@bencodrington
Jan 29 2016 04:22
@asthas thanks, that worked. sigh.
CamperBot
@camperbot
Jan 29 2016 04:22
bencodrington sends brownie points to @asthas :sparkles: :thumbsup: :sparkles:
:warning: bencodrington already gave asthas points
Alex Rose
@thelyricalrose
Jan 29 2016 04:22
@dev15firkin Yes it should be grabbing all other alpha-numerics
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:22
@asthas , my if logic was different, but it never worked. thats whyi looked at the answer, which is the code i posted,which did not work
Bobby Rath
@bobbyrath
Jan 29 2016 04:22
@CamMakoJ Just finished that
Astha Sharma
@asthas
Jan 29 2016 04:22
@yonichanowitz charAt() is very accurate you have to iterate over the whole string and match each character
Alex Rose
@thelyricalrose
Jan 29 2016 04:22
@CamMakoJ Can you paste your code?
Cam
@CamMakoJ
Jan 29 2016 04:22
@thelyricalrose i actually just realized i had to add an index number
i struggled for 10 mins, asked and then realized it as i was going to copy... but thanks @thelyricalrose anyways :)
CamperBot
@camperbot
Jan 29 2016 04:23
cammakoj sends brownie points to @thelyricalrose :sparkles: :thumbsup: :sparkles:
:star: 266 | @thelyricalrose | http://www.freecodecamp.com/thelyricalrose
Alex Rose
@thelyricalrose
Jan 29 2016 04:23
@CamMakoJ haha, good to hear. Glad you figured it out. We all make silly mistakes like that
Astha Sharma
@asthas
Jan 29 2016 04:23
@yonichanowitz
if(a.indexOf(b.charAt(i)) === -1){
      result = false;
      return result;
    }
@yonichanowitz I had initialised return value to true in the beginning
yoni chanowitz
@yonichanowitz
Jan 29 2016 04:25
@asthas , i litterally, just did what you typed before you typed it, and it didn't work
Astha Sharma
@asthas
Jan 29 2016 04:25
@yonichanowitz try this out
Fayheim
@Fayheim