These are chat archives for FreeCodeCamp/HelpJavaScript

4th
Jan 2017
Simon Cordova
@gbsimon87
Jan 04 2017 00:00 UTC
@MikeJSchorah I sent about three a day maybe, but with cover letters and stuff, and whenever I ot a response I made sure to learn that company a bit
Brownie points in the interview
Mike
@MikeJSchorah
Jan 04 2017 00:00 UTC
@gbsimon87 Wow, but you sent out 1,000? So it took a whole year?
Simon Cordova
@gbsimon87
Jan 04 2017 00:01 UTC
Not literally a thousand
But honestly a lot...I just went all over linkedin
Mike
@MikeJSchorah
Jan 04 2017 00:01 UTC
Oh ok. Couple months
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 00:01 UTC
@gbsimon87 were they all local? where do you live?
Simon Cordova
@gbsimon87
Jan 04 2017 00:01 UTC

Yeah, from when I started sending them out it tookd 2.5 - 3 months

London, all local yeah

HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 00:02 UTC
oh ok london
Simon Cordova
@gbsimon87
Jan 04 2017 00:02 UTC
To be perfectly honest I've learned quite a bit this past month at work, but I learn more here in FCC on a day to day basis
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 00:02 UTC
yeah london sho0uld always have lots
Simon Cordova
@gbsimon87
Jan 04 2017 00:02 UTC
Yeah, it's a mecca for them
Mike
@MikeJSchorah
Jan 04 2017 00:02 UTC
@gbsimon87 Wow really? So, the job is nowhere near as difficult as FCC?
I started struggling since the algorithms. I completed everything before that in less than 2-3 days.
Simon Cordova
@gbsimon87
Jan 04 2017 00:03 UTC
It can be challenging for sure, and it will also depend on your job details, but my job mainly requires using jQuery for DOM manipulations...
Traversing the DOM and stuff
But it gets complicated when you're looking at 2000 lines of code lol
I'm hoping one day I can get to the same level as some of the pros here on FCC
Kevin White
@Knowledge0417
Jan 04 2017 00:06 UTC
need a little help on challenge 131
It asks that I change myVar = myVar + 1 so that I use the ++ operator
Simon Cordova
@gbsimon87
Jan 04 2017 00:07 UTC
@Knowledge0417 what's the challenge's name?
Kevin White
@Knowledge0417
Jan 04 2017 00:07 UTC
I input this, myVar = ++myVar and everything is checked but "myVar = myVar should be changed
Increment a Number with JavaScript
Dogemon
@Dogemon
Jan 04 2017 00:07 UTC
Why won't my trueOrFalse(true/false) give me a result?
Bozhidar Stoyanov Kabzamalov
@BozhidarKabzamalov
Jan 04 2017 00:08 UTC
function factorialize(num) {
  if (num === 0) {
    return 1;
  } else {
    for (var i = 1; i <= num; i++) {
      num = num * i;
    }
  }
  return num;
}
factorialize(5);
Dogemon
@Dogemon
Jan 04 2017 00:08 UTC
or a string
Bozhidar Stoyanov Kabzamalov
@BozhidarKabzamalov
Jan 04 2017 00:08 UTC
can someone tell me why it doesn't work?
Jason Luboff
@JLuboff
Jan 04 2017 00:09 UTC
@BozhidarKabzamalov Becuase you can't alter num. You should instead create a new variable and manipulate that
@Dogemon whats your code?
Dogemon
@Dogemon
Jan 04 2017 00:09 UTC

// javascript

// Example
function ourTrueOrFalse(isItTrue) {
if (isItTrue) {
return "Yes, it's true";
}
return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {

// Only change code below this line.
function trueOrFalse(wasThatTrue) {
if (wasThatTrue) {
return "Yes, that was true";
}
return "No, that was false";
}

// Only change code above this line.

}

// Change this value to test
trueOrFalse(false);
//

ignore the //javascript and the // at the end
Kevin White
@Knowledge0417
Jan 04 2017 00:11 UTC
@gbsimon87 I figured it out
Jason Luboff
@JLuboff
Jan 04 2017 00:11 UTC
@Dogemon Becuase you have the line function trueOrFalse(wasThatTrue){ twice
Simon Cordova
@gbsimon87
Jan 04 2017 00:11 UTC
@Knowledge0417 sounds good :)
Kevin White
@Knowledge0417
Jan 04 2017 00:11 UTC
@gbsimon87 thanks
CamperBot
@camperbot
Jan 04 2017 00:11 UTC
:cookie: 378 | @gbsimon87 |http://www.freecodecamp.com/gbsimon87
knowledge0417 sends brownie points to @gbsimon87 :sparkles: :thumbsup: :sparkles:
Simon Cordova
@gbsimon87
Jan 04 2017 00:11 UTC
no worries :)
Dogemon
@Dogemon
Jan 04 2017 00:11 UTC
well one of them is the setup
@gbsimon87
CamperBot
@camperbot
Jan 04 2017 00:12 UTC
:bulb: to format code use backticks! ``` more info
Bozhidar Stoyanov Kabzamalov
@BozhidarKabzamalov
Jan 04 2017 00:12 UTC
function factorialize(num) {
  var factorialize = num;
  if (factorialize === 0) {
    return 1;
  } else {
    for (var i = 1; i <= factorialize; i++) {
      factorialize = factorialize * i;
    }
  }
  return factorialize;
}
factorialize(5);
Jason Luboff
@JLuboff
Jan 04 2017 00:13 UTC
@Dogemon Remove the second line. You incorrectly added a second function that is not needed
Bozhidar Stoyanov Kabzamalov
@BozhidarKabzamalov
Jan 04 2017 00:13 UTC
potential infinite loop at line 8, why's that?
Jason Luboff
@JLuboff
Jan 04 2017 00:13 UTC
@BozhidarKabzamalov Why not have factorialize = 1 and still have our loop be i<=num?
Stephen James
@sjames1958gm
Jan 04 2017 00:13 UTC
@BozhidarKabzamalov You are growing factorialize while trying to get to it.
Dogemon
@Dogemon
Jan 04 2017 00:13 UTC
// Example
function ourTrueOrFalse(isItTrue) {
  if (isItTrue) { 
    return "Yes, it's true";
  }
  return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {

  // Only change code below this line.
  function trueOrFalse(wasThatTrue) {
    if (wasThatTrue) {
      return "Yes, that was true";
    }
   return "No, that was false";
  }



  // Only change code above this line.

}

// Change this value to test
trueOrFalse(false);
CamperBot
@camperbot
Jan 04 2017 00:13 UTC
:bulb: to format code use backticks! ``` more info
Stephen James
@sjames1958gm
Jan 04 2017 00:14 UTC
@Dogemon Don't repeat the function definition.
@BozhidarKabzamalov Bad practice to have variables the same name as the function
Jason Luboff
@JLuboff
Jan 04 2017 00:14 UTC
@sjames1958gm I've told him that twice already :confused:
Bozhidar Stoyanov Kabzamalov
@BozhidarKabzamalov
Jan 04 2017 00:15 UTC
Oh, it worked, thanks @JLuboff @sjames1958gm
CamperBot
@camperbot
Jan 04 2017 00:15 UTC
bozhidarkabzamalov sends brownie points to @jluboff and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 559 | @jluboff |http://www.freecodecamp.com/jluboff
:star2: 5141 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Dogemon
@Dogemon
Jan 04 2017 00:16 UTC
@JLuboff @sjames1958gm That did nothing
Jason Luboff
@JLuboff
Jan 04 2017 00:16 UTC
@Dogemon Show your current code
Stephen James
@sjames1958gm
Jan 04 2017 00:17 UTC
@Dogemon did you remove the extra } as well?
Dogemon
@Dogemon
Jan 04 2017 00:19 UTC
// Example
function ourTrueOrFalse(isItTrue) {
  if (isItTrue) { 
    return "Yes, it's true";
  }
  return "No, it's false";
}

// Setup


  // Only change code below this line.
  function trueOrFalse(wasThatTrue) {
    if(wasThatTrue) {
      return "Yes, that was true";
    }
    return "No, that was false";
  }


  // Only change code above this line.

}

