These are chat archives for FreeCodeCamp/HelpJavaScript

18th
Mar 2017
Mokkants
@Mokkants
Mar 18 2017 00:00
@JLuboff this and no need for () around arr.length
JenimDacket
@JenimDacket
Mar 18 2017 00:00
obviously you don't need the i===0 statement.... hahahahah Come on Evan... Use the brain!
@JLuboff Thanks man. =D
CamperBot
@camperbot
Mar 18 2017 00:00
jenimdacket sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 1193 | @jluboff |http://www.freecodecamp.com/jluboff
JenimDacket
@JenimDacket
Mar 18 2017 00:00
I'll try to think more next time. XD
Jason Luboff
@JLuboff
Mar 18 2017 00:00
@Mokkants Good eye, I didn't even look at that lol
Mokkants
@Mokkants
Mar 18 2017 00:00
dw we've all been there @JenimDacket
Jason Luboff
@JLuboff
Mar 18 2017 00:00
Happy coding all, I'm out!
Karan Nandha
@karann7
Mar 18 2017 00:00
@JLuboff yeah but it doesn't return just one number i get three
Jason Luboff
@JLuboff
Mar 18 2017 00:01
@karannandha Thats becuase you're using console.log. You'll want to use return... and only return when its done looping through all the strings ;)
Mokkants
@Mokkants
Mar 18 2017 00:01
most of coding is making a huge mess that works and figuring out what can be salvaged
Vera S.
@verascity
Mar 18 2017 00:01

sorry, having another, similar problem as before... I know I can do these things easily in python so i don't know why they're so challenging for me in JS

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

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

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

returns "no such"es accurately and goes through the for/if loops okay but returns null on a positive result

Peter Segura
@be1mont
Mar 18 2017 00:04
so many brackets
Mokkants
@Mokkants
Mar 18 2017 00:05
you're returning no such contact inside the loop @verascity
Peter Segura
@be1mont
Mar 18 2017 00:05
yea
Mokkants
@Mokkants
Mar 18 2017 00:05
place that return outside the loop and it should work
Vera S.
@verascity
Mar 18 2017 00:06
thanks!
Peter Segura
@be1mont
Mar 18 2017 00:06
and no such property isn't necessary right? because if you cant find the contact than why would it have a property
or am i wrong to assume that?
Mokkants
@Mokkants
Mar 18 2017 00:07
if it finds the contact but doesn't have the right property it should say so
Peter Segura
@be1mont
Mar 18 2017 00:08
okay just checking
Karan Nandha
@karann7
Mar 18 2017 00:08
hey guys i need some help Im almost there but can't seem to return the largest number

function findLongestWord(str) {
  var largestNum = 0;
  var splitStr = str.split(' ');
  for(var i = 0; i < splitStr.length; i++) {
    if (splitStr[i].length > largestNum) {
     largestNum = splitStr[i].length;
   } else if (splitStr[i].length < largestNum) {
     return largestNum;
   }
  }
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Mokkants
@Mokkants
Mar 18 2017 00:09
am i the only one not using hasOwnProperty in ifs? I just say if(object.property)
@karannandha return it after the loop is finished
Karan Nandha
@karann7
Mar 18 2017 00:10
@Mokkants so no need for an else if?
Mokkants
@Mokkants
Mar 18 2017 00:10
@karannandha there's no need for an else if just place the return outside the for
ye
Karan Nandha
@karann7
Mar 18 2017 00:11
it worked but please tell me how would i knwo to place that outside the loop
and why did it have that affect of placing it inside the loop
Mokkants
@Mokkants
Mar 18 2017 00:12
well you're looping through an array, you want to check every single item
Karan Nandha
@karann7
Mar 18 2017 00:12
is it because if im returning in the loop the loop cuts it off by 1?
Mokkants
@Mokkants
Mar 18 2017 00:12
if you place the return inside the loop it'll get to it, read it, see that it needs to return the largest number now (at the first word) and then stop the function
Karan Nandha
@karann7
Mar 18 2017 00:13
Gotcha!
Mokkants
@Mokkants
Mar 18 2017 00:13
if you put it outside the loop, it doesn't get called until the loop is finished and it found the largest number
Karan Nandha
@karann7
Mar 18 2017 00:13
Awesome! Thanks a lot
Mokkants
@Mokkants
Mar 18 2017 00:13
np good luck
Karan Nandha
@karann7
Mar 18 2017 00:13
Being sober does help code a lot better
Mokkants
@Mokkants
Mar 18 2017 00:13
:D
im off to bed cyas
Karan Nandha
@karann7
Mar 18 2017 00:14
awesome thanks
@Mokkants Thanks
Ademola Ariya
@d3mola
Mar 18 2017 00:17

function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor

    return (str.substring(str.length - 1 )) === target;

}

confirmEnding("Bastian", "n");
pls help with this challenge https://www.freecodecamp.com/challenges/confirm-the-ending
confirmEnding("He has to give me a new name", "name")
failing this test. it should return true
confirmEnding("Open sesame", "same")
and this should return false
Spyrantis Theodoros
@thodorisanta
Mar 18 2017 00:27

im working on the twitch api. But why theres nothing shown in my console?

https://codepen.io/oshikurou/pen/YZrqBy?editors=1011

Evan
@CodeDraken
Mar 18 2017 00:31
Anyone know how to go back a page using history in React Router v4?
Alex
@alexlo0319
Mar 18 2017 00:32
Can someone help me?
How to type the beginning of Factorialize a Number?
odm275
@odm275
Mar 18 2017 00:34
Wiki.html:1 XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srsearch=hey. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
does anyone know this error?
JenimDacket
@JenimDacket
Mar 18 2017 00:36
Will I be well equipped to do the projects when I get there?
I'm getting the algorithms pretty easily, but I feel like I still can't really do anything with JS...
DannyArrow
@DannyArrow
Mar 18 2017 00:38
hello
need with the escape sequences
var myStr = '\nFirstLinenewline\\backslashecondLinebackslash\rcarriage-\\returnThirdLine';
Rene Villa
@renevilla
Mar 18 2017 00:40

hi - im wondering if there is a better solution to the problem "Profile Lookup"
here is my code

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

any insight would be greatly appreciated!

badalsaibo
@heyDante
Mar 18 2017 00:43
@renevilla Its fine!
Saboor Malik
@MathematicsCoding
Mar 18 2017 00:44
Sneeze
:wave:
Rene Villa
@renevilla
Mar 18 2017 00:44
@heyDante just wanted to check to see if there was a different solution. thanks!
CamperBot
@camperbot
Mar 18 2017 00:44
renevilla sends brownie points to @heydante :sparkles: :thumbsup: :sparkles:
:cookie: 588 | @heydante |http://www.freecodecamp.com/heydante
Saboor Malik
@MathematicsCoding
Mar 18 2017 00:45
Do anyone know swift?
Rudy Hernandez
@rudolphh
Mar 18 2017 00:46
@renevilla i did it this way, don't believe its 'better'; i avoided checking for the property until the end.
function lookUpProfile(name, prop){
// Only change code below this line
  var exists = false; 
  var index = -1;

  for (var i=0; i < contacts.length; i++) {
     if (contacts[i].firstName === name) {
         exists = true;
         index = i; 
      }
  }

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

// Only change code above this line
}
i like your way 'better' ;)
DannyArrow
@DannyArrow
Mar 18 2017 00:47
hey anyone can help me with the sequence string
Ardigi
@Ardigi
Mar 18 2017 00:48
@DannyArrow you referring to escaping them?
keanusuasuasuasuasuas
@keanusuasuasuasuasuas
Mar 18 2017 00:50
"lastName".length;
this isn't working
Ardigi
@Ardigi
Mar 18 2017 00:51
@keanusuasuasuasuasuas it has to equal something, you're trying to append the answer to the variable
@DannyArrow which part about that lesson are you stuck on?
Rudy Hernandez
@rudolphh
Mar 18 2017 00:52
@heyDante not sure what you mean but i am using the beta challenges and it wants that param to be named 'name'
Ardigi
@Ardigi
Mar 18 2017 00:53
@keanusuasuasuasuasuas look at the example, you're answer should have 3 lines as well as tthe firsNameLength example
c0d0er
@c0d0er
Mar 18 2017 00:55
@moT01 thanks
CamperBot
@camperbot
Mar 18 2017 00:55
c0d0er sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 578 | @mot01 |http://www.freecodecamp.com/mot01
Ardigi
@Ardigi
Mar 18 2017 00:56
Can someone help me understand what to start with on the Word Blanks challenge
Saboor Malik
@MathematicsCoding
Mar 18 2017 00:57
return "wordBlanks " + myNoun + " " + myAdjective + " " + myVerb + " " + " " + myAdverb;
}
Add something in spaces
Ardigi
@Ardigi
Mar 18 2017 00:59
make my own variables to add inside the spaces?
i get it if so
or assign already there word blanks to the variables listen by them?
the already*
Ryan
@DoubleTri
Mar 18 2017 01:00
@Ardigi
@Ardigi sure. what category is it in?
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 01:03
you dont need to assign any values to the parameters like myNoun etc
Ardigi
@Ardigi
Mar 18 2017 01:03
@DoubleTri @MathematicsCoding has already explained it
@HeebieGeeBee okay thanks, so just make my own variables to input into the spaces
CamperBot
@camperbot
Mar 18 2017 01:03
ardigi sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1083 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 01:03
you dont need to make any variables
the purpose of the function is to return a sentence made up of the parameters of the function along with other characters
Ardigi
@Ardigi
Mar 18 2017 01:05
ohhhh okay i see!
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 01:05
so for example result = myNoun + " " + myVerb........
you add the space strings becuase the sentence has to look like a sentenee and sentences need spaces between words
Ardigi
@Ardigi
Mar 18 2017 01:08
Oh, so the wordBlanks order is already defined and I'm just putting them together to form a sentence
thanks @HeebieGeeBee
CamperBot
@camperbot
Mar 18 2017 01:08
ardigi sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: ardigi already gave heebiegeebee points
silver537
@silver537
Mar 18 2017 01:13
boooo
cant do template literals
This message was deleted
Manish Giri
@Manish-Giri
Mar 18 2017 01:16
`${test}`
Suraj Khosla
@khreate
Mar 18 2017 01:16
yo! I need help on the Stand In Line module. How do I remove the first item in an array?
silver537
@silver537
Mar 18 2017 01:16
awww i wanted to do inline
Manish Giri
@Manish-Giri
Mar 18 2017 01:17
@khreate .shift()
Suraj Khosla
@khreate
Mar 18 2017 01:17
ah, thanks!
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:17
Yeah
@khreate Hold on Im sending you an image
Sigh cant do it
Well never mind this image can be useful
Kaylynne Hatch
@KaylynneH
Mar 18 2017 01:20
Has anyone else run into issues with the "Replacing If Else Chains with Switch" Challenge? I completed the challenge but I suspect there might be some kind of bug maybe?
Suraj Khosla
@khreate
Mar 18 2017 01:20
@MathematicsCoding Shift works, but I'm still not hitting the second criteria for the module: nextInLine([2], 1)should return 2
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:21
Dont write any codes except .shift, .push and return the element that was removed
Dont worry about these
Ryan
@DoubleTri
Mar 18 2017 01:21
@KaylynneH whats the issue?
Suraj Khosla
@khreate
Mar 18 2017 01:22
function nextInLine(arr, item) { arr.shift(); return arr.push(item); // Change this line }
Johnny
@JohnnyBizzel
Mar 18 2017 01:22
@KaylynneH If you think there is a bug you can report it.
Kaylynne Hatch
@KaylynneH
Mar 18 2017 01:22
I've got the code all correct but it keeps telling me that I still have IF/Else statements (I don't) & should have at least 4 breaks (I do).
Suraj Khosla
@khreate
Mar 18 2017 01:22
@MathematicsCoding That's my code so far
Manish Giri
@Manish-Giri
Mar 18 2017 01:22
your return is wrong @khreate
Suraj Khosla
@khreate
Mar 18 2017 01:23
ah
Manish Giri
@Manish-Giri
Mar 18 2017 01:23
arr.shift();
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:23
Return .shfit
Manish Giri
@Manish-Giri
Mar 18 2017 01:23
this value is what you need to return
Suraj Khosla
@khreate
Mar 18 2017 01:23
Oh, I see
Johnny
@JohnnyBizzel
Mar 18 2017 01:23
@KaylynneH link?
Suraj Khosla
@khreate
Mar 18 2017 01:23
Thanks, @Manish-Giri
CamperBot
@camperbot
Mar 18 2017 01:23
khreate sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4796 | @manish-giri |http://www.freecodecamp.com/manish-giri
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:23
Because that challenge want you to return the element that was removed
Bryson Bowie
@Lil-Bowie
Mar 18 2017 01:23

