These are chat archives for FreeCodeCamp/HelpJavaScript

15th
Jan 2017
Jonathan Mancia
@jonmancia
Jan 15 2017 00:00
why is that?
Phillip
@psnider22
Jan 15 2017 00:05
@oshane-willy99 agreed the switch is easier to use for that challenge
Dan Couper
@DanCouper
Jan 15 2017 00:09
@jeffersonnnn 'f'.repeat(6)would be 'ffffff '
no support in IE11, supprted everywhere else. + using fill is fine - you have to assume sane input, having negative numbers makes no sense in the context, so is a pointless optimisation in this context, you can’t have a negative number of repeated strings.
Austiclyse
@Austiclyse
Jan 15 2017 00:18
Why does java script not like adding or subtracting 0 to a variable?
Martynas
@FlintMayers
Jan 15 2017 00:19

Trying to return an array of the largest number from each array inside it.

I think a nested loop is the need. But right now it only returns the largests number from the last subarray


function largestOfFour(arr) {
  var result = 0;
  for(var i = 0; i < arr.length; i++){
    for(var j= 0; j < arr.length; j++){
     if(arr[i][j] > result){
       result = arr[i][j];
     }
    }
  }
  return result;
}


largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 50000, 1]]);
I think I need to use push to push numbers inside the array. Just not sure how
Dan Couper
@DanCouper
Jan 15 2017 00:22
result should be an array
then have a variable for each array that starts at 0
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:23
shouldn't it be j < arr[i].length? just pointing that out, may or maynot solve the problem.
Dan Couper
@DanCouper
Jan 15 2017 00:23
:point_up:
It won’t fix the core problem, but it needs to be that
Martynas
@FlintMayers
Jan 15 2017 00:25
@DanCouper I need 4 variables for each subarray?
Dan Couper
@DanCouper
Jan 15 2017 00:26
just set it up each time in the first loop
for(var i = 0; i < arr.length; i++){
  var max = 0;
  for(var j= 0; …..
the variable I called max there will be set to 0 every one of the four times the outer loop runs
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:27
and then push it to an array.
Dan Couper
@DanCouper
Jan 15 2017 00:27
that would be the thing you check against
Martynas
@FlintMayers
Jan 15 2017 00:27
I see now. It was the problem of scope to begin with. It wouldn't work ourside the first for loop right?
Dan Couper
@DanCouper
Jan 15 2017 00:28
no, because then you would have one max variable (as you have at the minute)
whereas
you want four; one for each of the four arrays
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:28
or you could've have, assigned result a value inside your first loop. that would work too.
Dan Couper
@DanCouper
Jan 15 2017 00:28
you could have it set up outside, then set it to 0 at that point every time
:)
great minds and all that
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:31
or explicitly set it to the first element of each array. options galore.
i meant arr[i][0]
Martynas
@FlintMayers
Jan 15 2017 00:32
Now I am just back to square one :D It just prints one single array with all the numbers.

function largestOfFour(arr) {
  var result = [];
  for(var i = 0; i < arr.length; i++){
    var max = 0;
    for(var j= 0; j < arr[i].length; j++){
     if(arr[i][j] > max){
       result.push(arr[i][j]);
     }
    }
  }
  return result;
}


largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 50000, 1]]);
Obviously it's because each array integer is higher than 0
Dan Couper
@DanCouper
Jan 15 2017 00:33
right, so you can’t just push immediately
what you want in the if is to set the value of max
Martynas
@FlintMayers
Jan 15 2017 00:33
I need a way to loop through each subarray and only take the highest integer
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:33
first assign it to max, and then push it to result
Dan Couper
@DanCouper
Jan 15 2017 00:34
:point_up:
at the same level as where the max variable is, not in the inner loop
ivangrozni14
@ivangrozni14
Jan 15 2017 00:34
why woundnt you rembemer i and j and just print array with that?
Phillip
@psnider22
Jan 15 2017 00:35
having a little trouble with this, I cant get it to return the winner outcome http://codepen.io/psnider22/full/xgEKXO/
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:35
assign it to the max variable inside the second for loop and push it to array outside the second loop
Martynas
@FlintMayers
Jan 15 2017 00:36
couldn't someone explain me why it won't work in the inner loop
@relentless-coder @DanCouper thank you guys I solved it with your assistance
CamperBot
@camperbot
Jan 15 2017 00:37
flintmayers sends brownie points to @relentless-coder and @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 444 | @dancouper |http://www.freecodecamp.com/dancouper
:cookie: 319 | @relentless-coder |http://www.freecodecamp.com/relentless-coder
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:38
@FlintMayers the reason you don't push it inside the loop is because you need to push the largest, not every other number which is bigger than max
@psnider22 let me check
Dan Couper
@DanCouper
Jan 15 2017 00:39
@FlintMayers :) :+1: Nested loops combined with multiple things changing get very confusing very fast; I'd avoid them where possible once you get comfortable with JS
Martynas
@FlintMayers
Jan 15 2017 00:40
@relentless-coder so inside the loop it would push every number that is bigger than current max?
@DanCouper Was there a solution without nested loops? I think it was intended to use them in this challenge.
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:41
@FlintMayers yes.
@psnider22 could you explain this line of code var winner = getDetermineWinner;
Dan Couper
@DanCouper
Jan 15 2017 00:42
@FlintMayers you want the order of operations like
result = []
max = 0
4 > max, max = 4
5 > max, max = 5
1 < max, max = 5
3 < max, max = 5
result = [5]
max = 0
13 > max, max = 13
….
Johnny
@JohnnyBizzel
Jan 15 2017 00:43
@psnider22 I can't see the definition for prompt
Phillip
@psnider22
Jan 15 2017 00:43
@relentless-coder used it for console.log(winner); at the end of that function
Johnny
@JohnnyBizzel
Jan 15 2017 00:44
@psnider22
function getUserChoice() {
 var userInput = "rock" ; // , paper, or scissors?");
 userInput = userInput.toLowerCase();
 if (userInput === "rock" || "paper" || "scissors") {
   return userInput;
 } else {
   console.log("Error");
 }
}
 function getComputerChoice() {
   var randomNumber = Math.floor(Math.random() * 3);
   switch (randomNumber) {
     case 0:
       return "rock";
     case 1:
       return "paper";
     case 2:
       return "scissors";
   }
 }

    function getDetermineWinner(userChoice, computerChoice) {
     var winner = getDetermineWinner;
     if (userChoice === computerChoice) {
       return "TIE";
     }
     if (userChoice === "rock") {
       if (computerChoice === "paper") {
         return "Computer Won";
       }
       if (userChoice === "paper") {
         if (computerChoice === "scissors") {
           return "Computer Won";
         } else {
           return "You Won";
         }
       }
     }
     if (userChoice === "scissors") {
       if (computerChoice === "rock") {
         return "Computer Won";
       } else {
         return "You Won";
       }
       console.log(winner);
     }
   }

function playGame() {
     var userChoice = getUserChoice();
     var computerChoice = getComputerChoice();
     console.log("You threw: " + userChoice);
     console.log("The computer threw: " + computerChoice);

   }
playGame();
Phillip
@psnider22
Jan 15 2017 00:45
@JohnnyBizzel do you know what prompt does?
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:46
you have defined playGame inside another function and calling it in global scope
Johnny
@JohnnyBizzel
Jan 15 2017 00:46
@psnider22 I presume it is a function to take user input from somewhere?
You should put something in the HTML to get the user's input.
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:46
see the error in the console, it says, playgame is not defined
Phillip
@psnider22
Jan 15 2017 00:46
yes,, its a popup that asks the user to input, rock, paper or scissors
@JohnnyBizzel
Johnny
@JohnnyBizzel
Jan 15 2017 00:46
@relentless-coder See my version
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:47
okay so you have changed your code. my bad, the pen you sent us had playgame defined inside another function
Johnny
@JohnnyBizzel
Jan 15 2017 00:47
@psnider22 No HTML in your codepen that I could see
Phillip
@psnider22
Jan 15 2017 00:47
html is not what im after right now
Dan Couper
@DanCouper
Jan 15 2017 00:47
@FlintMayers and yeah, you can use map, which runs a function for every element in an array, then use the JS function Math.max to get the highest number in a series of values. I’ll leave it as an exercise to figure out why this works:
function largestOfFour(arr) {
  return arr.map(subarray => Math.max(…subarray));
}
Johnny
@JohnnyBizzel
Jan 15 2017 00:47
@psnider22 The rest of the code I fixed works.
Alex
@Joshua-A-Smith
Jan 15 2017 00:48

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

function checkObj(checkProp) {
  // Your Code Here

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

// Test your code by modifying these values
checkObj("pet");
What's wrong with my code here?
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:49
@psnider22 you haven't changed your code yet, please refer @JohnnyBizzel 's code
Johnny
@JohnnyBizzel
Jan 15 2017 00:49
@relentless-coder :+1:
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:50
@Joshua-A-Smith checkProp is a variable, can't be in strings inside hasOwnProperty
Martynas
@FlintMayers
Jan 15 2017 00:51

@DanCouper I think I now kinda get it.
http://www.pythontutor.com/visualize.html#mode=display
I used this tool to see it executed line by line.

your other solution requires way less code:)

andercodder
@andercodder
Jan 15 2017 00:52
campers
hello
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

 if (myObj.hasOwnProperty("checkProp"));
{return myObj[checkProp];}

return "Not Found" ; }

// Test your code by modifying these values
checkObj("house");
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:53
@Joshua-A-Smith checkProp is a variable, can't be in strings inside hasOwnProperty
@andercodder
andercodder
@andercodder
Jan 15 2017 00:53
i have to modify this function
Austiclyse
@Austiclyse
Jan 15 2017 00:53
Could someone tell me why my 7, 8, 9 relevant block of code in the last section of the function is returning a decreased value of minus 1 to the count variable instead of not affecting the count variable at all?
    var count = 0;

    function cc(card) {
      // Only change code below this line
    if (card <=6) {
           count ++;

           if (count <= 0) {
             return (count + " Hold");
           } else {
             return (count + " Bet");
           }


        } else if (card === 'K' || 'Q' || 'J' || 'A' || 10) {
           count --;

           if (count <= 0) {
             return (count + " Hold");
           } else {
             return (count + " Bet");
           }


         } else if (card >= 7 && card <= 9) {
          count = count + 0;

           if (count <=0) {
             return (count + " Hold");
           } else {
             return (count + " Bet");
           }
       } 
      // Only change code above this line
      }

    // Add/remove calls to test your function.
    // Note: Only the last will display
    cc(7); cc(8); cc(9);
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:53
@Joshua-A-Smith checkProp is a variable, can't be in strings inside hasOwnProperty
@andercodder
andercodder
@andercodder
Jan 15 2017 00:54
@relentless-coder ok
Alex
@Joshua-A-Smith
Jan 15 2017 00:54
@relentless-coder
Thanks
CamperBot
@camperbot
Jan 15 2017 00:54
:cookie: 320 | @relentless-coder |http://www.freecodecamp.com/relentless-coder
joshua-a-smith sends brownie points to @relentless-coder :sparkles: :thumbsup: :sparkles:
Phillip
@psnider22
Jan 15 2017 00:54
@relentless-coder @JohnnyBizzel where do i see this change?
andercodder
@andercodder
Jan 15 2017 00:55
@relentless-coder i have to chage all the function?
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:55
function getUserChoice() {
 var userInput = "rock" ; // , paper, or scissors?");
 userInput = userInput.toLowerCase();
 if (userInput === "rock" || "paper" || "scissors") {
   return userInput;
 } else {
   console.log("Error");
 }
}
 function getComputerChoice() {
   var randomNumber = Math.floor(Math.random() * 3);
   switch (randomNumber) {
     case 0:
       return "rock";
     case 1:
       return "paper";
     case 2:
       return "scissors";
   }
 }

    function getDetermineWinner(userChoice, computerChoice) {
     var winner = getDetermineWinner;
     if (userChoice === computerChoice) {
       return "TIE";
     }
     if (userChoice === "rock") {
       if (computerChoice === "paper") {
         return "Computer Won";
       }
       if (userChoice === "paper") {
         if (computerChoice === "scissors") {
           return "Computer Won";
         } else {
           return "You Won";
         }
       }
     }
     if (userChoice === "scissors") {
       if (computerChoice === "rock") {
         return "Computer Won";
       } else {
         return "You Won";
       }
       console.log(winner);
     }
   }

function playGame() {
     var userChoice = getUserChoice();
     var computerChoice = getComputerChoice();
     console.log("You threw: " + userChoice);
     console.log("The computer threw: " + computerChoice);

   }
playGame();
@psnider22 replace your code in the pen to this code
@andercodder why did you say ok? nevermind, you need to fix the hasOwnProperty containing line.
@psnider22 that's the code that @JohnnyBizzel fixed for you
Phillip
@psnider22
Jan 15 2017 00:57
@relentless-coder that doesnt fix my code, userInput will always equal "rock", i need a prompt to ask the user for choice of the 3
Johnny
@JohnnyBizzel
Jan 15 2017 00:58
@relentless-coder Deserves a thanks!
CamperBot
@camperbot
Jan 15 2017 00:58
johnnybizzel sends brownie points to @relentless-coder :sparkles: :thumbsup: :sparkles:
:cookie: 321 | @relentless-coder |http://www.freecodecamp.com/relentless-coder
andercodder
@andercodder
Jan 15 2017 00:58
@psnider22 is just a way to sa that i seeyour message
Ayush Bahuguna
@relentless-coder
Jan 15 2017 00:58
@psnider22 just replace user input = "rock" with the prompt.
@JohnnyBizzel thank you :+1:
CamperBot
@camperbot
Jan 15 2017 00:59
relentless-coder sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1126 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Phillip
@psnider22
Jan 15 2017 00:59
@relentless-coder that what this is for----var userInput = prompt("rock, paper, or scissors?");
andercodder
@andercodder
Jan 15 2017 01:00
@psnider22 could you just help with an explanation i did not get what should do
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:01
@psnider22 if you have changed your code, then you would have var userInput = "rock" in your code. replace it with var userInput = prompt("rock, paper, or scissors")
Phillip
@psnider22
Jan 15 2017 01:01
when the script runs, the first thing it does is a popup window asking the user for rock, paper or scissors, this is the promt command;
Austiclyse
@Austiclyse
Jan 15 2017 01:01
Never mind guys. I guess this was already solved for me. Thanks @Lumexralph
CamperBot
@camperbot
Jan 15 2017 01:01
austiclyse sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 746 | @lumexralph |http://www.freecodecamp.com/lumexralph
Phillip
@psnider22
Jan 15 2017 01:02
@relentless-coder No,
that line is there for a reason
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:03
@psnider22 you need to explain more than that.
andercodder
@andercodder
Jan 15 2017 01:03
@relentless-coder :+1:
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:04
@andercodder were you asking for help to me? If so, you need to fix hasOwnProperty in your code.
andercodder
@andercodder
Jan 15 2017 01:04
@relentless-coder yes
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:05
@psnider22 what do I do with it?
@andercodder did you understand?
Phillip
@psnider22
Jan 15 2017 01:05
userInput does not equal "rock", it equals one of 3 choices given to the user in a popup window, given by the prompt command
andercodder
@andercodder
Jan 15 2017 01:05
@relentless-coder no, i did not understand
Jason Han
@somekoreanguy
Jan 15 2017 01:06
Hi everyone, I'm not understanding "Manipulating Complex Objects" problem. Can anyone help?
also, how can I copy paste the code here?
Martynas
@FlintMayers
Jan 15 2017 01:06