// Change this value to test
trueOrFalse(true);
Nvm
Lila Mohamed
@Lila-Mohamed
Jan 04 2017 00:19 UTC
Anyone know what's the answer to this var arr = ['a', 'b', 'c']; for(var i = arr.length - 1, > -1; i--) { console.log(arr[i]); }
Dogemon
@Dogemon
Jan 04 2017 00:20 UTC
I got it
Jason Luboff
@JLuboff
Jan 04 2017 00:20 UTC
@Dogemon You have an extra }
InSugyo
@Luich
Jan 04 2017 00:21 UTC
val1>val2 ? j++:i++;
(Expected an assignment or function call and instead saw an expression)
Is it wrong syntax?
mitron6
@mitron6
Jan 04 2017 00:22 UTC
@Lila-Mohamed var arr = ['a', 'b', 'c']; for(var i = arr.length - 1; i > -1; i--) { console.log(arr[i]); }
@Lila-Mohamed Use semicolon to separate parts of a for statements. Include i so >-1 becomes i > -1 in middle part of for statement.
Stephen James
@sjames1958gm
Jan 04 2017 00:24 UTC
@Dogemon You should acknowledge when people help you
Lila Mohamed
@Lila-Mohamed
Jan 04 2017 00:25 UTC
@mitron6 Thanks for clearing that up.
CamperBot
@camperbot
Jan 04 2017 00:25 UTC
:cookie: 426 | @mitron6 |http://www.freecodecamp.com/mitron6
lila-mohamed sends brownie points to @mitron6 :sparkles: :thumbsup: :sparkles:
Dylan Hsiao
@greedylan
Jan 04 2017 00:25 UTC
why is .replace() not doing its work??
function myReplace(str, before, after) {
  var newStr = str.replace(/before/g, after);
  return newStr;
}
myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Jason Luboff
@JLuboff
Jan 04 2017 00:27 UTC
@greedylan Try removing the / and the g
mitron6
@mitron6
Jan 04 2017 00:30 UTC
@greedylan Are you trying to replace the text 'before' or the contents of the function argument called before?
@greedylan Maybe you want var newStr = str.replace(before, after);
Kim Crayton
@kmcrayton7
Jan 04 2017 00:32 UTC
hello...I need some help with Stand In Line. I understand the concept of .push to add a number to the end of the arr and .unshift to remove the first element from the arr. I'm just confused by the instructions and what I'm expected to do.
mitron6
@mitron6
Jan 04 2017 00:32 UTC
@greedylan Also you don't really need newStr. You can just return str.replace(before, after);
Kim Crayton
@kmcrayton7
Jan 04 2017 00:35 UTC
function nextInLine(arr, item) {
  // Your code here

  return item;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Trenton Dragon
@DragonAce01
Jan 04 2017 00:35 UTC
i need help in escape sequences in strings
Jason Luboff
@JLuboff
Jan 04 2017 00:36 UTC
@kmcrayton7 Our number is the parameter item. Therefore, how can we use push to place our number (item) into our array?
mitron6
@mitron6
Jan 04 2017 00:37 UTC
@kmcrayton7 Hi kim. Does this console log help?
> var arr = [1,2]
undefined
> arr.push(3)
3
> arr
[1, 2, 3]
Trenton Dragon
@DragonAce01
Jan 04 2017 00:37 UTC
it keeps saying unexpected \ or it thought it was a function
Kim Crayton
@kmcrayton7
Jan 04 2017 00:38 UTC
@mitron6 Ok, this looks like what I was thinking but when I look at the code and where I'm supposed to edit I got lost
Instruction state to "write a function nextInLine" which has already been started
Joseph
@revisualize
Jan 04 2017 00:39 UTC
@kmcrayton7
// How do you add a number (item) to the end of an array (arr)? What does this method return?
// How do you remove the first element from an array (arr)? What does this method return?
@kmcrayton7 The base of the function has already been written for you.
mitron6
@mitron6
Jan 04 2017 00:40 UTC
@kmcrayton7 Right the skeleton of the function is already written. You just have to fill it in.
jv775
@jv775
Jan 04 2017 00:40 UTC

Can someone help please. I'm stuck in the following problem:

function convertToF(celsius) {
//only change code below this line

//only change code above this line
}

//change the inputs below to this line
convertToF(0)

Zak
@zaksanderford
Jan 04 2017 00:41 UTC
@jv775 What issues are you having with that problem?
Jason Luboff
@JLuboff
Jan 04 2017 00:41 UTC
@jv775 Why did you change the code above and below where it tells you not to?
Kim Crayton
@kmcrayton7
Jan 04 2017 00:41 UTC
@revisualize arr.push(#) arr.unshift(#)?
Zak
@zaksanderford
Jan 04 2017 00:42 UTC
@jv775 Also, reset your code below the second js //only change code above this line should be js return fahrenheit;
andercodder
@andercodder
Jan 04 2017 00:43 UTC
hello guys
Joseph
@revisualize
Jan 04 2017 00:43 UTC

@jv775 Some example code:

function addThree (num) {
    var result;
    result = num + 3;
    return result;
}

You can see how the parameter is used like a variable inside of the function.
And you can do mathmatical operations to the parameter and assign the value to the variable result

Kim Crayton
@kmcrayton7
Jan 04 2017 00:43 UTC
@revisualize
testArr.push(6);
testArr.unshift(0);
jv775
@jv775
Jan 04 2017 00:44 UTC
@zak, I have tried to solve the problem for the past hour and can't seem to get it.
@zak: I have written Fahrenheit = Celsius;
but it doesn't work
andercodder
@andercodder
Jan 04 2017 00:44 UTC
guys u good
jv775
@jv775
Jan 04 2017 00:45 UTC
on the assignments I have written:
Fahrenheit = 0*9/5+32;
Jason Luboff
@JLuboff
Jan 04 2017 00:45 UTC
@jv775 You need to remember that javascript is case-sensitive Celsius != celsius
jv775
@jv775
Jan 04 2017 00:45 UTC
fahreinheit = -30*9/5+32;
yes, fahrenheit = celsius
JLuboff
Zak
@zaksanderford
Jan 04 2017 00:46 UTC
@jv775 Instead of inputting numerical values, change the celsius temperature to a variable.
In the second example you provided replace -30 with a variable, specifically the one being passed in by the function (the bit in parentheses at the top of the code).
andercodder
@andercodder
Jan 04 2017 00:48 UTC
some one help me please
jv775
@jv775
Jan 04 2017 00:48 UTC
@zaksanderford ???
sorry, but I'm still new at this
Zak
@zaksanderford
Jan 04 2017 00:49 UTC
@jv775 An example of what your equation should look like var1 = (5 * var2) + 82
@jv775 var1 will be the variable you're trying to return and var2 will be the variable being operated on.
Camilo Silva Caviedes
@camilosilvac
Jan 04 2017 00:50 UTC
Hi!
jv775
@jv775
Jan 04 2017 00:51 UTC
@zaksanderford thanks, I am going to give it a try
CamperBot
@camperbot
Jan 04 2017 00:51 UTC
jv775 sends brownie points to @zaksanderford :sparkles: :thumbsup: :sparkles:
:cookie: 177 | @zaksanderford |http://www.freecodecamp.com/zaksanderford
jv775
@jv775
Jan 04 2017 00:52 UTC
To all in this room, thanks for your help guys, I really appreciate it
Zak
@zaksanderford
Jan 04 2017 00:52 UTC
@jv775, let me know what your outcome was.
Camilo Silva Caviedes
@camilosilvac
Jan 04 2017 00:53 UTC
can someone help me with the challange #145? please? :) it said that i have to use the "+" operator
i have this code

// Example
var myStr = "This is the start. " + "This is the end.";

// Only change code below this line

var myStr;

Stephen James
@sjames1958gm
Jan 04 2017 00:53 UTC
@greedylan toUpperCase is a function but you're are not calling it -
@camilosilvac Where is your code?
@camilosilvac Change the code below the comment that says only change below the comment
Camilo Silva Caviedes
@camilosilvac
Jan 04 2017 00:54 UTC
// Example
var myStr = "This is the start. " + "This is the end.";

// Only change code below this line

var myStr;
Christopher Richards
@way3edgyentertainment
Jan 04 2017 00:55 UTC
Same problem as @kmcrayton7
Camilo Silva Caviedes
@camilosilvac
Jan 04 2017 00:55 UTC
wow! i have to improve my english skills hahaha sorry! and thank you very much! @sjames1958gm
CamperBot
@camperbot
Jan 04 2017 00:55 UTC
camilosilvac sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5142 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jan 04 2017 00:57 UTC
@camilosilvac :+1:
Dylan Hsiao
@greedylan
Jan 04 2017 00:58 UTC
@sjames1958gm add the parenthesis but still not working
Christopher Richards
@way3edgyentertainment
Jan 04 2017 00:58 UTC
@kmcrayton7 Created a var for the removed item to return, then pushed in the item passed originally
Stephen James
@sjames1958gm
Jan 04 2017 00:59 UTC
@greedylan Failing all the tests? or only the upperCase one?
@way3edgyentertainment That is not correct - push the item then remove the first item @kmcrayton7
@greedylan Can you post first.
Kim Crayton
@kmcrayton7
Jan 04 2017 01:01 UTC
@greedylan but where does it go? The comments are not really helping me. I know if it's not exactly where they want it won't work
andercodder
@andercodder
Jan 04 2017 01:01 UTC
var myStr = "FirstLIne\n\SecondLine\ \rThirdLine"; // Change this line
Dylan Hsiao
@greedylan
Jan 04 2017 01:02 UTC
@sjames1958gm @kmcrayton7 @mitron6
function myReplace(str, before, after) {

  return str.replace(before, replaceIt);

  function replaceIt(){
    if(before[0] == before[0].toUpperCase()){
      return after[0].toUpperCase(); 
    }else if(before[0] == before.toLowerCase()){
      return after;
    }
  }
}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Stephen James
@sjames1958gm
Jan 04 2017 01:02 UTC
@andercodder There is a captial I in that should be i
andercodder
@andercodder
Jan 04 2017 01:02 UTC
guys i changed the code according to the question
Stephen James
@sjames1958gm
Jan 04 2017 01:02 UTC
@greedylan This returns one letter return after[0].toUpperCase();
andercodder
@andercodder
Jan 04 2017 01:03 UTC
but i get this error myStr should have encoded text with the proper escape sequences and no spacing.
@sjames1958gm i took theI
Stephen James
@sjames1958gm
Jan 04 2017 01:03 UTC
@andercodder I see at least one space in the string
Lorrie Pearson
@Lorrie01
Jan 04 2017 01:04 UTC
Woo hoo! Just finished the Card Count Challenge!
Stephen James
@sjames1958gm
Jan 04 2017 01:04 UTC
@Lorrie01 :+1:
@andercodder You should have six tottal \
andercodder
@andercodder
Jan 04 2017 01:04 UTC
ok
Dylan Hsiao
@greedylan
Jan 04 2017 01:04 UTC
@sjames1958gm it returns "undefined". I can certainly concat or splice into the whole word for var after
Lorrie Pearson
@Lorrie01
Jan 04 2017 01:04 UTC
thanks @sjames1958gm
CamperBot
@camperbot
Jan 04 2017 01:04 UTC
lorrie01 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5143 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
andercodder
@andercodder
Jan 04 2017 01:05 UTC
i will try it
Stephen James
@sjames1958gm
Jan 04 2017 01:05 UTC
@greedylan What tests are passing or failing?
Dylan Hsiao
@greedylan
Jan 04 2017 01:05 UTC
@sjames1958gm all tests are failing :) returns "undefined"
Fabio Andrade
@kaytesith
Jan 04 2017 01:07 UTC
Guys, I'm currently doing the profile lookup exercise on the site and I kinda got stuck on how to verify if a prop on the array is true or not
andercodder
@andercodder
Jan 04 2017 01:07 UTC
i have six \ i still got the error
Stephen James
@sjames1958gm
Jan 04 2017 01:07 UTC
@greedylan remove the if part of the else if -
@andercodder Can you post again?
andercodder
@andercodder
Jan 04 2017 01:08 UTC
var myStr = "FirstLine\n\SecondLine\ \rThirdLine"; // Change this line
Stephen James
@sjames1958gm
Jan 04 2017 01:09 UTC
@andercodder I see a space before \r
andercodder
@andercodder
Jan 04 2017 01:11 UTC
ok i got it
very thank you @sjames1958gm
CamperBot
@camperbot
Jan 04 2017 01:11 UTC
andercodder sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5144 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jan 04 2017 01:11 UTC
@andercodder :+1:
Jacob Peterman
@jdpeterman
Jan 04 2017 01:11 UTC
I'm stuck on an issue with my JS calculator. Every time I press a button, the whole keypad disappears. Any ideas? http://codepen.io/jpeterman/pen/rrGzmN
Connor
@cjmelnick
Jan 04 2017 01:12 UTC
import java.util.*;

public class countVowels {

    public static void main(String[] args) {
        //create a string to hold user input
        String input = "";
        int vowels = 0;

        //create scanner to accept user input
        System.out.println("Enter a string");
        @SuppressWarnings("resource")
        Scanner in = new Scanner(System.in);

        //set user input to variable input
        input = in.nextLine();

        int length = input.length();

        for (int i = length - 1; i >= 0; i --){
            String letter = Character.toString(input.charAt(i));
            System.out.println(letter);
            if (letter == "a"){
                vowels = vowels + 1;
            }
            System.out.println("There are " + vowels + " vowels in the string you provided");
        }
    }
}
Im trying to write a program that counts the number of vowels in a string. Why wont my if statement work? if i input the letter a it doesnt add 1 to the vowels
andercodder
@andercodder
Jan 04 2017 01:13 UTC
hoe do i send brownie points
Rebecca
@alimily
Jan 04 2017 01:13 UTC
help
help,please
Connor
@cjmelnick
Jan 04 2017 01:14 UTC
@andercodder just tag the person you want to thank and say "thank you"
CamperBot
@camperbot
Jan 04 2017 01:14 UTC
:cookie: 129 | @andercodder |http://www.freecodecamp.com/andercodder
cjmelnick sends brownie points to @andercodder :sparkles: :thumbsup: :sparkles:
Rebecca
@alimily
Jan 04 2017 01:14 UTC
myStr should have encoded text with the proper escape sequences and no spacing.
myStr should have one newline character \n
myStr should have one carriage return character \r
myStr should have two correctly escaped backslash characters \
and my answer is this var myStr="\FirstLine \t SecondLine \b gfdg \r gfg \n Th\";
why the answer is not right
andercodder
@andercodder
Jan 04 2017 01:15 UTC
@sjames1958gm thank you
CamperBot
@camperbot
Jan 04 2017 01:15 UTC
andercodder sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: andercodder already gave sjames1958gm points
Rebecca
@alimily
Jan 04 2017 01:15 UTC
what should i put down
Fabio Andrade
@kaytesith
Jan 04 2017 01:16 UTC
How do I verify if a property of an array exists or not, resulting in a boolean?
Rebecca
@alimily
Jan 04 2017 01:17 UTC
help
everyone
please,help me
Jie
@BEBEDYDY
Jan 04 2017 01:18 UTC
hasOwnProperty
Fabio Andrade
@kaytesith
Jan 04 2017 01:18 UTC
@BEBEDYDY tyvm (:
Rebecca
@alimily
Jan 04 2017 01:20 UTC
myStr should have encoded text with the proper escape sequences and no spacing.
myStr should have one newline character \n
myStr should have one carriage return character \r
myStr should have two correctly escaped backslash characters \
why i write code like this is wrong
var myStr="\FirstLine \t SecondLine \b gfdg \r gf
Q_zheng
@zhengbusinesscontact
Jan 04 2017 01:20 UTC
hey, guys, silly question. how to return a numerical variable in quote in Js. I want to return an output like "13 Hold" or "-5 Bet"
Rebecca
@alimily
Jan 04 2017 01:20 UTC
any one please help me
Jie
@BEBEDYDY
Jan 04 2017 01:21 UTC
yourArray.hasOwnProperty("property");//true or false if is true you can try to use typeof to find out
Tyler Collins
@tjscollins
Jan 04 2017 01:22 UTC

@zhengbusinesscontact

numberVariable + strVariable

Javascript will convert the number to a string for you.

@alimily
What are you trying to do?
Rebecca
@alimily
Jan 04 2017 01:24 UTC
myStr should have encoded text with the proper escape sequences and no spacing.
myStr should have one newline character \n
myStr should have one carriage return character \r
myStr should have two correctly escaped backslash characters \
Q_zheng
@zhengbusinesscontact
Jan 04 2017 01:24 UTC
@tjscollins for example: return count + "Hold"; //?
Rebecca
@alimily
Jan 04 2017 01:24 UTC
according this condition write some sentence
var myStr="\FirstLine \t SecondLine \b gfdg \r gf
Tyler Collins
@tjscollins
Jan 04 2017 01:25 UTC
@zhengbusinesscontact you probably want a space in " Hold", but yes.
Fabio Andrade
@kaytesith
Jan 04 2017 01:25 UTC
@BEBEDYDY yup, got it to work, thank you
CamperBot
@camperbot
Jan 04 2017 01:25 UTC
:cookie: 218 | @bebedydy |http://www.freecodecamp.com/bebedydy
kaytesith sends brownie points to @bebedydy :sparkles: :thumbsup: :sparkles:
Rebecca
@alimily
Jan 04 2017 01:25 UTC
var myStr="\FirstLine \t SecondLine \b gfdg \r gfg \n Th\";
i write this ,but is not ok
this is my code
Jie
@BEBEDYDY
Jan 04 2017 01:25 UTC
@kaytesith great.lol
Rebecca
@alimily
Jan 04 2017 01:25 UTC
@tjscollins
Jacob Peterman
@jdpeterman
Jan 04 2017 01:25 UTC
@alimily var myStr = "FirstLine\n\SecondLine\\rThirdLine";
Q_zheng
@zhengbusinesscontact
Jan 04 2017 01:26 UTC
@tjscollins TY!!!
CamperBot
@camperbot
Jan 04 2017 01:26 UTC
zhengbusinesscontact sends brownie points to @tjscollins :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @tjscollins |http://www.freecodecamp.com/tjscollins
Tyler Collins
@tjscollins
Jan 04 2017 01:26 UTC
@alimily Jacob's answer looks like what you want

@alimily Except probably without the \ before the S

var myStr = "FirstLine\nSecondLine\\rThirdLine";

or something like that. I'm not sure what the problem is actually asking you based on what you put.

Jie
@BEBEDYDY
Jan 04 2017 01:28 UTC
C9A64996-EF1D-46B1-A558-DF0E1ED79A0A.png
@tjscollins hi, sorry to bothering you. but i really don't know who to ask. i tried to looking answer online but nobody tell me . why the return "No such contact " is out of the for loop as the image i just upload?
Tyler Collins
@tjscollins
Jan 04 2017 01:30 UTC
@BEBEDYDY Switch lines 43 and 44
Rebecca
@alimily
Jan 04 2017 01:30 UTC
@tjscollins @jdpeterman thank you very much
CamperBot
@camperbot
Jan 04 2017 01:30 UTC
alimily sends brownie points to @tjscollins and @jdpeterman :sparkles: :thumbsup: :sparkles:
:cookie: 327 | @jdpeterman |http://www.freecodecamp.com/jdpeterman
:cookie: 332 | @tjscollins |http://www.freecodecamp.com/tjscollins
Jie
@BEBEDYDY
Jan 04 2017 01:30 UTC
@tjscollins I knew the correct code but i dont understand why
Tyler Collins
@tjscollins
Jan 04 2017 01:31 UTC
@BEBEDYDY You close the for loop on line 43 with the }
Connor
@cjmelnick
Jan 04 2017 01:31 UTC
Can anyone help me with the code i previously posted above
Rebecca
@alimily
Jan 04 2017 01:31 UTC
@jdpeterman but i want to know is why it is \n\ \r,not my code like \n or \t
Tyler Collins
@tjscollins
Jan 04 2017 01:31 UTC
@BEBEDYDY Although, that doesn't look right, give me a second
Rebecca
@alimily
Jan 04 2017 01:31 UTC
why
Jie
@BEBEDYDY
Jan 04 2017 01:32 UTC
@tjscollins 1> yes, the correct code return "No such contact" should be outside of the for loop, is weird? why is not in the for loop which is after the first if statement? 2> contacts[i][prop] contacts[i].prop not the same?
Tyler Collins
@tjscollins
Jan 04 2017 01:33 UTC
@BEBEDYDY It needs to be outside the loop because otherwise you don't check every contact in the list. If you put it in the loop, you'll only check the first contact. The return statement breaks the for loop
Bryan Reese
@breese8009
Jan 04 2017 01:34 UTC
Whats up campers? im back
Jie
@BEBEDYDY
Jan 04 2017 01:36 UTC
oh i see !!!! got this part. 2> contacts[i][prop] and contacts[i].prop not the same?i checked some website told they are not the same... i confused. I remember array[i]===array.i right? but why here array[i][j] !==array[i].j ?
agustashd
@agustashd
Jan 04 2017 01:37 UTC
Hi, I'm currently on 'Using Objects for Lookups' challenge and getting a little confused as to why sometimes when writing a properti of an object with brackets theres ["propertieName"] or [propertieName] directly
Jie
@BEBEDYDY
Jan 04 2017 01:38 UTC
@breese8009 Is mess. a lot people need help. At least i know Im not the only one who needs help.
Fabio Andrade
@kaytesith
Jan 04 2017 01:38 UTC
@agustashd "propertieName" you are searching for the property using a string while propertieName without quotes is using a variable
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:39 UTC
$('#next-canvas').animate({opacity: '1'}, 1000ms); can anyone tell me why this is causing an illegal token error in codepen?
agustashd
@agustashd
Jan 04 2017 01:39 UTC
@kaytesith i see, thanks! And what about dot notation? I tired using that first and got an error
CamperBot
@camperbot
Jan 04 2017 01:39 UTC
agustashd sends brownie points to @kaytesith :sparkles: :thumbsup: :sparkles:
:cookie: 218 | @kaytesith |http://www.freecodecamp.com/kaytesith
Jie
@BEBEDYDY
Jan 04 2017 01:39 UTC
@agustashd Object["property"] or Object.property so if you use the first way you should put "" .
Fabio Andrade
@kaytesith
Jan 04 2017 01:40 UTC
@agustashd From what i've been seeing, we tend to use [] notations when we need to access info from a nested array or get a value from a variable
@agustashd While we use dot notation to simplify things... maybe? Still learning it right now :D
ADIL KARMOUZI
@mradil16
Jan 04 2017 01:42 UTC
Hi everyone. I included a small script to show and hide a dropdown menu, but even I wrote the code right the script refuse to run ( I used bootstrap navbar) , please check this pen : http://codepen.io/mradil16/pen/apbGPj
Tyler Collins
@tjscollins
Jan 04 2017 01:42 UTC

@BEBEDYDY You're confusing arrays with objects:

array[i][j]

looks for the jth element in the ith element in array.

array[i].j

looks for a property named "j" in the ith element in array

agustashd
@agustashd
Jan 04 2017 01:43 UTC
@kaytesith hehe i liked the dot notation thats why i tried using that and got nothing :smile: I'll stick to brackets for variables then
Tyler Collins
@tjscollins
Jan 04 2017 01:45 UTC
@agustashd Yes, if your property name is stored in a variable you have to use the brackets
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:45 UTC
@mradil16 whats your problem exactly? your drop down menus not showing?
Joseph
@revisualize
Jan 04 2017 01:48 UTC
Hello.
ADIL KARMOUZI
@mradil16
Jan 04 2017 01:48 UTC
@HeebieGeeBee the problem is : when I hover the "english" list Item the dropdown menu doesn't show up (the script I included supposed to show the menu on hover)
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:50 UTC
why did you hide it with the first bit of code?
Joseph
@revisualize
Jan 04 2017 01:50 UTC
Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:51 UTC
not sure the effect you want but when i comment out this line // $(".navbar-nav > li > .dropdown-menu").css({visibility: "hidden"}); the drop down menus show when you hover over and dont when you leave them @mradil16
Joseph
@revisualize
Jan 04 2017 01:53 UTC
I know what it is.... I join and everyone runs away.
Everyone is all.. Damn it. That jerkface is back.
:P
Fabio Andrade
@kaytesith
Jan 04 2017 01:53 UTC
@revisualize Is it possible to use dot notations to define a property and a bracket notation afterwards ? Example myObj[num].property[num][num]
@revisualize Or is it considered bad practice?
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:54 UTC
maybe they just think they need to up their game with you around
karimpremji1990
@karimpremji1990
Jan 04 2017 01:54 UTC
i think in some cases you have to use bracket AND dot. like, if you're trying to access a property of an object with a space.
Joseph
@revisualize
Jan 04 2017 01:54 UTC
@kaytesith Yes.
@kaytesith You'd have a really complex object.
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:54 UTC
speaking of which
$('#next-canvas').animate({opacity: 1}, 200ms);
any idea why this is giving me an illegal token error?
Joseph
@revisualize
Jan 04 2017 01:55 UTC
@kaytesith It just matters the shape of your data / object.
Fabio Andrade
@kaytesith
Jan 04 2017 01:56 UTC
@revisualize Alright, I'm trying to understand everything thoroughly from start, so I don't miss on details that could help me
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:57 UTC
anyone? any ideas?
Joseph
@revisualize
Jan 04 2017 01:57 UTC
@kaytesith Why you would have 3 of the same properties in an object. I have no idea. But, yeah.. Just depends on the shape of your data.
Doegena Fennich
@Doegena
Jan 04 2017 01:57 UTC
@HeebieGeeBee try to remove ms
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:58 UTC
derp thanks
Fabio Andrade
@kaytesith
Jan 04 2017 01:58 UTC
@revisualize It's just that I was imagining a highly nested object, which I guess would be unnecessary?
Doegena Fennich
@Doegena
Jan 04 2017 01:58 UTC
:)
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:58 UTC
ty @Doegena
CamperBot
@camperbot
Jan 04 2017 01:58 UTC
heebiegeebee sends brownie points to @doegena :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for doegena
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 01:58 UTC
forget which language likes ms and doesnt
camperbot is getting really crap at finding ppl
Doegena Fennich
@Doegena
Jan 04 2017 01:59 UTC
@HeebieGeeBee Js only uses numbers so 100 = 200ms 1000 = 1000ms etc, np thanks anyways :)
CamperBot
@camperbot
Jan 04 2017 01:59 UTC
doegena sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 430 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 02:00 UTC
lol thats just mean camperbot
ty @Doegena
CamperBot
@camperbot
Jan 04 2017 02:00 UTC
:warning: could not find receiver for doegena
heebiegeebee sends brownie points to @doegena :sparkles: :thumbsup: :sparkles:
Doegena Fennich
@Doegena
Jan 04 2017 02:00 UTC
lol
Ion Leahu
@forza11879
Jan 04 2017 02:00 UTC
hey guys ! i am stacked at JavaScript 153
Dylan Hsiao
@greedylan
Jan 04 2017 02:00 UTC