I'm new to this but, can some one tell me what I missed
function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
celsius = 30 * 9/5 +32;

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

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

Kaylynne Hatch
@KaylynneH
Mar 18 2017 01:24
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:24
@Manish-Giri Hey can you help me with this challenge?
silver537
@silver537
Mar 18 2017 01:24
@Lil-Bowie what's the formula ?
Aj Broman
@Bromana
Mar 18 2017 01:24
Can someone give me a hand understanding Math.max.apply(null, [array]);
Johnny
@JohnnyBizzel
Mar 18 2017 01:24
@KaylynneH

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

  if (val === "bob") {
    answer = "Marley";
  } else if (val === 42) {
    answer = "The Answer";
  } else if (val === 1) {
    answer = "There is no #1";
  } else if (val === 99) {
    answer = "Missed me by this much!";
  } else if (val === 7) {
    answer = "Ate Nine";
  }

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

// Change this value to test
chainToSwitch(7);

// this one?
Manish Giri
@Manish-Giri
Mar 18 2017 01:25
@MathematicsCoding which
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:25
Kaylynne Hatch
@KaylynneH
Mar 18 2017 01:25
Yeah, that's what it looks like before I put in my code

This is what it looks like after I put it in:
function chainToSwitch(val) {
var answer = "";
// Only change code below this line
switch (val){
case "bob":
answer = "Marley";
break;
case 42:
answer = "The Answer";
break;
case 1:
answer = "There is no #1";
break;
case 99:
answer = "Missed me by this much!";
break;
case 7:
answer = "Ate Nine";
break;
default:
answer = "";
}
// Only change code above this line
return answer;
}

// Change this value to test
chainToSwitch(156);

Ryan
@DoubleTri
Mar 18 2017 01:25

@KaylynneH '''
switch (val){
case (val = "bob"):
answer = "Marley";
break;

case (val = 42):
answer = "The Answer";
break;  

case (val = 1):
answer = "There is no #1";
break;

case (val = 99):
answer = "Missed me by this much!";
break;

case (val = 7):
answer = "Ate Nine";
break;

}
'''

CamperBot
@camperbot
Mar 18 2017 01:25
:bulb: to format code use backticks! ``` more info
Johnny
@JohnnyBizzel
Mar 18 2017 01:26
@KaylynneH
function sequentialSizes(val) {
  var answer = "";
  // Only change code below this line
  switch(val){
    case 1: case 2: case 3:
      answer = "Low";
      break;

   case 4: case 5: case 6:
      answer = "Mid";
      break;
      case 7: case 8: case 9:
      answer = "High";
      break;
    default:
      answer = "";
  }


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

// Change this value to test
sequentialSizes(1);
Bryson Bowie
@Lil-Bowie
Mar 18 2017 01:26
@silver537 convert Celsius to Fahrenheit
Suraj Khosla
@khreate
Mar 18 2017 01:26
@MathematicsCoding
function testGreaterThan(val) {
  if (val>100) {  // Change this line
    return "Over 100";
  }

  if (val>10) {  // Change this line
    return "Over 10";
  }

  return "10 or Under";
}

// Change this value to test
testGreaterThan(10);
Kaylynne Hatch
@KaylynneH
Mar 18 2017 01:26
@JohnnyBizzel Why would I need assignments for val? It works fine without.
silver537
@silver537
Mar 18 2017 01:26
@Lil-Bowie yea but whats the formula
like physics formula
Manish Giri
@Manish-Giri
Mar 18 2017 01:27
@MathematicsCoding code?
Johnny
@JohnnyBizzel
Mar 18 2017 01:27
@KaylynneH if you post your code we can debug it
Bryson Bowie
@Lil-Bowie
Mar 18 2017 01:27
C * 9/5 +32 = F @silver537
Kaylynne Hatch
@KaylynneH
Mar 18 2017 01:27
I just posted it - 18:25 Scroll up
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:27
... Im swear I did it with that code but I didnt pass before?
@khreate How did you get that code?
Suraj Khosla
@khreate
Mar 18 2017 01:28

@MathematicsCoding You probably used the wrong sign;

= Greater Than, < = Less Than

silver537
@silver537
Mar 18 2017 01:28
@Lil-Bowie alright... does that look like this?
celsius = 30 * 9/5 +32;
Suraj Khosla
@khreate
Mar 18 2017 01:28
< = greater than
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:28
Maybe
Johnny
@JohnnyBizzel
Mar 18 2017 01:28
@KaylynneH I'm lost now
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:28
< is less than
is greater than
Suraj Khosla
@khreate
Mar 18 2017 01:28
Yeah
Sorry
markup is being not nice
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:28
Its alright
Ryan
@DoubleTri
Mar 18 2017 01:28
@KaylynneH because you need to add a value to the switch's (val)
Kaylynne Hatch
@KaylynneH
Mar 18 2017 01:28
@JohnnyBizzel I think it might just be a bug. I'll report it. Thanks!
CamperBot
@camperbot
Mar 18 2017 01:28
kaylynneh sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1513 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:28
Can you make the space? like this?
if (val > 10)....
Johnny
@JohnnyBizzel
Mar 18 2017 01:29
@KaylynneH this is my solution:
function chainToSwitch(val) {
  var answer = "";
  // Only change code below this line

  switch (val) {
   case "bob":
     answer = "Marley";
      break;
   case 42:
     answer = "The Answer";
      break;
   case 1:
     answer = "There is no #1";
      break;
   case 99:
     answer = "Missed me by this much!";
      break;
         case 7:
     answer ="Ate Nine";  
      break;
   default:
     answer ="";
      break;

  }

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

// Change this value to test
chainToSwitch(7);
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:29
Nvm it can have tested it
Suraj Khosla
@khreate
Mar 18 2017 01:29
@MathematicsCoding Yes, that's fine
Manish Giri
@Manish-Giri
Mar 18 2017 01:29
@KaylynneH post your challenge url here, click "run tests" first
Bryson Bowie
@Lil-Bowie
Mar 18 2017 01:29
yes but the test that it runs for the code catches an error. @silver537
Suraj Khosla
@khreate
Mar 18 2017 01:30
@Lil-Bowie Try putting a set of parentheses:
(9/5)
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:30
Oh I get...
I was confused because I thought > 10 was equal to 10...
Suraj Khosla
@khreate
Mar 18 2017 01:30
Ah
Bryson Bowie
@Lil-Bowie
Mar 18 2017 01:31
nope but least the java script is right @silver537
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:32
I have just passed like 2-3 challenges in few secs...
Arrived to 199...
silver537
@silver537
Mar 18 2017 01:33

@Lil-Bowie

F= C * 9/5 +32
you have
celsius = 30 * 9/5 +32;
you have a variable fahrenheit declared at the beginning of the function
but youre assigning celsius to the calculation.
in other words, you're converting celsius to.... celsius. does that make sense?

that's one reason why your code is off.
ask yourself.... what is ALWAYS changing?
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:34
Have anyone learned objective c?
Bryson Bowie
@Lil-Bowie
Mar 18 2017 01:35
oh wow I should have started with F because that is what is being asked for. hmm should have seen that.
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:35
Yeah
Well if you want fahrenheit and you can change the variable
But that challenge want the F... oh well
silver537
@silver537
Mar 18 2017 01:38
celsius right? look at the function declaration, you have a parameter called celsius function convertToF(celsius){ ... }
this is a variable that is initially declared with the function.
you assign a value to that variable by calling the function with an argument convertToF(30)
basically this means that celsius inside the function is assigned a value of 30
as when you are calling it with different numbers, convertToF(10), convertToF(3000)
in those instances celsius will be assigned the value 10, and then 3000.
Bryson Bowie
@Lil-Bowie
Mar 18 2017 01:38
@silver537 thank you for the help
CamperBot
@camperbot
Mar 18 2017 01:38
lil-bowie sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 875 | @silver537 |http://www.freecodecamp.com/silver537
silver537
@silver537
Mar 18 2017 01:38
slow typer here. lol
JenimDacket
@JenimDacket
Mar 18 2017 01:39
Hey fam, maybe a silly question, but is there a way to select a specific character in an array's string w/out breaking the array up?
silver537
@silver537
Mar 18 2017 01:40
@Lil-Bowie
what you did here celsius = 30 * 9/5 +32;
is you HARD coded in the 30 which was already assigned to celsius when you declared it.
so simply, change celsius to fahrenheit, and change 30 to celsius
Manish Giri
@Manish-Giri
Mar 18 2017 01:45
@JenimDacket just use the index
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:45
@Manish-Giri do you know objective c?
Manish Giri
@Manish-Giri
Mar 18 2017 01:45
@MathematicsCoding kind of
Ken Haduch
@khaduch
Mar 18 2017 01:45
@JenimDacket - you can just iterate over the string as you do an array, you just cannot change individual elements.
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:46
Well just asking If I wanted to learn swift and should I learn objective c first?
Manish Giri
@Manish-Giri
Mar 18 2017 01:46
I learnt it a long time back
then switched to swift
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:46
Did you make any iOS apps?
Manish Giri
@Manish-Giri
Mar 18 2017 01:47
yeah
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:47
IS it on app store lol
silver537
@silver537
Mar 18 2017 01:47
@Manish-Giri daaaaamn he puttin you on the spot
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:47
Well they costs 99$ per year..
Manish Giri
@Manish-Giri
Mar 18 2017 01:48
nah I didnt want to pay $99
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:48
Yeah
Manish Giri
@Manish-Giri
Mar 18 2017 01:48
just to put it up
@silver537 haha yeah
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:48
@Manish-Giri daaaaamn he puttin you on the spot
Are you talking about me?
silver537
@silver537
Mar 18 2017 01:48
yeaaa
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:48
So what?
silver537
@silver537
Mar 18 2017 01:49
it's a joke
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:49
Yeahhh righttt a jokeee....
:trollface:
silver537
@silver537
Mar 18 2017 01:49
yea we laughed :D
Manish Giri
@Manish-Giri
Mar 18 2017 01:49
you gotta understand those references buddy!
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:49
@Manish-Giri daaaaamn he puttin you on the spot
I actually laughed at that
silver537
@silver537
Mar 18 2017 01:50
see?
joke :D
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:50
:joy: :gun:
silver537
@silver537
Mar 18 2017 01:50
boom head shot
hoddedman
@hoddedman
Mar 18 2017 01:51
what am I doing wrong
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:51
Rip no blood symbol
@hoddedman With?
hoddedman
@hoddedman
Mar 18 2017 01:51

```var Bike = function() {

// Only change code below this line.
var gear = "";
this.setGear = function(myBike) {
gear += myBike;
};
this.getGear = function() {
return gear;
};
};