Check if a string (first argument, str) ends with the given target string (second argument, target).

I solved it like this. It kind of feels like a not legit solution. What do you guys think?


function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  var len = target.length * -1;
  var schar = str.substr(len);
  var tchar = target;

  if( schar === target){
    return true;
  }
  else return false;
}

confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification");
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:07
@psnider22 could you please post your code again?
@andercodder you are asked to fix the function, right? Then you need to understand that currently hasOwnProperty is looking for a literal property "checkProp", but checkProp is a variable so it can't be inside a pair of strings.
Manish Giri
@Manish-Giri
Jan 15 2017 01:07
@somekoreanguy
'''
CamperBot
@camperbot
Jan 15 2017 01:07
:bulb: to format code use backticks! ``` more info
Manish Giri
@Manish-Giri
Jan 15 2017 01:07
read the link
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:08
@somekoreanguy
step 1: type three backticks
step 2: in the next line paste your code
step 3: in the next line type three backticks
@andercodder did you understand now?
Dan Couper
@DanCouper
Jan 15 2017 01:09
@FlintMayers schar === target is either true or false, so you can just return that, you don’t need the if…else
andercodder
@andercodder
Jan 15 2017 01:09
@relentless-coder yeah but even if take off the string pairs it will not fix
Alex
@Joshua-A-Smith
Jan 15 2017 01:09

var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": ["CS", "8T", "LP"],
    "gold": true
  }
  {
    "artist": "Iron Maiden",
    "title": "Hallowed Be Thy Name",
    "release_year": 1980,     
    "formats":["CS", "8T", "LP"],
  }/// Add record here
];
Do I need to put quotes around the new album property keys?
andercodder
@andercodder
Jan 15 2017 01:09
@relentless-coder and also why does it work with others values
Jason Han
@somekoreanguy
Jan 15 2017 01:09
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  // Add record here
  { "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
];
@Joshua-A-Smith is on the same one as me!
Manish Giri
@Manish-Giri
Jan 15 2017 01:10
@Joshua-A-Smith you need to separate the two objects with a , first
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:10
@andercodder what is the challenge's name?
Jason Han
@somekoreanguy
Jan 15 2017 01:10
@relentless-coder Manipulating Complex Objects
andercodder
@andercodder
Jan 15 2017 01:10
@relentless-coder Testing Objects for Properties
Martynas
@FlintMayers
Jan 15 2017 01:10
@DanCouper thanks, nice way to clean it up
CamperBot
@camperbot
Jan 15 2017 01:11
flintmayers sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:warning: flintmayers already gave dancouper points
Dan Couper
@DanCouper
Jan 15 2017 01:11
@FlintMayers otherwise, that’s pretty smart
andercodder
@andercodder
Jan 15 2017 01:11
@relentless-coder Instructions
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
Dan Couper
@DanCouper
Jan 15 2017 01:11
@FlintMayers Multiplying by -1 is clever, it works perfectly, I’d say that’s a really good solution
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:12

@somekoreanguy

@Joshua-A-Smith you need to separate the two objects with a , first

Alex
@Joshua-A-Smith
Jan 15 2017 01:12
@Manish-Giri One comma can make a huge difference
Thanks @relentless-coder
CamperBot
@camperbot
Jan 15 2017 01:12
joshua-a-smith sends brownie points to @manish-giri and @relentless-coder :sparkles: :thumbsup: :sparkles:
:warning: joshua-a-smith already gave relentless-coder points
:star2: 3776 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:12
@andercodder now could you show me your code?
Dan Couper
@DanCouper
Jan 15 2017 01:13
@FlintMayers and you can get rid of tchar as well, just the first two varable assignments + the check
Jason Han
@somekoreanguy
Jan 15 2017 01:13
ahhh thank you @relentless-coder
CamperBot
@camperbot
Jan 15 2017 01:13
somekoreanguy sends brownie points to @relentless-coder :sparkles: :thumbsup: :sparkles:
:cookie: 322 | @relentless-coder |http://www.freecodecamp.com/relentless-coder
andercodder
@andercodder
Jan 15 2017 01:13

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

function checkObj(checkProp) {
// Your Code Here

if (myObj.hasOwnProperty("checkPro"));
{return myObj[checkProp];}

return "Not Found" ; }

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

Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:13
@somekoreanguy say thanks to @Manish-Giri . I just pointed you to his answer :)
CamperBot
@camperbot
Jan 15 2017 01:13
relentless-coder sends brownie points to @somekoreanguy and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 208 | @somekoreanguy |http://www.freecodecamp.com/somekoreanguy
:star2: 3777 | @manish-giri |http://www.freecodecamp.com/manish-giri
Conor Murphy
@cmurphy580
Jan 15 2017 01:13

would anyone mind giving me an explanation of heap's algorithm used the "no repeats" challenge? I get the recursive element, but I don't understand what the "swap(n%2 ? 0 : i, n-1)" is doing. Here's what i have for the heap's algorith:

 function generate(n) {
        //if statement breaks the 'generate' recursion -- 
        if (n === 1) {
            return emptyArray.push(split.join(""));
        } else {
            //Heap's algorithm for create the different permutations -- 
            for (var i = 0; i != n; i++) {
                generate(n - 1);
                swap(n % 2 ? 0 : i, n - 1);
            }
        }
    }

if you need to see the swap function let me know.

Phillip
@psnider22
Jan 15 2017 01:14
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:14
@andercodder you haven't changed if (myObj.hasOwnProperty("checkPro")); this yet
Manish Giri
@Manish-Giri
Jan 15 2017 01:14
@relentless-coder lol
andercodder
@andercodder
Jan 15 2017 01:14

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

function checkObj(checkProp) {
// Your Code Here

if (myObj.hasOwnProperty("checkPro"));
{return myObj[checkProp];}

return "Not Found" ; }

// Test your code by modifying these values
checkObj("house");
```
@relentless-coder

@relentless-coder i took off if i got nothing
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:14

@andercodder

@andercodder you haven't changed if (myObj.hasOwnProperty("checkPro")); this yet

Manish Giri
@Manish-Giri
Jan 15 2017 01:15
@cmurphy580
swap(n % 2 ? 0 : i, n - 1);
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:15
@andercodder i can still see it in your code. as a matter of fact I can now see "checkPro" which is further wrong.
Conor Murphy
@cmurphy580
Jan 15 2017 01:16
@Manish-Giri yeah i don't really understand what is going on there, except for its a conditional statement for even/odd
Manish Giri
@Manish-Giri
Jan 15 2017 01:17
I think - it checks if n is not even -if it isn't, the first argument to swap is 0, if n is even, the first arg to swapis i
@cmurphy580
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:17
@psnider22 sir, you haven't changed your code yet. please refer to @JohnnyBizzel 's code. You have defined playGame inside another function and are calling it in global scope. you can check the console for error, it says playGame is not defined.
Conor Murphy
@cmurphy580
Jan 15 2017 01:18
@Manish-Giri yeah that's along the lines of what i was thinking. thanks for the help
CamperBot
@camperbot
Jan 15 2017 01:18
cmurphy580 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3778 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 15 2017 01:18
@cmurphy580 :+1:
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:20
@andercodder if you haven't figured it out yet. then you need this in your code hasOwnProperty(checkProp) instead of hasOwnProperty("checkProp")
Phillip
@psnider22
Jan 15 2017 01:20
David Amanze
@GodKingShogun
Jan 15 2017 01:22
@Manish-Giri SENSEI
can someone take a look at these instructions
Now try it yourself! Modify the Bike constructor to have a private property called gear and two public methods called getGear and setGear to get and set that value.
Manish Giri
@Manish-Giri
Jan 15 2017 01:22
@GodKingShogun こんにちは
andercodder
@andercodder
Jan 15 2017 01:23

@relentless-coder wrong how could you explain me

@relentless-coder when i do that i got ReferenceError: checkPro is not defined with ou without if
@Manish-Giri sensei good one :worried: :+1:

David Amanze
@GodKingShogun
Jan 15 2017 01:23
@Manish-Giri hello to you too
Manish Giri
@Manish-Giri
Jan 15 2017 01:23
lol
@andercodder checkProp with a p at the end
not checkPro
@GodKingShogun show your code?
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:24

@andercodder that's what I said

@andercodder if you haven't figured it out yet. then you need this in your code hasOwnProperty(checkProp) instead of hasOwnProperty("checkProp")

David Amanze
@GodKingShogun
Jan 15 2017 01:24
@Manish-Giri what time is it where you ar
are*
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:24
@psnider22 http://codepen.io/psnider22/pen/xgEKXO?editors=0010 please check the code
Manish Giri
@Manish-Giri
Jan 15 2017 01:24
@GodKingShogun about 8:30 PM
andercodder
@andercodder
Jan 15 2017 01:24
@Manish-Giri but this is not the real problem
David Amanze
@GodKingShogun
Jan 15 2017 01:25
so you would say konbanwa instead of konichiwa
@Manish-Giri the student has taught the SENSEI lol
Manish Giri
@Manish-Giri
Jan 15 2017 01:25
@GodKingShogun ah good to know ty
CamperBot
@camperbot
Jan 15 2017 01:25
manish-giri sends brownie points to @godkingshogun :sparkles: :thumbsup: :sparkles:
:cookie: 14 | @godkingshogun |http://www.freecodecamp.com/godkingshogun
Manish Giri
@Manish-Giri
Jan 15 2017 01:25
@andercodder then what is the real problem?
David Amanze
@GodKingShogun
Jan 15 2017 01:26

var Bike = function(setGear) {

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

thats my code so far. i got as far as making a private and public property
Manish Giri
@Manish-Giri
Jan 15 2017 01:26
okay
andercodder
@andercodder
Jan 15 2017 01:26
@Manish-Giri

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

function checkObj(checkProp) {
  // Your Code Here

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

return "Not Found" ; }

// Test your code by modifying these values
checkObj("house");
Manish Giri
@Manish-Giri
Jan 15 2017 01:27
@andercodder remove the ; at the end of if
if(myObj.hasOwnProperty(checkProp));
andercodder
@andercodder
Jan 15 2017 01:27
@Manish-Giri yeah you got this
Manish Giri
@Manish-Giri
Jan 15 2017 01:28

@GodKingShogun each of these need to be a function

this.getGear=;
this.setGear=;

if you refer to the example above your code, they've probably shown a similar setup with Car

andercodder
@andercodder
Jan 15 2017 01:28
but i think this is not quite fair cos
@Manish-Giri very thank you code daver
CamperBot
@camperbot
Jan 15 2017 01:28
andercodder sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3779 | @manish-giri |http://www.freecodecamp.com/manish-giri
andercodder
@andercodder
Jan 15 2017 01:29
@relentless-coder thank you you patient is the best
CamperBot
@camperbot
Jan 15 2017 01:29
andercodder sends brownie points to @relentless-coder :sparkles: :thumbsup: :sparkles:
:cookie: 323 | @relentless-coder |http://www.freecodecamp.com/relentless-coder
HeebieGeeBee
@HeebieGeeBee
Jan 15 2017 01:29
if you look by the side of your code it will show when you have syntax erroors like that @andercodder
David Amanze
@GodKingShogun
Jan 15 2017 01:29
@Manish-Giri the example is a constructor of a car with a private speed and public accel and decel
Manish Giri
@Manish-Giri
Jan 15 2017 01:29
as like in the example, the function assigned to getGear will simply return the value of gear
and the function setGear will set the value of gear to a value you want
@GodKingShogun
@GodKingShogun right, so the example sets up a private property speed, which you can then access and change through the two functions
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:30
@psnider22 hey there are some problems with your code... I'll list them here.
it's better if you write each function in global scope, would help you debug your code.
you're if and else statements are wrong. you need to fix that too.
David Amanze
@GodKingShogun
Jan 15 2017 01:32

@Manish-Giri
var Bike = function(set) {

// Only change code below this line.
var gear;
this.getGear= return gear;
this.setGear=set;
};

Manish Giri
@Manish-Giri
Jan 15 2017 01:33
@GodKingShogun each of those need to be a function, like
this.getGear = function() {
return gear;
}
it sort of means that getGear is now a function, which you can call using the object created at the end
like bike.getGear();
David Amanze
@GodKingShogun
Jan 15 2017 01:35
@Manish-Giri where would i be without you sensei. arigato
Manish Giri
@Manish-Giri
Jan 15 2017 01:36
lol
David Amanze
@GodKingShogun
Jan 15 2017 01:36
@Manish-Giri by the way how did you write in hiragana
Manish Giri
@Manish-Giri
Jan 15 2017 01:36
ようこそ
@GodKingShogun
don't know if that's right!
David Amanze
@GodKingShogun
Jan 15 2017 01:37
@Manish-Giri i wish i knew but i am being very lazy on my hiragana and katakana learning.
William Cross
@williamtech814
Jan 15 2017 01:38
I'm misunderstanding the purpose of the challenge "Iterate Through an Array with a For Loop"
David Amanze
@GodKingShogun
Jan 15 2017 01:38
@GodKingShogun I'll do better sensei
@Manish-Giri
Manish Giri
@Manish-Giri
Jan 15 2017 01:39
lol
@GodKingShogun happy coding and happy learning :tada:
@williamtech814 as in?
David Amanze
@GodKingShogun
Jan 15 2017 01:40
@Manish-Giri IM GOING TO BECOME HOKAGE. BELIEVE IT
William Cross
@williamtech814
Jan 15 2017 01:40
@Manish-Giri What do I have to do in the challenge?
read the instructions but I don't get it
Manish Giri
@Manish-Giri
Jan 15 2017 01:41
@GodKingShogun I was just watching Naruto earlier today
love it
@williamtech814 you need to iterate through the array, I think it's called myArray, and sum all it's elements, and save the result to a variable, probably called total
David Amanze
@GodKingShogun
Jan 15 2017 01:42
@Manish-Giri where are you at
Manish Giri
@Manish-Giri
Jan 15 2017 01:42
@GodKingShogun near Boston
William Cross
@williamtech814
Jan 15 2017 01:43
@Manish-Giri I live in Connecticut, :)
Manish Giri
@Manish-Giri
Jan 15 2017 01:43
@williamtech814 niice
David Amanze
@GodKingShogun
Jan 15 2017 01:44
@Manish-Giri I loved it there when i visited. so much snow but i meant in naruto
Manish Giri
@Manish-Giri
Jan 15 2017 01:44
@williamtech814 Stamford?
William Cross
@williamtech814
Jan 15 2017 01:44
Nope, around the Massachusetts border
@Manish-Giri near Sturbridge
Manish Giri
@Manish-Giri
Jan 15 2017 01:45
@GodKingShogun oh, well I'm watching from the start again, I watched it once during college..now I'm at the part where Lady Tsunade comes to the village and becomes Hokage
@williamtech814 cool
William Cross
@williamtech814
Jan 15 2017 01:45
thanks @Manish-Giri
CamperBot
@camperbot
Jan 15 2017 01:45
williamtech814 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3780 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 15 2017 01:46
@williamtech814 :+1:
David Amanze
@GodKingShogun
Jan 15 2017 01:46
@Manish-Giri god bless lady tsunade and god bless lady tsunade's oppais
lol
Thiago Cruz
@thy705
Jan 15 2017 01:47

Hey guys! Can anybody tell me if I'm on the right track? ```
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUpProfile(firstName, prop){
// Only change code below this line

if (contacts.hasOwnProperty(firstName, prop)){

return;

}

// Only change code above this line
}

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

```

Manish Giri
@Manish-Giri
Jan 15 2017 01:47
haha
David Amanze
@GodKingShogun
Jan 15 2017 01:49
@Manish-Giri i rarely re watch anything but the final thing on my bucket list is to die while re watching all of my favorite animes
Manish Giri
@Manish-Giri
Jan 15 2017 01:50
lool
are there any other similar good animes that you'd recommend for me to watch?
@GodKingShogun
Thiago Cruz
@thy705
Jan 15 2017 01:51
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line

  if (contacts.hasOwnProperty(firstName, prop)){

    return;
  }

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Manish Giri
@Manish-Giri
Jan 15 2017 01:52
@thy705 the first thing you need to see is that contacts is an array, it contains individual objects, each of which has the firstName property
Thiago Cruz
@thy705
Jan 15 2017 01:52
Did I start it right?
Manish Giri
@Manish-Giri
Jan 15 2017 01:52
so this won't work - (contacts.hasOwnProperty(
David Amanze
@GodKingShogun
Jan 15 2017 01:52
@Manish-Giri i thought you would never ask
Manish Giri
@Manish-Giri
Jan 15 2017 01:52
@GodKingShogun lol
Thiago Cruz
@thy705
Jan 15 2017 01:53
I see. I'll spend more time on it then. Thanks @Manish-Giri
CamperBot
@camperbot
Jan 15 2017 01:53
thy705 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3781 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 15 2017 01:53
@thy705 cool, post if you need help..
Long Vu
@longorjames
Jan 15 2017 01:56
I'm stuck on Escape Sequences in Strings
David Amanze
@GodKingShogun
Jan 15 2017 01:56
@Manish-Giri Once you're done with the big three you can move on to the "death note", "hitman reborn", "d-gray man", "mirrai nikki", "one punch man", "fate", "full metal alchemist" "attack on titan" "hunter x hunter" "code geass"
Long Vu
@longorjames
Jan 15 2017 01:56
var myStr = FirstLine\n
\SecondLine\r
ThirdLine; // Change this line
David Amanze
@GodKingShogun
Jan 15 2017 01:56
@Manish-Giri i could go on for several more years but ill stop there
lol
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:57
Manish Giri
@Manish-Giri
Jan 15 2017 01:57
@GodKingShogun awesome
thanks a bunch
Manish Giri
@Manish-Giri
Jan 15 2017 01:59
@relentless-coder is there a pen?
David Amanze
@GodKingShogun
Jan 15 2017 01:59
@Manish-Giri anything for you sensei
Manish Giri
@Manish-Giri
Jan 15 2017 01:59
@GodKingShogun :smile:
Ayush Bahuguna
@relentless-coder
Jan 15 2017 01:59
@Manish-Giri ok, let me create one
Manish Giri
@Manish-Giri
Jan 15 2017 02:00
@GarrusNapp I see an "error" in console
nothing else
Ayush Bahuguna
@relentless-coder
Jan 15 2017 02:01
@Manish-Giri how do I insert the JSON data in the codepen?
Garrus Napp
@GarrusNapp
Jan 15 2017 02:01
@Manish-Giri do you have geolocation disabled?
William Cross
@williamtech814
Jan 15 2017 02:01

Nesting For Loops

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for(var i=0;i<multiplyAll.length;i++){
for(var k=0;k<multiplyAll[i].length;k++){
for(var l=0;multiplyAll[k][l].length;l++)
product*=multiplyAll[i][k][l]
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Manish Giri
@Manish-Giri
Jan 15 2017 02:01
@GarrusNapp nope
William Cross
@williamtech814
Jan 15 2017 02:01
not sure what i'm doing wrong here?
Garrus Napp
@GarrusNapp
Jan 15 2017 02:02
@Manish-Giri FML :D
Long Vu
@longorjames
Jan 15 2017 02:02
Escape Sequences in Stringsvar myStr = FirstLine\n
\SecondLine\r
ThirdLine;
Escape Sequences inStrings
var myStr = FirstLine\n
\SecondLine\r
ThirdLine;
Manish Giri
@Manish-Giri
Jan 15 2017 02:03
@GarrusNapp lol
@relentless-coder you have your own JSON file?
Ayush Bahuguna
@relentless-coder
Jan 15 2017 02:04
yes
Manish Giri
@Manish-Giri
Jan 15 2017 02:05
@longorjames everything needs to be on one line
Greg Duncan
@GregatGit
Jan 15 2017 02:05
@williamtech814 multiplyAll.length it should be arr.length
William Cross
@williamtech814
Jan 15 2017 02:05
@GregatGit aha i see, forgot it was in a function
thanks @GregatGit
CamperBot
@camperbot
Jan 15 2017 02:05
williamtech814 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 822 | @gregatgit |http://www.freecodecamp.com/gregatgit
Long Vu
@longorjames
Jan 15 2017 02:06
Nvm, got it. var myStr = "FirstLine\n\SecondLine\\rThirdLine";
They wanted it to look like the way I had it, but to do that in code I was supposed to do that... I got confused by the instructions
Manish Giri
@Manish-Giri
Jan 15 2017 02:07
@GarrusNapp why are these in a function
    $("#far").click(function(){
      var fahrenheit = celsius*9/5 + 32;
      $("#temp").html("Temperature: "+ fahrenheit +" °F");
      $("#temp").append("<button id=\"cel\">to Celsius</button>");
    });

     $("#cel").click(function(){
       console.log("CLICKED!");
      $("#temp").html("Temperature: "+ celsius +" °C");
      $("#temp").append("<button id=\"far\">to Fahrenheit</button>");        
    });
Long Vu
@longorjames
Jan 15 2017 02:07
I feel like they are so unclear sometimes xD
Garrus Napp
@GarrusNapp
Jan 15 2017 02:09
@Manish-Giri right, they shouldn't be there. However I moved them outside and now it cease to work at all. When it was in function the 1st one worked. f... jquery
Manish Giri
@Manish-Giri
Jan 15 2017 02:09
@GarrusNapp lol :smile:
if you can fix your geolocation thingy
I can figure out what's the problem in the C/F
Garrus Napp
@GarrusNapp
Jan 15 2017 02:10
@Manish-Giri it works on Firefox but not on chrome for some reason
ok
Manish Giri
@Manish-Giri
Jan 15 2017 02:10
okay let me try FF
@GarrusNapp
@relentless-coder you can save your JSON file somewhere, like dropbox, and then link to it in the settings - https://blog.codepen.io/documentation/editor/adding-external-resources/
William Cross
@williamtech814
Jan 15 2017 02:12
This challenge still isn't going through :/

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for(var i=0;i<arr.length;i++){

for(var j=0;j<arr[i][j].length;k++){

  product*=arr[i][j];
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Garrus Napp
@GarrusNapp
Jan 15 2017 02:12
@Manish-Giri that may to be the issue with dynamic button. At the moment of loaded page there are no #cel and #far buttons
Manish Giri
@Manish-Giri
Jan 15 2017 02:13
@GarrusNapp yup sounds right
William Cross
@williamtech814
Jan 15 2017 02:13
nvm i got it
Garrus Napp
@GarrusNapp
Jan 15 2017 02:14
@Manish-Giri so at the moment of function call, button was created and the instuctions for it came later, so it already existed. But the 2nd didn't... damn
Manish Giri
@Manish-Giri
Jan 15 2017 02:15
@GarrusNapp looks like you got it :+1:
Garrus Napp
@GarrusNapp
Jan 15 2017 02:16
why jquery is so retarded :(
bitcoinabdi
@bitcoinabdi
Jan 15 2017 02:16
any good JS video tutorials ?
Please recoment sme good JS video tutorial
thnaks
Manish Giri
@Manish-Giri
Jan 15 2017 02:18
lol
Ayush Bahuguna
@relentless-coder
Jan 15 2017 02:20
@Manish-Giri http://codepen.io/ayushb/pen/vgXEBo does this work?
oh no, it doesn't work. cors issue
Gamal9
@Gamal9
Jan 15 2017 02:24

what's wrong here "
function multiplyAll(arr) {
var product = 0;
// Only change code below this line
for(var i=0;i<arr.length;i++)
for(var j=0;j<arr[i].length;j++)
{
product+=arr[i][j];
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

"

Manish Giri
@Manish-Giri
Jan 15 2017 02:24
@Gamal9 product+=arr[i][j];
you're multiplying right?
Gamal9
@Gamal9
Jan 15 2017 02:24
yeh
*
Manish Giri
@Manish-Giri
Jan 15 2017 02:25
then why +=?
Gamal9
@Gamal9
Jan 15 2017 02:25
@Manish-Giri thank u
CamperBot
@camperbot
Jan 15 2017 02:25
:star2: 3782 | @manish-giri |http://www.freecodecamp.com/manish-giri
gamal9 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
Manish Giri
@Manish-Giri
Jan 15 2017 02:25
@GarrusNapp tested in FF, location works, but convert to F doesn't
Ayush Bahuguna
@relentless-coder
Jan 15 2017 02:27
@Manish-Giri hey, the dropbox thing is causing a cors issue
Manish Giri
@Manish-Giri
Jan 15 2017 02:28
@relentless-coder try prefixing it with the crossorigin.me thing
Ayush Bahuguna
@relentless-coder
Jan 15 2017 02:33
Manish Giri
@Manish-Giri
Jan 15 2017 02:34
@relentless-coder worked?
Ayush Bahuguna
@relentless-coder
Jan 15 2017 02:35
yes, I am not getting cors issue, but definitely some weird data in the console
Dashzeveg Galbadrakh
@dashzeveg
Jan 15 2017 02:38

function myLocalScope() {
'use strict';

console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);

// Now remove the console log line to pass the test

No global myVar variable
JamesVitaly
@JamesVitaly
Jan 15 2017 02:39
HI struggling to make my lookup table work here is my code

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

// Only change code below this line

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

}

Convert the switch statement into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.
dont know what to do next to be honest tried a number of things
Manish Giri
@Manish-Giri
Jan 15 2017 02:42
@JamesVitaly you need to use bracket notation to get the value of the property val from the lookup object
and assign it to result
@relentless-coder taking a look
JamesVitaly
@JamesVitaly
Jan 15 2017 02:43
@Manish-Giri thanks ill take another go
CamperBot
@camperbot
Jan 15 2017 02:43
jamesvitaly sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3783 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 15 2017 02:43
@JamesVitaly :+1:
mousbasha
@mousbasha
Jan 15 2017 02:45
Hello world!
CamperBot
@camperbot
Jan 15 2017 02:45

welcome to FreeCodeCamp @mousbasha!

justinmaines
@justinmaines
Jan 15 2017 02:46
Can anyone help with the lesson "Golf Score"
JamesVitaly
@JamesVitaly
Jan 15 2017 02:48

@Manish-Giri var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echoe": "Easy",
"foxtrot": "Frank"
};

result=val[lookup]; this is what i wrote but no dice, I'm probably being a bit stupid but i have looked through the passed challenges and cant figure it out

@justinmaines what do you need help with
justinmaines
@justinmaines
Jan 15 2017 02:49
If I write "if (par, strokes == par, 1) {
then "return "Hole-in-one!"; }
it works
but for any other score, it will not owrk
work
JamesVitaly
@JamesVitaly
Jan 15 2017 02:50
@justinmaines well for a hole in one what you want is
if strokes==1 return hoel in one
hole*
you dont need to reference par in this case
after this : strokes == par -..
or par +
or par for par
actually i wrote this
if (strokes == 1) {return "Hole-in-one!";}
else if (strokes<= par-2) {return "Eagle";}
nd then so on
justinmaines
@justinmaines
Jan 15 2017 02:53
thank you
Manish Giri
@Manish-Giri
Jan 15 2017 02:54
@JamesVitaly this is actually the inverse of what you need
result=val[lookup];
JamesVitaly
@JamesVitaly
Jan 15 2017 02:54
@Manish-Giri so i need lookup[val]=result?
Manish Giri
@Manish-Giri
Jan 15 2017 02:54
lookup is the object, val is the property
so it should be result = lookup[val];
@JamesVitaly
like how you use the dot notation - objectName.propertyName
similarly for bracket notation - objectName[propertyName]
JamesVitaly
@JamesVitaly
Jan 15 2017 02:56
@Manish-Giri I see! hmm im still getting no luck with the challenge tho
Manish Giri
@Manish-Giri
Jan 15 2017 02:57
@JamesVitaly I don't remember seeing a return statement in your code?
did you delete it?
you need to return result
JamesVitaly
@JamesVitaly
Jan 15 2017 02:57
@Manish-Giri ahhhh let me try that
@Manish-Giri thanks so much
CamperBot
@camperbot
Jan 15 2017 02:58
jamesvitaly sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:warning: jamesvitaly already gave manish-giri points
Manish Giri
@Manish-Giri
Jan 15 2017 02:58
@JamesVitaly :+1:
Phillip
@psnider22
Jan 15 2017 03:00
@relentless-coder or anyone else that could take a look and help... cant get this script to run http://codepen.io/psnider22/full/xgEKXO/
Manish Giri
@Manish-Giri
Jan 15 2017 03:02
@psnider22 why is playGame() inside getComputerChoice()
Ayush Bahuguna
@relentless-coder
Jan 15 2017 03:04
^ that's what I've been asking him. Anyways, it won't run because you haven't made the function call for getDetermineWinner
Phillip
@psnider22
Jan 15 2017 03:04
@Manish-Giri thats what i mean, i dont know where to put it so that it will run
@relentless-coder you told me to remove the prompt from my first function
Ayush Bahuguna
@relentless-coder
Jan 15 2017 03:05
@psnider22 sir, I asked you earlier to write your function statements in global scope, it'd be easy for you to debug.
Manish Giri
@Manish-Giri
Jan 15 2017 03:06
@psnider22 one sec
Ayush Bahuguna
@relentless-coder
Jan 15 2017 03:06
@psnider22 nope. let me find my message.

@psnider22

@psnider22 if you have changed your code, then you would have var userInput = "rock" in your code. replace it with var userInput = prompt("rock, paper, or scissors")

@psnider22

@psnider22 hey there are some problems with your code... I'll list them here.
it's better if you write each function in global scope, would help you debug your code.
you're if and else statements are wrong. you need to fix that too.

Manish Giri
@Manish-Giri
Jan 15 2017 03:09
@psnider22 like @relentless-coder says, create each of your function in the global scope, ie, no function should be nested inside ane another
Ashvini Pandian
@Pabduab
Jan 15 2017 03:09
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));
Manish Giri
@Manish-Giri
Jan 15 2017 03:10
function getUserChoice() {
...
}
function getComputerChoice() {
...
}
function determine...() {
...
}
function playGame() {
...
}

playGame(); //start game
@psnider22
Ashvini Pandian
@Pabduab
Jan 15 2017 03:10
iDk what they are asking for about queue
Manish Giri
@Manish-Giri
Jan 15 2017 03:10
@Pabduab okay, your function gets two arguments - arr and item, yes?
Ashvini Pandian
@Pabduab
Jan 15 2017 03:11
yes that right
Manish Giri
@Manish-Giri
Jan 15 2017 03:11
the first step is to add the number itemto the end of the array arr, use .push() for this.
Ashvini Pandian
@Pabduab
Jan 15 2017 03:11
and then its supposed to return an item that was removed?? idk whats going on :(
Phillip
@psnider22
Jan 15 2017 03:12

```
function getUserChoice() {
var userInput = "rock" ; // , paper, or scissors?");
userInput = userInput.toLowerCase();
if (userInput === "rock" || "paper" || "scissors") {
return userInput;
} else {
console.log("Error");
}
}
function getComputerChoice() {
var randomNumber = Math.floor(Math.random() * 3);
switch (randomNumber) {
case 0:
return "rock";
case 1:
return "paper";
case 2:
return "scissors";
}
}

function getDetermineWinner(userChoice, computerChoice) {
 var winner = getDetermineWinner;
 if (userChoice === computerChoice) {
   return "TIE";
 }
 if (userChoice === "rock") {
   if (computerChoice === "paper") {
     return "Computer Won";
   }
   if (userChoice === "paper") {
     if (computerChoice === "scissors") {
       return "Computer Won";
     } else {
       return "You Won";
     }
   }
 }
 if (userChoice === "scissors") {
   if (computerChoice === "rock") {
     return "Computer Won";
   } else {
     return "You Won";
   }
   console.log(winner);
 }

}

function playGame() {
var userChoice = getUserChoice();
var computerChoice = getComputerChoice();
console.log("You threw: " + userChoice);
console.log("The computer threw: " + computerChoice);

}
playGame();
```

@psnider22 replace your code in the pen to this code

@relentless-coder
Manish Giri
@Manish-Giri
Jan 15 2017 03:12
@Pabduab maybe you write the code for the first step now?
once that's done, you can do the next step..
Ashvini Pandian
@Pabduab
Jan 15 2017 03:12
yes idk what I'm supposed to do for that...
ill try writing something ill be right back
see the examples
Ayush Bahuguna
@relentless-coder
Jan 15 2017 03:13
@psnider22 yes, that was Johnny Sir's working code, and it works for userInput = "rock", then I told you to replace var userInput = "rock" with var userInput = prompt();
Manish Giri
@Manish-Giri
Jan 15 2017 03:14
@relentless-coder you don't need to call ppl as sir
lol
Margaret
@Margaret2
Jan 15 2017 03:14
@Manish-Giri in the mood for JS tonight i see :D
Manish Giri
@Manish-Giri
Jan 15 2017 03:14
oh noes she found me
:see_no_evil:
Margaret2 @Margaret2 leaves
Ashvini Pandian
@Pabduab
Jan 15 2017 03:15
ok thanks @Manish-Giri
CamperBot
@camperbot
Jan 15 2017 03:15
pabduab sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3784 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 15 2017 03:16
@Margaret2 leaves
??
Ayush Bahuguna
@relentless-coder
Jan 15 2017 03:17
@Manish-Giri my Indian parents' sanskars will haunt me for life if i didn't address people elder than me as Sir and Mam :D
Manish Giri
@Manish-Giri
Jan 15 2017 03:17
@Pabduab :+1:
Kolia Khep
@kolekhep
Jan 15 2017 03:19
can someone help with with #122
assign a to b with an =
Manish Giri
@Manish-Giri
Jan 15 2017 03:20
@psnider22 it works
Ayush Bahuguna
@relentless-coder
Jan 15 2017 03:21
@psnider22 you haven't called getDetermineWinner anywhere so, you won't get the winner, but rest is working great
Phillip
@psnider22
Jan 15 2017 03:24
Manish Giri
@Manish-Giri
Jan 15 2017 03:25
:+1:
Phillip
@psnider22
Jan 15 2017 03:25
@Manish-Giri thanks
CamperBot
@camperbot
Jan 15 2017 03:25
psnider22 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3785 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 15 2017 03:27
@psnider22 welcome
thx to @relentless-coder too
CamperBot
@camperbot
Jan 15 2017 03:27
manish-giri sends brownie points to @relentless-coder :sparkles: :thumbsup: :sparkles:
:cookie: 324 | @relentless-coder |http://www.freecodecamp.com/relentless-coder
Kolia Khep
@kolekhep
Jan 15 2017 03:29
?
Evan Kalvis
@evan17gr
Jan 15 2017 03:30
Alexis
@alexisgcn
Jan 15 2017 03:31
Hello guys, i need some help se
I made my random quote machine,but its dont know what to do that every quote have a transition of time
Jor
@joreyesl
Jan 15 2017 03:35
@alexisgcn you mean an animation transition?
Gilbert
@GilTorch
Jan 15 2017 03:35
Helloo I'm building my wikipedia viewer and there s a peace of code that doesn't work. I commented it doesn't work for you to see it: http://codepen.io/BlessedCamper/pen/QdyJYa?editors=0111
Manish Giri
@Manish-Giri
Jan 15 2017 03:38
@evan17gr link it via <script> tag in index.html
just before the closing </body>
Alexis
@alexisgcn
Jan 15 2017 03:40
@joreyesl
Yeah
Yes
Evan Kalvis
@evan17gr
Jan 15 2017 03:43
@Manish-Giri should i put this?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> </head>
Manish Giri
@Manish-Giri
Jan 15 2017 03:43
@evan17gr yeah that works too
usually putting it in body is preferable
Ammy3165
@Ammy3165
Jan 15 2017 03:43
I am working on check for palindromes, Help to find the errors,

function palindrome(str) {
// Good luck!
var changeIntolowerCase = str.toLowerCase();
var removeSpecialCharacter = changeIntolowerCase.replace(/\s+/gi);

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

}

palindrome("My ageis00siegaym");

Evan Kalvis
@evan17gr
Jan 15 2017 03:44
@Manish-Giri ok thanks do i also need to link the css file and the js file?
CamperBot
@camperbot
Jan 15 2017 03:44
evan17gr sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3786 | @manish-giri |http://www.freecodecamp.com/manish-giri
Krzysztof Burka
@kazcor
Jan 15 2017 03:44
Hey fellas
Manish Giri
@Manish-Giri
Jan 15 2017 03:45
@evan17gr yeah
Evan Kalvis
@evan17gr
Jan 15 2017 03:45
@kazcor Hey
@Manish-Giri so would i do <script src="main.js"> for example?
Manish Giri
@Manish-Giri
Jan 15 2017 03:47
@evan17gr yeah, and the order matters, so that too
like for example
<script src='jquery.js'>...
<script src='bootstrap.js'>...
<script src='main.js'>...
same for <link> tags
Evan Kalvis
@evan17gr
Jan 15 2017 03:48
so jquery goes first then bootstrap and then js?
Manish Giri
@Manish-Giri
Jan 15 2017 03:50
yeah
because bootstrap js requires jquery to work
Evan Kalvis
@evan17gr
Jan 15 2017 03:50
and then css?
Manish Giri
@Manish-Giri
Jan 15 2017 03:50
and your main.js requires jquery too
Evan Kalvis
@evan17gr
Jan 15 2017 03:50
is master basically like saying root?
Manish Giri
@Manish-Giri
Jan 15 2017 03:51
if you aren't using bootstrap js, then you don't need to include it though
Evan Kalvis
@evan17gr
Jan 15 2017 03:51
no im not
Manish Giri
@Manish-Giri
Jan 15 2017 03:51
@evan17gr masteris usually the default branch to begin with when you create a git project
then you could create other branches
Evan Kalvis
@evan17gr
Jan 15 2017 03:51
so thats why i can use main.js?
only
Manish Giri
@Manish-Giri
Jan 15 2017 03:52
no you'll still need jquery
Evan Kalvis
@evan17gr
Jan 15 2017 03:52
otherwise it could be javascript/main.js for example?
Manish Giri
@Manish-Giri
Jan 15 2017 03:52
um
?
Evan Kalvis
@evan17gr
Jan 15 2017 03:52
if i have multiple branches
do the directories work like in the terminal?
Manish Giri
@Manish-Giri
Jan 15 2017 03:53
your branch has nothing to do with how your code is named in the files
so if you have this folder structure in your computer
- index.html
- style.css
- main.js
then in your html file
you'll write <script src="main.js">
no matter which git branch you're on
Evan Kalvis
@evan17gr
Jan 15 2017 03:54
but thats because they are in the same directory right?
Manish Giri
@Manish-Giri
Jan 15 2017 03:54
because your js file on the same folder level as your html file
Evan Kalvis
@evan17gr
Jan 15 2017 03:54
oh really
Manish Giri
@Manish-Giri
Jan 15 2017 03:54
yes
Traek Wells
@TraekWells
Jan 15 2017 03:54
can anyone help me out with a challenge?
Manish Giri
@Manish-Giri
Jan 15 2017 03:54
if you have this instead
Traek Wells
@TraekWells
Jan 15 2017 03:54
Find the longest word in a string
CamperBot
@camperbot
Jan 15 2017 03:54
find the longest word in a string
nothing found
Traek Wells
@TraekWells
Jan 15 2017 03:54

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

findLongestWord("The quick brown fox jumped over the lazy dog");
not quite sure what I’m missing here
Manish Giri
@Manish-Giri
Jan 15 2017 03:55
- index.html
- styles
    -- style.css
- scripts 
    --  main.js
then in your html, you'll use <script src="scripts/main.js>
@evan17gr
again, no relation with git branch
Evan Kalvis
@evan17gr
Jan 15 2017 03:56
@Manish-Giri ok thats what i meant thanks
CamperBot
@camperbot
Jan 15 2017 03:56
evan17gr sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:warning: evan17gr already gave manish-giri points
Paulo Tokimatu
@paulotokimatu
Jan 15 2017 03:56
@TraekWells you are passing array.length
instead of array[i]
Manish Giri
@Manish-Giri
Jan 15 2017 03:56
@evan17gr also, think of a git branch as version of your code
manish
@kumarheemanshu
Jan 15 2017 03:57
how to solve golf score problem
Evan Kalvis
@evan17gr
Jan 15 2017 03:57
@Manish-Giri wdym by version of ur code?
Manish Giri
@Manish-Giri
Jan 15 2017 03:57
say you are in master branch, and you have some code until now. You want to make a new feature called evan/animation, and you don't want to mess your current version of code in master
current version = whatever code you have saved until now
so you just switch to a new branch
git checkout -b evan/animation
Evan Kalvis
@evan17gr
Jan 15 2017 03:58
oh so basically u create a new branch where u store the new code
Traek Wells
@TraekWells
Jan 15 2017 03:58
@paulotokimatu

function findLongestWord(str) {
  var array = str.split(' ');
  var longestWord;

  for (var i = 0; i < array.length; i++) {
    if (array[i].length > longestWord.length) {
      longestWord = array[i].length;
    }
  }
  return longestWord.length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Manish Giri
@Manish-Giri
Jan 15 2017 03:58
this will have all your code until now from master, but importantly, you have a safe backup in master, so you could easily switch to it
Paulo Tokimatu
@paulotokimatu
Jan 15 2017 03:58
@TraekWells you want to return the length of the longest word or the word itself?
Manish Giri
@Manish-Giri
Jan 15 2017 03:58
if something goes wrong with the animation
Austiclyse
@Austiclyse
Jan 15 2017 03:59

Here is my example:

    var myObj = {
     "Space Name": "Kirk",
     "More Space": "Spock"
   };
   myObj["Space Name"]; // Kirk
   myObj['More Space']; // Spock

Here is my code:

   var testObj = {
     "an entree": "hamburger",
     "my side": "veggies",
     "the drink": "water"
   };

   // Only change code below this line

   testObj["an entree"];   // Change this line
   testObj["the drink"];    // Change this line

Example starts off calling for variable name then then butts up brackets right next to it, adds quotation marks, with property name inside, ends line with a ;. My code starts off calling for variable name then then butts up brackets right next to it, adds quotation marks, with property name inside, ends line with a ;. Where did I go wrong?

Evan Kalvis
@evan17gr
Jan 15 2017 03:59
@Manish-Giri how do i add jquery to a js file?
because i saw some weird ways
Traek Wells
@TraekWells
Jan 15 2017 03:59
@paulotokimatu I want to return the length of the longest word
Manish Giri
@Manish-Giri
Jan 15 2017 03:59
@evan17gr if you link it with script tags before your own js file, jquery will automatically be available to your js file
manish
@kumarheemanshu
Jan 15 2017 04:00
var code="formatted";
Alexis
@alexisgcn
Jan 15 2017 04:00
@TraekWells first your variable have to be a integer
Evan Kalvis
@evan17gr
Jan 15 2017 04:00
@Manish-Giri so if i link it to my html file will it be available to the js file ?
Paulo Tokimatu
@paulotokimatu
Jan 15 2017 04:00
This message was deleted
manish
@kumarheemanshu
Jan 15 2017 04:00

function golfScore(par, strokes) {
// Only change code below this line
if (strokes==1){
return "Holes-in-one!";
}
else if (strokes<=par-2){
return "Eagle";
}
else if(strokes==par-1){
return "Birdie";
}
else if (strokes==par&&strokes!=1){
return "Par";
}
else if (strokes==par+1){
return "Bogey";

}
else if (strokes==par+2){
return "Double Bogey";
}if (strokes>=par+3)
{
return "Go Home!";
}
else
return "Change Me";
// Only change code above this line
}

// Change these values to test
golfScore(5, 4);

Alexis
@alexisgcn
Jan 15 2017 04:01
Your variable longest Word
Paulo Tokimatu
@paulotokimatu
Jan 15 2017 04:01
see if that works
@TraekWells
manish
@kumarheemanshu
Jan 15 2017 04:01
anyone can help me
Alexis
@alexisgcn
Jan 15 2017 04:02
@TraekWells your variable longest wordk must be zero and store the length of the longest string
Traek Wells
@TraekWells
Jan 15 2017 04:02
@paulotokimatu @alexisgcn

function findLongestWord(str) {
  var array = str.split(' ');
  var longestWord = 0;

  for (var i = 0; i < array.length; i++) {
    if (array[i].length > longestWord.length) {
      longestWord = array[i].length;
    }
  }
  return longestWord;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
I’m getting a return of 0. rubs chin mmmm
Manish Giri
@Manish-Giri
Jan 15 2017 04:02
@evan17gr yes, here's an example from my index.html for one of the projects

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskX3iaEnIogmQchP8opvBy3Mi7Ce34nWjpBIwVTHfGYWQS9jwHDVRnpKKHJg7" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.0.2/howler.core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.0.2/howler.min.js"></script>
<script src="https://cdn.jsdelivr.net/lodash/4.17.3/lodash.min.js"></script>
<script src="app3.js"></script>
</body>
Alexis
@alexisgcn
Jan 15 2017 04:03
@TraekWells
Paulo Tokimatu
@paulotokimatu
Jan 15 2017 04:03
@TraekWells because in the condition you used longestWord.length instead of just longestWord
Alexis
@alexisgcn
Jan 15 2017 04:03
If your variable longestword is 0 you dont need it length
Ammy3165
@Ammy3165
Jan 15 2017 04:03
@kumarheemanshu here is the error,[ if (strokes>=par+3)],
Paulo Tokimatu
@paulotokimatu
Jan 15 2017 04:03
in your case longestWord is actually a number
manish
@kumarheemanshu
Jan 15 2017 04:04
@Ammy3165 how to solve it
Alexis
@alexisgcn
Jan 15 2017 04:04
Just verify which word length is the longest and add it to the variable
Evan Kalvis
@evan17gr
Jan 15 2017 04:04
@Manish-Giri does the link to the css file go last?
Ammy3165
@Ammy3165
Jan 15 2017 04:04
use else if
@kumarheemanshu
Manish Giri
@Manish-Giri
Jan 15 2017 04:04
@evan17gr no those are in the <head> tags
Traek Wells
@TraekWells
Jan 15 2017 04:04
@paulotokimatu @alexisgcn you both are amazing. Thanks for the help gentlemen! Worked out for me.
CamperBot
@camperbot
Jan 15 2017 04:04
traekwells sends brownie points to @paulotokimatu and @alexisgcn :sparkles: :thumbsup: :sparkles:
:cookie: 254 | @alexisgcn |http://www.freecodecamp.com/alexisgcn
:cookie: 356 | @paulotokimatu |http://www.freecodecamp.com/paulotokimatu
Paulo Tokimatu
@paulotokimatu
Jan 15 2017 04:05
@TraekWells Great! No problem :)
Manish Giri
@Manish-Giri
Jan 15 2017 04:05
@evan17gr
<head>
    <meta charset="UTF-8">
    <title>Simon</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css">
    <link href="./assets/favicon.ico" rel="icon" type="image/x-icon" />
    <link rel="stylesheet" href="style.css">
</head>
TomexDEV
@TomexDEV
Jan 15 2017 04:05
How does this Word Blanks game works?
manish
@kumarheemanshu
Jan 15 2017 04:05
@Ammy3165 i tried but still have two error
Manish Giri
@Manish-Giri
Jan 15 2017 04:06
@evan17gr you could also put <script> tags in <head>, but I usually do it in <body>
Ammy3165
@Ammy3165
Jan 15 2017 04:06
@kumarheemanshu paste the code again
Evan Kalvis
@evan17gr
Jan 15 2017 04:06
@Manish-Giri ok i ll try so do i need both versions of jquery ?
manish
@kumarheemanshu
Jan 15 2017 04:06
sir could you send complete code of problem golfscore
Alexis
@alexisgcn
Jan 15 2017 04:06
@TraekWells happy coding and ask when you want
Manish Giri
@Manish-Giri
Jan 15 2017 04:07
@evan17gr nope, I was using jQuery UI so I added it
manish
@kumarheemanshu
Jan 15 2017 04:07

function golfScore(par, strokes) {
// Only change code below this line
if (strokes==1){
return "Holes-in-one!";
}
else if (strokes<=par-2){
return "Eagle";
}
else if(strokes==par-1){
return "Birdie";
}
else if (strokes==par&&strokes!=1){
return "Par";
}
else if (strokes==par+1){
return "Bogey";

}
else if (strokes==par+2){
return "Double Bogey";
}
else if (strokes>=par+3)
{
return "Go Home!";
}

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

// Change these values to test
golfScore(5, 4);

Manish Giri
@Manish-Giri
Jan 15 2017 04:07
if you don't need it, don't add it
@evan17gr
brb]
Evan Kalvis
@evan17gr
Jan 15 2017 04:08
@Manish-Giri ok ty very much
CamperBot
@camperbot
Jan 15 2017 04:08
evan17gr sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:warning: evan17gr already gave manish-giri points
Krzysztof Burka
@kazcor
Jan 15 2017 04:09
Hello, could you guys help me with my Profile Lookup challange?
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i=0;i<contacts.length;i++){
if(firstName==contacts[i].firstName&&contacts[i].hasOwnProperty(prop)){
return contacts[i].prop;
}if(firstName!=contacts[i]&&i==contacts.length-1){
return "No such contact";
}if(contacts[i].hasOwnProperty(prop)===false&&i==contacts.length-1){
return "No such property";
}
}
// Only change code above this line
}
I don't know what's wrong here
Ammy3165
@Ammy3165
Jan 15 2017 04:12
use else before this, [return "Change Me";] and [else if (strokes==par&&strokes!=1)], error in this line, why you have used (strokes !=1), wee don't need this.
@kumarheemanshu
see the instructions again....
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:15
@kazcor you can post your code in a more readable format like this:
```javascript
// code here
```
Justin
@tanpaopao
Jan 15 2017 04:16
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    2468: {
      album: "1999",
      artist: "Prince",
      tracks: [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    1245: {
      artist: "Robert Palmer",
      tracks: [ ]
    },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {
  if (value !== "" && prop !== "tracks") {
    collectionCopy[id][prop] = value;
  } else if (value !== "" && prop === "tracks") {
    collectionCopy[id][prop].push(value);
  } if (value === "") {
    delete colletionCopy[id][prop];
  }

  return collection;
}


// Alter values below to test your code
update(5439, "artist", "ABBA");
Could some help me with the course Record Collection? I completely have no idea about it.
Krzysztof Burka
@kazcor
Jan 15 2017 04:16
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i=0;i<contacts.length;i++){
  if(firstName==contacts[i].firstName&&contacts[i].hasOwnProperty(prop)){
    return contacts[i].prop;
  }if(firstName!=contacts[i]&&i==contacts.length-1){
    return "No such contact";
  }if(contacts[i].hasOwnProperty(prop)===false&&i==contacts.length-1){
    return "No such property";
  }
}
// Only change code above this line
}
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:18
Also @kazcor what's the name of the challenge?
Krzysztof Burka
@kazcor
Jan 15 2017 04:18
@no-stack-dub-sack Profile lookup
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:22
@kazcor Ok, let me take a look
Krzysztof Burka
@kazcor
Jan 15 2017 04:22
thanks :)
Thiago Cruz
@thy705
Jan 15 2017 04:25
haha I'm stuck at the same challenge
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:25
@kazcor so one of your issues is that you just have if statements chained together
Krzysztof Burka
@kazcor
Jan 15 2017 04:25
tried it with elses, same result
Ashvini Pandian
@Pabduab
Jan 15 2017 04:26
im stuck! :(
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:26
if/else would be a better approach, if not just more propper
Ashvini Pandian
@Pabduab
Jan 15 2017 04:26

```function nextInLine(arr, item) {
// Your code here
testArr.push(item);

return testArr.shift(arr); // 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));

Jason Han
@somekoreanguy
Jan 15 2017 04:26

can someone walk me through to figure this out? I have no clue in the world to make this happen.... ```function multiplyAll(arr) {
var product = 1;
// Only change code below this line

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);```

Thiago Cruz
@thy705
Jan 15 2017 04:26
I've tried the same thing.
Jason Han
@somekoreanguy
Jan 15 2017 04:26

``` function multiplyAll(arr) {
var product = 1;
// Only change code below this line

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]); ```

Ashvini Pandian
@Pabduab
Jan 15 2017 04:26
function nextInLine(arr, item) {
  // Your code here
  testArr.push(item);

  return testArr.shift(arr);  // 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));
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:26
@kazcor also, try using bracket notation for that first return statement
that will get you much closer
Jason Han
@somekoreanguy
Jan 15 2017 04:27
Nesting For Loops
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:27
some spaces in your code would also make it much easier to read
Krzysztof Burka
@kazcor
Jan 15 2017 04:28
@no-stack-dub-sack the bracket notation worked for some things but I still have one more issue there :<
Ashvini Pandian
@Pabduab
Jan 15 2017 04:28
I'm stuck with one particular problem all the other parts are a go. its just says
Krzysztof Burka
@kazcor
Jan 15 2017 04:29
@no-stack-dub-sack DO you see a problem with the third IF ?
Ashvini Pandian
@Pabduab
Jan 15 2017 04:29
"nextInLine([5,6,7,8,9], 1) should return 5 "
Jason Han
@somekoreanguy
Jan 15 2017 04:31
can someone help me out with "Nesting For Loops"?
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Instructions
Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr
Tiffany
@tiffanymakes
Jan 15 2017 04:31
@Pabduab you should use the given parameters (arr and item) in your function. You don't need testArr in there.
Krzysztof Burka
@kazcor
Jan 15 2017 04:32
the function still doesn't seem to check if the property is there @no-stack-dub-sack
Ashvini Pandian
@Pabduab
Jan 15 2017 04:34
ahh! thanks @tiffanymakes
CamperBot
@camperbot
Jan 15 2017 04:34
pabduab sends brownie points to @tiffanymakes :sparkles: :thumbsup: :sparkles:
:cookie: 269 | @tiffanymakes |http://www.freecodecamp.com/tiffanymakes
Tiffany
@tiffanymakes
Jan 15 2017 04:34
:thumbsup:
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:35
@kazcor So again, it's becuase of your use of multiple if statements
you're not setting any order of precedence in which the checks should happen
If you re-order the ifs you have a working solution
however, this could also be fixed by defining an order in which the checks should happen using else/if and would be much better practice
Thiago Cruz
@thy705
Jan 15 2017 04:37

Hey @no-stack-dub-sack I'm on the same challenge:

 if (lookUpProfile(contacts[3][1], contacts[3][2])){

    return contacts[3][2];

      }

Am I on the right track?

Manish Giri
@Manish-Giri
Jan 15 2017 04:37
@no-stack-dub-sack guess you had an awesome time renaming things in the codebase
:wink:
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:38
@kazcor Also, while it may not seem to matter all that much now because you are typically the only one reading your code, readability is HUGE, for getting help down the line, and for when you eventually start collaborating with other developers. I would start adding spaces to your code in sensible places and making it more readable overall - you will notice the difference!
@Manish-Giri It was my favorite thing ever! :smile:
Manish Giri
@Manish-Giri
Jan 15 2017 04:38
lol
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:38
@Manish-Giri how's all the .md docs going?
Rebecca Vest
@idahogurl
Jan 15 2017 04:38
Is someone available to help me with the Make a Person challenge
Krzysztof Burka
@kazcor
Jan 15 2017 04:38
@no-stack-dub-sack done that, still that one issue remains
Manish Giri
@Manish-Giri
Jan 15 2017 04:38
@no-stack-dub-sack ugh it's so boring :disappointed:
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:39
Sorry @thy705, let me take a look
Manish Giri
@Manish-Giri
Jan 15 2017 04:39
I'm waiting on Quincy, but don't think he's gonna comment, so might as well submit the PR tonight
Rebecca Vest
@idahogurl
Jan 15 2017 04:39
My issue is with the keys count. I get 7 and it wants 6.
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:39
@Manish-Giri Yeah, not the most fun job lol
Manish Giri
@Manish-Giri
Jan 15 2017 04:39
@no-stack-dub-sack .md = most dreadful
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:40
haha
Carlo Blanco
@ccBlanco
Jan 15 2017 04:40

// Setup
var a;
var b = 2;

// Only change code below this line
var a=7;
var b=7;
I'm having trouble trying to figure our how how to assign the variable a to b when its asking me to

Traek Wells
@TraekWells
Jan 15 2017 04:40
A little help with the Title case a sentence challenge?
Thiago Cruz
@thy705
Jan 15 2017 04:40
@no-stack-dub-sack thanks
CamperBot
@camperbot
Jan 15 2017 04:40
thy705 sends brownie points to @no-stack-dub-sack :sparkles: :thumbsup: :sparkles:
:cookie: 335 | @no-stack-dub-sack |http://www.freecodecamp.com/no-stack-dub-sack
Traek Wells
@TraekWells
Jan 15 2017 04:40

function titleCase(str) {
  var lower = str.toLowerCase();
  var array = lower.split(' ');
  var newStr;

  for (var i = 0; i <= array.length; i++) {
    newStr = array[i].slice(0, 1).toUpperCase();
  }
  return newStr;
}

titleCase("I'm a little tea pot");
Manish Giri
@Manish-Giri
Jan 15 2017 04:40
@ccBlanco here you assigned 2 to b yes? var b = 2;
Rebecca Vest
@idahogurl
Jan 15 2017 04:41
I'm sure it has to do that it sees this.firstAndLast as a key
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:41
@thy705 wait, I'm confused - are you on the same challenge? the lookupProfile one?
@kazcor Did you get it?
Thiago Cruz
@thy705
Jan 15 2017 04:41
@no-stack-dub-sack Yep, same one.
Carlo Blanco
@ccBlanco
Jan 15 2017 04:42
@Manish-Giri Thanks man!
CamperBot
@camperbot
Jan 15 2017 04:42
ccblanco sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3787 | @manish-giri |http://www.freecodecamp.com/manish-giri
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:42
Then I'm a bit confused by what you posted, can you post all of your code? Except the setup...
Krzysztof Burka
@kazcor
Jan 15 2017 04:42

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

}
// Only change code above this line
}
``` @no-stack-dub-sack

function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i=0;i<contacts.length;i++){
if (firstName!=contacts[i].firstName && i==contacts.length-1){
return "No such contact";}
else if (contacts[i].hasOwnProperty(prop)===false && i==contacts.length-1){
return "No such property";
}
else if(firstName==contacts[i].firstName&&contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
}
// Only change code above this line
}
Thiago Cruz
@thy705
Jan 15 2017 04:43
I haven't written the whole code yet. I'm asking if that's the right start to it. I've been stuck on this one for a few hours now and have re-written it a few times.
Krzysztof Burka
@kazcor
Jan 15 2017 04:43
sorry for the mess, it now seems return "No such contact" when actually the wrong property has been entered
Rebecca Vest
@idahogurl
Jan 15 2017 04:45
I probably cheated but I moved the variable to be global one outside the class.
Ammy3165
@Ammy3165
Jan 15 2017 04:45
Hi help me to solve the check for palindromes challenge,

function palindrome(str) {
// Good luck!
var changeIntolowerCase = str.toLowerCase();
var removeSpecialCharacter = changeIntolowerCase.replace(/\s+/gi);

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

palindrome("Mybageis00siegaym");

Bigyan Karki
@bigyankarki
Jan 15 2017 04:46
var j = 1;
function factorialize(num) {
  for (var i = num; i > 0; i--) {
    j *= i;
  }
  return j;
}

factorialize(10);
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:46
@kazcor This is your code as you had it before, with the bracket notation and cleaned up a bit:
function lookUpProfile(firstName, prop){
  for(var i=0; i<contacts.length; i++) {

    if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)){
      return contacts[i][prop]; 

    } if (firstName!== contacts[i].firstsname &&i === contacts.length-1) {
      return "No such contact";
    } 

    if(contacts[i].hasOwnProperty(prop) === false && i === contacts.length - 1) {
      return "No such property";
    }
  }
}
Bigyan Karki
@bigyankarki
Jan 15 2017 04:46
hey guys this code is returning the write outputs. But still the freecodecamp section does recognize it
whats the matter
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:47
from here, a simple reorder of the if statements gets you the win
Bigyan Karki
@bigyankarki
Jan 15 2017 04:47
right*
Ammy3165
@Ammy3165
Jan 15 2017 04:47
@bigyankarki first define what's your variable
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:47
@thy705 to me that does not look like the right start... a quick glance at @kazcor will show you a closer setup, although there are still other ways to do this
Krzysztof Burka
@kazcor
Jan 15 2017 04:48
thanks a lot @no-stack-dub-sack :D you're really helpful!
CamperBot
@camperbot
Jan 15 2017 04:48
kazcor sends brownie points to @no-stack-dub-sack :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @no-stack-dub-sack |http://www.freecodecamp.com/no-stack-dub-sack
Bigyan Karki
@bigyankarki
Jan 15 2017 04:48
@Ammy3165 i Have already defined i and j
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:48
@kazcor no prob!
Ammy3165
@Ammy3165
Jan 15 2017 04:48
your variable of the defined function
@bigyankarki
Bigyan Karki
@bigyankarki
Jan 15 2017 04:48
yr?
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 04:49
@kazcor now that you've solved it on your own, it's worth checking out the wiki to see the "official" solution so you can get a better sense of what's going on
Krzysztof Burka
@kazcor
Jan 15 2017 04:49
oh theres a wiki? could you link it @no-stack-dub-sack ?
Patrick McCarty
@patrickthesailorman
Jan 15 2017 04:50
// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line

var gloveBoxContents = "maps"; // Change this line
  myStorage.car["inside"].gloveBoxContents;
what am I missing here?
Ammy3165
@Ammy3165
Jan 15 2017 04:50
@bigyankarki your variable is "num" here
Tiffany
@tiffanymakes
Jan 15 2017 04:50
@bigyankarki just move your variable j definition into your function and it should work
right now it is outside of the function
Krzysztof Burka
@kazcor
Jan 15 2017 04:51
ok, found it, as always I've proven my stupidity to myself
Bigyan Karki
@bigyankarki
Jan 15 2017 04:52
@tiffanymakes j return j is inside the function
var j = 1;
function factorialize(num) {
  for (var i = num; i > 0; i--) {
    j *= i;
  }
  return j;
}

factorialize(10);
Tiffany
@tiffanymakes
Jan 15 2017 04:52
where you define var j
Alex
@Joshua-A-Smith
Jan 15 2017 04:53
So I'm supposed to put the for loop in the functiion
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for ( )
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Kodati Sai Kiran
@saiki96
Jan 15 2017 04:53
@Pabduab hi .....im still with the same problem.....the error which arises is "nextInLine([5,6,7,8,9], 1) should return 5"
Bigyan Karki
@bigyankarki
Jan 15 2017 04:53
@tiffanymakes thanks it worked
CamperBot
@camperbot
Jan 15 2017 04:53
bigyankarki sends brownie points to @tiffanymakes :sparkles: :thumbsup: :sparkles:
:cookie: 270 | @tiffanymakes |http://www.freecodecamp.com/tiffanymakes
Austiclyse
@Austiclyse
Jan 15 2017 04:53
Does freecodecamp purposefully use the most unhelpful instructions on purpose?
Tiffany
@tiffanymakes
Jan 15 2017 04:53
:thumbsup:
Patrick McCarty
@patrickthesailorman
Jan 15 2017 04:54
YES!
Bigyan Karki
@bigyankarki
Jan 15 2017 04:54
anyways why is it that j should be local variable and not global? @tiffanymakes
both works right?
Thiago Cruz
@thy705
Jan 15 2017 04:54
@Austiclyse I feel the same. And also it feels like things get too advanced without proper preparation.
Kodati Sai Kiran
@saiki96
Jan 15 2017 04:54
@Pabduab @tiffanymakes hi .....im still with the same problem.....the error which arises is "nextInLine([5,6,7,8,9], 1) should return 5"
Tiffany
@tiffanymakes
Jan 15 2017 04:55
Right, both should work. I'm wondering if it's just because of how FCC designed the problem @bigyankarki
Bigyan Karki
@bigyankarki
Jan 15 2017 04:56
yup that could be! thanks once again
Greg Duncan
@GregatGit
Jan 15 2017 04:56
@Austiclyse part of becoming a programer is learning how to overcome frustration and solve the problem at hand.
Tiffany
@tiffanymakes
Jan 15 2017 04:57
@saiki96 what do you have so far?
Ammy3165
@Ammy3165
Jan 15 2017 04:58
@GregatGit yes that's what amazing part to be a programmer
Austiclyse
@Austiclyse
Jan 15 2017 04:59
@thy705 Right. Or explanation. Of they show you apples and give you oranges to work with. It's cool that they provide a chat room but not cool that they make people lean on it so hard and keep it totally voluntary based. Nobody want to answer your question? It's not getting answered. I'd like to see people only really have to use the chat room for tackling projects instead of needing help just to be taught. But what are ya gonna do, right? @GregatGit
Kodati Sai Kiran
@saiki96
Jan 15 2017 04:59
@tiffanymakes im sorry ....i dint get your question...
Bigyan Karki
@bigyankarki
Jan 15 2017 05:01
@no-stack-dub-sack are you still stuck?
Greg Duncan
@GregatGit
Jan 15 2017 05:01
@Austiclyse it's really up to you to dig deeper and fill in the knowledge gaps. The fcc rooms here are great to lean how to ask questions. On stack overflow they can be quite sharp.
@Austiclyse But where are you stuck right now?
Tiffany
@tiffanymakes
Jan 15 2017 05:02
@saiki96 can you post the code you've written so far so I can take a look?
Peter Weinberg
@no-stack-dub-sack
Jan 15 2017 05:06
@bigyankarki Was that meant for someone else?
@thy705 Are you still stuck?
Kodati Sai Kiran
@saiki96
Jan 15 2017 05:07
@tiffanymakes oi...i got the soln....it was very carelessof of me not to use arr/
thanks anyways @tiffanymakes
CamperBot
@camperbot
Jan 15 2017 05:07
saiki96 sends brownie points to @tiffanymakes :sparkles: :thumbsup: :sparkles:
:cookie: 271 | @tiffanymakes |http://www.freecodecamp.com/tiffanymakes
Austiclyse
@Austiclyse
Jan 15 2017 05:08
I know. I've been all over the place and stack overflow, too. Just ranting because trying to get in the zone to learn something but having to stop every few minutes to scour the web for answers or ask it yourself and wait for he reply is really annoying. What if someone was on a time crunch? Anyways, I'm hopping around variable properties right now. @GregatGit
Ammy3165
@Ammy3165
Jan 15 2017 05:08
hi help me to solve this challenge,

function palindrome(str) {
// Good luck!
var changeIntolowerCase = str.toLowerCase();
var removeSpecialCharacter = changeIntolowerCase.replace(/\s+/gi,changeIntolowerCase);

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

palindrome("My ageis00siegaym");

Joseph
@revisualize
Jan 15 2017 05:08
hey.
@Ammy3165 You're not removing ALL non-alphanumeric characters
Your .replace() isn't written correctly either.
Ammy3165
@Ammy3165
Jan 15 2017 05:10
@revisualize thanks I will consider
CamperBot
@camperbot
Jan 15 2017 05:10
ammy3165 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2971 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 15 2017 05:11
Anyone else here need assistance? I'm scrolling up and looking at some stuff that may have timed out.
@saiki96 Did you solve Stand In Line?
@Joshua-A-Smith Did you write out your nested for loops?
Ammy3165
@Ammy3165
Jan 15 2017 05:22

@revisualize hey look this one, which I edited further
function palindrome(str) {
// Good luck!
var changeIntolowerCase = str.toLowerCase();
var removeSpecialCharacter = changeIntolowerCase.replace(/[\W_]/g, '');

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

palindrome("My ageis00siegaym");

arkosingh
@arkosingh
Jan 15 2017 05:22
how to

Assign the value 7 to variable a.

Assign the contents of a to variable b.

// Setup
var a;
var b = 2;

// Only change code below this line
Var a=7;
Var b=7;
var a= var b;

?????????
Ammy3165
@Ammy3165
Jan 15 2017 05:23
@arkosingh Just put a=b;
arkosingh
@arkosingh
Jan 15 2017 05:23
ok
Ammy3165
@Ammy3165
Jan 15 2017 05:24
@revisualize hey are u here?
arkosingh
@arkosingh
Jan 15 2017 05:25
thanks @Ammy3165
CamperBot
@camperbot
Jan 15 2017 05:25
arkosingh sends brownie points to @ammy3165 :sparkles: :thumbsup: :sparkles:
:cookie: 242 | @ammy3165 |http://www.freecodecamp.com/ammy3165
Paolo Manlunas
@Paomanz
Jan 15 2017 05:25
just assign the agorithm to the var farenheit
that's it
Joseph
@revisualize
Jan 15 2017 05:26
I am.
@arkosingh You don't have a var on the right of the = assignment operator
@arkosingh How do you assign the value of 7 to a variable num? ... var num = 7;
Now if you want you can use a variable to store values.
Like in mathmatics. num + 3 = 10 What is the value of num?
var x = num + 3; ... That outputs 10
So, you can do several things with variables. But, you need to understand that variables hold values and variables can be used with other variables.
So, how do you assign the value of 5 to a variable x? ... x = 5; (Which is also overwriting the previous value of 10 from above.
How do you assign the value of x to a variable y?
Look at the way things are written. var y = x;
How do you assign the value of 42 to a variable answer? ... What is the answer?
Variables hold values. Just understand that.
@Ammy3165 Does that solve?
Ammy3165
@Ammy3165
Jan 15 2017 05:28
@revisualize hey my function returning everything but FCC showing you're not done with it.
Joseph
@revisualize
Jan 15 2017 05:29
@Ammy3165 Let me test it. One sec.
Ammy3165
@Ammy3165
Jan 15 2017 05:31
You mean I have to assign "===" this instead of "==" this.
@revisualize
Justin
@tanpaopao
Jan 15 2017 05:31

```function update(id, prop, value) {

if (value !== "" && prop !== "tracks") {
collectionCopy[id][prop] = value;
} else if (value !== "" && prop === "tracks") {
collectionCopy[id][prop].push(value);
} if (value === "") {
delete colletionCopy[id][prop];
}

if (value !=="" && prop !== "tracks") {
collectionCopy[id][prop] = value;
} else if (value !=="" && prop === "tracks") {
collectionCopy[id][prop].push(value);
} if (value === "") {
delete collectionCopy[id][prop];
}
```
Is this a bug? The below sentence can wrok out, but the upper one can not . Can someone find the difference between them?

function update(id, prop, value) {

  if (value !== "" && prop !== "tracks") {
    collectionCopy[id][prop] = value;
  } else if (value !== "" && prop === "tracks") {
    collectionCopy[id][prop].push(value);
  } if (value === "") {
    delete colletionCopy[id][prop];
  }

  if (value !=="" && prop !== "tracks") {
    collectionCopy[id][prop] = value;
  } else if (value !=="" && prop === "tracks") {
    collectionCopy[id][prop].push(value);
  } if (value === "") {
    delete collectionCopy[id][prop];
  }
Is this a bug? The below sentence can wrok out, but the upper one can not . Can someone find the difference between them?
Joseph
@revisualize
Jan 15 2017 05:32
@Ammy3165 No. I mean redo that lesson.
Kelvin Maués
@kelvinmaues
Jan 15 2017 05:32
Hey Campers, do you know why the geolocation API does not work on codepen.io?
Joseph
@revisualize
Jan 15 2017 05:32
@tanpaopao No but, You're not supposed to use the copy you are supposed to use the collection.
@kelvinmaues Google Chrome and HTTPS?
@Ammy3165 I did the same thing that lesson requires and modified your code and it works.
@tanpaopao You're also not following all of the instructions.
mitron6
@mitron6
Jan 15 2017 05:37
@tanpaopao Also what if "tracks" does not already exist in the object at collection[id]? You can't use push on it. If it didn't exist you need to create it before you can push it, perhaps something like ..[i][prop]=[]
Joseph
@revisualize
Jan 15 2017 05:38
You mean... I can't .push() to arrays that don't exist! NO WAY!
:trollface:
mitron6
@mitron6
Jan 15 2017 05:39
@revisualize I tested it. It gives an exception. No magic creation.
Ammy3165
@Ammy3165
Jan 15 2017 05:40
@revisualize thanks it worked after removing unncessary if else statement.
CamperBot
@camperbot
Jan 15 2017 05:40
:warning: ammy3165 already gave revisualize points
ammy3165 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
Justin
@tanpaopao
Jan 15 2017 05:40
Thank you both @mitron6 @revisualize
CamperBot
@camperbot
Jan 15 2017 05:40
tanpaopao sends brownie points to @mitron6 and @revisualize :sparkles: :thumbsup: :sparkles:
:cookie: 451 | @mitron6 |http://www.freecodecamp.com/mitron6
:star2: 2974 | @revisualize |http://www.freecodecamp.com/revisualize
Sharuf
@Sharuf
Jan 15 2017 05:42
how to assign the contents of a to variable b ?
mitron6
@mitron6
Jan 15 2017 05:42
@revisualize From working with other languages, it is easy to have mistaken assumptions. For example, today I learned that false && 23 returns false but true && 23 returns not true, but 23.
Joseph
@revisualize
Jan 15 2017 05:44
@Sharuf How do you assign the value of 7 to a variable num? ... var num = 7;
Now if you want you can use a variable to store values.
Like in mathmatics. num + 3 = 10 What is the value of num?
var x = num + 3; ... That outputs 10
So, you can do several things with variables. But, you need to understand that variables hold values and variables can be used with other variables.
So, how do you assign the value of 5 to a variable x? ... x = 5; (Which is also overwriting the previous value of 10 from above.
How do you assign the value of x to a variable y?
Look at the way things are written. var y = x;
How do you assign the value of 42 to a variable answer? ... What is the answer?
Variables hold values. Just understand that.
Kelvin Maués
@kelvinmaues
Jan 15 2017 05:44
@revisualize Yes, exactly! On Mozila, it's works!
Joseph
@revisualize
Jan 15 2017 05:45
@kelvinmaues You need to call an HTTPS api if you want to use chrome.
You can try to use a CORS like crossorigin.me
There are a few others.
Nathan Parsons
@10milliondollarwebpage
Jan 15 2017 05:46
I have decided to quit freecodecamp and become an assembly programmer have I made the right decision
Kelvin Maués
@kelvinmaues
Jan 15 2017 05:46
@revisualize thanks for your time, I'll try it. ;)
CamperBot
@camperbot
Jan 15 2017 05:46
kelvinmaues sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2975 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 15 2017 05:47
@unlawfulspoonisback It is your life.
@tanpaopao I see that you are Private Messaging me. I don't read any of them. I just close them instantly.
Nathan Parsons
@10milliondollarwebpage
Jan 15 2017 05:50
commands
CamperBot
@camperbot
Jan 15 2017 05:50

commands:

  • isCommand
  • cbot
  • echo
  • botversion
  • botstatus
  • botenv
  • archive
  • init
  • tooNoisy
  • help
  • menu
  • rooms
  • find
  • commands
  • music
  • announce
  • rollem
  • eightball
  • camperCount
  • welcome
  • hello
  • wikiFooter
  • wikiUsage
  • wikiCantFind
  • wiki
  • thanks
  • about
  • showInfoCallback
  • update
  • bonfire
  • checkBonfireCommands
  • searchBonfire
  • checkHasBonfire
  • inBonfireRoom
  • hint
  • bf
  • explain
  • bot
  • hi
  • index
  • thank
  • log
  • archives
Nathan Parsons
@10milliondollarwebpage
Jan 15 2017 05:51
init
explain
CamperBot
@camperbot
Jan 15 2017 05:51
usage:
wiki $topic info on that topic
Joseph
@revisualize
Jan 15 2017 05:52
A lot of those commands don't work any more since the Wiki was moved to the Forum.
Nathan Parsons
@10milliondollarwebpage
Jan 15 2017 05:56
bot
I dont like javascript it does not have IO
mitron6
@mitron6
Jan 15 2017 05:58
@unlawfulspoonisback console.log and in the browser, just modify the DOM.
Joseph
@revisualize
Jan 15 2017 06:11
What!? JavaScript doesn't have an Input Output? ... WHAT!?
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:13
geolocation not working
RedWalder85
@RedWalder85
Jan 15 2017 06:15
Javascript has input and output due to the console.log
And many more ways
hi
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:17
help
@revisualize
Tiffany
@tiffanymakes
Jan 15 2017 06:23
@shenoyabhijith I had this problem as well. The geolocation only works over a secure connection (HTTPS) and the weather API only works over a non-secure connection (HTTP). I ended up using IP addresses http://ip-api.com/json for the location. It's not as accurate, but it works with HTTP.
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:23
ohh so i cannot work with this ?
@tiffanymakes
site cannot be reached
@tiffanymakes
Tiffany
@tiffanymakes
Jan 15 2017 06:26
try the IP API instead of navigation.geolocation to get the location
Give me a second, let me take a look at your code.
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:29
i got an alternative
im confused about hostname
Arrow007
@Arrow007
Jan 15 2017 06:32
(Explain JavaScript)
CamperBot
@camperbot
Jan 15 2017 06:32
no wiki entry for: javascript
Tiffany
@tiffanymakes
Jan 15 2017 06:33
From the documentation, it seems like you can leave it out. I get an object with my IP, lat, long, and stuff with freegeoip.net/{format}/
Arrow007
@Arrow007
Jan 15 2017 06:33
Aw
It doesn't work
Tiffany
@tiffanymakes
Jan 15 2017 06:33
sorry freegeoip.net/json/ @shenoyabhijith
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:33
@tiffanymakes
can you tell me whats the hostname
mean here
Tiffany
@tiffanymakes
Jan 15 2017 06:35
I'm not sure what it means here.
Alexander Køpke
@alexanderkopke
Jan 15 2017 06:38
@shenoyabhijith hostname is something like google.com or github.com. You can check the location of those sites using http://freegeoip.net/json/github.com
Muhammad Hasham
@MohammadHasham
Jan 15 2017 06:40
blob
Why is my image not having border aligned with it instead it is like this:
Tiffany
@tiffanymakes
Jan 15 2017 06:40
Good to know, thanks @alexanderkopke!
CamperBot
@camperbot
Jan 15 2017 06:40
tiffanymakes sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:cookie: 977 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:42
ok @alexanderkopke
Aditya Gupta
@adityagupta4213
Jan 15 2017 06:44
Hey guys, I can't understand why the .toLowercase prototype isn't working in my case. Could someone explain it to me?
function palindrome(str) {
  var rev_str;
  str.toLowerCase();
  str=str.replace(/\s/g,'');
  str=str.replace(/,/g,"");
  str=str.replace(/\./g,"");
  str=str.replace(/\-/g,"");
  str=str.replace(/\_/g,"");
  console.log(str);
  str = '' + str + '';
  rev_str = str.split('').reverse().join('');
  if (rev_str==str){
    return true;
  }  
  else{
    return false;
  }

}
Will White
@willnwhite
Jan 15 2017 06:49
@adityagupta4213 Why aren't you doing str = str.toLowerCase()?
Aditya Gupta
@adityagupta4213
Jan 15 2017 06:50
@willnwhite Oh! Yeah I got it! Thanks a lot. I don't know why I forgot to assign the value.
Greg Duncan
@GregatGit
Jan 15 2017 06:51
@adityagupta4213 don't forget to use spaces - it makes you code easier to read -
str=str.replace(/\s/g,'');
str = str.replace(/\s/g,'');
Aditya Gupta
@adityagupta4213
Jan 15 2017 06:51
@GregatGit Alright, I'll keep that in mind :)
Muhammad Hasham
@MohammadHasham
Jan 15 2017 06:52
i need some help with frontend
anyone there?
Will White
@willnwhite
Jan 15 2017 06:52
Here.
Greg Duncan
@GregatGit
Jan 15 2017 06:52
@adityagupta4213 have a look at this replace(/[\W_]/g, '');
Aditya Gupta
@adityagupta4213
Jan 15 2017 06:53
@GregatGit Ok, I'll try that
Muhammad Hasham
@MohammadHasham
Jan 15 2017 06:53

@willnwhite
actually i wanted to know that how to make the page scroll over image like in this wix template the page can be scrolled over image
http://editor.wix.com/html/editor/web/renderer/new?metaSiteId=9f881df7-a843-43b5-9062-2efc3cb343c7&siteId=d24fe62c-3ce1-42e1-97d5-564f7740ac37&editorSessionId=F8BFCED4-BEB3-4498-A09D-B431A06C0DCC

how can i do that?

Aditya Gupta
@adityagupta4213
Jan 15 2017 06:54
@MohammadHasham Use fixed background
Muhammad Hasham
@MohammadHasham
Jan 15 2017 06:55
then do i need to add something over that to scroll ?
@adityagupta4213
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:55
not working
Aditya Gupta
@adityagupta4213
Jan 15 2017 06:55
@MohammadHasham Apply background-position:fixed to the div.
Greg Duncan
@GregatGit
Jan 15 2017 06:55
@MohammadHasham have a look at this template http://www.w3schools.com/bootstrap/bootstrap_scrollspy.asp
my ip address cannot be determined
Muhammad Hasham
@MohammadHasham
Jan 15 2017 06:55
@adityagupta4213 @GregatGit Thanks
CamperBot
@camperbot
Jan 15 2017 06:55
mohammadhasham sends brownie points to @adityagupta4213 and @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 102 | @adityagupta4213 |http://www.freecodecamp.com/adityagupta4213
:cookie: 823 | @gregatgit |http://www.freecodecamp.com/gregatgit
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:56
im getting undefined for the http request
grantknaver
@grantknaver
Jan 15 2017 06:57
why when I use Objec.values() does it return a property and a value?
Greg Duncan
@GregatGit
Jan 15 2017 06:57
@MohammadHasham it's very tough at first getting a handle on the css for everyone - so when you're finding it impossible - don't worry - we all struggled there (and still do at times)
grantknaver
@grantknaver
Jan 15 2017 06:58
function whatIsInAName(collection, source) {
   var sourceName = Object.keys(source);
   var sourceValue = Object.values(source);
  console.log(Object.values(collection[2]));
 for(var i = 0; i < collection.length; i++){
   var collectionArray = Object.values(collection[i]);
   if(collection[i].hasOwnProperty(sourceName) && Object.values(collection[i]) === sourceValue){
     console.log('it works');  
    }
  }

}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
abhijith shenoy
@shenoyabhijith
Jan 15 2017 06:58
any here to help
Aditya Gupta
@adityagupta4213
Jan 15 2017 06:59
@GregatGit Thanks! I was thinking about combining the RegEx but wasn't able to.
CamperBot
@camperbot
Jan 15 2017 06:59
adityagupta4213 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 824 | @gregatgit |http://www.freecodecamp.com/gregatgit
ip is undefined?
can some 1 take a look at my js code
Greg Duncan
@GregatGit
Jan 15 2017 06:59
grantknaver
@grantknaver
Jan 15 2017 07:00
any idea
Greg Duncan
@GregatGit
Jan 15 2017 07:00
@shenoyabhijith i think all apis should have http or https in front of them
ashifmvp
@ashifmvp
Jan 15 2017 07:00
@GregatGit

var Bike = function() {

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

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

whats wrong in above code?
not working
Darth Skywalker
@adityaparab
Jan 15 2017 07:01
@shenoyabhijith : var location= document.getElementById("cntnt").innerHTML = json.country_name; is why you get undefined
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:01
i tried it
Darth Skywalker
@adityaparab
Jan 15 2017 07:02
.getElementById doesn't return anything.
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:02
i console.log location
Greg Duncan
@GregatGit
Jan 15 2017 07:02
@ashifmvp what is the challenge called?
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:02
still i get object on console
Darth Skywalker
@adityaparab
Jan 15 2017 07:02
@shenoyabhijith yes console.log location is also undefined
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:02
how do i correct it
@adityaparab
some suggestion by you would be great
Darth Skywalker
@adityaparab
Jan 15 2017 07:04
@shenoyabhijith : There is no such thing as country_name in your json. This is your response
{
    "response": {
        "version": "0.1",
        "termsofService": "http://www.wunderground.com/weather/api/d/terms.html",
        "features": {
            "conditions": 1
        }
    },
    "current_observation": {
        "image": {
            "url": "http://icons.wxug.com/graphics/wu2/logo_130x80.png",
            "title": "Weather Underground",
            "link": "http://www.wunderground.com"
        },
        "display_location": {
            "full": "San Francisco, CA",
            "city": "San Francisco",
            "state": "CA",
            "state_name": "California",
            "country": "US",
            "country_iso3166": "US",
            "zip": "94102",
            "magic": "1",
            "wmo": "99999",
            "latitude": "37.77999878",
            "longitude": "-122.41999817",
            "elevation": "60.0"
        },
        "observation_location": {
            "full": "SOMA, San Francisco, California",
            "city": "SOMA, San Francisco",
            "state": "California",
            "country": "US",
            "country_iso3166": "US",
            "latitude": "37.778488",
            "longitude": "-122.408005",
            "elevation": "23 ft"
        },
        "estimated": {},
        "station_id": "KCASANFR131",
        "observation_time": "Last Updated on January 14, 11:00 PM PST",
        "observation_time_rfc822": "Sat, 14 Jan 2017 23:00:53 -0800",
        "observation_epoch": "1484463653",
        "local_time_rfc822": "Sat, 14 Jan 2017 23:00:58 -0800",
        "local_epoch": "1484463658",
        "local_tz_short": "PST",
        "local_tz_long": "America/Los_Angeles",
        "local_tz_offset": "-0800",
        "weather": "Partly Cloudy",
        "temperature_string": "47.8 F (8.8 C)",
        "temp_f": 47.8,
        "temp_c": 8.8,
        "relative_humidity": "85%",
        "wind_string": "Calm",
        "wind_dir": "North",
        "wind_degrees": -9999,
        "wind_mph": 0,
        "wind_gust_mph": 0,
        "wind_kph": 0,
        "wind_gust_kph": 0,
        "pressure_mb": "1021",
        "pressure_in": "30.16",
        "pressure_trend": "+",
        "dewpoint_string": "44 F (6 C)",
        "dewpoint_f": 44,
        "dewpoint_c": 6,
        "heat_index_string": "NA",
        "heat_index_f": "NA",
        "heat_index_c": "NA",
        "windchill_string": "48 F (9 C)",
        "windchill_f": "48",
        "windchill_c": "9",
        "feelslike_string": "48 F (9 C)",
        "feelslike_f": "48",
        "feelslike_c": "9",
        "visibility_mi": "10.0",
        "visibility_km": "16.1",
        "solarradiation": "0",
        "UV": "0.0",
        "precip_1hr_string": "0.00 in ( 0 mm)",
        "precip_1hr_in": "0.00",
        "precip_1hr_metric": " 0",
        "precip_today_string": "0.00 in (0 mm)",
        "precip_today_in": "0.00",
        "precip_today_metric": "0",
        "icon": "partlycloudy",
        "icon_url": "http://icons.wxug.com/i/c/k/nt_partlycloudy.gif",
        "forecast_url": "http://www.wunderground.com/US/CA/San_Francisco.html",
        "history_url": "http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KCASANFR131",
        "ob_url": "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=37.778488,-122.408005",
        "nowcast": ""
    }
}
JamesVitaly
@JamesVitaly
Jan 15 2017 07:05
how do i return the property of an object
Darth Skywalker
@adityaparab
Jan 15 2017 07:05
You will need to do var location = json.current_observation.display_location.country
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:05
check response of geolocation api
not weather api
@adityaparab
{
"ip": "192.30.253.113",
"country_code": "US",
"country_name": "United States",
"region_code": "CA",
"region_name": "California",
"city": "San Francisco",
"zip_code": "94107",
"time_zone": "America/Los_Angeles",
"latitude": 37.7697,
"longitude": -122.3933,
"metro_code": 807
}
Darth Skywalker
@adityaparab
Jan 15 2017 07:07
@shenoyabhijith in that case, your code is wrong.
you need to nest those two api calls
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:07
how do i do that
can you correct my code
@adityaparab
Greg Duncan
@GregatGit
Jan 15 2017 07:07
@shenoyabhijith first do the geolocation call then inside that do the api call
Darth Skywalker
@adityaparab
Jan 15 2017 07:07
Hold on
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:08
okay
ill try
ashifmvp
@ashifmvp
Jan 15 2017 07:10
@GregatGit
Make Object Properties Private
Darth Skywalker
@adityaparab
Jan 15 2017 07:10
@shenoyabhijith
$(document).ready(function() {

  var api = "https://api.wunderground.com/api/19b1920430424fb2/conditions/q/CA/San_Francisco.json";
  // determine geo lookup
  var geolocation = "https://freegeoip.net/json/github.com";
  $.getJSON(geolocation, function(geoLocation) {
    $.getJSON(api, function(weather) {
      console.log('Geolocation - ', geoLocation);
      document.getElementById("cntnt").innerHTML = weather.current_observation.display_location.country;
      var location = geoLocation.country_name;
      document.getElementById("cntnt").innerHTML += ' || ' + location;
      console.log(location);
    });
  });
});
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:11
weather?
Darth Skywalker
@adityaparab
Jan 15 2017 07:11
yes?
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:11
ok
Darth Skywalker
@adityaparab
Jan 15 2017 07:12
it's just a name given to the server response
JamesVitaly
@JamesVitaly
Jan 15 2017 07:12
struggling with tthis can someone point me in the right directionModify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:12
im getting my country as us
when i live in india
problem with api or with my code
Darth Skywalker
@adityaparab
Jan 15 2017 07:12
problem with API
not your code
JamesVitaly
@JamesVitaly
Jan 15 2017 07:13
myObj.hasOwnProperty();
return;} have tried this
also
this
var result ="";
result = myObj[checkProp];
return result;
Darth Skywalker
@adityaparab
Jan 15 2017 07:14
@shenoyabhijith : Yes. there is a small problem with your code.
Will White
@willnwhite
Jan 15 2017 07:14
@JamesVitaly There's no "Not Found" in your code.
Darth Skywalker
@adityaparab
Jan 15 2017 07:15

change your

var geolocation = "https://freegeoip.net/json/github.com";

to

var geolocation = "https://freegeoip.net/json/";
ashifmvp
@ashifmvp
Jan 15 2017 07:15
@JamesVitaly
Darth Skywalker
@adityaparab
Jan 15 2017 07:15
@shenoyabhijith
ashifmvp
@ashifmvp
Jan 15 2017 07:15

var Bike = function() {

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

this.setGear = function(change){
gear += change;
};
this.getGear = function(){
return gear;
};
};
pls help

abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:15
ohh thanks a lot @adityaparab
CamperBot
@camperbot
Jan 15 2017 07:15
shenoyabhijith sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 837 | @adityaparab |http://www.freecodecamp.com/adityaparab
Darth Skywalker
@adityaparab
Jan 15 2017 07:15
@ashifmvp : just assign value of change to your gear. don't +=
JamesVitaly
@JamesVitaly
Jan 15 2017 07:16
@willnwhite how do i put a return not found if false i tried a few things but nothing worked
Greg Duncan
@GregatGit
Jan 15 2017 07:16
@ashifmvp gear += change; should be this.gear = change;`
Darth Skywalker
@adityaparab
Jan 15 2017 07:17
@shenoyabhijith : while using 3rd party services, it always helps to take a look at official docs ( https://freegeoip.net/ ) when the results are unexpected ;)
@GregatGit this.gear would be wrong
since he's declared gear as var gear
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:17
thanks a lot im a beginner
Darth Skywalker
@adityaparab
Jan 15 2017 07:17
@shenoyabhijith :+1:
ashifmvp
@ashifmvp
Jan 15 2017 07:17
@GregatGit why diefference greg
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:18
im learning a lot from fcc
Darth Skywalker
@adityaparab
Jan 15 2017 07:18
keep it up
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:18
@adityaparab thanks mate for your feedback
CamperBot
@camperbot
Jan 15 2017 07:18
shenoyabhijith sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:warning: shenoyabhijith already gave adityaparab points
Darth Skywalker
@adityaparab
Jan 15 2017 07:18
@shenoyabhijith :+1:
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:18
you seem to be from india? are you
Darth Skywalker
@adityaparab
Jan 15 2017 07:18
Yes.
Pune
ashifmvp
@ashifmvp
Jan 15 2017 07:19
@GregatGit logically gear += change should store the value right?
Will White
@willnwhite
Jan 15 2017 07:19
@JamesVitaly ".hasOwnProperty() returns true or false if the property is found or not."
Greg Duncan
@GregatGit
Jan 15 2017 07:19
@ashifmvp @adityaparab i just ran it it and this.gear is required
@ashifmvp no - you don't - just =
Darth Skywalker
@adityaparab
Jan 15 2017 07:20
@GregatGit : May be required to pass the tests. However, considering the code he has, where there is var gear = 0; in the beginning, doing this.gear = whatever will not affect the var gear
JamesVitaly
@JamesVitaly
Jan 15 2017 07:21
@willnwhite ok so how do i write if true return ..
ashifmvp
@ashifmvp
Jan 15 2017 07:21
yeah thats required by i am trying to understand the difference in logic and the reason for not getting the test passed
Will White
@willnwhite
Jan 15 2017 07:21
@JamesVitaly So if it's false, return "Not Found".
JamesVitaly
@JamesVitaly
Jan 15 2017 07:21
@JamesVitaly and im not sure how to make it return the propery
Darth Skywalker
@adityaparab
Jan 15 2017 07:22

@ashifmvp doing

gear = change

will make value of gear to equal value of change

doing

gear += change

is as good as

gear = gear + change
Will White
@willnwhite
Jan 15 2017 07:23
Not me @adityaparab!
Darth Skywalker
@adityaparab
Jan 15 2017 07:23
@willnwhite sorry :P
updated
ashifmvp
@ashifmvp
Jan 15 2017 07:23
@adityaparab can you suggest why i was not getting the test passes?
Darth Skywalker
@adityaparab
Jan 15 2017 07:24
@ashifmvp no idea. show your full code again
and also the name of the challenge
let me take a look
Will White
@willnwhite
Jan 15 2017 07:24
@JamesVitaly If it's true, return the property's value.
ashifmvp
@ashifmvp
Jan 15 2017 07:24

var Bike = function() {

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

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

Make Object Properties Private
@adityaparab
may be cos of
JamesVitaly
@JamesVitaly
Jan 15 2017 07:25
@willnwhite yes but what do i type to get the properties value or do i put the value for each one in myself
ashifmvp
@ashifmvp
Jan 15 2017 07:25
myBike.gear should remain undefined. this condition?
Darth Skywalker
@adityaparab
Jan 15 2017 07:26
@ashifmvp yes. using var is how your define private properties
so this code is correct
Will White
@willnwhite
Jan 15 2017 07:26
@JamesVitaly I see.
Darth Skywalker
@adityaparab
Jan 15 2017 07:26
this.gear will be the public property
JamesVitaly
@JamesVitaly
Jan 15 2017 07:27
myObj.hasOwnProperty("gift");
if (true) return (WHAT TO PUT HERE);
else if (false) return "Not Found";
@willnwhite yeh im a bit stuck with this part I have
i can create one expresson for each property but isnt there a way to not have to do that
ashifmvp
@ashifmvp
Jan 15 2017 07:28
@adityaparab you are saying my code was correct ?
Will White
@willnwhite
Jan 15 2017 07:28
@JamesVitaly myObj[checkProp]
Darth Skywalker
@adityaparab
Jan 15 2017 07:28
without using this.gear yes, yours is correct
this one
ashifmvp
@ashifmvp
Jan 15 2017 07:29
yeah i havent used that still i am unable to get the test passes @adityaparab
dazewerk
@dazewerk
Jan 15 2017 07:29
greetings. noob here. need help with 'Stand in Line'. Supposed to push 'item' to 'arr', then remove first element of 'arr'... tried arr.shift(); but errors arr.shift is not a function
function nextInLine(arr, item) {
// Your code here
arr = arr.push(item);
arr.shift();
return item; // Change this line
}
karim06
@karim06
Jan 15 2017 07:30
can anyone help me with "Falsy Bouncer" algorithm ...
JamesVitaly
@JamesVitaly
Jan 15 2017 07:32

@willnwhite thanks for all your help so far, but im still not getting it , i have this myObj.hasOwnProperty();
if (true) return myObj[checkProp];
else if (false) return "Not Found";

but it wont return a not found

CamperBot
@camperbot
Jan 15 2017 07:32
:cookie: 309 | @willnwhite |http://www.freecodecamp.com/willnwhite
jamesvitaly sends brownie points to @willnwhite :sparkles: :thumbsup: :sparkles:
Will White
@willnwhite
Jan 15 2017 07:33
@JamesVitaly Why no argument to hasOwnProperty?
Alessandro
@Riverino
Jan 15 2017 07:33
hey guys, I'm lost with the challenge "Passing Values to Functions with Arguments". I do no understand what I'm doing wrong. I received the following errors: functionWithArgs(1,2) should output 3
functionWithArgs(7,9) should output 16. But, how am I supposed to know those parameters? the challenge doesn't refer to them. Any help?
JamesVitaly
@JamesVitaly
Jan 15 2017 07:34
@willnwhite myObj.hasOwnProperty("gift");
if (true) return myObj[checkProp];
if (false) return "Not Found"; like that? it doesnt seem to make a difference
Will White
@willnwhite
Jan 15 2017 07:34
@JamesVitaly if (true) will always run, as true is true.
JamesVitaly
@JamesVitaly
Jan 15 2017 07:35
@willnwhite so how would i write it?
Will White
@willnwhite
Jan 15 2017 07:35
@JamesVitaly You want it to run if myObj.hasOwnProperty(checkProp) is true.
@JamesVitaly You're not using the return value of myObj.hasOwnProperty in your if statement.
Will White
@willnwhite
Jan 15 2017 07:41
@JamesVitaly
var trueOrFalse = myObj.hasOwnProperty(checkProp);
if (trueOrFalse === true) ...
else ...
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:43
how to make a request to weather api
with latitude and longitude
hers mycode
JamesVitaly
@JamesVitaly
Jan 15 2017 07:43
@willnwhite thank you loads
CamperBot
@camperbot
Jan 15 2017 07:43
jamesvitaly sends brownie points to @willnwhite :sparkles: :thumbsup: :sparkles:
:warning: jamesvitaly already gave willnwhite points
JamesVitaly
@JamesVitaly
Jan 15 2017 07:43
i did it but i think i need to spend some time understanding it
Will White
@willnwhite
Jan 15 2017 07:48
@JamesVitaly Do you understand that if (true) will always run?
Tiffany
@tiffanymakes
Jan 15 2017 07:49
@shenoyabhijith look at the object given when you go to http://freegeoip.net/json/. The object contains latitude and longitude coordinates. Access those coordinates.
Muhammad Hasham
@MohammadHasham
Jan 15 2017 07:49
how to write text or place anything on a fixed background
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:50
something like this
Will White
@willnwhite
Jan 15 2017 07:50
@JamesVitaly That's why it wouldn't return a "Not Found".
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:50
geoLocation = geoLocation+latitude+","+longitude+".json";
@tiffanymakes
Tiffany
@tiffanymakes
Jan 15 2017 07:50
@Riverino did you still need help? You can pass in whatever arguments you want (like 7 and 9) as a and b, and the function you create will solve it for you. You don't need to know the arguments in advance. Follow the example they give, except with addition instead of subtraction.
Muhammad Hasham
@MohammadHasham
Jan 15 2017 07:51
<div class = "row">
    <div class = "col-md-12 col-xs-12">
        <div class = "container-one">
            <div class="background-one">
            <img src="images/background-one.jpg"/>

            <!--This is snippet-->

                  <div class = "row">
                    <div class = "col-md-4 col-xs-4 col-md-offset-2">
                        <div class="container-opacity">
                            <h3>"Let food by thy medicene and medicene be thy food"</h3>
                            </div>
                    </div>
                    </div>

            </div>
        </div>    
    </div>
</div>
Why is my text not being pasted on my fixed background
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:53
help me out @tiffanymakes
CamperBot
@camperbot
Jan 15 2017 07:53
no wiki entry for: me out @tiffanymakes
Tiffany
@tiffanymakes
Jan 15 2017 07:53
@shenoyabhijith in your code, "weather" is the parameter, so try weather.latitude to access it.
Arvind Natarajan
@Arvin6
Jan 15 2017 07:54
I'm stuck with JSON on wikipedia viewer exercise
Can someone take a look?
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:55
which command to type before pasting code
i kinda fggt
Tiffany
@tiffanymakes
Jan 15 2017 07:55
3 backticks ```
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:56
$(document).ready(function() {

  var api = "https://api.wunderground.com/api/19b1920430424fb2/geolookup/q/";
  // determine geo lookup
  var geolocation = "https://freegeoip.net/json/";
  $.getJSON(geolocation, function(geoLocation) {
    $.getJSON(api, function(weather) {
      console.log('Geolocation - ', geoLocation);


      var latitude = geoLocation.latitude;
      var longitude = geoLocation.longitude;
      weather = weather+latitude+","+longitude+".json";
   document.getElementById("cntnt").innerHTML = weather;
      console.log(weather);
    });
  });
});
Arvind Natarajan
@Arvin6
Jan 15 2017 07:56
```$.getJSON(,function(result)){
}
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:56
something like this @tiffanymakes
but still not working
Sidharth Anand
@fuuraa
Jan 15 2017 07:57
I need help guys
Anybody got open source development experience
Darth Skywalker
@adityaparab
Jan 15 2017 07:58
@shenoyabhijith : Have you taken a look at docs for https://api.wunderground.com/api/
Arvind Natarajan
@Arvin6
Jan 15 2017 07:58
$.getJSON("http://en.wikipedia.org/w/api.php?action=opensearch&redirects=resolve&callback=json_callback&search=Abdul%20kalam",function(data){console.log("get json")});
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:58
i need to add latitude and longitude
to api url
@adityaparab
Arvind Natarajan
@Arvin6
Jan 15 2017 07:59
@shenoyabhijith check the navigator.getgeolocation api
Its covered in the AJAX lesson also
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:59
wont work properly @Arvin6
Tiffany
@tiffanymakes
Jan 15 2017 07:59
@shenoyabhijith try declaring the variables inside of the geolocation API, not inside the weather one.
abhijith shenoy
@shenoyabhijith
Jan 15 2017 07:59
so im using ap
api*
Sidharth Anand
@fuuraa
Jan 15 2017 08:00
@tiffanymakes have u got any open source development experience
Arvind Natarajan
@Arvin6
Jan 15 2017 08:00
@shenoyabhijith It works well on mobile devices which has gps.
abhijith shenoy
@shenoyabhijith
Jan 15 2017 08:00
$(document).ready(function() {

  var api = "https://api.wunderground.com/api/19b1920430424fb2/geolookup/q/";
  // determine geo lookup
  var geolocation = "https://freegeoip.net/json/";
  $.getJSON(geolocation, function(geoLocation) {
     var latitude = geoLocation.latitude;
      var longitude = geoLocation.longitude;
    $.getJSON(api, function(weather) {
      console.log('Geolocation - ', geoLocation);



      weather = weather+latitude+","+longitude+".json";
   document.getElementById("cntnt").innerHTML = weather;
      console.log(weather);
    });
  });
});
Tiffany
@tiffanymakes
Jan 15 2017 08:00
@fuuraa no, sorry.
abhijith shenoy
@shenoyabhijith
Jan 15 2017 08:00
not working
Tiffany
@tiffanymakes
Jan 15 2017 08:01
@fuuraa I'd love to know how to though!
Sidharth Anand
@fuuraa
Jan 15 2017 08:01
Ok good @tiffanymakes, I am beginning to learn that