how do I return 'Sitting' with .splice()?

return 'sitting'.split("").splice(0, 1, 'sitting'[0].toUpperCase());

.splice(0, 1, "S"). index = 0 , remove "s", add "S"

Joseph
@revisualize
Jan 04 2017 02:01 UTC
@greedylan String Concatenation.
Dylan Hsiao
@greedylan
Jan 04 2017 02:02 UTC
@revisualize I was wondering why splice is not working here?
gant123
@gant123
Jan 04 2017 02:02 UTC

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

// Your code above this line
return result;
}

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

HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 02:03 UTC
@gant123 thats not going to work
Joseph
@revisualize
Jan 04 2017 02:03 UTC
@gant123 Why are you overwriting your variables parameters?
gant123
@gant123
Jan 04 2017 02:04 UTC
im a littl confused on what they wanted. i need help with getting on the right path
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 02:04 UTC
how would you write a function that added all those strings together @gant123 ?
Doegena Fennich
@Doegena
Jan 04 2017 02:04 UTC
@gant123 result = "My " + myNoun ; result += " and is " + myAdjective you finish the rest
gant123
@gant123
Jan 04 2017 02:05 UTC
I was about to make this harder than what it was , thanks yall
Joseph
@revisualize
Jan 04 2017 02:05 UTC
@Doegena Do you know giving people solutions isn't going to actually help them learn?
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 02:05 UTC
remember to include spaces @gant123
BAXHA
@baxha
Jan 04 2017 02:05 UTC
how do i assign processArg to processed?
gant123
@gant123
Jan 04 2017 02:06 UTC
i kne@heebieGeeBee i will
Joseph
@revisualize
Jan 04 2017 02:06 UTC
@baxha How do you assign the value of 7 to a variable num? ... var num = 7;
@baxha How do you assign the value of x to a variable y? ... var y = x;
wlagos1992
@wlagos1992
Jan 04 2017 02:07 UTC

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

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

  return myObj[checkProp];

}

// Test your code by modifying these values
checkObj("bed");
I have it to return but how do i make it return when there is value?
ADIL KARMOUZI
@mradil16
Jan 04 2017 02:07 UTC
@HeebieGeeBee the dropdown menu doesn't work as expected . I don't know why the script refuse to run ? is this problem has something to do with bootstrap ?
Doegena Fennich
@Doegena
Jan 04 2017 02:07 UTC
@revisualize well, he now knows how it works so next time he most likely wont have the same problem. but i know what you're trying to say. cheers
BAXHA
@baxha
Jan 04 2017 02:09 UTC
@revisualize var processed = processArg ain;t correct
David
@SimbaKali
Jan 04 2017 02:10 UTC
I am having trouble with the "Global Scope and Functions" lesson. I am supposed to assign 5 to oopsGlobal without using the var keyword within the fun1 function, but its not accepted as correct
Ion Leahu
@forza11879
Jan 04 2017 02:10 UTC
@gant123

@gant123 function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "My " + myAdjective + " lovely " + myNoun + " funny " + myVerb + " wovely " + myAdverb ;

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("cat", "little", "hit", "slowly");

wlagos1992
@wlagos1992
Jan 04 2017 02:10 UTC
when there is no value**
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 02:11 UTC
@mradil16 it runs fine for me and looks like i would expect it to look if you just get rid of the first bit of code in javascript,
but i dont know what else you want apart from the drop down menu dropping down when you hover over and going away when you leave it with the mouse
Joseph
@revisualize
Jan 04 2017 02:13 UTC
Studies have shown that giving people answers to problems instills an illusionary sense of learning. Because, it only puts information into short-term memory. Of which people think they are learning. Only through a little struggle and repetition that the human brain puts things into long-term memory. I don't know what your end goal. I don't know if you want to do this as a personal project, hobby, or if you want to move into industry. Because of this, I strongly feel that working with people to allow them to solve problems on their own is a far better outcome than giving away answers. But, others clearly don't agree with my methods for helping people learn.
@baxha I'm sorry. I don't know then. I don't know what lesson you're working on.
Jie
@BEBEDYDY
Jan 04 2017 02:14 UTC
@tjscollins I looked your answer again and again, I think I finally got it. haha.💗 object.j this j means a property named j , same as object["j"] ,which in this case array[i][j] means array[i]'s jth property, this j is a variable not a property name. So array[i]["j"] ===array[i].j which are not equal to array[i][j] . hahahaha Thank you.
CamperBot
@camperbot
Jan 04 2017 02:14 UTC
bebedydy sends brownie points to @tjscollins :sparkles: :thumbsup: :sparkles:
:cookie: 333 | @tjscollins |http://www.freecodecamp.com/tjscollins
gant123
@gant123
Jan 04 2017 02:15 UTC
@forza11879 Thanks i got it. i cleaned what i had :)
CamperBot
@camperbot
Jan 04 2017 02:15 UTC
gant123 sends brownie points to @forza11879 :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for forza11879
BAXHA
@baxha
Jan 04 2017 02:15 UTC
@revisualize if you give answers to people then they can practice it and use the time they would figure the answer to actuaclly practice it, and the reason i lack at this stage is because i havent learned variables yet and i actually suck at english , therefore i ask for help, thx :)
CamperBot
@camperbot
Jan 04 2017 02:15 UTC
baxha sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2815 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 04 2017 02:16 UTC
@baxha Honestly, how many people do you think really "practice" after you give them an answer?
@baxha Humans are lazy.
The brain is lazy.
nicknoel251289
@nicknoel251289
Jan 04 2017 02:16 UTC
that's a generalized statement
Joseph
@revisualize
Jan 04 2017 02:17 UTC
Generalized to the masses.
BAXHA
@baxha
Jan 04 2017 02:18 UTC
@revisualize you cannot choose the other's decisions, you give them the help, its their duty to choose whether they want to succeed or to lie themselves.
nicknoel251289
@nicknoel251289
Jan 04 2017 02:18 UTC
As long as YOU know that your comment is generalized. State humans are lazy as a whole is ignorant.
Joseph
@revisualize
Jan 04 2017 02:19 UTC
@nicknoel251289 I don't agree. I know that my statement is generalized to the masses.
Stating humans are lazy is going to the 90%. If only 5 to 10% of people are not lazy. It isn't a reflection on the human race as a whole.
There are people out there that work harder than I ever will.
Work 18 hour days every day.
ZOE
@ZOEGITHUB
Jan 04 2017 02:20 UTC
array[i][0]=array[i][0].toUpperCase();//reprot a type error
array[i] = array[i][0].toUpperCase() + array[i].substring(1);//turn out to be right.why??
Joseph
@revisualize
Jan 04 2017 02:20 UTC
Should be compare the human race to those people?
No.
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:20 UTC
do you guys see anything wrong with my code?
it keeps comming out as null
in line 7
Joseph
@revisualize
Jan 04 2017 02:21 UTC
@ZOEGITHUB Strings are immutable?
BAXHA
@baxha
Jan 04 2017 02:21 UTC
what do you define with "lazy" @revisualize
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:21 UTC

var leftHand = document.querySelector('.wrapper');
leftHand.style.display = "none";

function slideOut(){
  var wrap = document.querySelector('.wrapper');
  wrap.style.animation = "slideOut 1s ease-in-out 1";
  wrap.style.display = "flex";
}

setTimeout(slideOut, 3000);
leftHand.style.display = "none"; keeps coming out as null
Joseph
@revisualize
Jan 04 2017 02:21 UTC
@baxha Depends on the context.
@baxha In this context of learning web development. I'd say someone that just goes through the lessons copying and pasting and not actually learning why they're doing something.
@baxha If I see someone working on one of the challenges and I ask them a simple question about a previous challenge that relates to what they're working on... And they can't answer it. I have to assume that they were lazy and didn't learn the material from the previous lesson.
@baxha But still...
@baxha You haven't told me which lesson you're working on.
ZOE
@ZOEGITHUB
Jan 04 2017 02:27 UTC

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

titleCase("I'm a little tea pot");
//it should return to be "I'm A Little Tea Pot"@Joseph

@revisualize
Cory
@CoryThePresby
Jan 04 2017 02:28 UTC
Hey, I need help. I'm having difficulty understanding what I need to do for Challenge 173.
eeflores
@eeflores
Jan 04 2017 02:28 UTC
@Marbocatcat how are you testing the value of leftHand.style.display?
@Marbocatcat maybe you could put the line console.log(leftHand.style.display); after the assignment to check the value
Joseph
@revisualize
Jan 04 2017 02:30 UTC
@ZOEGITHUB You're not declaring var i = 0;
@CoryThePresby Challenges don't have numbers. So.... What's the name of the challenge.
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:31 UTC
@eeflores hey Erwin , i tested it using the console browser
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 02:31 UTC
@revisualize please am I on the right track