var myCar = new Car();

var myBike = new Bike();

Saboor Malik
@MathematicsCoding
Mar 18 2017 01:52
Sorry don't know these yet
silver537
@silver537
Mar 18 2017 01:52
object constructors
hate them
Manish Giri
@Manish-Giri
Mar 18 2017 01:52
@hoddedman gear += myBike;
should be just =
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:53
@Manish-Giri oh yeah you didnt answer my question...
Well just asking If I wanted to learn swift and should I learn objective c first?
hoddedman
@hoddedman
Mar 18 2017 01:53
ohhhh
because there's no initial variable?
silver537
@silver537
Mar 18 2017 01:56
@hoddedman no it's cause gear is a private property and can only be accessed by methods.
Saboor Malik
@MathematicsCoding
Mar 18 2017 01:58
function testLogicalAnd(val) {
  // Only change code below this line
if (num <=50 && num >=25) {
  return "Yes";
}
return "No";

}

// Change this value to test
testLogicalAnd(30);
silver537
@silver537
Mar 18 2017 01:59
@MathematicsCoding supposed to be val not num
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:00
Oh...
I just copied an example and adjust it :p
Well how does it works?
How do I make yes?
Manish Giri
@Manish-Giri
Mar 18 2017 02:00
@MathematicsCoding it's upto you, I'd learn swift..
It has significant improvements over obj c
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:01
So I dont have to learn objective c first?
I see
Wtf?
I was at 199, completed a challenge and got to 201?
I didnt get any thank recently
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:06
I might get this book when my parents are back from different country...
Is && and || same thing?
silver537
@silver537
Mar 18 2017 02:08
no, one is AND and the other is OR
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:08
SO && is and and || is or?
silver537
@silver537
Mar 18 2017 02:08
yea
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:08
So like Dog & Cat
silver537
@silver537
Mar 18 2017 02:08
no
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:09
Hot | Cold
Nvm thats analogies
silver537
@silver537
Mar 18 2017 02:10
it's a boolean operator.
&& represents AND as in
x< 3&& x> 0 <= both statements must be true in order for the whole thing to be true
x< 3|| x> 0 <= only one of the two statements must be true in order for the whole thing to be true
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:13
function testLogicalOr(val) {
  // Only change code below this line

  if (val > 30 || val < 0) {
    return "Outside";
  }

  // Only change code above this line
  return "Inside";
}

// Change this value to test
testLogicalOr(30);
A little change here...
function testLogicalOr(val) {
  // Only change code below this line

  if (val < 0 || val > 30) {
    return "Outside";
  }

  // Only change code above this line
  return "Inside";
}

// Change this value to test
testLogicalOr(30);
silver537
@silver537
Mar 18 2017 02:14
ooooook?
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:14
So is that correct...
silver537
@silver537
Mar 18 2017 02:15
what is the intended output?
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:15
Inside
silver537
@silver537
Mar 18 2017 02:15
so it should work
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:15
Outside if it is larger than 30
Yeah
But couldn't pass this challenge%20%7B%0A%20%20%2F%2F%20Only%20change%20code%20below%20this%20line%0A%0A%20%20if%20(val%20%3C%200%20%7C%7C%20val%20%3E%2030)%20%7B%0A%20%20%20%20return%20%22Outside%22%3B%0A%20%20%7D%0A%0A%20%20%2F%2F%20Only%20change%20code%20above%20this%20line%0A%20%20return%20%22Inside%22%3B%0A%7D%0A%0A%2F%2F%20Change%20this%20value%20to%20test%0AtestLogicalOr(30)%3B%0A)
silver537
@silver537
Mar 18 2017 02:15
yea
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:16
Challenge: Comparisons with the Logical Or Operator
silver537
@silver537
Mar 18 2017 02:16
whats does it ask for you to do?
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:16
Sorry got to eat dinner so do you mind sending me some messages in private chat?
silver537
@silver537
Mar 18 2017 02:16
ill be here. just come back
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:16
Just asked me to return random numbers
Alright thanks
See ya
Rudy Hernandez
@rudolphh
Mar 18 2017 02:17
anyone working on the javascript calculator with react? (beta)
silver537
@silver537
Mar 18 2017 02:17
na
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:18
Actually.. Im still here
Garo
@Garabed96
Mar 18 2017 02:19
@Fireklaws1 thank you, I was able to change the background color to give a more pleasent look
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:21
Nvm i managed to pass this challenge
Rudy Hernandez
@rudolphh
Mar 18 2017 02:22
who knew calculator logic would be so diabolical. lol
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:23
How is calculator evil?
g
silver537
@silver537
Mar 18 2017 02:23
there's a project you have to do and it's a calculator.
you gotta create it
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:23
Calculator: : Evi laughing
Yeah
silver537
@silver537
Mar 18 2017 02:23
it's cooool
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:24
@silver537 SO did you get that certificate?
First one
silver537
@silver537
Mar 18 2017 02:24
na
i quit a long time ago
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:25
Which one are you working on?
silver537
@silver537
Mar 18 2017 02:25
heheh
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:25
Oh..
silver537
@silver537
Mar 18 2017 02:25
im currently learning Vue
js framework
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:25
Yeag
For playstation?
silver537
@silver537
Mar 18 2017 02:25
na
Manish Giri
@Manish-Giri
Mar 18 2017 02:26
I started Vue too
but then decided to finish React + Redux first
then come back to Vue
silver537
@silver537
Mar 18 2017 02:26
i wanna try react
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:26
Is Node a react?
silver537
@silver537
Mar 18 2017 02:27
but idk man.... i feel like it's unnecessary to learn another framework.
Manish Giri
@Manish-Giri
Mar 18 2017 02:27
precisely.
which is why I'm sticking with R for now..
Prosthetic22
@Prosthetic22
Mar 18 2017 02:28
Help please
On 164
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:29
@Prosthetic22 164 isn't exactly
Prosthetic22
@Prosthetic22
Mar 18 2017 02:29
Huh??
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:29
You get a cookie by completing a lesson and getting a thank from a person
Prosthetic22
@Prosthetic22
Mar 18 2017 02:29
Ok?
silver537
@silver537
Mar 18 2017 02:29
@Prosthetic22 what's the challenge name?
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:29
For example I have 160 but I got 2 thanks from that person so Im on 162
Prosthetic22
@Prosthetic22
Mar 18 2017 02:30
Stand In Line
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:30
@Prosthetic22 We cant just start counting the challenges...
@Prosthetic22 what's the challenge name?:thumbup:
silver537
@silver537
Mar 18 2017 02:31

push()
pop()
shift()
unshift()

read the docs for those methods. like seriously, read it. those methods are essential.

Saboor Malik
@MathematicsCoding
Mar 18 2017 02:31
Yep
I forgot whats .unshift();
Oh yeah to add something at first element
At front I meant
opposite of .push
silver537
@silver537
Mar 18 2017 02:32
read the docs :P
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:32
Nah I have my own
JenimDacket
@JenimDacket
Mar 18 2017 02:32
@Manish-Giri Yeah, I was trying to do that. I am working on the mutations challenge, but something keeps going wrong when. 2 of the cases are not working.
Well, I'll keep playing with it.
Prosthetic22
@Prosthetic22
Mar 18 2017 02:32
Idk i think the wording is messing up
JenimDacket
@JenimDacket
Mar 18 2017 02:32
@Manish-Giri Thanks
CamperBot
@camperbot
Mar 18 2017 02:32
jenimdacket sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4797 | @manish-giri |http://www.freecodecamp.com/manish-giri
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:33
@Prosthetic22 Do you expect us to help you by your manner?!
Well there is something that will help you
Very useful one
Would you like to know?
Prosthetic22
@Prosthetic22
Mar 18 2017 02:34
Sure
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:34
Read the directions :) and also read carefully
silver537
@silver537
Mar 18 2017 02:34
misunderstanding...
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:34
And listen to @silver537
or someone else
Prosthetic22
@Prosthetic22
Mar 18 2017 02:35
Ive read them over and over, and i still don't understand. Thats why I'm obviously here to ask for hjelp
help*
Manish Giri
@Manish-Giri
Mar 18 2017 02:35
@Prosthetic22 what's your question?
Prosthetic22
@Prosthetic22
Mar 18 2017 02:35
by saying read the directions carefully doesn't help me
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:35
It might
And listen to @silver537
Manish Giri
@Manish-Giri
Mar 18 2017 02:36
@Prosthetic22 there are two steps in that challenge -
  1. add the number item to the end of the array arr
  2. remove the first element from the array arr and return it.
    The two functions - .push() and .shift() would be helfpul.
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:36
He told you to read the docs for .push, .pop. shift, and unshift
@Manish-Giri ..
nsonhouse
@nsonhouse
Mar 18 2017 02:36
Hello all. Need some help.
Prosthetic22
@Prosthetic22
Mar 18 2017 02:36
@Manish-Giri Thank you. ill give it a go
CamperBot
@camperbot
Mar 18 2017 02:36
prosthetic22 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:36
hi
CamperBot
@camperbot
Mar 18 2017 02:36
:star2: 4798 | @manish-giri |http://www.freecodecamp.com/manish-giri
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:37
Wow
Just wow
Manish Giri
@Manish-Giri
Mar 18 2017 02:37
@HeebieGeeBee :wave:
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:37
Only if you listened to @silver537 ...
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:37
@Manish-Giri :wave:
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:37
misunderstanding...
silver537
@silver537
Mar 18 2017 02:37
@MathematicsCoding you're really not helping.
Prosthetic22
@Prosthetic22
Mar 18 2017 02:37
yup
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:37
@nsonhouse whats the problem?
nsonhouse
@nsonhouse
Mar 18 2017 02:38
I have four images that need random numbers when clicked.
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:38
@Prosthetic22 So you wont learn about the .pop and .unshift then
Good Luck
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:38
what do you mean by random numbers?
Joseph
@revisualize
Mar 18 2017 02:38
Hi.
Prosthetic22
@Prosthetic22
Mar 18 2017 02:38
Sorry, not everyone is as bright as you @MathematicsCoding
nsonhouse
@nsonhouse
Mar 18 2017 02:39
I solved the problem inefficiently. I need help putting them into a loop.
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:39
@revisualize :wave:
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:39
@revisualize yo
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:39
@Prosthetic22 Yeah
At least try to read and memorize
nsonhouse
@nsonhouse
Mar 18 2017 02:39
I used Math.floor(Math.random
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:39
Otherwise you will just ask for help each single challenge...
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:39
@nsonhouse youre going to need to show some code
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:40
@MathematicsCoding you're really not helping.
@silver537 Sorry what did you want me to do..
Joseph
@revisualize
Mar 18 2017 02:40
@HeebieGeeBee Come on.. Can't you just read their mind and what's on their screen?
nsonhouse
@nsonhouse
Mar 18 2017 02:40
@HeebieGeeBee Ok. I am a newbie. Just paste to the window?
Prosthetic22
@Prosthetic22
Mar 18 2017 02:40
Haha thanks for your advice
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:40
:)
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:40
@nsonhouse yeah
Joseph
@revisualize
Mar 18 2017 02:40