var Car = function() {
// this is a private variable
var speed = 10;

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

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

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

var Bike = function() {

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

};

var myCar = new Car();

var myBike = new Bike();

Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:31 UTC
@eeflores the value return as null , im not sure why
ZOE
@ZOEGITHUB
Jan 04 2017 02:31 UTC
for (var i=0;i<array.length;i++) return the same
Cory
@CoryThePresby
Jan 04 2017 02:32 UTC
@revisualize "Stand in Line"
Joseph
@revisualize
Jan 04 2017 02:32 UTC
@ZOEGITHUB Not when I ran it.
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:32 UTC
@eeflores i even type the logic in the browser console and it worked
Doegena Fennich
@Doegena
Jan 04 2017 02:32 UTC
@revisualize well, depends on the difficulty of the question, if its like "make a slideshow on your own" and you dont know anything about Js then yeah the person will not learn anything by copy and pasting, that i agree with you completely. but questions like "make a sentence and shorten the code with +=" is quite easy to understand even if you dont know anything of Js.
eeflores
@eeflores
Jan 04 2017 02:32 UTC
@Marbocatcat I copy/pasta your code into chrome console - I'm getting an error
Joseph
@revisualize
Jan 04 2017 02:33 UTC
@ZOEGITHUB The only change that I made was that I added var in front of your i and I solved the challenge.
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:33 UTC
@eeflores what are you getting
Joseph
@revisualize
Jan 04 2017 02:33 UTC
@CoryThePresby What's your function?
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 02:33 UTC

var myStr = "This is the start. " + "This is the end.";

whats wrong in this code

Joseph
@revisualize
Jan 04 2017 02:33 UTC
@Doegena Can I PM you?
eeflores
@eeflores
Jan 04 2017 02:33 UTC
@Marbocatcat cannot read property 'style' of null at anonymous ...
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 02:34 UTC

var Car = function() {
// this is a private variable
var speed = 10;

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

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

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

var Bike = function() {

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

};

var myCar = new Car();

var myBike = new Bike();

Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 02:34 UTC

var myStr = "This is the start. " + "This is the end.";

whats wrong in this code Eror : myStr should have a value of This is the start. This is the end.

Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:34 UTC
@eeflores yup thats what im confused about
eeflores
@eeflores
Jan 04 2017 02:34 UTC
@Marbocatcat am guessing document.querySelector() for me is returning null
Doegena Fennich
@Doegena
Jan 04 2017 02:34 UTC
@revisualize sure
Cory
@CoryThePresby
Jan 04 2017 02:34 UTC

@revisualize

function nextInLine(arr, item) {

return item;
}

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

Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:35 UTC
@eeflores yup im not sure why thats happening , i have the same method inside a functino and it works fine
Mark Wartman
@markwartman1
Jan 04 2017 02:35 UTC
Hello, I'm stuck on Reverse a String. My lower for loop will not iterate the full length of the array. Does anyone know why? Thanks!
function reverseString(str) {

var arr = [];
  for (i = 0; i < str.length; i++){
    arr.push(str[i]);
  }

   var revString = "";
/*  The proble with the code below
is that it will only itterate 3 times
why?

*/
//   for (j = 0; j< arr.length; j++){
//     revString += arr.pop(); 
//   }


  return arr;
}

reverseString("hello");
Joseph
@revisualize
Jan 04 2017 02:35 UTC
@CoryThePresby
How do you add a number (item) to the end of an array (arr)? What does this method return?
How do you remove the first element from an array (arr)? What does this method return?
ZOE
@ZOEGITHUB
Jan 04 2017 02:35 UTC
array[i][0]=array[i][0].toUpperCase();//use this in for loop, u cannot solve,and report a error
array[i] = array[i][0].toUpperCase() + array[i].substring(1);//but this can.
eeflores
@eeflores
Jan 04 2017 02:36 UTC
@Marbocatcat I do this in the console: console.log(document.querySelector(".wrapper")) and get null
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 02:36 UTC
Help somebody
CamperBot
@camperbot
Jan 04 2017 02:36 UTC
no wiki entry for: somebody
ZOE
@ZOEGITHUB
Jan 04 2017 02:36 UTC
i can't understand the different @revisualize
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 02:36 UTC
@revisualize can you pls help me out

var Car = function() {
// this is a private variable
var speed = 10;

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

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

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

var Bike = function() {

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

};

var myCar = new Car();

var myBike = new Bike();

eeflores
@eeflores
Jan 04 2017 02:37 UTC
@Marbocatcat so I guess in the scope of the browser console, .wrapper doesn't exist
BAXHA
@baxha
Jan 04 2017 02:37 UTC
@revisualize oh sry didn't understand what u said challenge is at front end dev, called assignment with a returned value
Joseph
@revisualize
Jan 04 2017 02:37 UTC
@ZOEGITHUB All I did was copy and paste your code and add var in front of the i.
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 02:37 UTC

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line
var myStr = "This is the start. " + "This is the end.";

error: myStr should have a value of This is the start. This is the end.
eeflores
@eeflores
Jan 04 2017 02:38 UTC
@Marbocatcat I'm guessing you have that code within a function that is defined in a page, and there's an HTML element using the ".wrapper" class and that's being selected
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 02:38 UTC
help whats wrong in this pls
CamperBot
@camperbot
Jan 04 2017 02:38 UTC
no wiki entry for: whats wrong in this pls
Joseph
@revisualize
Jan 04 2017 02:38 UTC
@ZOEGITHUB See:
blob
ZOE
@ZOEGITHUB
Jan 04 2017 02:39 UTC
because the wrong one was behind '//' @revisualize
Joseph
@revisualize
Jan 04 2017 02:39 UTC
@ZOEGITHUB That's a comment. It doesn't get parsed.
@CoryThePresby Are you still here?
eeflores
@eeflores
Jan 04 2017 02:40 UTC
@idowuogedengbe this.gear = gear;
ZOE
@ZOEGITHUB
Jan 04 2017 02:40 UTC
array[i][0]=array[i][0].toUpperCase(); why this one is a comment??
wlagos1992
@wlagos1992
Jan 04 2017 02:41 UTC
the goal is to return "not found" if i search a query that doesnt exist, i feel like i did something similar in the past can anyone help??

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

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

  return myObj[checkProp];

}

// Test your code by modifying these values
checkObj("bed");
Any tips on tackling the roman numeral challenge?
eeflores
@eeflores
Jan 04 2017 02:42 UTC
@DILIPKUMARJOSHI I just tried the challenge - works for me
@DILIPKUMARJOSHI copied from the challenge: var myStr = "This is the start. " + "This is the end.";
ZOE
@ZOEGITHUB
Jan 04 2017 02:42 UTC
i mean why i wrote" array[i][0]=array[i][0].toUpperCase();" i reported a type error, while " array[i] = array[i][0].toUpperCase() + array[i].substring(1);" doesn't.
Joseph
@revisualize
Jan 04 2017 02:43 UTC
@ZOEGITHUB Strings are Immutable.
You have to completely reassign the string or create a new string.
ZOE
@ZOEGITHUB
Jan 04 2017 02:44 UTC
but i had split it into an array
haider
@candh
Jan 04 2017 02:44 UTC
hey whats up guys
Joseph
@revisualize
Jan 04 2017 02:44 UTC
@ZOEGITHUB The array element is still a string.
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 02:45 UTC
@eeflores okay i tried but its not passing,its giving this error: myStr should have a value of This is the start. This is the end.
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 02:46 UTC
@eeflores aftersetting the private property this.gear=gear; still not working
Joseph
@revisualize
Jan 04 2017 02:46 UTC
@wlagos1992 .hasOwnProperty() returns a boolean.
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:47 UTC
how do you hide div using vanilla javascript?
eeflores
@eeflores
Jan 04 2017 02:47 UTC
@idowuogedengbe what error are you getting?
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:47 UTC
is this code correct?
var hide = document.querySelector('.div');
hide.style.display = "none";
would above work to hide an object?
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 02:49 UTC

var Car = function() {
// this is a private variable
var speed = 10;

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

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

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

var Bike = function() {

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

};

var myCar = new Car();

var myBike = new Bike();

gear is not defined
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:49 UTC
@eeflores that also says "null" :( not really sure what im doing wrong
wlagos1992
@wlagos1992
Jan 04 2017 02:49 UTC
@revisualize i get that but i dont get how to use that function
eeflores
@eeflores
Jan 04 2017 02:50 UTC
@idowuogedengbe the original var gear = 10 is probably right. Put the this.gear = gear within the setGear function
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 02:50 UTC
@eeflores gear is not defined
eeflores
@eeflores
Jan 04 2017 02:50 UTC
@idowuogedengbe replace the gear += gear line
Joseph
@revisualize
Jan 04 2017 02:50 UTC
@wlagos1992 What's a boolean value?
eeflores
@eeflores
Jan 04 2017 02:51 UTC
@Marbocatcat maybe instead of .div (which is trying to select a class) it should just be div?
Joseph
@revisualize
Jan 04 2017 02:52 UTC
@wlagos1992
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
wlagos1992
@wlagos1992
Jan 04 2017 02:52 UTC
@revisualize means built in true or false
Joseph
@revisualize
Jan 04 2017 02:52 UTC
@wlagos1992 Great.
eeflores
@eeflores
Jan 04 2017 02:52 UTC
@Marbocatcat maybe that would hide all divs
Joseph
@revisualize
Jan 04 2017 02:53 UTC
@wlagos1992 Those are the instructions, maybe you should read them again? Because you know if and all.
eeflores
@eeflores
Jan 04 2017 02:53 UTC
@Marbocatcat what you may want to try to do is to target class elements (with the preceding dot notation) or id elements (with the preceding hash notation)
Ahm98
@Ahm98
Jan 04 2017 02:54 UTC
var madLibs = "Once upon a time, there was a " + myNoun + "that was really " + myAdjective + "and his owner " + myVerb + "into a University way too" + myAdverb;
Sorry but would anyone be able to tell me why that turns up a blank string for the Word Blanks challenge?
wlagos1992
@wlagos1992
Jan 04 2017 02:54 UTC
@revisualize i think im at the end of my day i cant rememeber how to check if it found a value and i am sure it went over that,
Maryna Nogtieva
@MarynaNogtieva
Jan 04 2017 02:54 UTC

Hello everyone

I'm working on twitchTV API project from FreeCodeCamp

when I reload the page, the status and the game of any 2 useers are displayed as undefined.
Please help me to figure out the reason.
Here is my code

$(document).ready(function(){
var channelArr = ["ESL_SC2",  "cretetion", "freecodecamp", "storbeck", "habathcx",  "noobs2ninjas","brunofin","comster404"];

function getUrl(type,channel){
  var url ='https://wind-bow.gomix.me/twitch-api/' + type + '/'      +channel + '?callback=?';
    return url;
}

function getAllurls(){
  channelArr.forEach(function(el,i){
     var status, game, channelName=el;
    var  preview,stream;
      var html ="";
  $.getJSON(getUrl("streams",el),function(data){
     //console.log(data);

     status= typeof status==="undefined" ? "offline" : status;
      game= typeof game==="undefined" ? "offline" : game;
   // var status, game;
    if(data.stream==null){
       status="Offline";
       game ="";
    }

    else{
      game = data.stream.game;
      status = "online";
      preview='<img srs="'+data.stream.preview.large.slice(6)+'"/>';
    }

    });
    var getTwitchInfo = function(){

    }
    $.getJSON(getUrl("channels",el),function(data){
   console.log(data);

      var error = data.error !=null ? data.error : " ";
      if (error !=" "){
        status="";
        game="";
      }
      var logo = data.logo != null ? data.logo : 'http://yf-personaltraining.ch/wp-content/uploads/2016/03/blank-profile.jpg';
      html+='<div class="row" style=" border-bottom:1px solid           blue;">';
      html+='<a target="_blank" href="https://www.twitch.tv/'+channelName+'">';
      html+='<div class="col-md-2 img">';
      html+='<img src="'+logo+'" /> <br/>';
      html+='</div>';//end of cokl-md-2
        html+='</a>';
      html+='<div class="col-md-8 ">';
      html+='<p>'+channelName+'  ' +status+ ' ' + game + '</p>';
      html+='<p>'+error+'</p>';
      html+='</div>';//end of cokl-md-8
      html+='<div class="col-md-2 ">';
      html+='</div>';//end of cokl-md-2

       html+='</div>';//end of row

      $("#info").append(html);
    });


  });

};


 getAllurls();


});
and this is my codepen page http://codepen.io/MarynaNight/pen/Roegdq
Joseph
@revisualize
Jan 04 2017 02:55 UTC
@wlagos1992 Yeah, it's called an if statement.
eeflores
@eeflores
Jan 04 2017 02:55 UTC
@Ahm98 with your strings, put a space at the beginning and end
Joseph
@revisualize
Jan 04 2017 02:55 UTC
@MarynaNogtieva Get help on our basic JavaScript and Algorithms Challenges. If you are posting code that is large use Gist - https://gist.github.com/ paste the link here.
eeflores
@eeflores
Jan 04 2017 02:56 UTC
@Ahm98 eg. " this is a " + myVerb + " and blah blah " etc
Maryna Nogtieva
@MarynaNogtieva
Jan 04 2017 02:56 UTC
@revisualize Thank you
wlagos1992
@wlagos1992
Jan 04 2017 02:56 UTC
so how do i say if its not true?
if false Return "Not Found"?
CamperBot
@camperbot
Jan 04 2017 02:56 UTC
:star2: 2817 | @revisualize |http://www.freecodecamp.com/revisualize
marynanogtieva sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Jan 04 2017 02:57 UTC
@wlagos1992 if / else ?
Ahm98
@Ahm98
Jan 04 2017 02:58 UTC
@eeflores it looks like the result is still turning out blank after doing that
wlagos1992
@wlagos1992
Jan 04 2017 02:58 UTC
I am using an if else but it is giving me Red x's
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:59 UTC
@eeflores thanks man i think thers just something wrong with my link page to my external js
CamperBot
@camperbot
Jan 04 2017 02:59 UTC
marbocatcat sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:cookie: 890 | @eeflores |http://www.freecodecamp.com/eeflores
Mar Bocatcat
@Marbocatcat
Jan 04 2017 02:59 UTC
@eeflores when i did it on my index.html and putting it under <script></script> it works
eeflores
@eeflores
Jan 04 2017 03:00 UTC
cool bananas @Marbocatcat
@Ahm98 what's the challenge name?
Dylan Hsiao
@greedylan
Jan 04 2017 03:00 UTC
how do we check if the first letter of given str a vowel?? charAt? str[0]? and how to define RegEx?
var vowels = /[aeiou]/gi
Nitivat Voraditee
@Nicstrendy
Jan 04 2017 03:00 UTC

I'm stuck at "Stand in Line" in basic JS

can't complete this one

After nextInLine(testArr, 10), testArr[4] should be 10

Ahm98
@Ahm98
Jan 04 2017 03:01 UTC
@eeflores it's "Word Blanks"
Joseph
@revisualize
Jan 04 2017 03:01 UTC
@greedylan Regexp
Dylan Hsiao
@greedylan
Jan 04 2017 03:01 UTC
var vowels = /[aeiou]/gi;

  if(str.charAt(0) == vowels){
    return true;
  }
@revisualize
eeflores
@eeflores
Jan 04 2017 03:01 UTC
@Ahm98 looks like you need to assign your string to result
Mar Bocatcat
@Marbocatcat
Jan 04 2017 03:02 UTC
@eeflores do i need to put a <script></script> tag on my external js?
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 03:02 UTC
@eeflores always get value 10
Joseph
@revisualize
Jan 04 2017 03:02 UTC
@greedylan Regexp
Ahm98
@Ahm98
Jan 04 2017 03:02 UTC
@eeflores That was it! Thank you :)
CamperBot
@camperbot
Jan 04 2017 03:02 UTC
ahm98 sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:cookie: 891 | @eeflores |http://www.freecodecamp.com/eeflores
Mar Bocatcat
@Marbocatcat
Jan 04 2017 03:02 UTC
@eeflores im not using jquery or anyting like that and the link page seems to be accurate , im just not sure whats up
eeflores
@eeflores
Jan 04 2017 03:02 UTC
@Ahm98 or return your created var madLibs
wlagos1992
@wlagos1992
Jan 04 2017 03:02 UTC

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

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

}
   return "Not Found";
}
// Test your code by modifying these values
checkObj("bennd");
eeflores
@eeflores
Jan 04 2017 03:03 UTC
@idowuogedengbe so your code should look like this:
var Bike = function() {
// Only change code below this line.
var gear=10;

this.getGear=function()
{
return gear;
};
this.setGear=function(gear){
this.gear=gear;
};
};
(unless there's some ambiguity around this.gear and gear)
Ken Haduch
@khaduch
Jan 04 2017 03:05 UTC
@wlagos1992 - what is your code doing as far as the tests passing or failing?
Hasan
@MHAhmed
Jan 04 2017 03:05 UTC
can someone please explain to me when using regular expression selectors... what we use /\S+/g; counts only the number of words in a string but if we get rid of the + it counts the number of non-white space characters?
wlagos1992
@wlagos1992
Jan 04 2017 03:05 UTC
@khaduch its coming up blank its not logging i know its within the return part
Ariel
@Draidel
Jan 04 2017 03:06 UTC
Hello, I have a simple question but its about PHP, anyone could help me on that ?
Dominic Jones
@dhjfoodstech
Jan 04 2017 03:06 UTC
I'm on the Java part of free code camp, I'm doing the challeges, but don't really understand the whys of what i'm doing
Ken Haduch
@khaduch
Jan 04 2017 03:06 UTC
@Draidel - I might be able to, if I'm not too rusty on my PHP
wlagos1992
@wlagos1992
Jan 04 2017 03:07 UTC
@dhjfoodstech youll get used to it, sometimes its a bit vague
Ken Haduch
@khaduch
Jan 04 2017 03:07 UTC
@wlagos1992 - what is checkProp, and what do you think happens when you test it with if (checkProp)
Dominic Jones
@dhjfoodstech
Jan 04 2017 03:08 UTC
@wlagos1992 ok, thats just what i needed to know lol
Joseph
@revisualize
Jan 04 2017 03:08 UTC
@wlagos1992 .hasOwnProperty() returns a boolean.
@wlagos1992
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
Stephen James
@sjames1958gm
Jan 04 2017 03:09 UTC
@MHAhmed because the + means match 1 or more of the previous character. With the + consecutive non-whitespace characters are matched as a whole not individually

function titleCase(str) {
  var strLC = str.toLowerCase();
  var strTitle = strLC.split(" ");
  var strTitleCase;
  for(var i = 0; i < strTitle.length; i++){
    strTitleCase = strTitle[i][0].toUpperCase();
  }
  return strTitleCase;
}

titleCase("sHoRt AnD sToUt");
Ariel
@Draidel
Jan 04 2017 03:10 UTC
@khaduch :) So I am uploading multiple files and this should return the number on it (thats not the main goal but i am stuck there), for example, if you upload HELLO25.jpg you should see 25
@khaduch but it says "array" however its not...
eeflores
@eeflores
Jan 04 2017 03:11 UTC
@lh15 maybe start by declaring var strTitleCase = "";
Stephen James
@sjames1958gm
Jan 04 2017 03:11 UTC
@lh15 That code will only return the first letter of the last word in upperCase()
Ariel
@Draidel
Jan 04 2017 03:11 UTC
@khaduch preg_match_all('#(\d+)#', $_FILES['archivos']['name'][1], $ancho); echo("<br>ancho: " . $ancho[0]);
eeflores
@eeflores
Jan 04 2017 03:11 UTC
@lh15 then concat by strTitleCase +=
Stephen James
@sjames1958gm
Jan 04 2017 03:11 UTC
@lh15 When you are in a loop you need to build up the result not use simple assignment
eeflores
@eeflores
Jan 04 2017 03:12 UTC
@lh15 I think use splice/split right?
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 03:12 UTC
 var Bike = function() {

  // Only change code below this line.
  var gear=10;

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

      };
};
Hasan
@MHAhmed
Jan 04 2017 03:13 UTC
@sjames1958gm if + means match 1 or more of the previous character i thought it would mean it would count the same character more than one times example "and" with the + it would count 3 and without the plus it would count 1 ? thats why i am confused
Stephen James
@sjames1958gm
Jan 04 2017 03:13 UTC
@MHAhmed with the + and is counted as one match - without the + it is counted as three matches a and n and d
hariharanguru83
@hariharanguru83
Jan 04 2017 03:14 UTC
function randomRange(myMin, myMax) {

  return math.floor(Math.random() * (myMax - myMin + 1)) + myMin; // Change this line

}
Stephen James
@sjames1958gm
Jan 04 2017 03:14 UTC
@hariharanguru83 Math not math
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 03:14 UTC