If you are posting code that is large, Please use Gist - https://gist.github.com/ then please paste the link here.
...
How to do code block format: ..... PLEASE try with a small block of code before you try to make a bigger one.
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
```js [SHIFT+ENTER]
// your code here
``` [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
...
Output:

var code = undefined;

...
You can also do inline code formatting:
A string of text with a `variable` or `other bit of code`.
Output:
A string of text with a variable or other bit of code.

Saboor Malik
@MathematicsCoding
Mar 18 2017 02:41
@revisualize Seriously? Did you copy everything into your docs?
Joseph
@revisualize
Mar 18 2017 02:41
@HeebieGeeBee So... I bought a selfie stick.
@MathematicsCoding Yes
Manish Giri
@Manish-Giri
Mar 18 2017 02:41
@nsonhouse do you have it on codepen/jsfiddle?
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:41
@revisualize you gonna start vlogging?
Joseph
@revisualize
Mar 18 2017 02:41
@HeebieGeeBee I could.
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:41
But?
Joseph
@revisualize
Mar 18 2017 02:41
@HeebieGeeBee But, it would be a crappy vlog.
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:42
well most of them are
nsonhouse
@nsonhouse
Mar 18 2017 02:42
@Manish-Giri No. Isn't there a fee for codepen?
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:42
There is no fee
Joseph
@revisualize
Mar 18 2017 02:42
@HeebieGeeBee I really do want to look at doing videos on youtube.
Manish Giri
@Manish-Giri
Mar 18 2017 02:42
@nsonhouse you can use the free version..
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:42
When you use free version yeah...
Joseph
@revisualize
Mar 18 2017 02:42
@HeebieGeeBee I'd like to do tutorial videos and walk through freeCodeCamp.
Manish Giri
@Manish-Giri
Mar 18 2017 02:42
it's sufficient for most things.
@nsonhouse
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:42
@revisualize you should, thers a few ppl doing that already
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:43
Yeah
These people are helpful
Joseph
@revisualize
Mar 18 2017 02:43
@HeebieGeeBee Yeah, I think I'd put a different spin on things and actually try to explain why.
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:43
Some of them are giving out the answers... @HeebieGeeBee
Joseph
@revisualize
Mar 18 2017 02:43
I think too many people are going.. Just do this.
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:43
@revisualize go for it
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:43
@HeebieGeeBee and I will support you @revisualize
Joseph
@revisualize
Mar 18 2017 02:44
But, I'd need to figure out how to record my screen and how to set up my environment.
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:44
@MathematicsCoding well how else do you do a tutorial?
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:44
No just giving the codes to viewer
Just like that
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:44
@revisualize use obs to record your desktop
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:44
Obs is also laggy
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:44
well to do recording or streaming live whatever
no its not
Joseph
@revisualize
Mar 18 2017 02:44
@HeebieGeeBee I don't want to do it live.
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:45
I have obs and decrease my fps whiling playing games...
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:45
@revisualize im just saying obs does it all
Jake R.
@theaquacadet
Mar 18 2017 02:45
Hey everyone, can you guys help me understand what I'm doing wrong? I'm on Using Objects For Lookup and it isnt passing the tests. I'm not entirely sure why it isn't.
// 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");
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:45
@revisualize Not live... Just record, edit it, then post it
Joseph
@revisualize
Mar 18 2017 02:45
@theaquacadet Your function has declared and initialized the variable result to "". You are not modifying result and your function is returning result. Ergo, you're returning "". You need to modify result to be the value of the property from the object that you created.
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:45
@MathematicsCoding well obs can record, not edit though
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:45
Yeah use other software for that
Take that video somewhere then edit it
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:46
youtube actually have editing software
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:46
@revisualize If you want I can teach you how to set up, where to store videos, etc..
@HeebieGeeBee Really?
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:46
or blender actually has video editing too
@MathematicsCoding yes its pretty basic but you can edit it
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:47
I see
Manish Giri
@Manish-Giri
Mar 18 2017 02:47
@theaquacadet you need to lookup the value of the val property from the lookup object, and assign the value to result, because that's what is being returned at the end..
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:47
I dont do record anymore
Since I hate playing minecraft now...
the0ffh
@the0ffh
Mar 18 2017 02:48
@theaquacadet Can you post your code?
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:48
Before now I was addicted to a lot of games..
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:48
@the0ffh he did
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:48
Hey everyone, can you guys help me understand what I'm doing wrong? I'm on Using Objects For Lookup and it isnt passing the tests. I'm not entirely sure why it isn't.
// 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");
His code
the0ffh
@the0ffh
Mar 18 2017 02:49
@HeebieGeeBee sorry..thought that was the one when you get after landing on the page
Adam
@GoingAllTheWayUp
Mar 18 2017 02:50
Pomodoro my CSS animations are not begining at the same position, but random ones. any ideas?
nsonhouse
@nsonhouse
Mar 18 2017 02:51
@HeebieGeeBee @Manish-Giri https://codepen.io/nsonhouse/pen/XMVXyK
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 02:52
@nsonhouse so whats wrong with generating random numbers like that?
Manish Giri
@Manish-Giri
Mar 18 2017 02:53

@nsonhouse all of this is a lot of repeated code -


var emeraldNum = Math.floor(Math.random() * ((12-1)+1) + 1);
var emeraldNumEl = document.getElementById("emerald");
emeraldNumEl.innerHTML = emerald;

var rubyNum = Math.floor(Math.random() * ((12-1)+1) + 1);
var rubyNumEl = document.getElementById("ruby");
rubyNumEl.innerHTML = ruby;

var topazNum = Math.floor(Math.random() * ((12-1)+1) + 1);
var topazNumEl = document.getElementById("topaz");
topazNumEl.innerHTML = topaz;

var sapphireNum = Math.floor(Math.random() * ((12-1)+1) + 1);
var sapphireNumEl = document.getElementById("sapphire");
sapphireNumEl.innerHTML = sapphire;

you can refactor all this into a function, to which you can pass the values you want, like the number 12 and the selector sapphire, and that function will do the rest..

nsonhouse
@nsonhouse
Mar 18 2017 02:53
@HeebieGeeBee @Manish-Giri My JS inefficient.
@Manish-Giri exactly
Im not sure how to put this into a function
Manish Giri
@Manish-Giri
Mar 18 2017 02:54
function randomizeAndSelect(number, selector) { 
 //generate random number
 //assign it to selector's innerHTML
}
and then call it like
randomizeAndSelect(12, "sapphire");
@nsonhouse
David Wen Riccardi-Zhu
@dwrz
Mar 18 2017 02:54
Any hints on where I might be going wrong with this code for Arguments Optional?
function addTogether() {

        var x = arguments[0];
        console.log(x);

  if (typeof arguments[0] !== "number" || typeof arguments[1] !== "number"){

    return undefined;

  } else if (typeof arguments[0] === "number" && typeof arguments[1] === "number") {

    return arguments[0] + egnom[1];

  } else if (arguments.length === 1) {
        var inner = function(y){
           return x + y;
         };
       return inner();    
  }
} 
addTogether(2,3);
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:54

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

  if (val < 5 && val >= 10) {
    result = "Bigger than 5";
  }
  else {
  // Only change code above this line
  return result;
}
  return "5 or Smaller";
}
// Change this value to test
testElse(5);
What is wrong with this code?
the0ffh
@the0ffh
Mar 18 2017 02:55
@MathematicsCoding (val < 5 && val >= 10)
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:56
if (val < 5 && val > 10)
the0ffh
@the0ffh
Mar 18 2017 02:56
you are checking if val is smaller than 5 and bigger or equal to 10 at the same time
Adam
@GoingAllTheWayUp
Mar 18 2017 02:56
how? is that possible
Jake R.
@theaquacadet
Mar 18 2017 02:56
@MathematicsCoding
a number can not be both less than five and greater than or equal to 10
Nadia
@nadiaschutz
Mar 18 2017 02:56
//WHY THIS DOESN"T WORK?

//* Without exception, there is a flat markup on all jobs of 5%
//* For each person that needs to work on the job, there is a markup of 1.2%
//The flat markup is calculated first and then all other markups are calculated on top of the base price plus flat markup.


function input(basePrice, people, markup){
  var varInput = prompt("Please enter data", "$1,299.99, 3 people, food");

var varInput=varInput.replace(',','');
var splits = varInput.split(',');


var basePrice=splits[0];
var people = splits[1];
var markup = splits[2];

    var peopleNumber=parseFloat (people);
    var basePriceNumb=parseFloat(basePrice.replace(/$/g,''));
    var flatMarkup=basePriceNumb*0.05;
    var peopleMarkup=peopleNumber*0.012*(basePriceNumb+flatMarkup);
 //Markups are also added depending on the types of materials involved:

//* If pharmaceuticals are involved, there is an immediate 7.5% markup
//* For food, there is a 13% markup
//* Electronics require a 2% markup
//* Everything else, there is no markup 
  /*Example 1:
----------
    Input:  $1,299.99, 3 people, food
    Output: $1,591.58

Example 2:
----------
    Input:  $5,432.00, 1 person, drugs
    Output: $6,199.81

Example 3:
----------
    Input:  $12,456.95, 4 people, books
    Output: $13,707.63*/


  if (markup=="drugs"){
      outputMarkup=(basePriceNumb+flatMarkup)*0.075+peopleMarkup+flatMarkup+basePriceNumb;
  }  else if (markup=="food"){
      outputMarkup=(basePriceNumb+flatMarkup)*0.13+peopleMarkup+flatMarkup+basePriceNumb;
  } else if(markup=="electronics"){
      outputMarkup=(basePriceNumb+flatMarkup)*0.02+peopleMarkup+flatMarkup+basePriceNumb;
  } else {
     outputMarkup=peopleMarkup+flatMarkup+basePriceNumb;
  }
   // return outputMarkup;
   return Math.round(outputMarkup*100)/100;
  //return basePriceNumb;
  //return splits;
}
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:56
Oooh

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

  if (val > 5 && val < 10) {
    result = "Bigger than 5";
  }
  else {
  // Only change code above this line
  return result;
}
  return "5 or Smaller";
}
// Change this value to test
testElse(6);
Correct?
the0ffh
@the0ffh
Mar 18 2017 02:57
@MathematicsCoding better :]
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:57
testElse(4) should return "5 or Smaller"
testElse(5) should return "5 or Smaller"
testElse(6) should return "Bigger than 5"
testElse(10) should return "Bigger than 5"
Adam
@GoingAllTheWayUp
Mar 18 2017 02:57
greater/less equals
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:57
function testElse(val) {
  var result = "";
  // Only change code below this line

  if (val > 5 && val <= 11) {
    result = "Bigger than 5";
  }
  else {
  // Only change code above this line
  return result;
}
  return "5 or Smaller";
}
// Change this value to test
testElse(11);
oh
Manish Giri
@Manish-Giri
Mar 18 2017 02:59
@MathematicsCoding else should return return "5 or Smaller"; I think..
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:59
} else {
I see
the0ffh
@the0ffh
Mar 18 2017 02:59
@MathematicsCoding try to separate it into smaller pieces
Saboor Malik
@MathematicsCoding
Mar 18 2017 02:59
That code is wrong because that else return result which means bigger than 5
Adam
@GoingAllTheWayUp
Mar 18 2017 02:59
Bigger than 5 will be returned for only numbers 6,7,8,9,10,11 as of now
Jake R.
@theaquacadet
Mar 18 2017 03:00
@Manish-Giri @revisualize thanks, I finally got it.
CamperBot
@camperbot
Mar 18 2017 03:00
theaquacadet sends brownie points to @manish-giri and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4799 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 3543 | @revisualize |http://www.freecodecamp.com/revisualize
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:00

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

  if (val > 5 && val <= 11) {

  }
  else {
  return "Smaller than 10";
}
  return "Bigger than 5";
}