@eeflores still not working```var Bike = function() {

// Only change code below this line.
var gear=10;

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

}; ```

Hasan
@MHAhmed
Jan 04 2017 03:14 UTC
@sjames1958gm okay ty
CamperBot
@camperbot
Jan 04 2017 03:14 UTC
mhahmed sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5145 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ken Haduch
@khaduch
Jan 04 2017 03:14 UTC

@Draidel - preg_match_all does this:

Searches subject for all matches to the regular expression given in pattern and puts them in matches in the order specified by flags

matches is the third argument and it should be an array - so I don't know if that's what you are seeing for the message? That you have to provide an array?

Nitivat Voraditee
@Nicstrendy
Jan 04 2017 03:14 UTC
K, got it
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 03:15 UTC

``` var Bike = function() {

// Only change code below this line.
var gear=10;

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

};```

Stephen James
@sjames1958gm
Jan 04 2017 03:15 UTC
@idowuogedengbe the parameter to setGear cannot be gear because you have to set gear inside of setGear
eeflores
@eeflores
Jan 04 2017 03:15 UTC
@idowuogedengbe maybe
this.setGear = function(newGear) {
  this.gear = newGear;
}
@idowuogedengbe what's the error?
@idowuogedengbe which challenge?
wlagos1992
@wlagos1992
Jan 04 2017 03:15 UTC

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

function checkObj(checkProp) {
  // Your Code Here

 if (checkProp.hasOwnProperty) 
   return myObj[checkProp];


  else return "Not Found";
}
// Test your code by modifying these values
checkObj("beddd");
okay i got the first half to work now the if not found is not working, sorry im slow
Stephen James
@sjames1958gm
Jan 04 2017 03:15 UTC
@idowuogedengbe But not this.gear = newGear it should be gear = newGear
hariharanguru83
@hariharanguru83
Jan 04 2017 03:15 UTC
thanks @sjames1958gm
CamperBot
@camperbot
Jan 04 2017 03:15 UTC
:star2: 5146 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
hariharanguru83 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Ken Haduch
@khaduch
Jan 04 2017 03:16 UTC
@Draidel - or it will store it as an array of strings
haider
@candh
Jan 04 2017 03:16 UTC
anybody want any help lol
Ariel
@Draidel
Jan 04 2017 03:16 UTC
@khaduch yes so $ancho is an array, then $ancho[0] should be the result i am looking for
thanks @eeflores @sjames1958gm
CamperBot
@camperbot
Jan 04 2017 03:16 UTC
:cookie: 892 | @eeflores |http://www.freecodecamp.com/eeflores
:star2: 5147 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
lh15 sends brownie points to @eeflores and @sjames1958gm :sparkles: :thumbsup: :sparkles:
jayisray
@jayisray
Jan 04 2017 03:17 UTC
Finally finished my WikipediaViewer :D (Without mobile responsive design lol) Can someone critique please?
Ariel
@Draidel
Jan 04 2017 03:17 UTC
@khaduch OMG, wait a minute $ancho[0][0] worked ! does that make sense?
Joseph
@revisualize
Jan 04 2017 03:17 UTC
@wlagos1992 Why did you go from myObj.hasOwnProperty("gift"); to checkProp.hasOwnProperty ??
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 03:18 UTC

``` var Bike = function() {

// Only change code below this line.
var gear=10;

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

};
```

eeflores
@eeflores
Jan 04 2017 03:18 UTC
@idowuogedengbe function parameter to setGear should be newGear
AliFox15
@AliFox15
Jan 04 2017 03:18 UTC
Hi,I just stuck at challenge "Word Blanks",I am not sure what exactly it want me to do,I added the following sentece to the function wordBlanks(),and it doesn't seem right.
result=myAdjective+myNoun +myVerb +myAdverb;
Hasan
@MHAhmed
Jan 04 2017 03:18 UTC
when writing JS objects whats the difference between saying engines: 1, and "engines": 1, is the first one assigning the value to a variable and the second one is assigning it to a string?
eeflores
@eeflores
Jan 04 2017 03:18 UTC
@idowuogedengbe this.setGear = function(newGear) {
John Calhoun
@DougCal
Jan 04 2017 03:19 UTC
@darkflikk Thanks! It's working well now!
CamperBot
@camperbot
Jan 04 2017 03:19 UTC
dougcal sends brownie points to @darkflikk :sparkles: :thumbsup: :sparkles:
:cookie: 241 | @darkflikk |http://www.freecodecamp.com/darkflikk
Dylan Hsiao
@greedylan
Jan 04 2017 03:19 UTC
anyone has a clue how to use Regex to check if the first letter of a given string a vowel?
var vowels = /[aeiou]/g;
var str = "apple";
Joseph
@revisualize
Jan 04 2017 03:20 UTC
@AliFox15 Dopeoplewritelikethis?
I don't think people write like that. Maybe you should add some spaces?
Idowu Ogedengbe
@idowuogedengbe
Jan 04 2017 03:20 UTC
@eeflores @sjames1958gm thanks
CamperBot
@camperbot
Jan 04 2017 03:20 UTC
idowuogedengbe sends brownie points to @eeflores and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 893 | @eeflores |http://www.freecodecamp.com/eeflores
:star2: 5148 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ken Haduch
@khaduch
Jan 04 2017 03:20 UTC
@Draidel - I was going to confirm that, because the docs say that $matches[0] will be an array of full pattern matches, so you have to access it by $ancho[0][0], and if there was a second match $ancho[0][1], etc.
Joseph
@revisualize
Jan 04 2017 03:20 UTC
@greedylan Regexp
Dylan Hsiao
@greedylan
Jan 04 2017 03:21 UTC
T_T @revisualize
Doegena Fennich
@Doegena
Jan 04 2017 03:21 UTC
@AliFox15 What have you learned a couple challenges back? Ff you know that you will know the solution for the challenge you're currently stuck on.
Joseph
@revisualize
Jan 04 2017 03:21 UTC
@greedylan What? I'm giving you the answer.
eeflores
@eeflores
Jan 04 2017 03:21 UTC
@greedylan ^[aeoiu]
AliFox15
@AliFox15
Jan 04 2017 03:21 UTC
@revisualize oh...Thank you.
@Doegena yeah,Thanks for the tip
Ken Haduch
@khaduch
Jan 04 2017 03:23 UTC
@Draidel - http://php.net/manual/en/function.preg-match-all.php - you'll probably also have $ancho[1][0] because you have parentheses in your expression, as well.
Dylan Hsiao
@greedylan
Jan 04 2017 03:24 UTC
@eeflores @revisualize I dont know how to connect str and [aeiou]
Ken Haduch
@khaduch
Jan 04 2017 03:24 UTC
@greedylan - look for the String.match() documentation. Plus a little extra Regexp usage...
Mar Bocatcat
@Marbocatcat
Jan 04 2017 03:29 UTC
@eeflores omg dude , i just needed to put my <script> link in the bottom of the <body> page. Document is not loaded yet thats why its giving me null on all my script
@eeflores effing fail.
eeflores
@eeflores
Jan 04 2017 03:30 UTC
@Marbocatcat but yay you solved it!
Mar Bocatcat
@Marbocatcat
Jan 04 2017 03:31 UTC
@eeflores sigh 1 hour just to fix that , make sense though. Thanks again
CamperBot
@camperbot
Jan 04 2017 03:31 UTC
marbocatcat sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:warning: marbocatcat already gave eeflores points
Dylan Hsiao
@greedylan
Jan 04 2017 03:32 UTC
@khaduch so I have this. it returns ["a"]. Is there other method that return boolean value either true or false?
function translatePigLatin(str) {
  var vowels = /[aeiou]/g;
  return str[0].match(vowels);
}
translatePigLatin("apple");
eeflores
@eeflores
Jan 04 2017 03:33 UTC
@greedylan could just be str.match(vowels);
@greedylan but I think that will give you "ae"
Dylan Hsiao
@greedylan
Jan 04 2017 03:33 UTC
@eeflores I need to check only the first letter of a given string
Ariel
@Draidel
Jan 04 2017 03:34 UTC
@khaduch awesome ! thanks a lot !
CamperBot
@camperbot
Jan 04 2017 03:34 UTC
draidel sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2207 | @khaduch |http://www.freecodecamp.com/khaduch
Stephen James
@sjames1958gm
Jan 04 2017 03:34 UTC
@greedylan If you checked for non-vowels you could use the length of the match.
eeflores
@eeflores
Jan 04 2017 03:34 UTC
@greedylan something like return str[0].match(vowels).length > 0 ? true : false;
Dylan Hsiao
@greedylan
Jan 04 2017 03:34 UTC
@eeflores @sjames1958gm yes thank you !
CamperBot
@camperbot
Jan 04 2017 03:34 UTC
greedylan sends brownie points to @eeflores and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 894 | @eeflores |http://www.freecodecamp.com/eeflores
:star2: 5149 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
wlagos1992
@wlagos1992
Jan 04 2017 03:37 UTC
@revisualize sorry i got a phone call i changed it

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

function checkObj(checkProp) {
  // Your Code Here

 if (myObj.hasOwnProperty) 
   return myObj[checkProp];


  else return "Not Found";
}
// Test your code by modifying these values
checkObj("bedd");
eeflores
@eeflores
Jan 04 2017 03:38 UTC
@wlagos1992 hasOwnProperty is a function that needs an argument
wlagos1992
@wlagos1992
Jan 04 2017 03:39 UTC
@eeflores isnt my "else return" my argument
eeflores
@eeflores
Jan 04 2017 03:40 UTC
@wlagos1992 the else return is a return value from your checkObj function
@wlagos1992 hasOwnProperty should be written as hasOwnProperty(blah) (but substitute something for blah)
wlagos1992
@wlagos1992
Jan 04 2017 03:44 UTC
@eeflores im sorry but i am not a fan of this things teaching methods sometimes i am really not understanding it, i would rather work backwards.. okay so does this work
@eeflores at first you told me it was the arguement that was wrong and now youre telling me its the first part too?
Rebecca
@alimily
Jan 04 2017 03:46 UTC
hello,everyOne
wlagos1992
@wlagos1992
Jan 04 2017 03:46 UTC

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

function checkObj(checkProp) {
  // Your Code Here

 if (myObj.hasOwnProperty) 
   return myObj[checkProp];


  else return "Not Found";

}
// Test your code by modifying these values
checkObj("");
this works when i use a code that exists like "gift" when i put soemthing that is false it leaves it blank, so is the problem with my if part or with my else part?
Rebecca
@alimily
Jan 04 2017 03:46 UTC
myBike.getGear() should return 4 after calling myBike.setGear(4).
myBike.getGear() should return 3 after calling myBike.setGear(3).
myBike.getGear() should return 1 after calling myBike.setGear(1).
this what should i do
eeflores
@eeflores
Jan 04 2017 03:46 UTC
@wlagos1992 a function is made up of a few things: it's name, things you pass into it that it uses, and a return value
Rebecca
@alimily
Jan 04 2017 03:46 UTC
var Bike = function() {
this.getGear=function(){
return this.setGear;
};
this.setGear=function(arg){
return arg;
};
var gear;
};
this can be ok??
eeflores
@eeflores
Jan 04 2017 03:47 UTC
@wlagos1992 can you tell me the name of your function, and it's parameters/arguments?
wlagos1992
@wlagos1992
Jan 04 2017 03:47 UTC
@eeflores okay i have the name and the name of my value i can insert
@eeflores checkObj is the name of my func
eeflores
@eeflores
Jan 04 2017 03:47 UTC
yep
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:47 UTC
no @alimily
wlagos1992
@wlagos1992
Jan 04 2017 03:47 UTC
and you can enter anything in the form of checkProp
its parameters are gift bed pet
eeflores
@eeflores
Jan 04 2017 03:48 UTC
@wlagos1992 checkProp is the argument to the checkObj function
Rebecca
@alimily
Jan 04 2017 03:48 UTC
@HeebieGeeBee can youtell me
wlagos1992
@wlagos1992
Jan 04 2017 03:48 UTC
values of pony kitten sleigh
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:48 UTC
thats getting into a bit of a mess you might want to reset your code and rethink @alimily
Jerry Purvis
@MessiaHack
Jan 04 2017 03:48 UTC
function nextInLine(arr, item) {
  arr = testArr;
  arr.push(item);
  item = arr.shift();

  return item;  // Change this line
}

// Test Setup
var testArr = [5,6,7,8,9];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 10)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
can someone tell me what I am doing wrong?
wlagos1992
@wlagos1992
Jan 04 2017 03:48 UTC
Okay that is my arguement, thank you that term wasnt solid in my head
Rebecca
@alimily
Jan 04 2017 03:49 UTC
@HeebieGeeBee how do i do
eeflores
@eeflores
Jan 04 2017 03:49 UTC
@wlagos1992 so the word hasOwnProperty is also a function (provided by the javascript environment)
Stephen James
@sjames1958gm
Jan 04 2017 03:49 UTC
@MessiaHack Dont overwrite the input parameter arr
wlagos1992
@wlagos1992
Jan 04 2017 03:49 UTC
@eeflores okay so i can use hasOwnProperty(WHAT DO I PUT HERE)
@eeflores do i use my arguement there?
Jerry Purvis
@MessiaHack
Jan 04 2017 03:50 UTC
@sjames1958gm I don't understand.
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:50 UTC
whats the name of the exercise again @alimily ?
eeflores
@eeflores
Jan 04 2017 03:50 UTC
@wlagos1992 close ... you know how you're using myObj[checkProp]?
Rebecca
@alimily
Jan 04 2017 03:50 UTC
Make Object Properties Private
Kevin Chandra
@Kaence
Jan 04 2017 03:50 UTC
guys
im stuck here and dont know what to do
help me out
CamperBot
@camperbot
Jan 04 2017 03:50 UTC
no wiki entry for: me out
eeflores
@eeflores
Jan 04 2017 03:51 UTC
@wlagos1992 you want to check that checkProp exists in myObj before being able to call myObj[checkProp]
Jerry Purvis
@MessiaHack
Jan 04 2017 03:51 UTC
nvm
thanks @sjames1958gm
CamperBot
@camperbot
Jan 04 2017 03:51 UTC
messiahack sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5150 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
eeflores
@eeflores
Jan 04 2017 03:51 UTC
@wlagos1992 so you would check by if(myObj.hasOwnProperty(checkProp)
wlagos1992
@wlagos1992
Jan 04 2017 03:51 UTC
@eeflores
 if (hasOwnProperty(checkProp)) 
   return myObj[checkProp];
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 03:52 UTC

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line

var myStr = "This is the start. " + "This is the end.";

whats wrong with above code its not passsing help

eeflores
@eeflores
Jan 04 2017 03:52 UTC
@wlagos1992 you would want to check the property in relation to myObj
wlagos1992
@wlagos1992
Jan 04 2017 03:52 UTC
@eeflores you are a saint! thank you the way you showed me i know have a far deeper understanding of how that works
CamperBot
@camperbot
Jan 04 2017 03:52 UTC
wlagos1992 sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:cookie: 895 | @eeflores |http://www.freecodecamp.com/eeflores
wlagos1992
@wlagos1992
Jan 04 2017 03:53 UTC
@eeflores thank you for taking the time too that meant a lot
CamperBot
@camperbot
Jan 04 2017 03:53 UTC
wlagos1992 sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:warning: wlagos1992 already gave eeflores points
eeflores
@eeflores
Jan 04 2017 03:53 UTC
@wlagos1992 good stuff ... does it make a little bit of sense?
Jerry Purvis
@MessiaHack
Jan 04 2017 03:53 UTC
So I've refactored my code as best as I know how, but I am still not happy. I have one long function, and I want to break it up into separate functions so that I can use the search function as well, but I am at a loss
wlagos1992
@wlagos1992
Jan 04 2017 03:54 UTC
@eeflores yes you dont even know i was close behind eery word haha thank you
CamperBot
@camperbot
Jan 04 2017 03:54 UTC
wlagos1992 sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:warning: wlagos1992 already gave eeflores points
eeflores
@eeflores
Jan 04 2017 03:54 UTC
@wlagos1992 anyway, good job, and onward!
wlagos1992
@wlagos1992
Jan 04 2017 03:54 UTC
@eeflores so wait
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:54 UTC
@alimily have you reset your code?
wlagos1992
@wlagos1992
Jan 04 2017 03:54 UTC
@eeflores i am essentially doing two functions on that one line is that correct?
@eeflores i am checking the checkProp of myObj exists
Rebecca
@alimily
Jan 04 2017 03:55 UTC
yes
wlagos1992
@wlagos1992
Jan 04 2017 03:55 UTC
@eeflores no wait so thats the only thing im doing in that line
Rebecca
@alimily
Jan 04 2017 03:55 UTC
now what should i do
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 03:55 UTC
HI help

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line

var myStr = "This is the start. " + "This is the end.";

wlagos1992
@wlagos1992
Jan 04 2017 03:56 UTC
@eeflores i guess in my head i would have wanted to do if (myObj(checkProp).hasOwnProperty) that would have made more sense before i understoof
eeflores
@eeflores
Jan 04 2017 03:56 UTC
@wlagos1992 it's made up of a couple of parts: the function call to hasOwnProperty that returns true or false, and the if statement to act on the true/false value
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:57 UTC
lets go through what its asks you to do step by step @alimily Modify the Bike constructor to have a private property called gear
Rebecca
@alimily
Jan 04 2017 03:57 UTC
i just want to know how to let myBike.getGear return myBike.setGear(4).
Ken Haduch
@khaduch
Jan 04 2017 03:57 UTC
@DILIPKUMARJOSHI - which lesson is this?
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:57 UTC
do this first step first
Rebecca
@alimily
Jan 04 2017 03:57 UTC
yes,i have gear property
var gear;
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:58 UTC
have you defined it with some value?
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 03:58 UTC
@khaduch Concatenating Strings with Plus Operator | Free Code Camp
Rebecca
@alimily
Jan 04 2017 03:58 UTC
no
Ken Haduch
@khaduch
Jan 04 2017 03:58 UTC
@DILIPKUMARJOSHI - never mind, I found it. Your code looks good. Try to save your code, reset the lesson, (maybe even reload the lesson) and paste your solution back in. Sometimes things get cached in the browser and don't want to leave...
eeflores
@eeflores
Jan 04 2017 03:59 UTC
@DILIPKUMARJOSHI could you reset the challenge and enter the code again?
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 03:59 UTC
you're going to have to
Rebecca
@alimily
Jan 04 2017 03:59 UTC
as the freecodecamp asked ,no value to gear
next ,what i should do
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 03:59 UTC
@eeflores okay
@khaduch oh i see okay
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:00 UTC
where does it say that? @alimily
Rebecca
@alimily
Jan 04 2017 04:00 UTC
myBike.gear should remain undefined.
Stephen James
@sjames1958gm
Jan 04 2017 04:01 UTC
@alimily If myBike.gear is not undefined then you are likely setting this.gear somewhere
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 04:02 UTC
@khaduch OMG its not passing.
@eeflores I did several times but its not passing.
Stephen James
@sjames1958gm
Jan 04 2017 04:02 UTC
@DILIPKUMARJOSHI Any specific test is failing?
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:03 UTC
@alimily well i dont see that but ok move onto the next step
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 04:03 UTC
\
@sjames1958gm Error : myStr should have a value of This is the start. This is the end.
Stephen James
@sjames1958gm
Jan 04 2017 04:03 UTC
@DILIPKUMARJOSHI Hmm I copied your code to my editor and it passed :(
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 04:04 UTC
@sjames1958gm oh my goodness then what i have to do now.
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:04 UTC
@alimily make the first public method of getGear to get the gear
Gant Allen
@I-Am-Booger
Jan 04 2017 04:04 UTC
Free code camp is making the brain hurt.
Ken Haduch
@khaduch
Jan 04 2017 04:05 UTC
@I-Am-Booger - it happens to all of us... ;)
Gant Allen
@I-Am-Booger
Jan 04 2017 04:05 UTC
Hopefully this pays off @khaduch :)
Rebecca
@alimily
Jan 04 2017 04:05 UTC
The method getGear of myBike should be accessible outside the object.
The method setGear of myBike should be accessible outside the object.
myBike.gear should remain undefined.
myBike.getGear() should return 4 after calling myBike.setGear(4).
myBike.getGear() should return 3 after calling myBike.setGear(3).
myBike.getGear() should return 1 after calling myBike.setGear(1).
Ken Haduch
@khaduch
Jan 04 2017 04:06 UTC
@DILIPKUMARJOSHI - can you go try a totally different browser? It should work if you reset your browser and reload... the code looks correct.
Rebecca
@alimily
Jan 04 2017 04:06 UTC
here is thefreecodecamp asked
Dilip Kumar Joshi
@DILIPKUMARJOSHI
Jan 04 2017 04:06 UTC
@khaduch okay i will try like that
Stephen James
@sjames1958gm
Jan 04 2017 04:06 UTC
@alimily Can you post your code?
Ken Haduch
@khaduch
Jan 04 2017 04:06 UTC
@I-Am-Booger - it depends what you're looking for. If you want to stretch your brain, this is a good place for it. The lessons are pretty good, but they take leaps in some places...
@DILIPKUMARJOSHI - maybe just re-enter your code after you do that, too, don't paste in case there is something strange in your original window? (Just making other guesses here.)
Gant Allen
@I-Am-Booger
Jan 04 2017 04:07 UTC
I can see that @khaduch
Rebecca
@alimily
Jan 04 2017 04:07 UTC

var Bike = function() {

// Only change code below this line.

var gear;
this.setGear=function(){

} ;

this.getGear=function(){

};

};

here is my code
but i want to know is how to let myBike.getGear() should return 1 after calling myBike.setGear(1).
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:09 UTC
how do you usually make a function return something? @alimily
Rebecca
@alimily
Jan 04 2017 04:10 UTC
once
i see the instance is funciton
so do i

var Car = function() {
// this is a private variable
var speed = 10;

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

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

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

you see ,it is also function
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:11 UTC
yeah look at the this-getSpeed function, its very similar to getGear
Gant Allen
@I-Am-Booger
Jan 04 2017 04:12 UTC
I'm on the Counting Cards part. I know I have the switch part down right. I think I do at least. I am just not for sure on what else I need to do ```
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:13 UTC
@I-Am-Booger compare the count to see if you need to return hold or bet
Rebecca
@alimily
Jan 04 2017 04:14 UTC

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

this.getGear=function getgear(gear){
return this.setGear();

};

};

how about this
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:15 UTC
no
Rebecca
@alimily
Jan 04 2017 04:15 UTC
why again
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:15 UTC
for setGear you just need to return what the gear has been changed to
and for getGear you just need to return what the gear is
well you dont need to return in setGear you just need to change the value of gear
Ogundele Olumide
@Lumexralph
Jan 04 2017 04:16 UTC
@I-Am-Booger increment or decrement count
Rebecca
@alimily
Jan 04 2017 04:16 UTC
how to change
the asked myBike.getGear() should return 3 after calling myBike.setGear(3).
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:18 UTC
in set gear change the gear to your setGear function parameter
Rebecca
@alimily
Jan 04 2017 04:19 UTC
oh,i see
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:19 UTC
and just for ths challenge use the word change for the function argument
its messes up if you use gear as the argument for the function and the variable
Rebecca
@alimily
Jan 04 2017 04:20 UTC
this.setGear=function setgear(arg){
gear=arg;
return gear;
} ;
this is ok??
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:20 UTC
you dont need to return gear there
return gear in the getGear function
Rebecca
@alimily
Jan 04 2017 04:21 UTC
yes,yes ,it is ok
you are so nice and smart
thank you
HeebieGeeBee
@HeebieGeeBee
Jan 04 2017 04:22 UTC
not sure about that but youre welcome
Rebecca
@alimily
Jan 04 2017 04:24 UTC
i want to tell you how i appreciate your help,it means too much
you are a so good person
Joseph
@revisualize
Jan 04 2017 04:33 UTC
Emily Sperry
@sperrye
Jan 04 2017 04:40 UTC
I finished my quote generator.
Alexander Køpke
@alexanderkopke
Jan 04 2017 04:41 UTC
:+1:
Ken Haduch
@khaduch
Jan 04 2017 04:44 UTC
@sperrye - great!
grantknaver
@grantknaver
Jan 04 2017 04:48 UTC
anyone have any ideas why this code keeps prompting an infinite loop
Ken Haduch
@khaduch
Jan 04 2017 04:48 UTC
@revisualize - thanks for posting that - I added it to my long list of udemy courses that I hope to get to eventually... :)
CamperBot
@camperbot
Jan 04 2017 04:48 UTC
khaduch sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2822 | @revisualize |http://www.freecodecamp.com/revisualize
Ken Haduch
@khaduch
Jan 04 2017 04:48 UTC
@grantknaver - do you mean the chatroom? :)
it feels like an infinite loop... or groundhog's day... :)
James
@JaCorbett
Jan 04 2017 04:49 UTC
Hey everyone!
So, I am stuck

function functionWithArgs(c, d) {
console.log(c+d)
}

functionWithArgs(1,2)
functionWithArgs(7,9)

grantknaver
@grantknaver
Jan 04 2017 04:50 UTC
lol na. here is the code
James
@JaCorbett
Jan 04 2017 04:50 UTC
I am calling the function "functionWithArgs" .... aren't I?
Ken Haduch
@khaduch
Jan 04 2017 04:50 UTC
@JaCorbett - it looks like it? What is it telling you?
Joseph
@revisualize
Jan 04 2017 04:50 UTC
@sperrye Grats. You're further along than I am.
James
@JaCorbett
Jan 04 2017 04:50 UTC
Well, I have an "X" and it states: "Call functionWithArgs after you define it."
grantknaver
@grantknaver
Jan 04 2017 04:51 UTC

function fearNotLetter(str) {

  for (var i = 0; i < str.length -1; i++){
    for(var j = 1; j < str.length; j++){
    alert(String.fromCharCode(str.charCodeAt(j)));
    }
  }  
}

fearNotLetter("abce");
Joseph
@revisualize
Jan 04 2017 04:51 UTC
James
@JaCorbett
Jan 04 2017 04:51 UTC
everything else is checked off..
Emily Sperry
@sperrye
Jan 04 2017 04:53 UTC
@revisualize no, should I be?
Ken Haduch
@khaduch
Jan 04 2017 04:53 UTC
@JaCorbett @JaCorbett - you need to end your lines of code with ;
James
@JaCorbett
Jan 04 2017 04:54 UTC
son of bitch....I literally just realized that
hahahaha
Thanks @khaduch
CamperBot
@camperbot
Jan 04 2017 04:54 UTC
jacorbett sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2208 | @khaduch |http://www.freecodecamp.com/khaduch
grantknaver
@grantknaver
Jan 04 2017 04:54 UTC
@khaduch any ideas
James
@JaCorbett
Jan 04 2017 04:54 UTC
I am literally LOLing and smh right now
Joseph
@revisualize
Jan 04 2017 04:56 UTC
@sperrye Yes.
foxdog
@foxdog
Jan 04 2017 04:56 UTC
Hello
Ken Haduch
@khaduch
Jan 04 2017 04:57 UTC
@grantknaver - no - are you seeing it flag infinite loop somewhere? Maybe they don't want you doing an alert inside a loop?
Emily Sperry
@sperrye
Jan 04 2017 04:57 UTC
Am I right in thinking there are two steps to this weather app? 1/Get location 2/Get weather for that location?
Joseph
@revisualize
Jan 04 2017 04:58 UTC
@sperrye There are a few more but... Sure.
Ken Haduch
@khaduch
Jan 04 2017 04:58 UTC
@sperrye - yes, that's about the size of it...
grantknaver
@grantknaver
Jan 04 2017 04:58 UTC
I think but when I console.log it, for some reason it keeps doing it. Might be a freeCodeCamp error
Ken Haduch
@khaduch
Jan 04 2017 04:58 UTC
@grantknaver - which lesson is this? I have to try it and see what it's doing...
foxdog
@foxdog
Jan 04 2017 04:59 UTC
So... I'm on lesson 173 and I'm stuck.
Ken Haduch
@khaduch
Jan 04 2017 05:00 UTC
@foxdog - what is "lesson 173" - the numbers don't correspond to the lessons. Please give the title, post code, ask questions, etc... :)
foxdog
@foxdog
Jan 04 2017 05:00 UTC
oh, Stand in Line is the title.
Ken Haduch
@khaduch
Jan 04 2017 05:01 UTC
@foxdog - okay, what is your sticking point?
ErikEBM
@ErikEBM
Jan 04 2017 05:01 UTC
Hi
I need help
foxdog
@foxdog
Jan 04 2017 05:02 UTC
I'm not really getting what its wanting me to do.... iterate over the numbers?
ErikEBM
@ErikEBM
Jan 04 2017 05:02 UTC
Somebody can help me, please?
Johnny
@JohnnyBizzel
Jan 04 2017 05:02 UTC
@sperrye One way to get the location is to use an IP addr API.
Ken Haduch
@khaduch
Jan 04 2017 05:02 UTC
@foxdog - you are working with an array, adding elements to the "end" of the array, and removing them from the head of the array. That's basically it.
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:03 UTC

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