// Change this value to test
testElse(11);
Better?
the0ffh
@the0ffh
Mar 18 2017 03:00
for a start you can check for each condition separately
nsonhouse
@nsonhouse
Mar 18 2017 03:03
@Manish-Giri Question in your function am I passing a number and selector?
Manish Giri
@Manish-Giri
Mar 18 2017 03:03
@nsonhouse yup
randomizeAndSelect(12, "sapphire");
nsonhouse
@nsonhouse
Mar 18 2017 03:05
@Manish-Giri so create a random number outside the function and call this function 4 times using the element id?
Manish Giri
@Manish-Giri
Mar 18 2017 03:06
@nsonhouse you can create the random number inside the function as well, the reason I passed a number as the first argument to the function was because I thought that represent some kind of an upper bound on the number, like the random number has to be between 0 and 10.
If you don't need an upper bound, you can create the random number in the function itself, and assign it to the selector. Then you just need to pass 1 argument to the function
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:07

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

  if (val < 5 && val > 5) {

  }
  else {
  return "5 or Smaller";
}
  return "Bigger than 5";
}

// Change this value to test
testElse(4, 6);
Sigh I will finish it later...
Manish Giri
@Manish-Giri
Mar 18 2017 03:10
randomizeAndSelect("sapphire"); //create a random number and assign it to sapphire's innerHTML

@nsonhouse
Also, instead of calling the function four times, you can write a loop that does it -

var items = ["ruby", "sapphire", "topaz", "emerald"];
for(var i = 0; i < items.length; i++) {
   randomizeAndSelect(items[i]);
}

with this you're doing two things -

  1. you don't need to write out that function four times, the loop is doing that for you
  2. since you have all the selectors in an array, you can just pass each one into the function, you don't have to type out each selector name again and again..
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:11

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

  if (val < 5 && val > 5) {


  }  else {
  return "5 or Smaller";
}
  return "Bigger than 5";
}

// Change this value to test
testElse(4, 11);
nsonhouse
@nsonhouse
Mar 18 2017 03:11
@Manish-Giri OK COOL
Adam
@GoingAllTheWayUp
Mar 18 2017 03:11
http://codepen.io/AllTheWayUp/pen/WpXjQQ animations don't start from same location if timer is ran repeatedly. any ideas?
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:11
testElse(6) should return "Bigger than 5"
testElse(10) should return "Bigger than 5"
Adam
@GoingAllTheWayUp
Mar 18 2017 03:14
@MathematicsCoding may I suggest you make a number line or use some ruler and familarize yourself with what > (greater) and < (less) are suggesting
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:15
Yeah I do
Adam
@GoingAllTheWayUp
Mar 18 2017 03:15
especialy if used with each other to make an if statement
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:15
testElse(4) should return "5 or Smaller"
testElse(5) should return "5 or Smaller"
testElse(6) should return "Bigger than 5"
testElse(10) should return "Bigger than 5"
See?
Smaller than 5 and bigger than 5..
Adam
@GoingAllTheWayUp
Mar 18 2017 03:17
I know my friend, just makeing it harder becuase you don't need to use both < and > just one
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:17
oh...
So can I use >=5
Adam
@GoingAllTheWayUp
Mar 18 2017 03:17
yes, where ever you found your example, limited your mind
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:18
:p
Finally
Aaron Bell
@awb715
Mar 18 2017 03:18
anyone do arguments optional?
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:18
But there is one problem
testElse(5) should return "5 or Smaller"
Adam
@GoingAllTheWayUp
Mar 18 2017 03:18
all ways
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:18

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

  if (val >=5) {


  }  else {
  return "5 or Smaller";
}
  return "Bigger than 5";
}

// Change this value to test
testElse(5);
Adam
@GoingAllTheWayUp
Mar 18 2017 03:19
work it out
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:19
...
Adam
@GoingAllTheWayUp
Mar 18 2017 03:19
if its graeter the 5 your returning nothing right now
you mistakenly drew the correct anmswer
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:20

function testElse(val) {
  var result= "Bigger than 5";
  // Only change code below this line

  if (val >=5) {


  }  else {
  return "5 or Smaller";
}
  return result;
}

// Change this value to test
testElse(6);
Adam
@GoingAllTheWayUp
Mar 18 2017 03:20
your mistaken by your green check marks
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:21
...
What am I supposed to do?
Adam
@GoingAllTheWayUp
Mar 18 2017 03:21
rigth now, if my value is >= 5 your returning NOTHING
but error your still returing the correct string, but thats clouser or scope out of order
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:22
What do you mean by returning nothing??
the0ffh
@the0ffh
Mar 18 2017 03:22
@MathematicsCoding look at the first requirement: testElse(4) should return "5 or Smaller"
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:22
oh
Still I got it correct?
Adam
@GoingAllTheWayUp
Mar 18 2017 03:23
your returns are all in the worng places
well one of them are
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:23
So switch these return?
Oh return result?
the0ffh
@the0ffh
Mar 18 2017 03:23
so..
IF (VAL is equal to or smaller than 5){
RETURN "5 or smaller;
}
Adam
@GoingAllTheWayUp
Mar 18 2017 03:24
no, right now if my value is >=5 your not doijng anything
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:24
Oh
I did >5
That fixed everything..
Adam
@GoingAllTheWayUp
Mar 18 2017 03:24
no thats ok\
what happens when you value is >=5?
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:24
But there is one problem///
Because it means 5 or equal to..
Adam
@GoingAllTheWayUp
Mar 18 2017 03:25
to me the code is not doing anything
there is literaly nopthing there
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:25
Well I got all correctly...
the0ffh
@the0ffh
Mar 18 2017 03:25
@MathematicsCoding do you know how to write it? 'equal or even' ?
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:25
What?
function testElse(val) {
  var result= "Bigger than 5";
  // Only change code below this line

  if (val >5) {


  }  else {
  return "5 or Smaller";
}
  return result;
}

// Change this value to test
testElse(5);
Look I did that and Got all green marks...
Manish Giri
@Manish-Giri
Mar 18 2017 03:25
@MathematicsCoding use something like jsbin, put in console.log statements, and test your code with the tests on FCC to see where you're going wrong..
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:26
I didnt do anything wrong..
Adam
@GoingAllTheWayUp
Mar 18 2017 03:26
if (val >=5) { //stuff here }
Manish Giri
@Manish-Giri
Mar 18 2017 03:26
:expressionless:
Adam
@GoingAllTheWayUp
Mar 18 2017 03:26
you have nothing\
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:26
@GoingAllTheWayUp
I told you I did >5
Adam
@GoingAllTheWayUp
Mar 18 2017 03:26
But becuase you have a return out of place iot fires
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:27

function testElse(val) {
  var result= "Bigger than 5";
  // Only change code below this line

  if (val >5) {


  }  else {
  return "5 or Smaller";
}
  return result;
}

// Change this value to test
testElse(5);
Look thats my code
And got all green marks...
Adam
@GoingAllTheWayUp
Mar 18 2017 03:27
you have return out of place,
Well you can fail to recognize why
I comend you for noticeing
FCC is not check\ing the code, only whats returned, not when or how
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:28
Wtf... I literally got all green marks..
Adam
@GoingAllTheWayUp
Mar 18 2017 03:28
k
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:28
Yeah..
Manish Giri
@Manish-Giri
Mar 18 2017 03:28
FCC is not check\ing the code, only whats returned, not when or how
this is why
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:29
But I cant pass this challenge because of this
Do not change the code above or below the lines.
Adam
@GoingAllTheWayUp
Mar 18 2017 03:30
@MathematicsCoding ok now you change the value of result at any time
with out touching that code above the line
David Fraser
@DavidFraserBHS
Mar 18 2017 03:31
@MathematicsCoding ding which tutorial is it (link)
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:31

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

  if (val >5) {


  }  else {
  return "5 or Smaller";
}
  return result;
}

// Change this value to test
testElse(5);
challenge%20%7B%0A%20%20var%20result%3D%20%22%22%3B%20%0A%20%20%2F%2F%20Only%20change%20code%20below%20this%20line%0A%20%20%0A%20%20if%20(val%20%3E5)%20%7B%0A%0A%20%20%0A%20%20%7D%20%20else%20%7B%0A%20%20return%20%225%20or%20Smaller%22%3B%0A%7D%0A%20%20return%20result%3B%0A%7D%0A%0A%2F%2F%20Change%20this%20value%20to%20test%0AtestElse(5)%3B%0A%0A%0A)
Adam
@GoingAllTheWayUp
Mar 18 2017 03:32
@MathematicsCoding make return "5 or Smaller"; result = "5 or Smaller";
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:32
Okay
I did it

function testElse(val) {
  var result= "5 or Smaller"; 
  // Only change code below this line

  if (val >5) {


  }  else {
  return "Bigger than 5";
}
  return result;
}