switch (answer){
case 1:
console.log("alpha");
break;
case 2:
console.log("beta");
break;
case 3:
console.log("gamma");
break;
case 4:
console.log("delta");
break;
}

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

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

switch is not work
not working
ErikEBM
@ErikEBM
Jan 04 2017 05:03 UTC

for(var e = 0; e < contacts.length; e++){
if(contacts[e][0] === "firstName"){
return contacts[e].firstName;
} else {
return "No such contact";
}

for(var i = 0; i < contacts[e].length; i++){
if(contacts[e][i].hasOwnProperty(prop) === true){
return contacts[e][i].prop;
} else {
return "No such property";
}
}
}

heroiczero
@heroiczero
Jan 04 2017 05:03 UTC
@huzaifa83 gotta set it to answer
ErikEBM
@ErikEBM
Jan 04 2017 05:03 UTC
What is wrong whit my code?
es the lesson 216
Ken Haduch
@khaduch
Jan 04 2017 05:04 UTC
@foxdog - the "line" is an analogy to a line such as a bank teller line, where a customer comes in, gets in the end of the line, the first person in line is served by the next teller. In Great Britain, they refer to it as a "queue", and in computer science, they refer to it as a queue. so the "Get in Line" is kind of a play on words, in my reckoning...
heroiczero
@heroiczero
Jan 04 2017 05:04 UTC
@huzaifa83 also it is switch of the parameter not your local variable of answer
aleeex
@rodneystrong
Jan 04 2017 05:04 UTC

i'm stuck on this one: https://www.freecodecamp.com/challenges/using-objects-for-lookups

It's titled "Using Objects for Lookups"

heroiczero
@heroiczero
Jan 04 2017 05:04 UTC
@huzaifa83 function caseInSwitch(val) val is your parameter
aleeex
@rodneystrong
Jan 04 2017 05:05 UTC

this is my code so far:

var lookup = {
alpha: "Adams",
bravo: "Boston",
charlie: "Chicago",
delta: "Denver",
echo: "Easy",
foxtrot: "Frank"
};

lookup['alpha'];

Johnny
@JohnnyBizzel
Jan 04 2017 05:05 UTC
@huzaifa83 Why do you switch answer and not val?
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:05 UTC
so in the switch in I need to put the parameter?
heroiczero
@heroiczero
Jan 04 2017 05:06 UTC
@rodneystrong gotta set it equal to result
Ken Haduch
@khaduch
Jan 04 2017 05:06 UTC
@foxdog - I messed up on my previous post: I didn't put your name. Check up about ten responses.
Johnny
@JohnnyBizzel
Jan 04 2017 05:06 UTC
@rodneystrong Looks fine (what you wrote).
@huzaifa83 I would
heroiczero
@heroiczero
Jan 04 2017 05:07 UTC
@rodneystrong make sure you use your parameter for your function
aleeex
@rodneystrong
Jan 04 2017 05:07 UTC
@heroiczero result = lookup['alpha']; ??
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:07 UTC

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

switch (val){
case 1:
console.log("alpha");
break;
case 2:
console.log("beta");
break;
case 3:
console.log("gamma");
break;
case 4:
console.log("delta");
break;
}

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

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

foxdog
@foxdog
Jan 04 2017 05:08 UTC
@khaduch you are referring to the queue response?
Ken Haduch
@khaduch
Jan 04 2017 05:08 UTC
@foxdog - yes...
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:08 UTC
I have changed from variable to parameter
heroiczero
@heroiczero
Jan 04 2017 05:08 UTC
@rodneystrong then result will always return the alpha value of lookup gotta use the parameter. function(parameter)
aleeex
@rodneystrong
Jan 04 2017 05:08 UTC
thanks @JohnnyBizzel but somethin
CamperBot
@camperbot
Jan 04 2017 05:08 UTC
rodneystrong sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1091 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
aleeex
@rodneystrong
Jan 04 2017 05:09 UTC
umm.. wow ok didn't know cmaperbot would do that
but @JohnnyBizzel its still not workin
Ken Haduch
@khaduch
Jan 04 2017 05:09 UTC
@foxdog - my response up there: about the queue
heroiczero
@heroiczero
Jan 04 2017 05:09 UTC
@huzaifa83 gotta use answer=instead of console.log
Johnny
@JohnnyBizzel
Jan 04 2017 05:09 UTC
@rodneystrong are you using a function?
foxdog
@foxdog
Jan 04 2017 05:09 UTC
I suppose I understand what is wanting, I think I just dont understand how to go about it.
heroiczero
@heroiczero
Jan 04 2017 05:10 UTC
@huzaifa83 return answer; you have that in your function
aleeex
@rodneystrong
Jan 04 2017 05:10 UTC
@JohnnyBizzel yes, i'll paste entire code here

// Setup
function phoneticLookup(val) {
var result = "";

// Only change code below this line
// switch(val) {
// case "alpha":
// result = "Adams";
// break;
// case "bravo":
// result = "Boston";
// break;
// case "charlie":
// result = "Chicago";
// break;
// case "delta":
// result = "Denver";
// break;
// case "echo":
// result = "Easy";
// break;
// case "foxtrot":
// result = "Frank";
// }

var lookup = {
alpha: "Adams",
bravo: "Boston",
charlie: "Chicago",
delta: "Denver",
echo: "Easy",
foxtrot: "Frank"
};

lookup['alpha'];

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

// Change this value to test
phoneticLookup("charlie");

it wants me to change from switch statement to object lookup. which is why i commented out their switch statement
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:10 UTC
Got
Johnny
@JohnnyBizzel
Jan 04 2017 05:10 UTC
@rodneystrong Use val
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:10 UTC
it
Johnny
@JohnnyBizzel
Jan 04 2017 05:10 UTC
@huzaifa83 Got what?
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:10 UTC
Thanks alot
Got the answer
Johnny
@JohnnyBizzel
Jan 04 2017 05:10 UTC
@huzaifa83 Who?
Nicolas
@annata83
Jan 04 2017 05:11 UTC
hey everybody
Huzaifa Gadiwala
@huzaifa83
Jan 04 2017 05:11 UTC
Thanks Johnny
aleeex
@rodneystrong
Jan 04 2017 05:11 UTC
@JohnnyBizzel use 'val' where ?
Nicolas
@annata83
Jan 04 2017 05:11 UTC
going crazy here
aleeex
@rodneystrong
Jan 04 2017 05:11 UTC
on my return statement ?
Ken Haduch
@khaduch
Jan 04 2017 05:11 UTC
@foxdog - the function receives two arguments - an array, in the variable arr, and an item, in the variable item. Sometimes the array has values, sometimes it is an empty array, but you can take the incoming item and add it to the "end of the line" (the array, arr) and take the first value out of the line and return it. You should always be using arr as the array within the function, and look at the Array methods that add elements to the end of the array and remove them from the start of the array.
Nicolas
@annata83
Jan 04 2017 05:11 UTC
coding its haaard!!!!
Johnny
@JohnnyBizzel
Jan 04 2017 05:11 UTC
@rodneystrong result = lookup[val]
@huzaifa83 anytime
Nicolas
@annata83
Jan 04 2017 05:12 UTC
i am stuck at 225
if anybody has some guidance i apreciate it
heroiczero
@heroiczero
Jan 04 2017 05:12 UTC
@annat83 what is the exercise called
aleeex
@rodneystrong
Jan 04 2017 05:13 UTC
@JohnnyBizzel oh that worked! thank you!
CamperBot
@camperbot
Jan 04 2017 05:13 UTC
rodneystrong sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:warning: rodneystrong already gave johnnybizzel points
Ken Haduch
@khaduch
Jan 04 2017 05:13 UTC
@annat83 - the lesson name, please, the numbers are not meaningful...
Nicolas
@annata83
Jan 04 2017 05:13 UTC
@rodneystrong Testing Objects for Properties
Johnny
@JohnnyBizzel
Jan 04 2017 05:13 UTC
@rodneystrong :beers:
aleeex
@rodneystrong
Jan 04 2017 05:13 UTC
@JohnnyBizzel but how would I know to put that line of code there ?
Nicolas
@annata83
Jan 04 2017 05:13 UTC

function checkObj(checkProp) {
if (myObj.hasOwnProperty("checkProp"))
return myObj[checkProp];
return "Not Found" ;

dosent work

aleeex
@rodneystrong
Jan 04 2017 05:14 UTC
oooh oh oh oh nevermind
i got it @JohnnyBizzel
Johnny
@JohnnyBizzel
Jan 04 2017 05:14 UTC
@rodneystrong functions use parameters and arguments which makes them re-usable for different situations.
aleeex
@rodneystrong
Jan 04 2017 05:14 UTC
ugh
heroiczero
@heroiczero
Jan 04 2017 05:14 UTC
@annat83 (myObj.hasOwnProperty(checkProp))
aleeex
@rodneystrong
Jan 04 2017 05:14 UTC
yea i just re-read the instructions on needing to assign the associated string to the "result" variable
ErikEBM
@ErikEBM
Jan 04 2017 05:14 UTC
Hi, i need hel whit the lesson 216
Ken Haduch
@khaduch
Jan 04 2017 05:14 UTC
@annat83 - within the function, do not put checkProp in quotes, otherwise that is just a string value, not the variable value.
aleeex
@rodneystrong
Jan 04 2017 05:14 UTC
thanks again for that though
Nicolas
@annata83
Jan 04 2017 05:14 UTC
i try like 5 diferent things
ErikEBM
@ErikEBM
Jan 04 2017 05:14 UTC

for(var e = 0; e < contacts.length; e++){
if(contacts[e][0] == "firstName"){
return contacts[e].firstName;
} else {
return "No such contact";
}

for(var i = 0; i < contacts[e].length; i++){
if(contacts[e][i].hasOwnProperty(prop) === true){
return contacts[e][i].prop;
} else {
return "No such property";
}
}
}

aleeex
@rodneystrong
Jan 04 2017 05:14 UTC
'preciate it!
Nicolas
@annata83
Jan 04 2017 05:14 UTC
cant figure it out
@khaduch let me check
oh my Gog,
it so terrible to get stuck like this
thanks @khaduch
CamperBot
@camperbot
Jan 04 2017 05:15 UTC
annat83 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2209 | @khaduch |http://www.freecodecamp.com/khaduch
Nicolas
@annata83
Jan 04 2017 05:16 UTC
tahnks @heroiczero
thanks @heroiczero
CamperBot
@camperbot
Jan 04 2017 05:16 UTC
:cookie: 616 | @heroiczero |http://www.freecodecamp.com/heroiczero
annat83 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
Nicolas
@annata83
Jan 04 2017 05:18 UTC
u know i really put focus into this... somedays its seems imposible to figure it out!!
'preciate it! GUYS
ErikEBM
@ErikEBM
Jan 04 2017 05:19 UTC
Help me please =(
CamperBot
@camperbot
Jan 04 2017 05:19 UTC
no wiki entry for: me please
ml3ha
@ml3ha
Jan 04 2017 05:19 UTC
Is anyone here familiar with twitter typeahead?
foxdog
@foxdog
Jan 04 2017 05:24 UTC
hey thanks @khaduch
CamperBot
@camperbot
Jan 04 2017 05:24 UTC
foxdog sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2210 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Jan 04 2017 05:25 UTC
@foxdog :+1:
foxdog
@foxdog
Jan 04 2017 05:26 UTC
I managed to pull it off using arr.push(item) and arr.shift
Ken Haduch
@khaduch
Jan 04 2017 05:26 UTC
@annat83 :+1:
@foxdog - that sounds about right... good work!
khaduch @khaduch - over and out for tonight... good luck and happy coding everyone!
abbas ashraf mughal
@abbasashraf
Jan 04 2017 05:28 UTC

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {

var result = "";
// Your code below this line
result = myNoun + myAdjective + myVerb + myAdverb;
// Your code above this line
return result;
}
// Change the wrds here to test your function
wordBlanks("dog", "big", "ran", "quickly");

its not working why

?
heroiczero
@heroiczero
Jan 04 2017 05:29 UTC
@abbasashraf make sure you are seperating that with a " " space or it will be one word
Rico042002
@rico042002
Jan 04 2017 05:31 UTC
Hello fellow JS ninja's
oldchicken
@oldturkey
Jan 04 2017 05:34 UTC

@ErikEBM for(i=0;i<4;i++){
if(contacts[i].firstName==firstName){
if(contacts[i].hasOwnProperty([prop])){
return contacts[i][prop];
}
else {return "No such property";}
}

}return "No such contact";

ErikEBM
@ErikEBM
Jan 04 2017 05:35 UTC
thank you so much =)
Rico042002
@rico042002
Jan 04 2017 05:35 UTC
add his name to give a brownie point
Dipal Gudhka
@dipalgudhka
Jan 04 2017 05:36 UTC
for the local weather is it ok to use simple weather?
Rico042002
@rico042002
Jan 04 2017 05:36 UTC
whenever you say thanks or someone helps you understand in a major way add their @username so they will receive a point like they passed a challenge
CamperBot
@camperbot
Jan 04 2017 05:36 UTC
rico042002 sends brownie points to @username :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for username
Ming Lei
@dabeister
Jan 04 2017 05:39 UTC
Hi all, any chance someone can help me fix up my code for Where do I belong? I'm so close, but I don't know how to account for one of the cases

function getIndexToIns(arr, num) {
  var sortedNumbers = arr.sort(function(a,b) {
    return a - b;
  });

  for (var i = 0; i < sortedNumbers.length; i++) {
    if (num <= sortedNumbers[i]) {
      return i;
    }

  }
}

getIndexToIns([40, 60], 50);
h1tag
@h1tag
Jan 04 2017 05:41 UTC
In the Where Do I Belong challenge, if the value num you want to insert is equal to another value in the array arr, where should you insert num?
Ming Lei
@dabeister
Jan 04 2017 05:41 UTC
i know the case that it;s failing right now is when num is greater than all the numbers in arr
but when i put in a return arr.length; in the code it messes with other cases, not sure why
Thanks @luishendrix92 @Rafase282 @hallaathrad for your help with Algorithm: Factorialize a Number
CamperBot
@camperbot
Jan 04 2017 05:41 UTC
lh15 sends brownie points to @luishendrix92 and @rafase282 and @hallaathrad :sparkles: :thumbsup: :sparkles:
:star2: 1436 | @rafase282 |http://www.freecodecamp.com/rafase282
:star2: 1231 | @luishendrix92 |http://www.freecodecamp.com/luishendrix92
:cookie: 529 | @hallaathrad |http://www.freecodecamp.com/hallaathrad
amarg26
@amarg26
Jan 04 2017 05:42 UTC
what is wrong with logic ???
Ming Lei
@dabeister
Jan 04 2017 05:42 UTC
@fortMaximus backsolving the test cases, it appears you have to put it in the first instance of where you see that value
amarg26
@amarg26
Jan 04 2017 05:42 UTC

```function lookUpProfile(firstName, prop){
var i;
for(i=0;i<contacts[i].lenght;i++)
{
if(contacts[i].firstName===firstName && contacts[i].prop===true)
{
if(contacts[i].prop!==null)
{
return contacts[i].prop;
}
else
{
return "no such a property";
}
}
else{
return "no such a contact";
}
}
}

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

Ming Lei
@dabeister
Jan 04 2017 05:42 UTC
@fortMaximus so i thought i accounted for that by putting it as <= instead of just < as i tried earlier
h1tag
@h1tag
Jan 04 2017 05:44 UTC
@dabeister let's wait and see if someone who knows the answer for sure, could answer us
Ming Lei
@dabeister
Jan 04 2017 05:45 UTC
getIndexToIns([10, 20, 30, 40, 50], 30) should return 2
getIndexToIns([3, 10, 5], 3) should return 0.
getIndexToIns([5, 3, 20, 3], 5) should return 2.
@fortMaximus just from the checklist, i think i'm only missing the final case:
getIndexToIns([2, 5, 10], 15) should return 3.
h1tag
@h1tag
Jan 04 2017 05:47 UTC
yea, true, sorry
Ming Lei
@dabeister
Jan 04 2017 05:47 UTC
no problem, wording on these things usually ambiguous
amarg26
@amarg26
Jan 04 2017 05:49 UTC

```function lookUpProfile(firstName, prop){
var i;
for(i=0;i<contacts[i].lenght;i++)
{
if(contacts[i].firstName===firstName && contacts[i].prop===true)
{
if(contacts[i].prop!==null)
{
return contacts[i].prop;
}
else
{
return "no such a property";
}
}
else{
return "no such a contact";
}
}
}

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

why ``` not working for me ????
h1tag
@h1tag
Jan 04 2017 05:56 UTC
@amarg26 there's a markdown help another the chat/compose switch or just press (ctrl + shift + m) to open the markdown help
Sparkin
@seanparkin
Jan 04 2017 05:56 UTC
you need to press shift+enter after the ```
amarg26
@amarg26
Jan 04 2017 05:58 UTC
when i type ` symbol then it gets printed on second keypress like this
````
Philippe
@PhilTRobot
Jan 04 2017 05:58 UTC
hey Amarg! you need to loop through the properties of each object for 1
@amarg26 you need to loop through the properties of each object for 1
amarg26
@amarg26
Jan 04 2017 05:59 UTC
@PhilTRobot what is going wrong with my loop ??
Philippe
@PhilTRobot
Jan 04 2017 06:00 UTC
well you are only looping through the array, so you need to add an additional loop to go through the properties of each object
@amarg26
@amarg26 well you are only looping through the array, so you need to add an additional loop to go through the properties of each object
amarg26
@amarg26
Jan 04 2017 06:00 UTC
ok.
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:02 UTC
@amarg26 i<contacts[i].lenght it should belength typo
@amarg26 and prop is a variable not a valid property, dot method won't work, use [ ] method
amarg26
@amarg26
Jan 04 2017 06:07 UTC

is this correct or still something missing ??? ```
function lookUpProfile(firstName, prop){
var i;
for(i=0;i<contacts[i].firstName;i++)
{
for(i=0;i<contacts[i].prop;i++)
{
if(contacts[i].firstName===firstName && contacts[prop]===prop)
{
if(contacts[prop]!==null)
{
return contacts[prop];
}
else
{
return "no such a property";
}
}
else{
return "no such a contact";
}

           } 
   }

}

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

```

Ogundele Olumide
@Lumexralph
Jan 04 2017 06:10 UTC
@amarg26 your for loop condition is logically wrong, treat prop always as a variable if you want to use it to access the object
tech-tron
@tech-tron
Jan 04 2017 06:12 UTC
so im working a problem with nested arrays where i have to return the largest value of each nested array. i used a for loop with a sort function and then, in that same for loop i ran a slice and its saying that arr[i].slice(0,1) isnt a function
NoobsNoob
@NoobsNoob
Jan 04 2017 06:15 UTC

Can someone please explain how the following user of arr.Filter works?

function diffArray(arr1, arr2) { 
  var newArr1 = arr1.filter(function(obj) { return arr2.indexOf(obj) == -1; }); 
  var newArr2 = arr2.filter(function(obj) { return arr1.indexOf(obj) == -1; });   
  newArr = newArr1.concat(newArr2);
  return newArr;
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);

I got to this solution based on this SO tread, but while I was able to change it for the solution I haven't been able to work out how it works. I've read the MDN Page on the function but still can't break down the logic in the code above. Thanks :)

tech-tron
@tech-tron
Jan 04 2017 06:16 UTC
for( var i = 0; i < arr.length; i++){
arr = arr[i].sort(function(a,b) {
return a-b;
});
arr = arr[i].slice(0,1);
}
NoobsNoob
@NoobsNoob
Jan 04 2017 06:17 UTC
Sorry it's for the Diff Two Arrays exercise
Jake
@neozane1
Jan 04 2017 06:17 UTC
hello world
CamperBot
@camperbot
Jan 04 2017 06:17 UTC

welcome to FreeCodeCamp @neozane1!

Ogundele Olumide
@Lumexralph
Jan 04 2017 06:21 UTC
@tech-tron don't use a sort array method in a loop, sort is also a kind of loop, sort the arr before using the arr in the for loop
DevRice
@DevRice
Jan 04 2017 06:21 UTC
'''
CamperBot
@camperbot
Jan 04 2017 06:21 UTC
:bulb: to format code use backticks! ``` more info
Nick McCord
@Thrillxlordz
Jan 04 2017 06:21 UTC
is there a way to make a variable inversely proportional to another variable, without running into a 'divide by zero' possibility?
DevRice
@DevRice
Jan 04 2017 06:22 UTC
```
oops
amarg26
@amarg26
Jan 04 2017 06:22 UTC
still incorrect ???
function lookUpProfile(firstName, prop)
{
  var i;
  for(i=0;i<contacts[firstName];i++)
       {
     for(i=0;i<contacts[prop];i++)
           {
            if(contacts[firstName]===firstName && contacts[prop]===prop)
              {
                if(contacts[prop]!==null)
                   {
                return contacts[prop];
                   }
                 else
                 {
                  return "no such a property";
                 }
              }
         else{
            return "no such a contact";
             }

           } 
       }
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
asarialtun
@asarialtun
Jan 04 2017 06:22 UTC
 $.getJSON(apiString, function(json){
      console.log("getJSON");
      console.log(json);
      });
Why I can't see console.log messages within this function?
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:23 UTC
@NoobsNoob filter method returns an array it's working that returns boolean true on each index and ignores the element on the index that returns false, that's what happened here.... var newArr1 = arr1.filter(function(obj) { return arr2.indexOf(obj) == -1; }); var newArr2 = arr2.filter(function(obj) { return arr1.indexOf(obj) == -1; }); 2 arrays was produced and it was joined here newArr = newArr1.concat(newArr2);
NoobsNoob
@NoobsNoob
Jan 04 2017 06:24 UTC
@Lumexralph Thanks
CamperBot
@camperbot
Jan 04 2017 06:24 UTC
noobsnoob sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 642 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:26 UTC
@asarialtun what's apiString? any error message on your console?
@NoobsNoob :+1:
Phuong Nguyen
@neunygph
Jan 04 2017 06:27 UTC
Hello
Nick McCord
@Thrillxlordz
Jan 04 2017 06:27 UTC
hello
Phuong Nguyen
@neunygph
Jan 04 2017 06:27 UTC
Does any know a good image lazyload library other than the one from https://www.appelsiini.net/projects/lazyload?
asarialtun
@asarialtun
Jan 04 2017 06:28 UTC
@Lumexralph the apiString is "api.openweathermap.org/data/2.5/weather?lat=40.982661199999995&lon=29.093339800000003&APPID=3bb66aacd171791900486f10031c9d10" and there are no errors
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:28 UTC
@amarg26 you need just a for loop that iterates over contacts....each elements which is the objects in contacts will be contacts[i] and i should be less than length of contacts in the condition of your loop
Nitesh Piya
@nitespia
Jan 04 2017 06:28 UTC
Combine the two if statements into one statement which returns "Outside" if val is not between 10 and 20, inclusive. Otherwise, return "Inside".
Jake
@neozane1
Jan 04 2017 06:28 UTC
hey yall anyone good with Testing Objects for Properties challenge?
Nitesh Piya
@nitespia
Jan 04 2017 06:28 UTC

function testLogicalOr(val) {
// Only change code below this line

if (val <= 20|| val >= 10) {
return "Inside";
}

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

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

Ogundele Olumide
@Lumexralph
Jan 04 2017 06:29 UTC
@asarialtun in your browser console?
@neozane1 what are you trying to do
@nitespia do you understand how switch statement works?
asarialtun
@asarialtun
Jan 04 2017 06:30 UTC
@Lumexralph yes, no errors reported in browser console
@Lumexralph lol, you're helping many people like a superhero :clap:
Nitesh Piya
@nitespia
Jan 04 2017 06:31 UTC
@Lumexralph we have to use if statement with ||
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:31 UTC
@asarialtun my friends are not around, the league of helpers
Nitesh Piya
@nitespia
Jan 04 2017 06:31 UTC
Instructions
Combine the two if statements into one statement which returns "Outside" if val is not between 10 and 20, inclusive. Otherwise, return "Inside".
asarialtun
@asarialtun
Jan 04 2017 06:31 UTC
@Lumexralph I wish I can do the same sometime..
Nitesh Piya
@nitespia
Jan 04 2017 06:31 UTC

function testLogicalOr(val) {
// Only change code below this line

if (val) {
return "Outside";
}

if (val) {
return "Outside";
}

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

// Change this value to test
testLogicalOr(15);

Manish Giri
@Manish-Giri
Jan 04 2017 06:32 UTC
@nitespia you should test if val is between a certain range.
Joseph
@revisualize
Jan 04 2017 06:32 UTC
@amarg26 Why do you have two for loops for 1 array?
Manish Giri
@Manish-Giri
Jan 04 2017 06:32 UTC
if(val) will always return true, for a call like this testLogicalOr(15);.
@nitespia
Nitesh Piya
@nitespia
Jan 04 2017 06:33 UTC
its a default code
help me in this
amarg26
@amarg26
Jan 04 2017 06:33 UTC
@PhilTRobot
@amarg26 well you are only looping through the array, so you need to add an additional loop to go through the properties of each object
CamperBot
@camperbot
Jan 04 2017 06:33 UTC
no wiki entry for: me in this
Jake
@neozane1
Jan 04 2017 06:33 UTC

@Lumexralph what im trying to figure out is if useing the hasOwnProperty i should put it in the function like if i put checkProp.hasOwnProperty(myObj) or should i use myObj.hasOwnProperty(checkProp)? this is the base code i tried a couple varations. i tried using the if else statement didnt seem to work var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// Your Code Here

return "Change Me!";
}

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

Joseph
@revisualize
Jan 04 2017 06:33 UTC
@amarg26 This code up here :point_up: January 3, 2017 9:49 PM was better than the last code block that you pasted.
@neozane1 You should be accessing the object.
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:33 UTC
@nitespia use if(val <= 20 && val >= 10)
Joseph
@revisualize
Jan 04 2017 06:34 UTC
@neozane1 Object.hasOwnProperty()
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:34 UTC
@neozane1 it should be the other way round myObj.hasOwnProperty(checkProp)
amarg26
@amarg26
Jan 04 2017 06:34 UTC
this code ??
function lookUpProfile(firstName, prop){
var i;
for(i=0;i<contacts[i].firstName;i++)
{
for(i=0;i<contacts[i].prop;i++)
{
if(contacts[i].firstName===firstName && contacts[prop]===prop)
{
if(contacts[prop]!==null)
{
return contacts[prop];
}
else
{
return "no such a property";
}
}
else{
return "no such a contact";
}
           } 
   }
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
Nitesh Piya
@nitespia
Jan 04 2017 06:35 UTC
thanks @Lumexralph but we have to use |||
CamperBot
@camperbot
Jan 04 2017 06:35 UTC
nitespia sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
h1tag
@h1tag
Jan 04 2017 06:35 UTC

Hey, in the Where Do I Belong challenge, I solved it like this:

function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  arr.sort(function (a,b){
    return a - b;
  });

  arr.push(num); 
  arr.sort(function (a,b){
   return a- b;
 });

  return arr.indexOf(num); 
}

And although I've passed it, I don't think this is a right solution.

CamperBot
@camperbot
Jan 04 2017 06:35 UTC
:cookie: 643 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jan 04 2017 06:35 UTC
@neozane1 return the value of checkProp property in myObject
Jake
@neozane1
Jan 04 2017 06:35 UTC
@revisualize i should go with say myObj.hasOwnProperty(checkprop) ok when i tried that with adding not found in the return change me it didnt work for some reason
Joseph
@revisualize
Jan 04 2017 06:36 UTC
@amarg26 No.
Jake
@neozane1
Jan 04 2017 06:36 UTC
so with the return checkprop else return not found sound about right
Joseph
@revisualize
Jan 04 2017 06:36 UTC
@neozane1 That's part of my code for that challenge. So, why it doesn't work for you?
@neozane1 I know.
Alex
@MaeStat
Jan 04 2017 06:37 UTC
@fortMaximus nice solution
amarg26
@amarg26
Jan 04 2017 06:37 UTC
function lookUpProfile(firstName, prop){ var i; for(i=0;i<contacts[i].lenght;i++) { if(contacts[i].firstName===firstName && contacts[i].prop===true) { if(contacts[i].prop!==null) { return contacts[i].prop; } else { return "no such a property"; } } else{ return "no such a contact"; } } } // Change these values to test your function lookUpProfile("Akira", "likes");
Joseph
@revisualize
Jan 04 2017 06:38 UTC
@amarg26 That code is better.
Alex
@MaeStat
Jan 04 2017 06:38 UTC
@fortMaximus I've got another one. It's more complex
Joseph
@revisualize
Jan 04 2017 06:38 UTC
@amarg26 Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
@amarg26 How do you test objects for properties?
Jake
@neozane1
Jan 04 2017 06:39 UTC
@revisualize i checked my spelling and case sensitive first i was right on the money
@neozane1 What?
@neozane1 Looks incorrect to me.
Alex
@MaeStat
Jan 04 2017 06:41 UTC
@fortMaximus may be it will run without first sorting.
Joseph
@revisualize
Jan 04 2017 06:41 UTC
@amarg26 I just re-looked over your code. Your strings aren't correct.
Jake
@neozane1
Jan 04 2017 06:41 UTC
no i used myObj.hasOwnProperty(checkProp); return checkprop im thinking i need to do a if else statment with it and it should work i hope
Alex
@MaeStat
Jan 04 2017 06:41 UTC
@fortMaximus try to remove first sort.
Joseph
@revisualize
Jan 04 2017 06:41 UTC
@neozane1 But, you don't return checkProp.
Jake
@neozane1
Jan 04 2017 06:42 UTC
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found" @revisualize is what im susposed to do
h1tag
@h1tag
Jan 04 2017 06:43 UTC
@MaeStat I know, that's why I think it's not right because the challenge asks you to insert the second argument num in the first argument arr but arr has to be sorted first
Joseph
@revisualize
Jan 04 2017 06:43 UTC
@neozane1

If the property is found, return that property's value.

Jake
@neozane1
Jan 04 2017 06:43 UTC
@revisualize that is why i was thinking an if else statement was going to say if not then not found right
Joseph
@revisualize
Jan 04 2017 06:43 UTC
@neozane1 If true else false