// Change this value to test
testElse(5);
Adam
@GoingAllTheWayUp
Mar 18 2017 03:32
then figure remove the else
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:33
Remove just else?
Adam
@GoingAllTheWayUp
Mar 18 2017 03:33
just } else {
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:33
Okay
Adam
@GoingAllTheWayUp
Mar 18 2017 03:33
maike it >=5
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:33
Done
Adam
@GoingAllTheWayUp
Mar 18 2017 03:33
there are many ways to do this
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:33
Well it doesnt works wont return 5 or smaller
Adam
@GoingAllTheWayUp
Mar 18 2017 03:34
so if your value is >= it chages result
if it's not then it stays the same and returns the result
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:34
Okay'
So can I just do >5
Adam
@GoingAllTheWayUp
Mar 18 2017 03:34
that will be 6,7,8,...
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:34
So..
Adam
@GoingAllTheWayUp
Mar 18 2017 03:34
>=5 is 5,6,7,...
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:35
Yeah
Adam
@GoingAllTheWayUp
Mar 18 2017 03:35
you just need to understand the function that fallows an if statement
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:35
I know what is >5...
Adam
@GoingAllTheWayUp
Mar 18 2017 03:36
do you know that?
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:36
>5 = 6 7 8 9 etc.
Of course..
So?
David Fraser
@DavidFraserBHS
Mar 18 2017 03:37
@MathematicsCoding all you have to do is : if (val > 5) {
result = "Bigger than 5";
} else {
result = "5 or Smaller";
}
Adam
@GoingAllTheWayUp
Mar 18 2017 03:37
Do put in work, i can not help you ill drowned
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:38
@DavidFraserBHS That is what I did...
Adam
@GoingAllTheWayUp
Mar 18 2017 03:38
no you did not
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:38
Yes I did
David Fraser
@DavidFraserBHS
Mar 18 2017 03:38

@MathematicsCoding function testElse(val) {
var result = "";
// Only change code below this line

if (val > 5) {
result = "Bigger than 5";
} else {
result = "5 or Smaller";
}

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

// Change this value to test
testElse(4);

Saboor Malik
@MathematicsCoding
Mar 18 2017 03:38
Scroll all the way up
Adam
@GoingAllTheWayUp
Mar 18 2017 03:38
I know a little
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:38
And you thought I did >=5...
I changed to >5 after that
Adam
@GoingAllTheWayUp
Mar 18 2017 03:39
Your on petty
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:39
I told you I got all green marks
@DavidFraserBHS I know and he is trying to explain something else..
Adam
@GoingAllTheWayUp
Mar 18 2017 03:40
many way to skin this cat, you don't understand the basics
David Fraser
@DavidFraserBHS
Mar 18 2017 03:40
@MathematicsCoding im sry lol
jason.song
@sxj1011
Mar 18 2017 03:40
In the following order, and separated by spaces:
backslash, tab, Backspace character, return character and assigns it to the variable myStr
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:40

```
function testElse(val) {
var result= "Bigger than 5";
// Only change code below this line

if (val >5) {

} else {
return "5 or Smaller";
}
return result;
}

// Change this value to test
testElse(5);

```

Old code...
jason.song
@sxj1011
Mar 18 2017 03:40
what is the answer
nsonhouse
@nsonhouse
Mar 18 2017 03:41
@Manish-Giri Sorry Manish. I'm not getting it.
Adam
@GoingAllTheWayUp
Mar 18 2017 03:41
not what you had bro
this is your code

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

  if (val >5) {


  }  else {
  return "5 or Smaller";
}
  return result;
}

// Change this value to test
testElse(5);
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:41

function testElse(val) {
  var result= "5 or Smaller"; 
  // Only change code below this line

  if (val >5) {
  return "Bigger than 5";
} else {
  return result;
}
}
// Change this value to test
testElse(5);
Adam
@GoingAllTheWayUp
Mar 18 2017 03:41
your only fooling yourself, no way to live.
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:41
@GoingAllTheWayUp That is after that...
You told me to change my code lol
You're
I can prove it
There you go
20:27
Screenshot and time doesn't lie...
Manish Giri
@Manish-Giri
Mar 18 2017 03:44
@nsonhouse which part
Herman Fassett
@HermanFassett
Mar 18 2017 03:45
Lolz, screenshots of browser lie very easily
Just inspect element and anyone says anything
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:46
@HermanFassett When I didnt edit it :p
nsonhouse
@nsonhouse
Mar 18 2017 03:46
@Manish-Giri var items = ["ruby", "sapphire", "topaz", "emerald"];
function randomizeAndSelect(items) {
for(var i = 0; i < items.length; i++) {
//generate random number
var rNum = Math.floor(Math.random() * ((12-1)+1) + 1);
console.log("rNum: " , rNum);
//assign it to selector's innerHTML
document.getElementById(items[i]).innerHTML = items[i];
I do not see the assignment to the DOM element, nor o I see how to add the eventListener
Manish Giri
@Manish-Giri
Mar 18 2017 03:51
@nsonhouse hold on
Saboor Malik
@MathematicsCoding
Mar 18 2017 03:56
Finally
I figured it out

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

  if (val > 5) {
    result = "Bigger than 5";
  }
 else {
  return "5 or Smaller";
}

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

// Change this value to test
testElse(5);
That is what I did now...
Adam
@GoingAllTheWayUp
Mar 18 2017 03:59
return "5 or Smaller"; to be result = "5 or Smaller";
paradox289
@paradox289
Mar 18 2017 04:00
Im having some serious problems with this challenge
"FirstLine
\SecondLine\
ThirdLine"
Saboor Malik
@MathematicsCoding
Mar 18 2017 04:00
Yeah I get it what you were trying to saying...
paradox289
@paradox289
Mar 18 2017 04:00
I cant figure out how to do that with escapes
escape sequences
Saboor Malik
@MathematicsCoding
Mar 18 2017 04:00
"FirstLine"
.......\
"......."
heroiczero
@heroiczero
Mar 18 2017 04:01
@paradox289 need to use \n and \r and \ to make it look like it
paradox289
@paradox289
Mar 18 2017 04:01
do I have spaces after my backslash?
Adam
@GoingAllTheWayUp
Mar 18 2017 04:01
@paradox289 gets messy just becareful
heroiczero
@heroiczero
Mar 18 2017 04:01
@paradox289 no spaces
Saboor Malik
@MathematicsCoding
Mar 18 2017 04:01
Doesn't matter
paradox289
@paradox289
Mar 18 2017 04:01
okay ill give it a shot, thanks
what is a "carriage return">
Adam
@GoingAllTheWayUp
Mar 18 2017 04:03
Yeah, its just a diffrent kind of return the computer can read
Arthur Miguel
@LShybrid1980
Mar 18 2017 04:03

Im doing the "Using Objects for Lookup" challenge and I do not what to do. I have this code so far and its not working at all...
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");

paradox289
@paradox289
Mar 18 2017 04:03
Sorry for asking so many questions :@
Adam
@GoingAllTheWayUp
Mar 18 2017 04:03
google bro
your cool
heroiczero
@heroiczero
Mar 18 2017 04:04
@LShybrid1980 you have to set the result variable to an obj[val]
Saboor Malik
@MathematicsCoding
Mar 18 2017 04:04
Practice typing...
Chisky Chen
@chiskychen
Mar 18 2017 04:04
Hi, does someone know in class "Check for Palindromes", how to detect "\ " not a space in a string?
Arthur Miguel
@LShybrid1980
Mar 18 2017 04:04
@heroiczero Ill try that... thanks
CamperBot
@camperbot
Mar 18 2017 04:04
lshybrid1980 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 994 | @heroiczero |http://www.freecodecamp.com/heroiczero
Adam
@GoingAllTheWayUp
Mar 18 2017 04:04
my minds too fast for the physics of my mortal fingers, you should be able to undertand me\
Im transmitting
Manish Giri
@Manish-Giri
Mar 18 2017 04:05
@nsonhouse here
heroiczero
@heroiczero
Mar 18 2017 04:06
@chiskychen https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Special_characters_meaning_in_regular_expressions check this out. some of the special characters will tell you how to find only non-alphanumeric characters
Saboor Malik
@MathematicsCoding
Mar 18 2017 04:06
@GoingAllTheWayUp Yeah you just type too fast to get some spells incorrectly... but at least type a bit slower
Nadia
@nadiaschutz
Mar 18 2017 04:06
``` 

//WHY THIS DOES IT SAY ILLEGAL RETURN STATMENT?

// Without exception, there is a flat markup on all jobs of 5%
//
For each person that needs to work on the job, there is a markup of 1.2%
//The flat markup is calculated first and then all other markups are calculated on top of the base price plus flat markup.
var varInput = prompt("Please enter data", "$1,299.99, 3 people, food");

var varInput=varInput.replace(',','').replace(/[#$]\@]/,'').split(',');

var basePrice=parseFloat(varInput[0]);
var people = parseFloat(varInput1);
var markup = varInput2;

var flatMarkup=basePrice0.05;
var peopleMarkup=people
0.012*(basePrice+flatMarkup);

//Markups are also added depending on the types of materials involved:

// If pharmaceuticals are involved, there is an immediate 7.5% markup
//
For food, there is a 13% markup
// Electronics require a 2% markup
//
Everything else, there is no markup

/*Example 1:

Input:  $1,299.99, 3 people, food
Output: $1,591.58

Example 2:

Input:  $5,432.00, 1 person, drugs
Output: $6,199.81

Example 3:

Input:  $12,456.95, 4 people, books
Output: $13,707.63*/

if (markup=="drugs"){
outputMarkup=(basePrice+flatMarkup)0.075+peopleMarkup+flatMarkup+basePrice;
} else if (markup=="food"){
outputMarkup=(basePrice+flatMarkup)
0.13+peopleMarkup+flatMarkup+basePrice;
} else if(markup=="electronics"){
outputMarkup=(basePrice+flatMarkup)*0.02+peopleMarkup+flatMarkup+basePrice;
} else {
outputMarkup=peopleMarkup+flatMarkup+basePrice;
}
return outputMarkup;
```

Chisky Chen
@chiskychen
Mar 18 2017 04:07
@heroiczero OK I'll see that, thank you!
CamperBot
@camperbot
Mar 18 2017 04:07
chiskychen sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 995 | @heroiczero |http://www.freecodecamp.com/heroiczero
Nadia
@nadiaschutz
Mar 18 2017 04:07

//WHY THIS DOES IT SAY ILLEGAL RETURN STATMENT?

//* Without exception, there is a flat markup on all jobs of 5%
//* For each person that needs to work on the job, there is a markup of 1.2%
//The flat markup is calculated first and then all other markups are calculated on top of the base price plus flat markup.
var varInput = prompt("Please enter data", "$1,299.99, 3 people, food");

var varInput=varInput.replace(',','').replace(/[#$\]\\@]/,'').split(',');


var basePrice=parseFloat(varInput[0]);
var people = parseFloat(varInput[1]);
var markup = varInput[2];

var flatMarkup=basePrice*0.05;
var peopleMarkup=people*0.012*(basePrice+flatMarkup);

 //Markups are also added depending on the types of materials involved:

//* If pharmaceuticals are involved, there is an immediate 7.5% markup
//* For food, there is a 13% markup
//* Electronics require a 2% markup
//* Everything else, there is no markup 
  /*Example 1:
----------
    Input:  $1,299.99, 3 people, food
    Output: $1,591.58

Example 2:
----------
    Input:  $5,432.00, 1 person, drugs
    Output: $6,199.81

Example 3:
----------
    Input:  $12,456.95, 4 people, books
    Output: $13,707.63*/
  if (markup=="drugs"){
      outputMarkup=(basePrice+flatMarkup)*0.075+peopleMarkup+flatMarkup+basePrice;
  }  else if (markup=="food"){
      outputMarkup=(basePrice+flatMarkup)*0.13+peopleMarkup+flatMarkup+basePrice;
  } else if(markup=="electronics"){
      outputMarkup=(basePrice+flatMarkup)*0.02+peopleMarkup+flatMarkup+basePrice;
  } else {
     outputMarkup=peopleMarkup+flatMarkup+basePrice;
  }
     return outputMarkup;
Adam
@GoingAllTheWayUp
Mar 18 2017 04:08
its all willy nilly\
out there in the open no home
its no where
return outputMarkup;
Nadia
@nadiaschutz
Mar 18 2017 04:09
@GoingAllTheWayUp ??
nsonhouse
@nsonhouse
Mar 18 2017 04:09
@Manish-Giri TY. I'm going to try this right now.
CamperBot
@camperbot
Mar 18 2017 04:09
nsonhouse sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4801 | @manish-giri |http://www.freecodecamp.com/manish-giri
Adam
@GoingAllTheWayUp
Mar 18 2017 04:10
function (checkdurgs) {
if (markup=="drugs"){
      outputMarkup=(basePrice+flatMarkup)*0.075+peopleMarkup+flatMarkup+basePrice;
  }  else if (markup=="food"){
      outputMarkup=(basePrice+flatMarkup)*0.13+peopleMarkup+flatMarkup+basePrice;
  } else if(markup=="electronics"){
      outputMarkup=(basePrice+flatMarkup)*0.02+peopleMarkup+flatMarkup+basePrice;
  } else {
     outputMarkup=peopleMarkup+flatMarkup+basePrice;
  }
     return outputMarkup;
}
put it in a function
Nadia
@nadiaschutz
Mar 18 2017 04:10
@GoingAllTheWayUp what's wrong with that?
@GoingAllTheWayUp oh..ok
Nadia
@nadiaschutz
Mar 18 2017 04:25
@GoingAllTheWayUp still not working
paradox289
@paradox289
Mar 18 2017 04:27
var myStr = "This is the start." + " This is the end.";
any reason why this only worked with a space after the first double comma on " This is the end"
nvm I figured it out
because spaces aren't automatically added...right?
Vikram
@vikramnr
Mar 18 2017 04:30
Hi All.. I have a doubt in Golf Code task. Is the given values is for strokes??
Nick DiMoro
@ekleinem
Mar 18 2017 04:31
i need a tutorial/resource to guide me through setting up a full stack JS/node web dev environment..anyone got anything?
im following this class but it uses cloud9 and i want to do it the right way the first time
Manish Giri
@Manish-Giri
Mar 18 2017 04:32
@vikramnr yeah
Nadia
@nadiaschutz
Mar 18 2017 04:32
@ekleinem check lynda.com
Vikram
@vikramnr
Mar 18 2017 04:33
I have compared values like this 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";
}
Nick DiMoro
@ekleinem
Mar 18 2017 04:33
i don't have an account:'(
Vikram
@vikramnr
Mar 18 2017 04:33
@Manish-Giri Is this right
Nick DiMoro
@ekleinem
Mar 18 2017 04:34
ooh i do have a pluralsight account though i bet there is something there thanks for jogging my memory :panda_face:
Manish Giri
@Manish-Giri
Mar 18 2017 04:34
@vikramnr yeah
Vikram
@vikramnr
Mar 18 2017 04:35
@Manish-Giri But the challenge is not passing
@Manish-Giri It is failing for 1st and last contd., ??
Manish Giri
@Manish-Giri
Mar 18 2017 04:37
@vikramnr post your challenge URL here, click "run tests" first
jacob
@bjh2012
Mar 18 2017 04:38
var myObj = {
gift:"pony",
pet:"kitten",
bed:"sleigh", };
function checkObj(checkProp){
return myObj[checkProp];}
The instruction say, "Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found"." But i'm not sure where hasOwnProperty() fits into this. Any suggestions?
Manish Giri
@Manish-Giri
Mar 18 2017 04:40
@vikramnr "Hole-in-one";
missing ! at the end
check the rest too
Vikram
@vikramnr
Mar 18 2017 04:41
@Manish-Giri :smile: :smile: Thanks
CamperBot
@camperbot
Mar 18 2017 04:41
vikramnr sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4802 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Mar 18 2017 04:44
:+1:
jacob
@bjh2012
Mar 18 2017 04:48
do I need an else/if statement? and how would I apply hasOwnProperty() to it?
Jeremy
@JeremyAntonoff
Mar 18 2017 04:50
can someone help me with this
function destroyer(arr) {
  // Remove all the values
  var argArray = [];
  var final = [];
  for (x = 1; x < arguments.length; x++) {
    argArray.push(arguments[x]);   
  }
  final = argArray.map(function(x) {
    return arr.filter(argArray[x]);


  });







}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Malik Dixon
@mdixon47
Mar 18 2017 04:59
Hello Everyone. I have a question. how can you can get users to see the existing images from folder images to the images list
Nadia
@nadiaschutz
Mar 18 2017 05:05
@GoingAllTheWayUp i think the main issue with passing global var to the function
Benjamin Pitts
@Darkweld
Mar 18 2017 05:08
Hello all, I managed to finish the "No Repeats Please" but when I try to use a callback in the final function it causes a browser crash. If I manually enter a number for the function to compare to it is fine. I used another website to test the code and it works fine there.
Oh nevermind, it just takes like two minutes to calculate. Never tried waiting that long before. Why does it take so long sometimes?
Emmanuel Pierre
@epierr14
Mar 18 2017 05:12

function palindrome(str) {
  // Good luck!
  var p = '';
   p = str.replace(/[\W_]/g, '');
  p = p.toLowerCase();
  var array = [];
  array = p.split('');
  array = array.reverse();
  p = array.join('');

  if (p!== str){
    return false;
  }  else {
  return true ;}
}



palindrome("eye");
help please
Joseph
@revisualize
Mar 18 2017 05:15
@epierr14 You should be doing the replace and lowercase to both sides of the comparison.
Benjamin Pitts
@Darkweld
Mar 18 2017 05:15
@JToddFL I have been using my filters like this: return argarray.indexOf(x) === -1; to filter out a specific array. In this case this would filter out any value found in argarray.
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:16
@bjh2012 if(Object.hasOwnProperty(property))
@JToddFL where's your callback for filter method ?
dn92
@dn92
Mar 18 2017 05:20
blob
Jeremy
@JeremyAntonoff
Mar 18 2017 05:20
Hey guy ssorry for delay
I got it
figured out i needed to compare it to -1
dn92
@dn92
Mar 18 2017 05:20
guys, am i going crazy here?
no matter where i put the code it says it's wrong
Jeremy
@JeremyAntonoff
Mar 18 2017 05:20
@darkweld thanks
CamperBot
@camperbot
Mar 18 2017 05:20
jtoddfl sends brownie points to @darkweld :sparkles: :thumbsup: :sparkles:
:cookie: 296 | @darkweld |http://www.freecodecamp.com/darkweld
Joseph
@revisualize
Mar 18 2017 05:20
@dn92 remove the var
dn92
@dn92
Mar 18 2017 05:20
ahhhh
thank you
Joseph
@revisualize
Mar 18 2017 05:20
@dn92 Have your variables already been declared?
dn92
@dn92
Mar 18 2017 05:21
i believe so, one sec
Joseph
@revisualize
Mar 18 2017 05:21
@dn92 If they have.. You don't need to declare them again. You just need to assign or re-assign the value.
dn92
@dn92
Mar 18 2017 05:22
no they have not been declared, the screenshot is the entire source code
Joseph
@revisualize
Mar 18 2017 05:23
@dn92 THen you deleted some important stuff
dn92
@dn92
Mar 18 2017 05:23
ahhh
redo!
Jeremy
@JeremyAntonoff
Mar 18 2017 05:24
im so close on this one
Joseph
@revisualize
Mar 18 2017 05:24
@dn92 I kind of feel bad for just now noticing that actually was lines 1 through 7 in your screenshot.
Jeremy
@JeremyAntonoff
Mar 18 2017 05:24


function getIndexToIns(arr, num) {
  // Find my place in this sorted array
  var args = [];
  var final = 0
  for (x = 1; x < arguments.length; x++) {
    args.push(arguments[x]);
  }
  var sortedArray = arr.sort(function(a, b) {
    return a -b ;
  });
  for (x = 0; x < sortedArray.length; x++) {
    if (sortedArray[x] > args) {
      final = sortedArray[x];



    }

  }


}

getIndexToIns([40, 60], 50);
Joseph
@revisualize
Mar 18 2017 05:24
@JToddFL YOU CAN DO IT!.
Jeremy
@JeremyAntonoff
Mar 18 2017 05:24
when i do final = sortedArray.indexOf(x) i get -1
but its returning 60 with just the sortedArray[x]
i dont get it
dn92
@dn92
Mar 18 2017 05:25
just starting out sir :)
Joseph
@revisualize
Mar 18 2017 05:25
@dn92 I should have seen it.
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:28
@JToddFL because sortedArray is referencing an array that doesn't contain the second argument 50
Jeremy
@JeremyAntonoff
Mar 18 2017 05:29
yes but i want that
im comparing it to 50
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:29
@JToddFL by doing this ? (sortedArray[x] > args)
@JToddFL you're just comparing the elements sortedArrayis referencing to args array, not the element
Jeremy
@JeremyAntonoff
Mar 18 2017 05:31
im comparing it to 50
so is 40 > 50
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:32
@JToddFL args is an array not 50...you can do args[0] if you want to compare it to 50
Jeremy
@JeremyAntonoff
Mar 18 2017 05:33
args will return 50
....
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:34
@JToddFL seriously? console.log(args) from your code
Jeremy
@JeremyAntonoff
Mar 18 2017 05:35
i just tested
49 > args which returned false
51 > args returned true
when i return args its [50]
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:36
@JToddFL so are you comparing 50 or [50], by using args?
Gulsvi
@gulsvi
Mar 18 2017 05:36
@JToddFL x is equal to 0, 1, 2 up to the length of the array, you're using that for your iterator in the for loop
Whoa chat updated.... sorry will read up
Jeremy
@JeremyAntonoff
Mar 18 2017 05:37
@Lumexralph if my code is returning those values it should still work for what im trying to do
Gulsvi
@gulsvi
Mar 18 2017 05:38
Yeah, so sortedArray.indexOf(x) is close, but not quite right...
Emmanuel Pierre
@epierr14
Mar 18 2017 05:38

function palindrome(str) {
  // Good luck!
  var oneWord = /[\W_]/g;
  var outComeWord = '';
    str = str.replace(oneWord, outComeWord).toLowerCase(); 
  outComeWord = str.split(outComeWord).reverse().join(outComeWord);
  return str !== outComeWord;
}



palindrome("eye");
silver537
@silver537
Mar 18 2017 05:38
it is i
the great asher
hoorah
Emmanuel Pierre
@epierr14
Mar 18 2017 05:42
I see, I should change the comparaison to the inverse form by removing the not... man, I was confusing for a moment
Joseph
@revisualize
Mar 18 2017 05:42
@epierr14 Shouldn't it be === instead of !== ?
Emmanuel Pierre
@epierr14
Mar 18 2017 05:42
Thanks @revisualize
CamperBot
@camperbot
Mar 18 2017 05:42
epierr14 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3544 | @revisualize |http://www.freecodecamp.com/revisualize
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:44
@JToddFL it works because [50] is coerced to a number which returns that element 50.... that doesn't mean you're compairing it to 50...... console.log(50 === [ 50 ])
Jeremy
@JeremyAntonoff
Mar 18 2017 05:44
but if i know its converting it to a number then isn't it tech still correct
silver537
@silver537
Mar 18 2017 05:46
why are you even using arguments?
Jeremy
@JeremyAntonoff
Mar 18 2017 05:48
would concat the two arrays be better
then just sort and find index of
ugh
thats so much easier
thanks i got it
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:50
@JToddFL yeah..... that'll make life easy for you
Jeremy
@JeremyAntonoff
Mar 18 2017 05:50
lol it really did
@Lumexralph thank you
CamperBot
@camperbot
Mar 18 2017 05:50
jtoddfl sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1331 | @lumexralph |http://www.freecodecamp.com/lumexralph
silver537
@silver537
Mar 18 2017 05:50
show your updated code
Jeremy
@JeremyAntonoff
Mar 18 2017 05:52


function getIndexToIns(arr, num) {
  // Find my place in this sorted array
  var args = [];
  for (x = 1; x < arguments.length; x++) {
    args.push(arguments[x]);
  }
  var final = []
  final =args.concat(arr);
  var sortedArray = final.sort(function(a, b) {
    return a -b ;
  });




  return sortedArray.indexOf(num);



}

getIndexToIns([2, 5, 10], 15)
Bina
@binakhalid
Mar 18 2017 05:54
answer = "Marley";
  break;
  case 2:
  switch (val === 42) {
   case 2: 
answer = "The Answer";
      break;
    case 3:

switch (val === 1) {
case 4:
answer = "There is no #1";

switch (val === 99) {
case 5:
answer = "Missed me by this much!";
break;
case 6:
switch (val === 7) {
case 7:
answer = "Ate Nine";
break;
}

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

Replacing If Else Chains with Switch
If you have many options to choose from, a switch statement can be easier to write than many chained if/else if statements. The following:
can some one help me?
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:55
@binakhalid do you know how a switch statement is constructed?
@binakhalid here's a link, to give you more understanding of switch https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
AlanMcDowell888
@AlanMcDowell888
Mar 18 2017 05:56
For Return Early Pattern for Functions.. why can't a simple if else work?
Ogundele Olumide
@Lumexralph
Mar 18 2017 05:57
@AlanMcDowell888 depends on what you're to do
AlanMcDowell888
@AlanMcDowell888
Mar 18 2017 05:58

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

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

Ogundele Olumide
@Lumexralph
Mar 18 2017 05:58
@AlanMcDowell888 what do you think is going on here? if(a||b < 0)
Gulsvi
@gulsvi
Mar 18 2017 05:58
@JToddFL :sparkles: :+1: :sparkles:
AlanMcDowell888
@AlanMcDowell888
Mar 18 2017 05:59
It's saying if either a or b are less than zero, return undefined @Lumexralph
@Lumexralph
whoops, I now see that Lumexralph is Ogundele Olumide.. sorry for the repeat
Ogundele Olumide
@Lumexralph
Mar 18 2017 06:01
@AlanMcDowell888 b < 0 is evaluated to a boolean then you have a || true.... which will true for all conditions because a is a number and if a is 0 the boolean will be used and depending on whether it's true or false
Jor
@joreyesl
Mar 18 2017 06:01
@AlanMcDowell888 In normal language that makes sense to speak it that way, but when programming you have to say instead, if a is less than zero or b is less than zero.
Ogundele Olumide
@Lumexralph
Mar 18 2017 06:01
@AlanMcDowell888 what you should do is a < 0 || b < 0
Joseph
@revisualize
Mar 18 2017 06:02

@AlanMcDowell888 How to write an if conditional statements with OR and AND operators:
I am seeing a large number of people writing if conditions using OR and AND operators incorrectly.
Here is an example of what I'm seeing:

if (param1 == "a" || "c" || "e") { // incorrect
   var output = "Odd lowercase alpha character"; 
}

What I think people think is that it will compare param1 to "a" then compare param1 to "c" then compare param1 to "e"
However, that's not actually what the computer is processing.

if conditions need to be evaluated to true for the if statement to run:

if ((condition1) || (condition2) || (condition3) {
    // true statement
}

And how we would code that up from our example above where we're trying to get the odd character from a parameter (param1):

if (param1 == "a" || param1 == "c" || param1 == "e") {
   var output = "Odd lowercase alpha character"; 
}

I'm also seeing people writing and statements like this:

if (param1 == "a" && param1 == "e") {
}

The problem with this is the fact that a variable can't really be two strings or two different numbers at the same time.

AlanMcDowell888
@AlanMcDowell888
Mar 18 2017 06:03
thanks @joreyesl
CamperBot
@camperbot
Mar 18 2017 06:03
alanmcdowell888 sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 615 | @joreyesl |http://www.freecodecamp.com/joreyesl
AlanMcDowell888
@AlanMcDowell888
Mar 18 2017 06:03
thanks @Lumexralph
CamperBot
@camperbot
Mar 18 2017 06:03
alanmcdowell888 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1332 | @lumexralph |http://www.freecodecamp.com/lumexralph
AlanMcDowell888
@AlanMcDowell888
Mar 18 2017 06:03
thanks @revisualize
CamperBot
@camperbot
Mar 18 2017 06:03
alanmcdowell888 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3545 | @revisualize |http://www.freecodecamp.com/revisualize
Markus Kiili
@Masd925
Mar 18 2017 06:07
@Lumexralph @revisualize Good morning.
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:07
can anyone help me with this one?
Joseph
@revisualize
Mar 18 2017 06:07
Good Morning.
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:08

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

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

// Change these values to test your function
lookUpProfile("Akira", "likes");
When i look at my code i cant seem to figure out why its not working.

Manish Giri
@Manish-Giri
Mar 18 2017 06:09
@OtakuDrew you're complicating things, somewhat.
Markus Kiili
@Masd925
Mar 18 2017 06:09
@OtakuDrew You are not checking for the correct first name.
Manish Giri
@Manish-Giri
Mar 18 2017 06:10
else {
if (i == 3) {
return "No such contact";
}
else {
i++;
}
}
this bit.
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:10
@Manish-Giri but that part works
@Masd925 i thought it was since im checking if it has the firstName as a property name
Manish Giri
@Manish-Giri
Mar 18 2017 06:11
@OtakuDrew right, I didn't say it's wrong. It's just that you can get away with just one line, instead of all that, if you think it over..
Markus Kiili
@Masd925
Mar 18 2017 06:11
@OtakuDrew You need to compare the firstName property value with the firstName parameter with ===
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:13
like this? contacts[i].firstName === firstName
@Masd925
Markus Kiili
@Masd925
Mar 18 2017 06:13
@OtakuDrew Yes.
Jor
@joreyesl
Mar 18 2017 06:14
@OtakuDrew
  1. You are checking if contacts[i] has a firstName property, which they all should. Instead you should be checking it matches the firstName parameter value.
  2. prop is a variable. when returning the property using prop, you should be using bracket notation.
  3. Why checking i == 3 to return No such contact? It should be returned only once you've checked all contacts and none matched. i.e. after the loop.
Manish Giri
@Manish-Giri
Mar 18 2017 06:15

@OtakuDrew

Why checking i == 3 to return No such contact? It should be returned only once you've checked all contacts and none matched. i.e. after the loop.

This is what I meant here-

It's just that you can get away with just one line, instead of all that, if you think it over..

Markus Kiili
@Masd925
Mar 18 2017 06:15
@OtakuDrew Using 3 is hardcoding the number of contacts.
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:16
@Masd925 i know im supposed to use contacts.length but i feel like i dont have to worry anything will go wrong there if i hardcode itr
Markus Kiili
@Masd925
Mar 18 2017 06:17
@OtakuDrew The function needs to work on any contact list.
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:18
@Masd925 ok ill change it back once it works on my current list
guptanikita09
@guptanikita09
Mar 18 2017 06:22
bouncer([false, null, 0, NaN, undefined, ""])
error: cannot read property length of null
challenge: falsy bouncer
Arthur Miguel
@LShybrid1980
Mar 18 2017 06:24
how do I add another element to an array? Here's what I have and its not working for me...
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}
// Add record here
{
"artist": "Nirvana",
"title": "Smells Like Teen Spirit",
"release_year": 1995,
"formats": [ "CD", "Cassette", "LP" ],
"gold": true
}
];
Markus Kiili
@Masd925
Mar 18 2017 06:24
@guptanikita09 Post the code you have.
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:24
@Masd925 oh... contacts .length doesnt work
Markus Kiili
@Masd925
Mar 18 2017 06:24
@OtakuDrew It works if used properly.
Joseph
@revisualize
Mar 18 2017 06:26
@LShybrid1980 You're missing a , between your array elements.
@LShybrid1980 It should be something like this [ { ... } , { ... } ] But, the ... is actually your information.
Arthur Miguel
@LShybrid1980
Mar 18 2017 06:27
@revisualize Let me try that... Thanks.
CamperBot
@camperbot
Mar 18 2017 06:27
lshybrid1980 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3546 | @revisualize |http://www.freecodecamp.com/revisualize
Shvetal
@verv0eren
Mar 18 2017 06:31
hi everybody!
so i am running this date.getMonth() on console and it's returning me 2 instead of 3 ! why is that??
Markus Kiili
@Masd925
Mar 18 2017 06:33
@verv0eren Integer value representing the month, beginning with 0 for January to 11 for December
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:34
@Masd925 just a quick question am i on the right direction with the rest of my code?
Markus Kiili
@Masd925
Mar 18 2017 06:36
@OtakuDrew Simpler is if you just return No such contact after the loop. Also .prop is not correct.
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 06:37
@Masd925 :wave:
Markus Kiili
@Masd925
Mar 18 2017 06:37
@HeebieGeeBee Hi.
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:38
@Masd925 i changed both of the .prop to [prop] and it still wasnt working , is that wrong syntax?
Markus Kiili
@Masd925
Mar 18 2017 06:39
@OtakuDrew My crystal ball is not working. You have to post the code.
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 06:41
@verv0eren you remember how computer languages like 0 based indexing?
Emmanuel Pierre
@epierr14
Mar 18 2017 06:41


function titleCase(str) {
  var array = [];
  str = str.toLowerCase();
  array = str.split(' ');
  for (var i; i < array.length; i++){
    array[i] = array[i].charAt(0).toUpperCase() + array[i].substring(1);
  }
  str = array.join(' ');
  return str;
}

titleCase("I'm a little tea pot");
help please
Shvetal
@verv0eren
Mar 18 2017 06:42
@HeebieGeeBee yes I got it! thanx
CamperBot
@camperbot
Mar 18 2017 06:42
verv0eren sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1084 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Markus Kiili
@Masd925
Mar 18 2017 06:42
@epierr14 array[i] = array[i].charAt...
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:42

@Masd925 lol sorry here you go function lookUpProfile(firstName, prop){
// Only change code below this line
var i = 0;
while (i < contacts.length) {
if (contacts[i].firstName === firstName) {
if (contacts[i][prop] === prop) {
return contacts[i][prop];
}
else {
return "No such property";
}
}
else {

        i++;

}
return "No such contact";

}
// Only change code above this line
}

Markus Kiili
@Masd925
Mar 18 2017 06:43
@OtakuDrew Second check need to be a property existence check with hasOwnProperty() or propertyIsEnumerable()
Shvetal
@verv0eren
Mar 18 2017 06:45
@Masd925 Thanx!
CamperBot
@camperbot
Mar 18 2017 06:45
verv0eren sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3611 | @masd925 |http://www.freecodecamp.com/masd925
Drew Alcazar
@OtakuDrew
Mar 18 2017 06:54
@Masd925 i changed it to a hasOwnProperty() but its still not working, when i try calling the function with a name other than the first one ("Akira") it says "No such contact
@Masd925 Doesnt that mean that my loop isnt working either?
Markus Kiili
@Masd925
Mar 18 2017 06:55
@OtakuDrew Check whether the looped contact has the property key stored in prop.
Joseph
@revisualize
Mar 18 2017 06:56
@HeebieGeeBee https://www.amazon.com/gp/product/B001M4HXB2/ my future selfie stick.
Jeremy
@JeremyAntonoff
Mar 18 2017 06:57
can someone help me
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 06:57
@revisualize looks more like a tripod
Joseph
@revisualize
Mar 18 2017 06:57
@JToddFL With?
Jeremy
@JeremyAntonoff
Mar 18 2017 06:57
function rot13(str) { // LBH QVQ VG!
  var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '

  var finalString = []
  var finalArray = [];
  for (x = 0; x < str.length; x++) {
    finalString.push(str.charCodeAt(x));


  }
  for (x = 0; x < finalString.length; x++) {
    if (finalString[x] === 32) {
        finalString[x] = 32;
        }
   else if (finalString[x] > 78) {
      finalString[x]-=13;
    }
    else if (finalString[x] < 78) {
      finalString[x]+= 13;
    }
  }
var final = finalString.join( " ")


  return final
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Joseph
@revisualize
Mar 18 2017 06:57
@HeebieGeeBee It's actually a light stand that can be used like a tripod.
HeebieGeeBee
@HeebieGeeBee
Mar 18 2017 06:57
@revisualize cool
Jeremy
@JeremyAntonoff
Mar 18 2017 06:58
i have all the unicode that i want to switch back i just cant get fromCharCode to work
i deleted all that i had wiht that