These are chat archives for FreeCodeCamp/HelpJavaScript

12th
Jul 2016
Sendjasni
@sendja-3360
Jul 12 2016 00:00
@gilioo \W is the opposite of \w which is a-zA-Z0-9 and underscore, so the _ is added back in to remove that.
pizzapgh
@pizzapgh
Jul 12 2016 00:02
var someVar = "Hat";
function myFun() {
var someVar = "Head";
return someVar;
}
aren't these two local variables? because they have var in front of them
it's saying that one of them is global
llamatarianism
@llamatarianism
Jul 12 2016 00:04
nah
the first someVar isn't declared inside any function
so it's global
a variable is global either if it's declared without a keyword or if it's declared in the global scope
pizzapgh
@pizzapgh
Jul 12 2016 00:05
so if I call the variable with and without the var outside the function, they're both global?
ok
@llamatarianism thanks
CamperBot
@camperbot
Jul 12 2016 00:05
pizzapgh sends brownie points to @llamatarianism :sparkles: :thumbsup: :sparkles:
:cookie: 957 | @llamatarianism |http://www.freecodecamp.com/llamatarianism
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:16
blob
help please: stuck on Assignment with a Returned Value my code is as follows:
CamperBot
@camperbot
Jul 12 2016 00:17
no wiki entry for: please stuck on assignment with a returned value my code is as follows
mrscouture
@mrscouture
Jul 12 2016 00:17

HI everyone. I'm working on Switch Statements and not sure where I am going wrong. I am getting TypeError: Function Expected when I test.

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1:
answer("alpha");
break;
case 2:
answer("beta");
break;
case 3:
answer("gamma");
break;
case 4:
answer("delta");
break;
}

// Only change code above this line
return answer;

Mariya
@mariyadiminsky
Jul 12 2016 00:17
Having trouble learning Node.js? Learn Node.js with Brigadier Fluffykins! I've created a brand new series that takes you step by step. Check it out :smile: :sparkles: https://medium.com/@__Masha__/learn-node-js-with-brigadier-fluffykins-i-basics-async-sync-create-your-first-server-b9e54a45e108#.k9amg8b8d
Lauren
@LaurenDoughty
Jul 12 2016 00:17
@EdnaMode love the name, I loved The Incredibles!
Stephen James
@sjames1958gm
Jul 12 2016 00:17
@mrscouture Answer is not a function you need to do answer =
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:17
im a great fan
mrscouture
@mrscouture
Jul 12 2016 00:19
@sjames1958gm Thanks! I copied the formatting from the "helpful link" :)
CamperBot
@camperbot
Jul 12 2016 00:19
mrscouture sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1797 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
michael dorsey
@mikedorsey1021
Jul 12 2016 00:20
hello everyone. i need some guidance on how to properly finish this challenge. it is the Reverse a string challenge. here is my code:

function reverseString(str) {



  str = [str]; //making the string into an array



  /*
  ==============================
  code below is supposed to attempt the 
  explaination giving in the discription 
  of this problem.
  ==============================

  */
  var splitString = function (){    //Im sure that an if statement would work but not sure
                                    //how to properly set it up to do what i want
    str.split();
  };

  var reverseString = function(){
    splitString.reverse();
  };

  var joinAgain = function (){
    reverseString.join();
  };

  var newStr = joinAgain(reverseString(splitString(str)));



  return newStr;
}

reverseString("hello");
Stephen James
@sjames1958gm
Jul 12 2016 00:28
@mrscouture :+1:
@mikedorsey1021 1) [str] does not turn the string into an array str.split(''); will convert the string into an array of characters. You don't need a bunch of functions like that.
michael dorsey
@mikedorsey1021
Jul 12 2016 00:31
@sjames1958gm ok let me try and revise.
falconpunch12
@falconpunch12
Jul 12 2016 00:32
looking for some guidance. can someone please tell me what im doing wrong for the "Return Largest Numbers in Arrays" algorithm

function largestOfFour(arr) {
  var largest = [];
  for (var i=0;i<arr.length;i++){
    for(var x=0;x<arr[i].length;x++){
      largest.push(Math.max(arr[i][x]));
    }
  }
  // You can do this!
  return largest;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Stephen James
@sjames1958gm
Jul 12 2016 00:33
@falconpunch12 Math.max on a single value doesn't do anything.
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 00:34
Ok, so I've got the basic functionality for my Wiki Viewer down, though I haven't stylized really yet. http://codepen.io/no_stack_dub_sack/full/akLkZP/
However, I'm trying to improve upon it and this means using a generator instead of a list to perform a search in my API call - however, this is causing some issues. Can anyone give me a suggestion here? I know the query works because when I just paste it into the address bar, I see all the JSON data, but when I try to log the JSON data in my console, I get none of the info I requested. I also tried plain JSON instead of JSONP. Here's the code just for the api call, any help would be appreciated. Should I be making the API call in another way altogether? (p.s. I've tried $.getJSON instead of ajax as well)
  $.ajax({
    url: "https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrsearch=test&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&callback=?",
    type: "GET",
    data: {},
    dataType: "jsonp",
    jsonpCallback: "wikiJSON",
  });

function wikiJSON(json) {
      console.log(json);
    }
falconpunch12
@falconpunch12
Jul 12 2016 00:34
@sjames1958gm do you mind if i pm you a few questions?
Stephen James
@sjames1958gm
Jul 12 2016 00:34
@falconpunch12 go for it
David Liendo
@DavLiendoProgramming
Jul 12 2016 00:38
Good night guys!
is there a kind sould that would liek to answer some questions of mine about the caesars cipher challenge?
Cameron
@Cameron-Grams
Jul 12 2016 00:39
Good evening, I was hoping that someone could take a look at one of the exercises that has me stalled; https://repl.it/Cati/4 I am new to Javascript so I am not sure what I am missing that fails the tests; to me when I send the collection to the console it seems to be executing as intended. Anyone have any thoughts? Thanks....
David Liendo
@DavLiendoProgramming
Jul 12 2016 00:39
@cameron what challenge is that?
Cameron
@Cameron-Grams
Jul 12 2016 00:40
it is 222, one of the introduction to Javascript ones....
Archangelpak
@Archangelpak
Jul 12 2016 00:40
var myStr = "I am a \"double quoted\" string inside \"double quotes\".";

Change the provided string from double to single quotes and remove the escaping.
guys pls help I dont understand this tsk
Cameron
@Cameron-Grams
Jul 12 2016 00:41
@Archangelpak which challenge is that from?
David Liendo
@DavLiendoProgramming
Jul 12 2016 00:41
@cameron its the record collection challengue
Diego Mayer
@Chrono79
Jul 12 2016 00:42
@Archangelpak delete all \ and change the first and last " for '
Cameron
@Cameron-Grams
Jul 12 2016 00:42
the record collection is the one that has me stumped....
I can't tell why it fails...
michael dorsey
@mikedorsey1021
Jul 12 2016 00:42
@sjames1958gm can you explain a little more
Archangelpak
@Archangelpak
Jul 12 2016 00:42
@Cameron-Grams
Quoting Strings with Single Quotes
@Cameron-Grams name of this challenge
Stephen James
@sjames1958gm
Jul 12 2016 00:43
@mikedorsey1021 You have the various pieces,
change str to array
reverse array
change array back to string
you can do these in a sequence of steps, or you can use chaining
Diego Mayer
@Chrono79
Jul 12 2016 00:44
@Archangelpak :point_up: 11 de julio de 2016 21:42 have you seen that?
Archangelpak
@Archangelpak
Jul 12 2016 00:44
@Chrono79 yep trying to do that :-)
Diego Mayer
@Chrono79
Jul 12 2016 00:44
:+1:
michael dorsey
@mikedorsey1021
Jul 12 2016 00:45
@sjames1958gm ok i think i understand
Archangelpak
@Archangelpak
Jul 12 2016 00:47
@Chrono79 ```
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:48
@EdnaMode
blob
help please: stuck on Assignment with a Returned Value my code is as follows:
Archangelpak
@Archangelpak
Jul 12 2016 00:48
@Chrono79 sry friend I have a different link that I need to change to
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
@Chrono79
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
@Chrono79 this one
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:48
You should assign processArg to processed cant get this blob
help please: stuck on Assignment with a Returned Value my code is as follows:
JJMin
@JJMin
Jul 12 2016 00:48
blob
I forget but how do I make a way for (i, i+1) to work without going out of bounds?
Archangelpak
@Archangelpak
Jul 12 2016 00:50
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
still stuck((
JJMin
@JJMin
Jul 12 2016 00:52
oh whops , nvm lol
Dolan
@dguh
Jul 12 2016 00:53
hey guys! im just getting started on the algorithm challenges and I had a question about the sum all numbers in a range. I got a for loop to print all of the numbers from the min to the max, but the push command isn't pushing to the end of my new array it's just making a new array each time like 1 then 2 then [3] etc. any way here is the pen i've been practicing with so i can see the console. https://gitter.im/FreeCodeCamp/HelpJavaScript
JJMin
@JJMin
Jul 12 2016 00:54
@Archangelpak do u need help with that challenge?
Archangelpak
@Archangelpak
Jul 12 2016 00:55
@JJMin yes my friend
JJMin
@JJMin
Jul 12 2016 00:55
@Archangelpak try
@Archangelpak try var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';
Norvin Burrus
@ndburrus
Jul 12 2016 00:55
@EdnaMode can you post your code so far?
Archangelpak
@Archangelpak
Jul 12 2016 00:56
@JJMin thank you very much
CamperBot
@camperbot
Jul 12 2016 00:56
archangelpak sends brownie points to @jjmin :sparkles: :thumbsup: :sparkles:
:cookie: 250 | @jjmin |http://www.freecodecamp.com/jjmin
Cameron
@Cameron-Grams
Jul 12 2016 00:56
@Archangelpak, this worked for me-- '''var myStr = '<a href="http://www.example.com" target="_blank">Link</a>'; ''' it was just a question of having the double and single quotes offset to refer to different parts of the variable.
CamperBot
@camperbot
Jul 12 2016 00:56
:bulb: to format code use backticks! ``` more info
JJMin
@JJMin
Jul 12 2016 00:56
np
Archangelpak
@Archangelpak
Jul 12 2016 00:58
@Cameron-Grams thank you
CamperBot
@camperbot
Jul 12 2016 00:58
archangelpak sends brownie points to @cameron-grams :sparkles: :thumbsup: :sparkles:
:cookie: 223 | @cameron-grams |http://www.freecodecamp.com/cameron-grams
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:58
@ndburrus
Archangelpak
@Archangelpak
Jul 12 2016 00:58
@Cameron-Grams Im kinda got confused with this task
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:58

@ndburrus var processed = 2;
function processArg(num){
return (num +2);
}

var processed = processArg(0 );

Norvin Burrus
@ndburrus
Jul 12 2016 00:58
@EdnaMode yes?
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:58
sorry not doing this very well
Ivan
@gonzalezi2
Jul 12 2016 00:59
Does anyone have any resources that they used for the Random Quote Generator project? I'm having trouble with it and the JSON APIs exercises before did not really help
Norvin Burrus
@ndburrus
Jul 12 2016 00:59
@EdnaMode
  • using Shift + enter will give you additional line feeds (space) for pasting your code. also, the backticks (`) key is located to the left of the number one (#1) key.
  • further, you may find the two buttons (chat/compose & markdown - the chat/compose button alternates modes) to the right of the text entry area helpful.
Ednacode (New to Github and making mistakes)
@EdnaMode
Jul 12 2016 00:59
blob
blob
blob
blob
blob
blob
Cameron
@Cameron-Grams
Jul 12 2016 01:00
@Archangelpak I think it was just trying to walk you through the use of the 2 quotes for that challenge. Is there another question?
Has anyone completed the Record Collection challenge? For some reason my code is failing and I can't tell why...
thanks
Archangelpak
@Archangelpak
Jul 12 2016 01:02
@Cameron-Grams not yet but thnx for asking
CamperBot
@camperbot
Jul 12 2016 01:02
archangelpak sends brownie points to @cameron-grams :sparkles: :thumbsup: :sparkles:
:warning: archangelpak already gave cameron-grams points
Stephen James
@sjames1958gm
Jul 12 2016 01:02
@mikedorsey1021 Cool - I was off pm'ing
Archangelpak
@Archangelpak
Jul 12 2016 01:03
@Cameron-Grams javascript seems so complicated
michael dorsey
@mikedorsey1021
Jul 12 2016 01:04
@sjames1958gm i just completed it. took me a bit to just realize each step at a time. thank you for your help in guiding me to the right direction. any advice on how to work through these challenging on my own?
CamperBot
@camperbot
Jul 12 2016 01:04
mikedorsey1021 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1798 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Norvin Burrus
@ndburrus
Jul 12 2016 01:04
@EdnaMode
ok, here: var processed = processArg(0 ); we need to do this "Call the processArg function with an argument of 7 and assign its return value to the variable processed."
Stephen James
@sjames1958gm
Jul 12 2016 01:06
@mikedorsey1021 This one was kind of a coding one, where you had to consider that string didn't have reverse but array did.
My advice on most is to think about the steps first without code or you can end up getting stuck down the wrong code path.
Another advice is that code is not precious, don't be afraid to delete it and start over.
Elaine Vianna
@elavianna
Jul 12 2016 01:07
This message was deleted
Stephen James
@sjames1958gm
Jul 12 2016 01:07
@elavianna So close - you need to return the value that you removed from the front.
@Archangelpak Have you programmed in other languages?
michael dorsey
@mikedorsey1021
Jul 12 2016 01:08
@sjames1958gm great advice. I will definitely make sure i use this methodology in the future.
Caner Çalışkaner
@alchemistake
Jul 12 2016 01:09
http://imgur.com/EZ3fT39 what is wrong? I don't get it
Norvin Burrus
@ndburrus
Jul 12 2016 01:11
This message was deleted
Elaine Vianna
@elavianna
Jul 12 2016 01:12
@sjames1958gm I started programming in Ruby, but I'm just learning. Thanks!
CamperBot
@camperbot
Jul 12 2016 01:12
elavianna sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1799 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Norvin Burrus
@ndburrus
Jul 12 2016 01:13
@alchemistake
ok, we need to take the given string, here:
FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
and replace the appropriate text with the escape coding...
Stephen James
@sjames1958gm
Jul 12 2016 01:13
@elavianna :+1:
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:13
anybody get a chance to take a gander at my question above (probably way above by now)? I can repost if need be... regarding the wiki viewer project
Norvin Burrus
@ndburrus
Jul 12 2016 01:14
@EdnaMode how are we doing?
Caner Çalışkaner
@alchemistake
Jul 12 2016 01:14
thanks @ndburrus
CamperBot
@camperbot
Jul 12 2016 01:14
alchemistake sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 949 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
Jul 12 2016 01:14
@alchemistake you're welcome! nice work :palm_tree:
JJMin
@JJMin
Jul 12 2016 01:17
blob
Anyone understand what I'm trying to do? Why doesn't this work :(
Stephen James
@sjames1958gm
Jul 12 2016 01:19
@JJMin What is the first loop trying to do?
JJMin
@JJMin
Jul 12 2016 01:19
The first loop puts the numbers into separate arrays
so 0,1,2,3, => [[0],1, etc]
[[0], 1, 2]
Like this
blob
John
@tertiaryidentifier
Jul 12 2016 01:21
could someone help me understand why my openweathermap API isn't working?
Stephen James
@sjames1958gm
Jul 12 2016 01:22
@JJMin Then you will only be incrementing counter once because j can only equal size once
@tertiaryidentifier Are you seeing errors in the devtools console?
Wali Gauvin
@Docwali777
Jul 12 2016 01:23
Any tips for Palindrome?
function palindrome(str) {
 if (str === str) {
      // Good luck!
  return true;
     }
  else if (str !== str) 
  {
   return str.replace(/[^A-Za-z0-9]/g/i,"").toLowerCase;
  }
  else {
    return false;
  }
}



palindrome("ghua");
FM
@mafelix
Jul 12 2016 01:24
@Docwali777 watch for punctuation and letter case
Moisés Man
@moigithub
Jul 12 2016 01:25
is "ghua" === "ghua" ?? @Docwali777
JJMin
@JJMin
Jul 12 2016 01:25
@sjames1958gm what do you mean by j can only equal 1 once :worried:
Stephen James
@sjames1958gm
Jul 12 2016 01:25
@Docwali777 you don't do /g/i you just do /gi
toLowerCase is a function but you aren't calling it
You are returning a string in the middle not true or false.
@JJMin j goes from 0 to sliced.length so only one time will it be === to size
@Docwali777 str === str is always true and you want str compared to reverse of str
nbogie
@nbogie
Jul 12 2016 01:27
@tertiaryidentifier Sure. Post a specific issue. A link to your project, or paste a short amount of code within which you have identified the problem lies.
@Cameron-Grams did you get sorted out?
Marco Zapata
@makesi
Jul 12 2016 01:32

Currently working on Radom Quote Machine, could use some help figuring out the JS/API? Thanks

http://codepen.io/marcozapata/pen/GqOpjP

chris84948
@chris84948
Jul 12 2016 01:34
Anyone else having a problem with Counting Cards? I'm failing the 7, 8, 9 test even though the results bar is showing the right answer.
FM
@mafelix
Jul 12 2016 01:37
@makesi what are you stuck on for js/api?
Dylan
@dhcodes
Jul 12 2016 01:37
@makesi you need to enable jquery in your settings I believe
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:37
Can anyone give me a suggestion here? I know the api query works because when I just paste it into the address bar, I see all the JSON data, but when I try to log the JSON data in my console, I only get a partial response. Here's the code just for the api call, any help would be appreciated. Should I be making the API call in another way altogether? (p.s. I've tried $.getJSON instead of ajax as well)
  $.ajax({
    url: "https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrsearch=test&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&callback=?",
    type: "GET",
    data: {},
    dataType: "jsonp",
    jsonpCallback: "wikiJSON",
  });

function wikiJSON(json) {
      console.log(json);
    }
FM
@mafelix
Jul 12 2016 01:38
theres documentation in the api that you're using
@no-stack-dub-sack try writing a success function in your ajax
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:38
@mafelix tried that as well, doesn't work
chris84948
@chris84948
Jul 12 2016 01:39
This message was deleted
FM
@mafelix
Jul 12 2016 01:39
wikipedia api should have an example no?
chris84948
@chris84948
Jul 12 2016 01:39
This message was deleted
This message was deleted
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:40
@mafelix they have examples of what the queries should look like, but not always how to call them since there's so many ways...
chris84948
@chris84948
Jul 12 2016 01:40
Seems like this should work?
function cc(card) {
  // Only change code below this line
  switch (card) {
    case "2":
    case "3":
    case "4":
    case "5":
    case "6":
      count++;
      break;
    case "10":
    case "J":
    case "Q":
    case "K":
    case "A":
      count--;
      break;
  }

  if (count > 0)
    return count + " Bet";
  else
    return count + " Hold";
  // Only change code above this line
}
Marco Zapata
@makesi
Jul 12 2016 01:40
@mafelix I just realized I needed authentication with that specific API
@dhcodes i'll try that to see what happens
thank you both
CamperBot
@camperbot
Jul 12 2016 01:40
makesi sends brownie points to @mafelix and @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1203 | @dhcodes |http://www.freecodecamp.com/dhcodes
:cookie: 325 | @mafelix |http://www.freecodecamp.com/mafelix
Dylan
@dhcodes
Jul 12 2016 01:40
@no-stack-dub-sack can you paste your codepen
really no apis require no authentication
except the ones you make yourself
:D
Dylan
@dhcodes
Jul 12 2016 01:41
@chris84948 are the numbers given as strings in that one?
imrandall
@imrandall
Jul 12 2016 01:41
Is the Record Collection task brought up much in here?
Michaelangelo Leon
@mikey1995
Jul 12 2016 01:42

Currently working on the Title Case a Sentence Algorithm but I'm stuck. Here's a look at my code so far:

function titleCase(str) {
var newStr = String(str);
var checkStr = newStr.toLowerCase();
var count = 1;

var upperStr = checkStr.replace( checkStr[0], checkStr[0].toUpperCase() );

while( count < upperStr.length - 1){
if( upperStr[count] == " "){
count++;
upperStr = upperStr.replace( upperStr[count], upperStr[count].toUpperCase() );
}else{
count++;
}
}
return upperStr;
}

I'm not looking for the answer, just some help please :)

Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:42
@dhcodes sure, here's the project in progress, the JS in question is at the bottom. I also have a pen that has just the API call if you'd rather see that for simplicity: http://codepen.io/no_stack_dub_sack/pen/zBPvPE?editors=0011
imrandall
@imrandall
Jul 12 2016 01:42
Just curious as it seems like this one is beasty, or maybe I'm just overthinking it.
chris84948
@chris84948
Jul 12 2016 01:42
@dhcodes Oh man, I'm moving from c# to javascript and didn't realize that would work
@dhcodes Thanks for the help. Passed first time.
CamperBot
@camperbot
Jul 12 2016 01:43
chris84948 sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1204 | @dhcodes |http://www.freecodecamp.com/dhcodes
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:43
@dhcodes here's the version that has just the API call http://codepen.io/no_stack_dub_sack/pen/rLGzLK?editors=0011
ronaldrdguez
@ronaldrdguez
Jul 12 2016 01:43
@makesi For what I see your problem is you’re calling a non-public method without authentication? You’re getting 401s on the API call.
Marco Zapata
@makesi
Jul 12 2016 01:45

@ronaldrdguez per https://theysaidso.com/api/#
Authentication
The API's marked as public below can be accessed without any authentication.

Initially I was using a private one, but now tried using a public one. Now when I click Get Quote the original text just disappears

Dylan
@dhcodes
Jul 12 2016 01:46
@no-stack-dub-sack it's been awhile since i've done it but are the results under object query pages, not the right ones?
it gives you a title and desc
Marco Zapata
@makesi
Jul 12 2016 01:46
@ronaldrdguez or are they really not 'public' :-/
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:47
@dhcodes this is all i see in my console:
Object {
batchcomplete: "",
continue: Object {
    continue: "gsroffset||",
    gsroffset: 10
},
limits: Object {
    extracts: 20,
    pageimages: 50
},
query: Object {
    pages: Object {}
 }
}
do you see something different?
Dylan
@dhcodes
Jul 12 2016 01:47
@no-stack-dub-sack if you open your dev tools console you'll be able to go deeper
the codepen console limits
the output
Marco Zapata
@makesi
Jul 12 2016 01:49

@mafelix https://theysaidso.com/api/#
Authentication
The API's marked as public below can be accessed without any authentication.

Initially I was using a private one, but now tried using a public one. Now when I click Get Quote the original text just disappears :-/

FM
@mafelix
Jul 12 2016 01:50
your api has limits on it.
if you apply for a key
you get an increased limit
10 calls per hour w/o a key
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:50
@dhcodes Oh. Wow. I just (mistakenly) assumed that codepen's console would show all the same info that my browsers dev console would, so I didn't even think to check it.
so it's working fine then....
Marco Zapata
@makesi
Jul 12 2016 01:51
gotcha, maybe I've surpassed that.
as far as the code, is that valid code?
ronaldrdguez
@ronaldrdguez
Jul 12 2016 01:51
@makesi The call is alright, problem is your getting back a JSON object, not HTML. Try this and you see what I mean
$("#quoteDisplay").html(JSON.stringify(json));
Michaelangelo Leon
@mikey1995
Jul 12 2016 01:51
Currently working on the Title Case a Sentence Algorithm but I'm stuck. Here's a look at my code so far:
function titleCase(str) {
var newStr = String(str);
var checkStr = newStr.toLowerCase();
var count = 1;
var upperStr = checkStr.replace( checkStr[0], checkStr[0].toUpperCase() );
while( count < upperStr.length - 1){
if( upperStr[count] == " "){
count++;
upperStr = upperStr.replace( upperStr[count], upperStr[count].toUpperCase() );
}else{
count++;
}
}
return upperStr;
}
I'm not looking for the answer, just some help please :smile:
FM
@mafelix
Jul 12 2016 01:52
whats the input of str?
a str?
if it's a str in the first place you don't need String(str)
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:52
@dhcodes sheesh. hadn't even tried to access the info I wanted because I didn't know what the object looked like. Now I should be able to see and grab what I want. Thanks man.. I feel like a dummy. Amateur hour.
CamperBot
@camperbot
Jul 12 2016 01:52
no-stack-dub-sack sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1205 | @dhcodes |http://www.freecodecamp.com/dhcodes
Samuel Fitzsimmons
@samfitz1
Jul 12 2016 01:53
Hey awesome peeps! If y'all code check my code I'd appreciate it. I think I have it, but it isn't working.

var array = [4,5,6,7,8];
var singleVal = 0;

// Only change code below this line.
var singleVal = array.reduce(function(previousVal, currentVal) {
  return previousVal+currentVal;
});
singleVal = array;
it's the condense array with reduce challenge
Norvin Burrus
@ndburrus
Jul 12 2016 01:54
@mikey1995 were you planning to use the helpful link String.prototype.split()?
you may enjoy these: :sparkles:
es_python
@espython
Jul 12 2016 01:55
hello folks how could i return from a function variable + string in one string like this "-3 Hold" -3 i a variable value and Hold just a string
Marco Zapata
@makesi
Jul 12 2016 01:55
@ronaldrdguez I see now, making some progress
@ronaldrdguez @mafelix thank you!
CamperBot
@camperbot
Jul 12 2016 01:55
makesi sends brownie points to @ronaldrdguez and @mafelix :sparkles: :thumbsup: :sparkles:
:warning: makesi already gave mafelix points
:cookie: 320 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
es_python
@espython
Jul 12 2016 01:56
hello folks how could i return from a function variable + string in one string like this "-3 Hold" -3 i a variable value and Hold just a string
Diego Mayer
@Chrono79
Jul 12 2016 01:56
@samfitz1 delete this singleVal = array;
Dylan
@dhcodes
Jul 12 2016 01:57
@no-stack-dub-sack no worries man, those projects took me a lifetime
Samuel Fitzsimmons
@samfitz1
Jul 12 2016 01:57
@Chrono79 thanks!
CamperBot
@camperbot
Jul 12 2016 01:57
samfitz1 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1476 | @chrono79 |http://www.freecodecamp.com/chrono79
Norvin Burrus
@ndburrus
Jul 12 2016 01:58
@espython like this:
string = variable + " Hold";
return string;
Samuel Fitzsimmons
@samfitz1
Jul 12 2016 01:58
@Chrono79 it was already there, so I didn't think of deleting it hah
Diego Mayer
@Chrono79
Jul 12 2016 01:58
@samfitz1 Otherwise you'll be overwriting singleVal with the array
Archangelpak
@Archangelpak
Jul 12 2016 01:59
guys what is wrong with this code? ```

oops
Peter Weinberg
@no-stack-dub-sack
Jul 12 2016 01:59
@dhcodes feeling good about the progress overall, it's just the little obstacles like this sometimes. Got the basic functionality down for it pretty quickly, but really want to be able to improve it...
Archangelpak
@Archangelpak
Jul 12 2016 02:00
var myStr = \"FirstLine\n\\ SecondLine\\\r Thirdline\";
Diego Mayer
@Chrono79
Jul 12 2016 02:00
it's invisible @Archangelpak ;)
@Archangelpak you don't need to escape the quotes and no spaces between
\"this is an escaped double quote, you need them without escaping
Archangelpak
@Archangelpak
Jul 12 2016 02:00
@Chrono79 put it by mistake srty
es_python
@espython
Jul 12 2016 02:00
thanks @ndburrus
CamperBot
@camperbot
Jul 12 2016 02:00
espython sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 950 | @ndburrus |http://www.freecodecamp.com/ndburrus
Archangelpak
@Archangelpak
Jul 12 2016 02:01
@Chrono79 gives me an error like this myStr should have encoded text with the proper escape sequences and no spacing.
Diego Mayer
@Chrono79
Jul 12 2016 02:02
@Archangelpak yes, don't leave spaces after the escaped codes
Norvin Burrus
@ndburrus
Jul 12 2016 02:02
@espython you're welcome! enjoy :palm_tree:
Archangelpak
@Archangelpak
Jul 12 2016 02:04
@Chrono79 I removed spaces but still wont work
Maria Luciene
@lucienemlf
Jul 12 2016 02:04
Hi everyone, I'm not understanding why one of the test is not passing, I will be glad if anyone can help me. https://www.freecodecamp.com/challenges/record-collection#?solution=%0A%2F%2F%20Setup%0Avar%20collection%20%3D%20%7B%0A%20%20%20%20%222548%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22Slippery%20When%20Wet%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Bon%20Jovi%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%22Let%20It%20Rock%22%2C%20%0A%20%20%20%20%20%20%20%20%22You%20Give%20Love%20a%20Bad%20Name%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%222468%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%221999%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Prince%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%221999%22%2C%20%0A%20%20%20%20%20%20%20%20%22Little%20Red%20Corvette%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%221245%22%3A%20%7B%0A%20%20%20%20%20%20%22artist%22%3A%20%22Robert%20Palmer%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%225439%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22ABBA%20Gold%22%0A%20%20%20%20%7D%0A%7D%3B%0A%2F%2F%20Keep%20a%20copy%20of%20the%20collection%20for%20tests%0Avar%20collectionCopy%20%3D%20JSON.parse(JSON.stringify(collection))%3B%0A%0A%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Afunction%20updateRecords(id%2C%20prop%2C%20value)%20%7B%0A%20%20var%20id_collection%20%3D%20collection%5Bid%5D%3B%0A%20%20%0A%20%0A%20%20if(prop%20!%3D%20%22tracks%22%20%26%26%20value%20!%3D%3D%20%22%22)%20%7B%0A%20%20%20%20id_collection%5Bprop%5D%20%3D%20value%3B%0A%20%20%7D%0A%20%20%0A%20%20if(prop%20!%3D%20%22tracks%22%20%26%26%20value%20%3D%3D%3D%20%22%22)%20%7B%0A%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20if(prop%20%3D%3D%20%22tracks%22%20%26%26%20collection%5Bid%5D.hasOwnProperty(prop)%20%3D%3D%3D%20false)%20%7B%0A%20%20%20%20id_collection.tracks%20%3D%20%5B%20%5D%3B%20%0A%20%20%7D%0A%20%20%0A%20%20%20%20%0A%20%20if(prop%20%3D%3D%20%22tracks%22%20%26%26%20value%20!%3D%3D%20%22%22)%20%7B%0A%20%20%20%20id_collection.tracks.push(value)%3B%20%0A%20%20%7D%0A%20%20%0A%20%20if(prop%20%3D%3D%20%22tracks%22%20%26%26%20value%20%3D%3D%3D%20%22%22)%20%7B%0A%20%20%20%20delete%20id_collection.tracks%3B%20%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20return%20collection%3B%0A%7D%0A%0A%2F%2F%20Alter%20values%20below%20to%20test%20your%20code%0AupdateRecords(2548%2C%20%22artist%22%2C%20%22%22)%3B%0A%0A
FM
@mafelix
Jul 12 2016 02:04
show code plz
Dylan
@dhcodes
Jul 12 2016 02:04
@no-stack-dub-sack word
Diego Mayer
@Chrono79
Jul 12 2016 02:04
@Archangelpak let's see your code again
Archangelpak
@Archangelpak
Jul 12 2016 02:05
@Chrono79 ```

var myStr ="FirstLine\n\\SecondLine\\\rThirdline";
FM
@mafelix
Jul 12 2016 02:05
you would use string +
and then your number should be a converted to a string
Dylan
@dhcodes
Jul 12 2016 02:06
@lucienemlf prop will not always be tracks
FM
@mafelix
Jul 12 2016 02:06
var string = "oaiefjaoiwefj"
function(num){
    return String(num)+string
}
something like that
Archangelpak
@Archangelpak
Jul 12 2016 02:06
@Chrono79 did you se it?
Dylan
@dhcodes
Jul 12 2016 02:06
@lucienemlf the one you are missing has the prop of artists, so they are saying if the value of artists is "", you should remove artist
Diego Mayer
@Chrono79
Jul 12 2016 02:06
ThirdLine not Thirdline @Archangelpak with capital L
Archangelpak
@Archangelpak
Jul 12 2016 02:07
@Chrono79 thank you very much
CamperBot
@camperbot
Jul 12 2016 02:07
archangelpak sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1477 | @chrono79 |http://www.freecodecamp.com/chrono79
Maria Luciene
@lucienemlf
Jul 12 2016 02:07
Thanks @dhcodes . I didn't realize it
CamperBot
@camperbot
Jul 12 2016 02:07
lucienemlf sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1207 | @dhcodes |http://www.freecodecamp.com/dhcodes
Archangelpak
@Archangelpak
Jul 12 2016 02:07
@Chrono79 one little unrecognizible mistake
@Chrono79 can ruin your Code :-)
Diego Mayer
@Chrono79
Jul 12 2016 02:09
The devil is in the details
Archangelpak
@Archangelpak
Jul 12 2016 02:09
@Chrono79 agree
@Chrono79 so my friend Messi is quit a team?
Diego Mayer
@Chrono79
Jul 12 2016 02:10
I hope not, maybe a little time out
Archangelpak
@Archangelpak
Jul 12 2016 02:11
:-)
96street
@96street
Jul 12 2016 02:16
what's a quick way to check if the first letter is uppercase?
of a string
Ken Haduch
@khaduch
Jul 12 2016 02:16
@96street - match to a regular expression?
Eraofdiscord
@Eraofdiscord
Jul 12 2016 02:22

Hey guys this is something probably pretty silly but I'm having trouble using the increment operator. What am I supposed to do? var myVar = 87;

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

momoko8443
@momoko8443
Jul 12 2016 02:22
@96street var ascii_code = "Your Message".charCodeAt(0); make sure the code is between 65 ~ 90
Ken Haduch
@khaduch
Jul 12 2016 02:22
@Eraofdiscord myVar++;
Eraofdiscord
@Eraofdiscord
Jul 12 2016 02:23
Thanks! @khaduch
CamperBot
@camperbot
Jul 12 2016 02:23
eraofdiscord sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1426 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Jul 12 2016 02:25
@Eraofdiscord - you're welcome - you should go back and review the information that they put in the lesson and see how they tried to explain it, compared to how you actually did it. The lessons on the basics are pretty good, once you get used to studying them and comparing to the example code...
Andrew Schmidthuber
@calicode
Jul 12 2016 02:28
@96street
if (blah[0] === blah[0].toUpperCase() ) { console.log("yes"); } else {console.log("no");}
Samuel Cupidon
@Zerazera
Jul 12 2016 02:29
Hi all, looking for some feedback for my to-do app in Angular 1
http://zerazera.github.io/Heroic_todo_list/
Chris Winge
@ChrisWinge
Jul 12 2016 02:31
I'm on challenge #178 (Global Scope and Functions).

Here is my code...var myGlobal = (10);
// Declare your variable here

function fun1(oopsGlobal) {
oopsGlobal = (5);
// Assign 5 to oopsGlobal Here

}

Norvin Burrus
@ndburrus
Jul 12 2016 02:32
Chris Winge
@ChrisWinge
Jul 12 2016 02:32
I'm sorry for the multiple messages. I was planning to hit enter and go to another line :-). Anyway, I'm supposed to have oopsGlobal = 5, and I'm supposed to not use var
I'm I close in my code?
Norvin Burrus
@ndburrus
Jul 12 2016 02:33
@ChrisWinge what are the parentheses for, (like here): var myGlobal = (10); ?
...there is only one line of code to change. observe comment lines... (ie where to change code)
Chris Winge
@ChrisWinge
Jul 12 2016 02:33
Geez...Am I close
@ndburrus . myGlobal was initially supposed to equal 10
Norvin Burrus
@ndburrus
Jul 12 2016 02:35
@ChrisWinge update code, please...
Tonye Iyalla
@tiyalla
Jul 12 2016 02:36
anyone on here completed the twitch tv app project?
nbogie
@nbogie
Jul 12 2016 02:36
@tiyalla sure
Chris Winge
@ChrisWinge
Jul 12 2016 02:37
@ndburrus - I'm sorry for not being clear. I'm new to this, and Javascript has been the most confusing so far. Here's what I'm supposed to do...myGlobal should be defined
myGlobal should have a value of 10
myGlobal should be declared using the var keyword
oopsGlobal should have a value of 5
Do not declare oopsGlobal using the var keyword
Tonye Iyalla
@tiyalla
Jul 12 2016 02:37
@nbogie i'm having trouble getting my online button to display all the streamers online. can you take a look http://codepen.io/tiyalla/pen/QEqBRp/
nbogie
@nbogie
Jul 12 2016 02:37
sure
Chris Winge
@ChrisWinge
Jul 12 2016 02:37

@ndburrus and here's my complete code...var myGlobal = (10);
// Declare your variable here

function fun1(oopsGlobal) {
oopsGlobal = (5);
// Assign 5 to oopsGlobal Here

}

// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}

Norvin Burrus
@ndburrus
Jul 12 2016 02:39
@ChrisWinge
ok, we may need to do a code reset.
carefully read the comments in the code - they are the lines that begin with //
nbogie
@nbogie
Jul 12 2016 02:41
@tiyalla looking now. by the way with jquery you can just say $(".online").hide(); instead of adding a class and styling.
Norvin Burrus
@ndburrus
Jul 12 2016 02:42
@ChrisWinge how are we doing?
Chris Winge
@ChrisWinge
Jul 12 2016 02:43
@ndburrus - I'm resetting now
96street
@96street
Jul 12 2016 02:43
@calicode tried that but its not working
function myReplace(str, before, after) {
  if(before[0] === before.charCodeAt[0].toUpperCase()) {
    after[0] = after[0].toUpperCase();
  }
  else {
    after[0] = after[0].toLowerCase();
  }

  return str.replace(before, after);

}

myReplace("He is Sleeping on the couch", "Sleeping", "sitting");
Chris Winge
@ChrisWinge
Jul 12 2016 02:43

@ndburrus - here is the reset code..// Declare your variable here

function fun1() {
// Assign 5 to oopsGlobal Here

}

// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}

@ndburrus - Thank you for your help!
CamperBot
@camperbot
Jul 12 2016 02:43
chriswinge sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 954 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
Jul 12 2016 02:44
@ChrisWinge where is the code we need?
here: // Declare your variable here and here: // Assign 5 to oopsGlobal Here
Chris Winge
@ChrisWinge
Jul 12 2016 02:46
@ndburrus - this is what I put, but it's not right.

function fun1(oopsGlobal) {
oopsGlobal = (5);
// Assign 5 to oopsGlobal Here

}

LukaLyptus
@LukaLyptus
Jul 12 2016 02:47
function mutation(arr) { 

  var arrFirst = arr[0].toLowerCase();
  var arrSecond = arr[1].toLowerCase();
  arrSecond = arrSecond.split('');

  for (x = 0; x < arrSecond.length; x++) {
    if (arrFirst.indexOf(arrSecond[x]) < 0) {
    return false;
  } else {
    return true;
  }
  } 
}

mutation(["hello", "hey"]);
Hey can someone help me with this please. I am getting a green tick for every test except one and my code looks almost identical to the solution...
Norvin Burrus
@ndburrus
Jul 12 2016 02:47
@ChrisWinge why are we using these ()'s ?
and see previous comment/s :point_up: July 11, 2016 10:44 PM
This message was deleted
khasan0v
@khasan0v
Jul 12 2016 02:48

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

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

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

can someone help me out with this? i dont understand it at all
Chris Winge
@ChrisWinge
Jul 12 2016 02:48
@ndburrus - Will do! Thank you!!!
CamperBot
@camperbot
Jul 12 2016 02:48
chriswinge sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: chriswinge already gave ndburrus points
LukaLyptus
@LukaLyptus
Jul 12 2016 02:49
@khasan0v what don't you understand ?
Norvin Burrus
@ndburrus
Jul 12 2016 02:49
@khasan0v we need this equation in code, here: The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
Rob
@ravenstudios
Jul 12 2016 02:50
can some one help me with a multi dim array?
NPeyralans
@NPeyralans
Jul 12 2016 02:51
Can anyone help with sending an http request to the Wikipedia api via Angular?
Tonye Iyalla
@tiyalla
Jul 12 2016 02:51
@nbogie I fixed it. Thanks for taking a look.
CamperBot
@camperbot
Jul 12 2016 02:51
:cookie: 282 | @nbogie |http://www.freecodecamp.com/nbogie
tiyalla sends brownie points to @nbogie :sparkles: :thumbsup: :sparkles:
khasan0v
@khasan0v
Jul 12 2016 02:51
@ndburrus so "var celsius = celsius * 9/5 +32" ?
nbogie
@nbogie
Jul 12 2016 02:52
@tiyalla ofline rather than offline?
NPeyralans
@NPeyralans
Jul 12 2016 02:53
Anybody know why I'm getting "Unable to execute script because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled." with ``` $scope.searchWikipedia = function() {
console.log('Searched for: ' + $scope.userInput);
        $http.jsonp(endpoint + $scope.userInput + callback).then(function(response){
            console.log('response was ' + response);
            var results = response.query.pages;
            angular.forEach(results, function(value, key) {
                $scope.results.push({title: value.title, body: value.extract, page: page + value.pageid})
            });
        });```
clintonjohn
@clintonjohn
Jul 12 2016 02:55
Hi @ndburrus. I've been intensively doing FCC related things for about 26 days now. One difficulty is the sense I get that there isn't a systematic or agreed upon way to approach an algorithm challenge. The functional approach seems to have some consistency, but even then there are so many options
Tonye Iyalla
@tiyalla
Jul 12 2016 02:55
@nbogie i changed the way I was adding my offline class. It wasn't being added correctly so there was no offline class to remove or hide when I was calling for it to do that
nbogie
@nbogie
Jul 12 2016 02:56
Yeah, it looked like you were trying to add a class called "ofline" not "offline", though I couldn't find it in the DOM. Glad you fixed it ;)
looks good :)
clintonjohn
@clintonjohn
Jul 12 2016 02:57
@ndburrus there are so many ways to do things in JavaScript. It's difficult to find a focused method of doing things
nbogie
@nbogie
Jul 12 2016 02:57
@NPeyralans could you log and post here the full URL to which you're making the GET request?
Tonye Iyalla
@tiyalla
Jul 12 2016 02:58
@nbogie yeah. Thanks! I appreciate the feedback!
CamperBot
@camperbot
Jul 12 2016 02:58
tiyalla sends brownie points to @nbogie :sparkles: :thumbsup: :sparkles:
:warning: tiyalla already gave nbogie points
NPeyralans
@NPeyralans
Jul 12 2016 02:58

@nbogie
```.controller('WikiController', function($scope, $http) {
// initialize variables
console.log("inside wikicontroller");
$scope.userInput = "";
$scope.results = [];
var endpoint = 'https://en.wikipedia.org/w/api.php?format=jsonfm&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=';
var callback = '$callback=JSON_CALLBACK';
var page = 'https://en.wikipedia.org/?curid=';

    $scope.searchWikipedia = function() {
        console.log('Searched for: ' + $scope.userInput);

        $http.jsonp(endpoint + $scope.userInput + callback).then(function(response){
            console.log('response was ' + response);
            var results = response.query.pages;
            angular.forEach(results, function(value, key) {
                $scope.results.push({title: value.title, body: value.extract, page: page + value.pageid})
            });
        });
        console.log('Results inside function: ' + $scope.results);

    }    

})

; ```

nbogie
@nbogie
Jul 12 2016 02:59
@NPeyralans what I think would be useful to you would be to form this string and log it to console: endpoint + $scope.userInput + callback
This message was deleted
Chase
@Belax8
Jul 12 2016 02:59
@clintonjohn Yep. There are many ways to solve a problem in JavaScript. With time, you'll see the pros and cons to each method and you'll be able to find the way that works best for you.
96street
@96street
Jul 12 2016 03:00
why doesn't this work?
function myReplace(str, before, after) {

  var upper = /^[A-Z]/;
  if(before.charAt(0) == upper) {
    after.charAt(0).toUpperCase();
  }
  else {
    after.charAt(0).toLowerCase();
  }

  return str.replace(before, after);

}

myReplace("He is Sleeping on the couch", "Sleeping", "sitting");
trying to say if the first character of before is uppercase, change after to uppercase
NPeyralans
@NPeyralans
Jul 12 2016 03:03
@nbogie I did that and then tried to access it in the browser. When I took off the 'callback' part it rendered fine in the browser, console.logged it and I'm still getting the same error
clintonjohn
@clintonjohn
Jul 12 2016 03:03
@chase thanks!
CamperBot
@camperbot
Jul 12 2016 03:03
clintonjohn sends brownie points to @chase :sparkles: :thumbsup: :sparkles:
:cookie: 11 | @chase |http://www.freecodecamp.com/chase
nbogie
@nbogie
Jul 12 2016 03:04
@tiyalla For readability (and your sanity) consider moving all your code which creates a .display-box div out into a dedicated function, and just call it from the getJSON callback, passing the necessary data.
Tonye Iyalla
@tiyalla
Jul 12 2016 03:05
@nbogie great point! will work on that
Andrew
@andrewlee56
Jul 12 2016 03:06
Screen Shot 2016-07-11 at 5.05.08 PM.png
Hello guys, can't figure out why this won't work for the record album challenge. Need help.
nbogie
@nbogie
Jul 12 2016 03:07
@NPeyralans is that format parameter supposed to be jsonfm? If you read the page you accessed in your browser, it will tell you it is an HTML presentation of the results, not JSON.
John Calhoun
@DougCal
Jul 12 2016 03:07

I'm working on the 'Seek and Destroy' challenge and can't seem to get this function to accept my code. I keep getting error messages like, "TypeError: [object Array] is not a function." Not sure what to do to get this code to run.
'''function destroyer(arr) {
// Remove all the values
var args = arr.slice.call(arguments);

return arr.filter(args);
}

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

CamperBot
@camperbot
Jul 12 2016 03:07
:bulb: to format code use backticks! ``` more info
Andrew
@andrewlee56
Jul 12 2016 03:08
Screen Shot 2016-07-11 at 5.07.39 PM.png
John Calhoun
@DougCal
Jul 12 2016 03:08

```function destroyer(arr) {

// Remove all the values

var args = arr.slice.call(arguments);

return arr.filter(args);

}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);" ```

Sorry, still working on how to format.
This message was deleted
Andrew
@andrewlee56
Jul 12 2016 03:18
j
m
Norvin Burrus
@ndburrus
Jul 12 2016 03:18
@khasan0v we need fahrenheit in the equation, right?
Abhishek Baliyan
@abhishekdevinfo
Jul 12 2016 03:19
@DougCal try to use filter and argument of function
96street
@96street
Jul 12 2016 03:20
i'm getting 'bad assignment' error on my equals
function myReplace(str, before, after) {

  var upper = /[A-Z]/;
  if(before.charAt(0) == upper) {
    after.charAt(0) = after.charAt(0).toUpperCase();
  }
  else {
    after.charAt(0) = after.charAt(0).toLowerCase();
  }

  return str.replace(before, after);

}

myReplace("He is Sleeping on the couch", "Sleeping", "sitting");
any idea
silver537
@silver537
Jul 12 2016 03:21
@DougCal .filter(function (x){ return blahblahblah; });
you cant use args inside filter.
Norvin Burrus
@ndburrus
Jul 12 2016 03:22
@clintonjohn i'm a newbie :smile: , so i'm not the best camper to answer that question... i agree that js is broad, and that there are multiple ways to approach lessons. the key, i think, is to gain the knowledge intended. for example, when specific methods, functions, approaches, etc. are presented as helpful, or useful, that indicates what is being evaluated for pas/fail/ing in the test conditions.... after all, that function is handled by yours truly - mr/ms computer :+1:
Randall Cordoba
@Redfleet
Jul 12 2016 03:24
Hey everyone, I'm working on the section on queues, and I can't quite seem to get the output right
Norvin Burrus
@ndburrus
Jul 12 2016 03:25
@96street for equals, use == or === . assignment/s is/are = .
Randall Cordoba
@Redfleet
Jul 12 2016 03:25
I used push and shift functions to change the array, but I can't get the return to show the removed item
Norvin Burrus
@ndburrus
Jul 12 2016 03:26
@Redfleet can you post?
Randall Cordoba
@Redfleet
Jul 12 2016 03:26

//
function nextInLine(arr, item) {
testArr.push(item);
testArr.shift(arr[0]);

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

whoops... wrong posting notation
silver537
@silver537
Jul 12 2016 03:27
testArr.shift is wrong
Norvin Burrus
@ndburrus
Jul 12 2016 03:27
@Redfleet why are we using testArr ? hint: look at the function inputs
also, we need to adhere to this: // Your code here
silver537
@silver537
Jul 12 2016 03:27
its all wrong
holy shit...
Randall Cordoba
@Redfleet
Jul 12 2016 03:28
testArr is the array that we want to change, isn't it?
silver537
@silver537
Jul 12 2016 03:28
no. arr is
96street
@96street
Jul 12 2016 03:29
@ndburrus isn't that an assiignment? You're assigning a new value to after.charAt(0)
similar to assigning a value to a variable
silver537
@silver537
Jul 12 2016 03:29
in the function(arr , item)
arr and item are both variables.
Norvin Burrus
@ndburrus
Jul 12 2016 03:30

@96street i was responding to this comment

i'm getting 'bad assignment' error on my equals

silver537
@silver537
Jul 12 2016 03:30
arr=textArr item=6
96street
@96street
Jul 12 2016 03:30
yeah. aren't assignments one equals '='
@ndburrus
silver537
@silver537
Jul 12 2016 03:30
use the push or shift method with arr and item.
96street
@96street
Jul 12 2016 03:30
it worked though
Randall Cordoba
@Redfleet
Jul 12 2016 03:31
so I don't need to target testArr since the function is actually referring to arr
96street
@96street
Jul 12 2016 03:31
just thought it was an assignment so should be = not ==
silver537
@silver537
Jul 12 2016 03:32
exactly
use the parameters.
Randall Cordoba
@Redfleet
Jul 12 2016 03:33
I see... so now I just need to return the variable that's removed from the array
but if i just target arr[0], it's just going to return the new value, not the one i removed
silver537
@silver537
Jul 12 2016 03:34
which one removes the first index of an array? refer back to your previous challenges. you must know what push shift unshift and pop does since you've completed previous challenges with those methods.
Randall Cordoba
@Redfleet
Jul 12 2016 03:35
unshift removes the first index
silver537
@silver537
Jul 12 2016 03:35
but how?
NPeyralans
@NPeyralans
Jul 12 2016 03:36
@nbogie I changed that and got back an error "“No 'Access-Control-Allow-Origin' header is present on the requested resource” Do you know how to fix this?
Randall Cordoba
@Redfleet
Jul 12 2016 03:37
wait, no, shift removes the first index, unshift adds a variable to the front
silver537
@silver537
Jul 12 2016 03:38
so whichever removes the first, you must return that. now what add an element to the end of the array?
Randall Cordoba
@Redfleet
Jul 12 2016 03:38
push
silver537
@silver537
Jul 12 2016 03:38
so then whats the problem? :P
Randall Cordoba
@Redfleet
Jul 12 2016 03:41
thanks @silver537 I think I got it
CamperBot
@camperbot
Jul 12 2016 03:41
redfleet sends brownie points to @silver537 :sparkles: :thumbsup: :sparkles:
:cookie: 402 | @silver537 |http://www.freecodecamp.com/silver537
John Freeborn
@jfx1026
Jul 12 2016 03:44
hi gang: I'm having some trouble with the "Using Objects for Lookups" task
Norvin Burrus
@ndburrus
Jul 12 2016 03:47
@jfx1026 can you post?
@96street yes
John Freeborn
@jfx1026
Jul 12 2016 03:48
var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank"
  };

  lookup[val];
I don't know how to assign the lookup
Norvin Burrus
@ndburrus
Jul 12 2016 03:49
@jfx1026 you have a variable already setup for you, right? use it. and how are assigments made?
John Freeborn
@jfx1026
Jul 12 2016 03:50
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

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

  lookup[val];

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

// Change this value to test
phoneticLookup("charlie");
Defeds
@defeds
Jul 12 2016 03:50
can somebody please help me understand what i'm doing wrong here, please?
It's for : Escape Sequences in Strings.
My code is
var myStr = "\n \ \r"; // Change this line
Archangelpak
@Archangelpak
Jul 12 2016 03:50
guys
Norvin Burrus
@ndburrus
Jul 12 2016 03:50
@jfx1026 result does not change?
Archangelpak
@Archangelpak
Jul 12 2016 03:50
whats wrong wit this code?
mrankins
@mrankins
Jul 12 2016 03:50
how do you add an album in manipulating complex objects
Aaron Chiandet
@achiandet
Jul 12 2016 03:50
I want to preface this by saying that I'm early in the process of discovering how I want to do this, so please try to point me in the right direction without telling me. I'm working on the bonfire that provides you with an array of arrays and I need to pull the largest number out of each array, store it in a new array and then return that. My current gameplan is to loop through the first array, and then again through the next array, I think I might be able to do this with recursion but that will come after this initial attempt. My question at this point in time is, how would I take the value of arr[i][j] and then assign it to a variable? Is this the wrong strategy, do I have a scope issue? My code thus far
var bigNum = 0;
var emptyArr = [];

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

      //console.log(arr[i][j]);
    }
  }
  //return j;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Archangelpak
@Archangelpak
Jul 12 2016 03:50
var myStr = "This is the start.\" + \"This is the end.";
Aaron Chiandet
@achiandet
Jul 12 2016 03:51
@Archangelpak you need to wrap that in single quotes
96street
@96street
Jul 12 2016 03:51
how is it == if it's an assignment then? @ndburrus
function myReplace(str, before, after) {

  var upper = /[A-Z]/;
  if(before.charAt(0) == upper) {
    after.charAt(0) == after.charAt(0).toUpperCase();
  }
  else {
    after.charAt(0) == after.charAt(0).toLowerCase();
  }

  return str.replace(before, after);

}

myReplace("He is Sleeping on the couch", "Sleeping", "sitting");
Archangelpak
@Archangelpak
Jul 12 2016 03:51
myStr should have a value of This is the start. This is the end.
Use the + operator to build myStr
John Freeborn
@jfx1026
Jul 12 2016 03:51
@ndburrus I'm getting an errot on that lookup[var] line
Norvin Burrus
@ndburrus
Jul 12 2016 03:52
@defeds
ok, we need to take the given string, here:
"FirstLine newline backslash SecondLine backslash carriage-return ThirdLine"
(ignore the spacing) and replace the appropriate text with the escape coding...
@defeds
Defeds
@defeds
Jul 12 2016 03:53
Hmm, whats the reason i need the + ? if you dont mind @Archangelpak
@ndburrus Thanks i'll try again!
CamperBot
@camperbot
Jul 12 2016 03:53
defeds sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 955 | @ndburrus |http://www.freecodecamp.com/ndburrus
AbdallahMezo
@AbdallahMezo
Jul 12 2016 03:53
guys iam stucked in something cant underrstantd
understand*
Understand String Immutability
Instructions
Correct the assignment to myStr to achieve the desired effect.
and this is my code
// Setup
var myStr = "Jello World";
// Only change code below this line
myStr = "Hello World";
myStr[0] = "H"; // Fix Me
Archangelpak
@Archangelpak
Jul 12 2016 03:55
@defeds Concatenating Strings with Plus Operator Im doing this task
Suzanne Atkinson
@AdventureBear
Jul 12 2016 03:55
Get rid of the last line
@AbdallahMezo
Norvin Burrus
@ndburrus
Jul 12 2016 03:55
@AbdallahMezo delete this: myStr[0] = "H";
John Calhoun
@DougCal
Jul 12 2016 03:55
function destroyer(arr) {
  // Remove all the values 
var args = arr.prototype.slice.call(arguments);  

return arr.filter(args);
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
For some this challenge doesn't like the method slice or the method from. I'm trying to convert the arguments into an array and doesn't want to accept my code
AbdallahMezo
@AbdallahMezo
Jul 12 2016 03:56
@ndburrus it worked , thanks <3
CamperBot
@camperbot
Jul 12 2016 03:56
abdallahmezo sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 956 | @ndburrus |http://www.freecodecamp.com/ndburrus
clintonjohn
@clintonjohn
Jul 12 2016 03:56
@nd thx
CamperBot
@camperbot
Jul 12 2016 03:56
clintonjohn sends brownie points to @nd :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for nd
John Calhoun
@DougCal
Jul 12 2016 03:56
I even looked up the solution because the hints even lead to most of the code I have. Even the solution is unacceptable.
Aaron Chiandet
@achiandet
Jul 12 2016 03:56
If anyone can help provide some insight to my question above, I would appreciate it.
John Calhoun
@DougCal
Jul 12 2016 03:56
hints lead to*
clintonjohn
@clintonjohn
Jul 12 2016 03:56
@ndburrus
@ndburrus thx
CamperBot
@camperbot
Jul 12 2016 03:57
clintonjohn sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 957 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
Jul 12 2016 03:57
@AbdallahMezo excellent!! nice job :sparkles:
@clintonjohn super! way to go! :palm_tree:
Defeds
@defeds
Jul 12 2016 03:58
@Archangelpak really cant wrap my brain around it, i keep trying but nothings working :/
Norvin Burrus
@ndburrus
Jul 12 2016 03:59
@Archangelpak can you post?
Defeds
@defeds
Jul 12 2016 04:00
@ndburrus it's the Escape Sequences in Strings
Norvin Burrus
@ndburrus
Jul 12 2016 04:01
@defeds did you review this comment? :point_up: July 11, 2016 11:52 PM
Archangelpak
@Archangelpak
Jul 12 2016 04:01
@ndburrus just give me a moment
Kartik Mudgal
@Sprinting
Jul 12 2016 04:01
uhm I have an issue with Access-Control-Allow-origin header. help please. It works fine on Atom but not on codepen
@Sprinting
this is what i'm getting when I make an api request on codepenio. any idea how to get around this ?
XMLHttpRequest cannot load http://quotesondesign.com/wp-json/posts?filter[orderby]=rand. The 'Access-Control-Allow-Origin' header has a value 'http://null' that is not equal to the supplied origin. Origin 'http://s.codepen.io' is therefore not allowed access.
Defeds
@defeds
Jul 12 2016 04:02
@ndburrus Yeah, i do that "FirstLine\n\SecondLine\ \rThirdLine" but it's still not working, and i cant figure out why
Aaron Chiandet
@achiandet
Jul 12 2016 04:02
I want to preface this by saying that I'm early in the process of discovering how I want to do this, so please try to point me in the right direction without telling me. I'm working on the bonfire that provides you with an array of arrays and I need to pull the largest number out of each array, store it in a new array and then return that. My current gameplan is to loop through the first array, and then again through the next array, I think I might be able to do this with recursion but that will come after this initial attempt. My question at this point in time is, how would I take the value of arr[i][j] and then assign it to a variable? Is this the wrong strategy, do I have a scope issue? My code thus far
var bigNum = 0;
var emptyArr = [];

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

      //console.log(arr[i][j]);
    }
  }
  //return j;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Archangelpak
@Archangelpak
Jul 12 2016 04:03
Nor @ndburrus ```
Kartik Mudgal
@Sprinting
Jul 12 2016 04:03
@defeds you need to escape the backslash and the the carrige return
Norvin Burrus
@ndburrus
Jul 12 2016 04:03
@defeds carefully map each word in the sentence and escape coding! example: where is the backslash after new line?
Archangelpak
@Archangelpak
Jul 12 2016 04:03
@ndburrus var myStr = "This is the start\" + \"This is the end";
Norvin Burrus
@ndburrus
Jul 12 2016 04:04
@Archangelpak what are \'s for? and where is the punctuation?
Kartik Mudgal
@Sprinting
Jul 12 2016 04:04
@defeds you're only escaping one of them
Archangelpak
@Archangelpak
Jul 12 2016 04:04
@ndburrus gives me result like this : var myStr = "This is the start\" + \"This is the end";
Norvin Burrus
@ndburrus
Jul 12 2016 04:05
@Archangelpak did you see this? :point_up: July 12, 2016 12:04 AM
Archangelpak
@Archangelpak
Jul 12 2016 04:05
@ndburrus \ is for double quotes
John Freeborn
@jfx1026
Jul 12 2016 04:05
I'm stuck still on "Using Objects for Lookups".
I understand that I'm creating an mini array.
I don't understand how to connect the function and the passed variable into a statement to change the "result"
Norvin Burrus
@ndburrus
Jul 12 2016 04:06
@Archangelpak i'm not sure i understand. we're joining strings together...
Archangelpak
@Archangelpak
Jul 12 2016 04:06
@ndburrus the name of this task is : "Concatenating Strings with Plus Operator"
Norvin Burrus
@ndburrus
Jul 12 2016 04:06
@jfx1026 can you post?
John Freeborn
@jfx1026
Jul 12 2016 04:06
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

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

  //Help me here, please
  var result = lookup[alpha];

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

// Change this value to test
phoneticLookup("charlie");
Archangelpak
@Archangelpak
Jul 12 2016 04:06
@ndburrus try it bu yourself
Aaron Chiandet
@achiandet
Jul 12 2016 04:06
Is anyone able to assist me?
John Freeborn
@jfx1026
Jul 12 2016 04:07
I threw alpha in for a reach, obviously that's not right
ronaldrdguez
@ronaldrdguez
Jul 12 2016 04:07
@achiandet Following your idea…
To get the maximum value on the inner array:
  • set maximum value to first element.
  • traverse the array (your inner for loop) updating maximum
  • when this inner loop is done, maximum will hold the right value. So push it into the final array.
    No need to get too fancy, nor use recursion.
Norvin Burrus
@ndburrus
Jul 12 2016 04:07
@jfx1026 here: var result = lookup[alpha]; remove var
why are we using alpha, and not the input variable?
Archangelpak
@Archangelpak
Jul 12 2016 04:07
@ndburrus because I think result of my code is fine but it wont let me pass
Aaron Chiandet
@achiandet
Jul 12 2016 04:08
Thanks @ronaldrdguez I appreciate that feedback.
CamperBot
@camperbot
Jul 12 2016 04:08
achiandet sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 321 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
John Freeborn
@jfx1026
Jul 12 2016 04:08
thanks @ndburrus - that helped
CamperBot
@camperbot
Jul 12 2016 04:08
jfx1026 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 958 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
Jul 12 2016 04:08
@jfx1026 did you test?
John Freeborn
@jfx1026
Jul 12 2016 04:08
I just needed a nudge - it worked after I fixed the input and removed the var
Norvin Burrus
@ndburrus
Jul 12 2016 04:09
@Archangelpak did you remove the \'s?
@jfx1026 nice. great job :+1:
Archangelpak
@Archangelpak
Jul 12 2016 04:09
@ndburrus I did but it wont let me pass anyway
Norvin Burrus
@ndburrus
Jul 12 2016 04:10
@Archangelpak :point_up: July 12, 2016 12:04 AM
Archangelpak
@Archangelpak
Jul 12 2016 04:12
@ndburrus Ill show you my changed code
@ndburrus give me a sec
I dont understand one thing
@ndburrus I wrote the same code several times but after 3rd attempt it let me pass
@ndburrus I wrote the same code several times but after 3rd attempt it let me pass
@ndburrus sorry for repeating
@ndburrus but thanks anyway
CamperBot
@camperbot
Jul 12 2016 04:16
archangelpak sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 959 | @ndburrus |http://www.freecodecamp.com/ndburrus
NPeyralans
@NPeyralans
Jul 12 2016 04:40
Does anybody have a concise comprehensive explanation of how AJAX requests work in both JQuery and AngularJS? Topics I'm looking to understand: headers, configuration parameters, how to understand api documentation. When I read api documentation its so complicated that I just don't understand!

How to fix: XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?format=json&action=query&generator=searc…s&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=test. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:50704' is therefore not allowed access. code: ```
.controller('WikiController', function($scope, $http) {
// initialize variables
console.log("inside wikicontroller");
$scope.userInput = "";
var endpoint = 'https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=';
var page = 'https://en.wikipedia.org/?curid=';

    $scope.searchWikipedia = function() {
        console.log('Searched for: ' + $scope.userInput);
        console.log(endpoint + $scope.userInput);
        $http.get(endpoint + $scope.userInput).then(function(response){
            console.log('response: ' + response);
            $scope.results = response;
        });
        console.log('Results inside function: ' + $scope.results);


        /* resultsFac.get($scope.userInput).then(function(data) {
            $scope.results = data.data.query.pages;
            for (var page in $scope.results) {
                $scope.results[page].link = 'http://en.wikipedia.org/wiki/' + $scope.results[page].title;
            }
        }); */
    };

```

Why isn't my code all in the codeviewer?
Mahade Walid
@walidmahade
Jul 12 2016 04:51
This message was deleted
Defeds
@defeds
Jul 12 2016 04:55
@Sprinting @ndburrus @Archangelpak super late but thank you for helping!
CamperBot
@camperbot
Jul 12 2016 04:55
defeds sends brownie points to @sprinting and @ndburrus and @archangelpak :sparkles: :thumbsup: :sparkles:
:cookie: 159 | @archangelpak |http://www.freecodecamp.com/archangelpak
:cookie: 310 | @sprinting |http://www.freecodecamp.com/sprinting
:cookie: 960 | @ndburrus |http://www.freecodecamp.com/ndburrus
Mahade Walid
@walidmahade
Jul 12 2016 04:57
@defeds thanks for thanking them
CamperBot
@camperbot
Jul 12 2016 04:57
walidmahade sends brownie points to @defeds :sparkles: :thumbsup: :sparkles:
:cookie: 125 | @defeds |http://www.freecodecamp.com/defeds
MrBurks
@mrburks
Jul 12 2016 04:59
Not quite understanding what I'm needing to do here. needs some help
NPeyralans
@NPeyralans
Jul 12 2016 04:59
does anyone know how to set up parameters for an api call useing $http.jsonp()?
Nada
@NadaH
Jul 12 2016 04:59

what's wrong here :( ??
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch(answer) {

  case 1:
  console.log("alpha");
  break;

  case 2:
  console.log("beta");
  break;

  case 3:
  console.log("gamma");
  break;

  case 4:
  console.log("delta");
  break;

default:

}

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

// Change this value to test
caseInSwitch(1);
"Selecting from many options with Switch Statements" challenge

MrBurks
@mrburks
Jul 12 2016 05:00
@NPeyralans yeah there's not a lot of instructions in these camp lessons about it, huh?
bitgrower
@bitgrower
Jul 12 2016 05:01
@NadaH where are you in the process of doing the challenge ... if you're trying to pass the tests, you'll have to set the answer variable to the various values ... as for the rest, I'll have to review the challenge ....
NPeyralans
@NPeyralans
Jul 12 2016 05:01
@mrburks Nothing!!
Olly Sholotan
@Ollysho
Jul 12 2016 05:01
Hey, I wrote a for loop but for some reason it appears my code isn't looping and I'm not sure why
could anyone give it a look pelase?
NPeyralans
@NPeyralans
Jul 12 2016 05:01
@mrburks AJAX and HTTP requests are the most complicated and difficult part and I haven't found any good resources to clarify it!
musicsmithnz
@musicsmithnz
Jul 12 2016 05:01
help smallest common multiple
CamperBot
@camperbot
Jul 12 2016 05:01

:point_right: algorithm smallest common multiple [wiki]

Algorithm Smallest Common Multiple

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

The smallest common multiple between two numbers is the smallest number that both numbers can divide into. This concept can be extended to more than two numbers as well.

We can first start with just finding the smallest common multiple between two numbers. Naively, you can start writing out multiple of each number until you write a multiple that exists from both numbers.

An example would be the numbers 3 and 4. The multiples of 3 are 3, 6, 9, 12, 15, 18, ... and the multiples of 4 are 4, 8, 12, 16, 20, .... The first smallest number we run into in both lists is 12 so this is the smallest common multiple between 3 and 4.

This problem can be confusing because most people look for the smallest common multiple of just the two numbers but forget the keyword range. However, this means that if you are given [1,5], then you have to check for the smallest common multiple for all the numbers [1,2,3,4,5] that is evenly divisible by all of them.

Relevant Links

:pencil: read more about algorithm smallest common multiple on the FCC Wiki

Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:01
@Ollysho post it!
I did not know that if we typed help then the bot would answer
this is pretty cool
help meaning of life
CamperBot
@camperbot
Jul 12 2016 05:02
no wiki entry for: meaning of life
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:02
lol
musicsmithnz
@musicsmithnz
Jul 12 2016 05:02
yup its awesome!
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:02
help factorial
CamperBot
@camperbot
Jul 12 2016 05:02

:point_right: algorithm factorialize a number [wiki]

Algorithm Factorialize A Number

Recursion

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:pencil: read more about algorithm factorialize a number on the FCC Wiki

musicsmithnz
@musicsmithnz
Jul 12 2016 05:02
@AleCx4 lol!
bitgrower
@bitgrower
Jul 12 2016 05:02
sometimes it can be tricky getting the challenge name right ... but, other than that, yep ... very handy at times ...
there's also an eightball
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:03
handy indeed my good sir, handy indeed
musicsmithnz
@musicsmithnz
Jul 12 2016 05:03
has anyone here actually done pair progamming?
bitgrower
@bitgrower
Jul 12 2016 05:03
eightball -- am I cool programmer ?
CamperBot
@camperbot
Jul 12 2016 05:03
@bitgrower :8ball: outlook not so good :sparkles:
bitgrower
@bitgrower
Jul 12 2016 05:03
you're right @camperbot -- it's summer ...
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:03
@bitgrower o....m......g
musicsmithnz
@musicsmithnz
Jul 12 2016 05:04
@camperbot ty
CamperBot
@camperbot
Jul 12 2016 05:04
musicsmithnz sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 2042 | @camperbot |http://www.freecodecamp.com/camperbot
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:04
eightball -- will clinton go to jail?
CamperBot
@camperbot
Jul 12 2016 05:04
@AleCx4 :8ball: reply hazy try again :sparkles:
Olly Sholotan
@Ollysho
Jul 12 2016 05:04

function titleCase(str) {
  var words = str.split(' ');

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

titleCase("I'm a little tea pot");
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:04
everything in that business is hazy
Olly Sholotan
@Ollysho
Jul 12 2016 05:04
It only return's the word I'm but It should be giving me back all the strings in the array right?
musicsmithnz
@musicsmithnz
Jul 12 2016 05:04
eightball -- clinton is a criminal
CamperBot
@camperbot
Jul 12 2016 05:04
@musicsmithnz :8ball: don't count on it :sparkles:
bitgrower
@bitgrower
Jul 12 2016 05:04
eightball will @musicsmithnz give me a brownie point instead of giving it to you?
CamperBot
@camperbot
Jul 12 2016 05:04
@bitgrower :8ball: yes. Definitely :sparkles:
musicsmithnz
@musicsmithnz
Jul 12 2016 05:05
@bitgrower lol
@bitgrower ty
CamperBot
@camperbot
Jul 12 2016 05:05
musicsmithnz sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star2: 1136 | @bitgrower |http://www.freecodecamp.com/bitgrower
musicsmithnz
@musicsmithnz
Jul 12 2016 05:05
wowo
!
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:05
@Ollysho let me look into it
bitgrower
@bitgrower
Jul 12 2016 05:05
hahahahahahaha
musicsmithnz
@musicsmithnz
Jul 12 2016 05:05
mind blown
eightball -- is Donald Trump secretly gay?
eightball -- is Donald Trump secretly gay?
CamperBot
@camperbot
Jul 12 2016 05:06
@musicsmithnz :8ball: signs point to yes :sparkles:
musicsmithnz
@musicsmithnz
Jul 12 2016 05:06
i knew it
bitgrower
@bitgrower
Jul 12 2016 05:06
eightball will Bernie Sanders become president ?
CamperBot
@camperbot
Jul 12 2016 05:06
@bitgrower :8ball: outlook good :sparkles:
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:06
@AleCx4 ah just saw it, you are returning each item, automatically, once a function sees a return statement, it will stop there
musicsmithnz
@musicsmithnz
Jul 12 2016 05:06
lol
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:06
@Ollysho replied to myself
@Ollysho ah just saw it, you are returning each item, automatically, once a function sees a return statement, it will stop there
musicsmithnz
@musicsmithnz
Jul 12 2016 05:07
i thought camperbot would be a little smarter tbh
Olly Sholotan
@Ollysho
Jul 12 2016 05:07
@AleCx4 Ahh okay, so should I put console log instead?
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:07
@Ollysho if you wanted to return the whole array, you would need to have an array variable declared inside, and then push items into it
@Ollysho let me write you a quick example
Olly Sholotan
@Ollysho
Jul 12 2016 05:07
@AleCx4 you're god! thank you
CamperBot
@camperbot
Jul 12 2016 05:07
ollysho sends brownie points to @alecx4 :sparkles: :thumbsup: :sparkles:
:cookie: 271 | @alecx4 |http://www.freecodecamp.com/alecx4
bitgrower
@bitgrower
Jul 12 2016 05:08
god is there life on earth ?
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:08
'''
CamperBot
@camperbot
Jul 12 2016 05:08
:bulb: to format code use backticks! ``` more info
bitgrower
@bitgrower
Jul 12 2016 05:08
hey, you never know what sort of easter eggs might be hidden ...
musicsmithnz
@musicsmithnz
Jul 12 2016 05:09
camperbot
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:10
function returnArray(textString){
  var makeArray = textString.split(" ");
 return makeArray;
}

//then to show you the outcome

var myTest = returnArray("This is merely a test");
console.log(myTest);
@Ollysho something like that bro, let me know if you need more help
@bitgrower i wonder what other things the programmers program into it
camperbot
MrBurks
@mrburks
Jul 12 2016 05:11
@NPeyralans neither have I. I even tried Lynda.com and they go through so fast because at that point they assume that you know something. so they just start typing and saying what their typing but no rhyme or reason behind it.
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:12
@camperbot
Olly Sholotan
@Ollysho
Jul 12 2016 05:12
@AleCx4 gotcha....
yes. I think I get it yeah!
@AleCx4 again, thanks you're god :P
CamperBot
@camperbot
Jul 12 2016 05:13
ollysho sends brownie points to @alecx4 :sparkles: :thumbsup: :sparkles:
:warning: ollysho already gave alecx4 points
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:13
@Ollysho here to help :)
MrBurks
@mrburks
Jul 12 2016 05:16
is there a link on this site for feedback? anyone know of anything like that. I haven't found any. but they say they welcome user feedback.
Jack
@jh0l
Jul 12 2016 05:17
help truncate a string
CamperBot
@camperbot
Jul 12 2016 05:17

:point_right: algorithm truncate a string [wiki]

Algorithm Truncate a String

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

We need to reduce the length of the string or truncate it if it is longer than the given maximum lengths specified and add ... to the end. If it is not that long then we keep it as is.

Relevant Links

:pencil: read more about algorithm truncate a string on the FCC Wiki

Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:19
@Jhollond stuck on that one?
help game of life
CamperBot
@camperbot
Jul 12 2016 05:19
no wiki entry for: game of life
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:19
ha!
Jack
@jh0l
Jul 12 2016 05:26
it's pretty quite in here today
I guess everyone's out playingg pokemon
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 12 2016 05:30
@Jhollond not me, I didn't like the game
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 05:37
help largest number
CamperBot
@camperbot
Jul 12 2016 05:37

:point_right: algorithm return largest numbers in arrays [wiki]

Algorithm Return largest Numbers in Arrays

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

You will get an array that contains sub arrays of numbers and you need to return an array with the largest number from each of the sub arrays.

:pencil: read more about algorithm return largest numbers in arrays on the FCC Wiki

gdntian
@gdntian
Jul 12 2016 05:40
help stand in line
CamperBot
@camperbot
Jul 12 2016 05:40

:point_right: challenge stand in line [wiki]

Challenge Stand In Line

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

In Computer Science a queue is an abstract data structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.

  • Change the code below //Your Code here and up to //Change this line.
  • Ensure that you are editing the inside of the nextInLine function.
  • Use an array function you learned to add the item to the end of the array arr.
  • Use an array function you learned to remove the first element from array arr.
  • Return the element removed.

Relevant Links

Mahade Walid
@walidmahade
Jul 12 2016 05:44
can some one kindly take the time to explain this -
function titleCase(str) {
  return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}
Bogdan
@Bogdan032
Jul 12 2016 05:44

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

// Only change code below this line

var secondTree = ""; // Change this line

Anyone know what i need to do here???

Markus Kiili
@Masd925
Jul 12 2016 05:46
@Bogdan032 Most likely you need to access the array myPlants.
Bogdan
@Bogdan032
Jul 12 2016 05:46
Yup that's the instruction :D But I tried a few times and my code doesn't work
Markus Kiili
@Masd925
Jul 12 2016 05:46
Dot and bracket notation are used to access arrays and objects.
What do you need to get?
Bogdan
@Bogdan032
Jul 12 2016 05:47
the second tree
Markus Kiili
@Masd925
Jul 12 2016 05:48
First you must access the second element of myPlants. Try to console.log it.
myPlants is an array of two elements.
Bogdan
@Bogdan032
Jul 12 2016 05:49
I don't think console log would do it. This is a challenge for acessing nested arrays
But I'll give it a try
Markus Kiili
@Masd925
Jul 12 2016 05:50
Just to see that you get the correct element. Then you can access properties of the element.
Bogdan
@Bogdan032
Jul 12 2016 05:51
I tried but the elements are undefined
Markus Kiili
@Masd925
Jul 12 2016 05:51
What did you try?
Bogdan
@Bogdan032
Jul 12 2016 05:52
I tried to console log the myPlants elements
Markus Kiili
@Masd925
Jul 12 2016 05:52
Post the code you used.
Bogdan
@Bogdan032
Jul 12 2016 05:53

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

// Only change code below this line

var secondTree = ""; // Change this line
console.log(myPlants);

The actual error is that i have to use dot and bracket notation to do it

Markus Kiili
@Masd925
Jul 12 2016 05:54
myPlants is an array. You need to access the second element, which is at index 1.
"1" is not a valid JS identifier name, so only bracket notation works.
Vivek Tripathi
@SopanTripathi
Jul 12 2016 05:55
some-one help me with Escape characters, i am not able to understand this.. Challenge 126
FirstLine
\SecondLine\
ThirdLine
is required output
Mustafijur rahman
@Dinar717
Jul 12 2016 05:57
@SopanTripathi you need to write FirstLine then one newline and backslash then SecondLine then backslash and carrige return then Thirdline
without spaces between them
Vivek Tripathi
@SopanTripathi
Jul 12 2016 05:58
I written like this FirstLine\n\SecondLine\rThirdLine
but i am facing issues with '' "" where to use and where not
Anoosha keen
@anookeen
Jul 12 2016 05:59
hello
Mustafijur rahman
@Dinar717
Jul 12 2016 05:59
@SopanTripathi use it at first and last
Anoosha keen
@anookeen
Jul 12 2016 05:59
Anyone please help me with palindromes
Vivek Tripathi
@SopanTripathi
Jul 12 2016 05:59
Then its all become 1 string ? @Dinar717
Mustafijur rahman
@Dinar717
Jul 12 2016 05:59
yes
Sahana
@Sahana496
Jul 12 2016 06:00
help Seek and Destroy
CamperBot
@camperbot
Jul 12 2016 06:00

:point_right: algorithm seek and destroy [wiki]

Algorithm Seek and Destroy

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

This problem is a bit tricky because you have to familiarize yourself with Arguments, as you will have to work with two or more but on the script you only see two. Many people hardcode this program for three arguments. You will remove any number from the first argument that is the same as any other other arguments.

Relevant Links

:pencil: read more about algorithm seek and destroy on the FCC Wiki

Mustafijur rahman
@Dinar717
Jul 12 2016 06:00
@SopanTripathi the task wants you to do that
Anoosha keen
@anookeen
Jul 12 2016 06:00

function palindrome(str) {

var a=str.split().reverse().join();

if(a===str){
return true;}
else{
return false;
}
}
palindrome("_eye");

this is my code
Markus Kiili
@Masd925
Jul 12 2016 06:00
@anookeen You need to remove all the non-alphanumeric characters from the string before reversing it.
Vivek Tripathi
@SopanTripathi
Jul 12 2016 06:00
but it shows error then var myStr= "FirstLine\n\SecondLine\rThirdLine";
Mustafijur rahman
@Dinar717
Jul 12 2016 06:00
@anookeen still your string may have space or other symol
Markus Kiili
@Masd925
Jul 12 2016 06:01
@anookeen Also, split and join need an argument.
Mustafijur rahman
@Dinar717
Jul 12 2016 06:01
remove non-alphanumeric characters with regex.
Mahade Walid
@walidmahade
Jul 12 2016 06:01
help title case
CamperBot
@camperbot
Jul 12 2016 06:01

:point_right: algorithm title case a sentence [wiki]

Algorithm Title Case a Sentence

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

We have to return a sentence with title case. This means that the first letter will always be in uppercase and the rest will be in lowercase.

Relevant Links

:pencil: read more about algorithm title case a sentence on the FCC Wiki

Anoosha keen
@anookeen
Jul 12 2016 06:01
which kind of argument @Masd925
Bogdan
@Bogdan032
Jul 12 2016 06:01
I figured out the code. Thanks Markus for helping out :D
Mustafijur rahman
@Dinar717
Jul 12 2016 06:02
@SopanTripathi can you give url of your page?
Markus Kiili
@Masd925
Jul 12 2016 06:02
@anookeen .split("") would split the string into characters and .split(" ") into words etc.
Anoosha keen
@anookeen
Jul 12 2016 06:02
@Masd925 it is returning true for nope
edison sim
@Edisonsim
Jul 12 2016 06:03
how do i switch my question? after someone choose the answer?
Mustafijur rahman
@Dinar717
Jul 12 2016 06:03
@SopanTripathi if you want to write \ you need to write it twice for escape sequence so \n\\ like this.
edison sim
@Edisonsim
Jul 12 2016 06:03
Screen Shot 2016-07-12 at 1.59.24 PM.png
Anoosha keen
@anookeen
Jul 12 2016 06:04
@Masd925 if i give arguments then it is failing more tests.
Markus Kiili
@Masd925
Jul 12 2016 06:04
@anookeen Tests don't tell too much at that point. You need to do the removing at first.
Vivek Tripathi
@SopanTripathi
Jul 12 2016 06:05
@Dinar717 I got it.... :) thanks I will note down this error for my future reference.. as it almost taken 3nours for me to understand
CamperBot
@camperbot
Jul 12 2016 06:05
sopantripathi sends brownie points to @dinar717 :sparkles: :thumbsup: :sparkles:
:cookie: 411 | @dinar717 |http://www.freecodecamp.com/dinar717
MrBurks
@mrburks
Jul 12 2016 06:05

Help!! Please!!

// 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 updateRecords(id, prop, value) {
for(i=0; i < collection.length; i++){
if(prop !== "tracks" && value !== ""){
collection.value = "Addicted to Love";
}

}

return collection;
}

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

CamperBot
@camperbot
Jul 12 2016 06:05
no wiki entry for: please setupvar 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 testsvar collectioncopy jsonparsejsonstringifycollection only change code below this linefunction updaterecordsid prop value fori0 i collectionlength i ifprop tracks value collectionvalue addicted to love return collection alter values below to test your codeupdaterecords5439 artist abba
Markus Kiili
@Masd925
Jul 12 2016 06:05
@mrburks You don't need any loop in Record collection.
Anoosha keen
@anookeen
Jul 12 2016 06:05
@Masd925 I have to change the string into characters. Right?
MrBurks
@mrburks
Jul 12 2016 06:06
so how do you move through the record to specify all the information that is missing? @Masd925
Markus Kiili
@Masd925
Jul 12 2016 06:06
@anookeen Easiest way to remove, is to use .replace() method and regexp object.
@mrburks You just access collection with the property key.
@mrburks You need a couple of tests for parameters value and prop and on if blocks you access collection. Property tracks needs an extra test.
MrBurks
@mrburks
Jul 12 2016 06:08
so just one statement at a time? because I tried that and that didn't work
Dany Din
@danydin
Jul 12 2016 06:08
@Masd925 in the loop that @mrburks mentioned : for(i=0; i < collection.length; i++){
the .length search in all ids,props, and values? i mean i know in array its [0,1,2] it will retrun length 3 but how is it in this object what length will retrun?
Markus Kiili
@Masd925
Jul 12 2016 06:09
@danydin Plain objects don't have length property. Arrays and functions have it.
Olly Sholotan
@Ollysho
Jul 12 2016 06:09
Hey guys I have a question about for loops
my code is ```
function titleCase(str) {
  var lowerStr = str.toLowerCase();
  var words = lowerStr.split(' ');
  var first = [ ];

  for (i = 0; i < words.length; i++) {
    first.push(words[i]);
    return first;
  }
}
When I run the code it only gives me an array with the word "i'm" not the whole words array
Mustafijur rahman
@Dinar717
Jul 12 2016 06:10
@Ollysho the loop will iterate 1 time only
because your returned
Anoosha keen
@anookeen
Jul 12 2016 06:10
Thanks @Masd925
CamperBot
@camperbot
Jul 12 2016 06:10
anookeen sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2080 | @masd925 |http://www.freecodecamp.com/masd925
Dany Din
@danydin
Jul 12 2016 06:10
@Masd925 ohh really??! then it will search just in thet tracks prop in that example above
Mustafijur rahman
@Dinar717
Jul 12 2016 06:10
your return should be out of for loop @Ollysho
Olly Sholotan
@Ollysho
Jul 12 2016 06:11
@Dinar717 gotcha! Thanks man :)
CamperBot
@camperbot
Jul 12 2016 06:11
ollysho sends brownie points to @dinar717 :sparkles: :thumbsup: :sparkles:
:cookie: 412 | @dinar717 |http://www.freecodecamp.com/dinar717
Dany Din
@danydin
Jul 12 2016 06:11
and how eaxctly it works in functions the .length method? thanks @Masd925
CamperBot
@camperbot
Jul 12 2016 06:11
danydin sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2081 | @masd925 |http://www.freecodecamp.com/masd925
Mustafijur rahman
@Dinar717
Jul 12 2016 06:11
@Ollysho :+1:
Markus Kiili
@Masd925
Jul 12 2016 06:11
@danydin Functions length is the number of functions parameters (rarely needed).
Dany Din
@danydin
Jul 12 2016 06:12
ahh so theres no need to learn it? @Masd925
where its acutally used
Markus Kiili
@Masd925
Jul 12 2016 06:13
@danydin I am not aware of any use for it. There are things like function decomposition, where it might come handy.
MrBurks
@mrburks
Jul 12 2016 06:15
ok I went back to the original lesson where it explains it but the data object in that lesson is simpler than what I'm dealing with now. so there is obviously some missing minor detail that I'm not aware for addressing the data keys and values
Dany Din
@danydin
Jul 12 2016 06:16
@Masd925 i see.. it also works with strings though the .length right
Markus Kiili
@Masd925
Jul 12 2016 06:16
@mrburks Here you have the property keys in parameters (variables) value and prop. You can use them with bracket notation (dot notation doesn't work here).
Dany Din
@danydin
Jul 12 2016 06:16
cuz i see oshylo function few paragrahpes above or maybe because he split it , it became array auto? @Masd925
Markus Kiili
@Masd925
Jul 12 2016 06:16
@danydin Yes, array-like objects have .length property too.
Olly Sholotan
@Ollysho
Jul 12 2016 06:17
Hey does the ToUpperCase change the original string/array or do you have to make a new variable?
Markus Kiili
@Masd925
Jul 12 2016 06:17
@Ollysho Strings are immutable, so a new string is returned.
Olly Sholotan
@Ollysho
Jul 12 2016 06:17
like words[i].charAt(0).toUpperCase();
@Masd925 Oy thank you
CamperBot
@camperbot
Jul 12 2016 06:17
ollysho sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2082 | @masd925 |http://www.freecodecamp.com/masd925
Olly Sholotan
@Ollysho
Jul 12 2016 06:17
I feel like I shouldnt be this helpless but alas I'll figure it out ¯_(ツ)_/¯
Markus Kiili
@Masd925
Jul 12 2016 06:18
@danydin Split makes an array out of a string.
Olly Sholotan
@Ollysho
Jul 12 2016 06:19
hey @Masd925 One more thing

function titleCase(str) {
  var lowerStr = str.toLowerCase();
  var words = lowerStr.split(' ');
  var upper = [ ];

  for (var i = 0; i < words.length; i++) {
    words[i].charAt(0).toUpperCase();
  }
  return words;
}

titleCase("I'm a little tea pot");
Just gives me an array of the regular words
it seems like my .toUpperCase was completely ignored
Markus Kiili
@Masd925
Jul 12 2016 06:20
@Ollysho Assign the titlecased word back to the array.
Olly Sholotan
@Ollysho
Jul 12 2016 06:21
That just gives me I as a response in the console
Dany Din
@danydin
Jul 12 2016 06:21
try upper = words[i].charAt(0).toUpperCase();? @Ollysho
Olly Sholotan
@Ollysho
Jul 12 2016 06:22
@danydin tried that and for some reason it returns p
The first letter of the last word in the sentence
Which makes zero sense to me I won't lie
Markus Kiili
@Masd925
Jul 12 2016 06:22
@Ollysho You can assign the titlecased word back to words[i], or push it to the result array upper. Which ever you wan't to use.
@Ollysho You need to concat the rest of the string to the titlecased first character.
Olly Sholotan
@Ollysho
Jul 12 2016 06:23
@Masd925 Ahh yeah, charAt completely removes the rest of the word, I thought it only changed the first character and kept the others there
Markus Kiili
@Masd925
Jul 12 2016 06:23
words[i].charAt(0).toUpperCase() is only one character.
@Ollysho Strings are immutable.
Dany Din
@danydin
Jul 12 2016 06:24
ya i always forget that too :(
Olly Sholotan
@Ollysho
Jul 12 2016 06:24
@danydin I thought I was onto something too haha
Dany Din
@danydin
Jul 12 2016 06:26
@Masd925 but then he has to slice also so it will remove the first letter of each (0) letter?!
MrBurks
@mrburks
Jul 12 2016 06:27
@Masd925 that's not even where i'm having trouble
Dany Din
@danydin
Jul 12 2016 06:27
@Ollysho haha man it takes time to remmber all the rules no worries
Markus Kiili
@Masd925
Jul 12 2016 06:27
@danydin Yes.
Olly Sholotan
@Ollysho
Jul 12 2016 06:27
@danydin @Masd925 It's also slightly possible I'm going about this wrong... or maybe I'm onto something I'll keep you posted :P
Dany Din
@danydin
Jul 12 2016 06:28
i think you can do it all on the same row @Masd925 @Ollysho
just check about push and slice
Markus Kiili
@Masd925
Jul 12 2016 06:29
@danydin One line is enough, yes.
Olly Sholotan
@Ollysho
Jul 12 2016 06:31
Oh wait... that's a good idea.... just slice then push it to each line. @danydin I love you thank you
CamperBot
@camperbot
Jul 12 2016 06:31
ollysho sends brownie points to @danydin :sparkles: :thumbsup: :sparkles:
:cookie: 292 | @danydin |http://www.freecodecamp.com/danydin
Dany Din
@danydin
Jul 12 2016 06:33
:+1: thanks to @Masd925 too im just student as u
CamperBot
@camperbot
Jul 12 2016 06:33
danydin sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:warning: danydin already gave masd925 points
Anoosha keen
@anookeen
Jul 12 2016 06:37
I am having problem in finding the longest word in string
it is returning the correct answer but the codecamp does not consider it right
I am having problem with one test only.

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

}

findLongestWord("May the force be with you");

this is the code
anyone??
Olly Sholotan
@Ollysho
Jul 12 2016 06:39
try putting it in backticks
It'll be easier to read
like put three things ``` and then press enter then paste your code in there
Olly Sholotan
@Ollysho
Jul 12 2016 06:49
@Masd925 Why does strUpper = upper[i].push(words[i]); tell me that Upper[i].push isn't function?
Markus Kiili
@Masd925
Jul 12 2016 06:49
@Ollysho Upper[i] is a string?
This message was deleted
Olly Sholotan
@Ollysho
Jul 12 2016 06:50
Maybe the whole code would be better

function titleCase(str) {
  var lowerStr = str.toLowerCase();
  var words = lowerStr.split(' ');
  var upper = [ ];
  var strUpper = [ ];

  for (var i = 0; i < words.length; i++) {
    upper[i] = words[i].charAt(0).toUpperCase();
    words[i] = words[i].substring(1);
    strUpper = upper[i].push(words[i]);
  }
  return strUpper;
}

titleCase("I'm a little tea pot");
I have two perfectly good arrays that I'm trying to basically zipper together but that won't work haha
Vikash Saini
@Enigma10
Jul 12 2016 06:51
@anookeen hello you are returning length ?
Markus Kiili
@Masd925
Jul 12 2016 06:52
@Ollysho You don't need any extra variables. words[i] is the original word, and just assign the new titlecased word back to it words[i]=words[i].charAt(0).toUpperCase()+... <- rest of string here lowercased. Then just .join(" ") words back to a string and return it.
Vikash Saini
@Enigma10
Jul 12 2016 06:52
about @anookeen
CamperBot
@camperbot
Jul 12 2016 06:52
:warning: no user found for anookeen
Vikash Saini
@Enigma10
Jul 12 2016 06:54
about @anookeen
CamperBot
@camperbot
Jul 12 2016 06:54
:warning: no user found for anookeen
Olly Sholotan
@Ollysho
Jul 12 2016 06:54
@Masd925 I see where you're going, I'll play with it a bit more, hopefully my next @ to you will be telling you I got it
I'm annoyed at how simple a solution yours was though :P
Viknesh
@vk2mars
Jul 12 2016 06:55
help sorted union
CamperBot
@camperbot
Jul 12 2016 06:55

:point_right: algorithm sorted union [wiki]

Algorithm Sorted Union

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

The program has to return a new array of unique values from two original arrays in the order they show up. So there is not sorting required, and there shouldn't be any duplicates.

Relevant Links

:pencil: read more about algorithm sorted union on the FCC Wiki

Vivek Tripathi
@SopanTripathi
Jul 12 2016 06:55
I did solution, but not actually the thing challenge want me to do...
kirbyedy
@kirbyedy
Jul 12 2016 06:55
@SopanTripathi myNoun[2] what does this mean ?
Vivek Tripathi
@SopanTripathi
Jul 12 2016 06:56
I want to take second character of "myNoun" variable
Vikash Saini
@Enigma10
Jul 12 2016 06:59
@SopanTripathi
About @SopanTripathi
CamperBot
@camperbot
Jul 12 2016 06:59
:cookie: 138 | @sopantripathi |http://www.freecodecamp.com/sopantripathi
kirbyedy
@kirbyedy
Jul 12 2016 07:00
@SopanTripathi why?
Vikash Saini
@Enigma10
Jul 12 2016 07:00
@SopanTripathi var result = myNoun+" "+myAdjective+" "+myVerb+" "+myAdverb;
you just need to create a sentence using this variable :)
Olly Sholotan
@Ollysho
Jul 12 2016 07:01
@Masd925 I did it! Thank you thank you thank you
CamperBot
@camperbot
Jul 12 2016 07:01
ollysho sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:warning: ollysho already gave masd925 points
Markus Kiili
@Masd925
Jul 12 2016 07:02
@Ollysho Great!
Vikash Saini
@Enigma10
Jul 12 2016 07:03
@SopanTripathi or this var result = myAdjective+" "+myNoun+" "+myVerb+" "+myAdverb;
Nathaniel Nasarow
@Torgian
Jul 12 2016 07:04
Hey all
I'm wondering why I am getting an "undefined" in the console and on my page. http://codepen.io/torgian/pen/PzJXkN
Vikash Saini
@Enigma10
Jul 12 2016 07:05
@SopanTripathi check this condition :) wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
kirbyedy
@kirbyedy
Jul 12 2016 07:06
@Torgian did you try to type this into your browser ? https://api.twithc.tv/kraken/channels/streams/ogamingsc2
Nathaniel Nasarow
@Torgian
Jul 12 2016 07:07
@kirbyedy yeah, I noticed that just now and deleted that console command, but I ams till getting an undefined on my html body
before each div that is generated
kirbyedy
@kirbyedy
Jul 12 2016 07:08
it gives me 404
check the link I dont think its valid
DJ
@qualitymanifest
Jul 12 2016 07:11
@Torgian need to set your html var
Nathaniel Nasarow
@Torgian
Jul 12 2016 07:11
No, that's not the problem
@qualitymanifest oh?
DJ
@qualitymanifest
Jul 12 2016 07:11
@Torgian at the beginning of createElement function
just set var html to an empty string
Nathaniel Nasarow
@Torgian
Jul 12 2016 07:12
ahh there we go
ok cool @qualitymanifest thanks
CamperBot
@camperbot
Jul 12 2016 07:12
torgian sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star2: 1266 | @qualitymanifest |http://www.freecodecamp.com/qualitymanifest
DJ
@qualitymanifest
Jul 12 2016 07:12
np
i kind of misphrased that - you didn't need to "reset" it, you just needed to declare it as a string so you could += onto it
Kirtimaan Gogna
@kman30
Jul 12 2016 07:22
Hello everyone , I am stuck in a challenge
can anyone help me ?
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:22
@kman30 where do you stuck
Kirtimaan Gogna
@kman30
Jul 12 2016 07:24
in javaScript challenge using obejcts for lookups
this chllenge
*challenge
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:25
remove switch statement and convert it into object called lookup
Kirtimaan Gogna
@kman30
Jul 12 2016 07:25
I cant understand how to use val in this challenge and assign its value to result
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:25
var alpha = {
1:"Z",
2:"Y",
3:"X",
4:"W",
...
24:"C",
25:"B",
26:"A"
};
same as above example create lookup with alpha etc
Kirtimaan Gogna
@kman30
Jul 12 2016 07:26
I made the object for it , but cant use val
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:26
after createing lookup just use lookup[val]
I mean result = lookup[val]
Kirtimaan Gogna
@kman30
Jul 12 2016 07:27
Thank you very much :smile:
i got it
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:28
:thumbsup:
Jack
@jh0l
Jul 12 2016 07:28
help chunky monkey
CamperBot
@camperbot
Jul 12 2016 07:28

:point_right: algorithm chunky monkey [wiki]

Algorithm Chunky Monkey

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

Our goal for this Algorithm is to split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument). There are 4 green checks (objectives) our code needs to pass in order to complete this Algorithm:

  1. (['a', 'b', 'c', 'd'], 2) is expected to be [['a', 'b'], ['c', 'd']]
  2. ([0, 1, 2, 3, 4, 5], 3) is expected to be [[0, 1, 2], [3, 4, 5]]
  3. ([0, 1, 2, 3, 4, 5], 2) is expected to be [[0, 1], [2, 3], [4, 5]]
  4. ([0, 1, 2, 3, 4, 5], 4) is expected to be [[0, 1, 2, 3], [4, 5]]

Relevant Links

:pencil: read more about algorithm chunky monkey on the FCC Wiki

Jack
@jh0l
Jul 12 2016 07:28

@Jhollond

function chunkArrayInGroups(arr, size) {
  for (var i=0, arrNew=[]; i < arr.length; i+=size){
    arrNew.push(arr.slice(i,size));     
  }
  return arrNew;
} 

chunkArrayInGroups(["a", "b", "c", "d"], 2);

why does this return

[["b"."b"],[]]
*[["a","b"],[]]
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:30
@Jhollond try to change slice
Jack
@jh0l
Jul 12 2016 07:30
@chakrihacker ok
I will report bacvk
Markus Kiili
@Masd925
Jul 12 2016 07:31
@Jhollond The second slice argument is the end index (excluded).
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:31
read slice documentation
what you are doing is wrong
remove size
and try
hope it will works
Markus Kiili
@Masd925
Jul 12 2016 07:32
@Jhollond It is very close to working.
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 07:32
@Jhollond think logically and replace size
Jack
@jh0l
Jul 12 2016 07:33
: D
: )
ohe
I get it
Jack
@jh0l
Jul 12 2016 07:38
would I use i+size?
Pericles
@periman2
Jul 12 2016 07:38
hello there
Jack
@jh0l
Jul 12 2016 07:38
yes
:smile:
thank u guys
<3
thanks @Masd925 @chakrihacker
CamperBot
@camperbot
Jul 12 2016 07:39
jhollond sends brownie points to @masd925 and @chakrihacker :sparkles: :thumbsup: :sparkles:
:star2: 2083 | @masd925 |http://www.freecodecamp.com/masd925
:cookie: 262 | @chakrihacker |http://www.freecodecamp.com/chakrihacker
Jack
@jh0l
Jul 12 2016 07:39
@periman2 hey dood
Pericles
@periman2
Jul 12 2016 07:40
can someone tell me how to select multiple properties in an object?
that's without making a loop
maybe an easier more clean way ?
for example I want the properties from obj{1] up until the end property whatever that is
how I do I write that in a line ?
Jack
@jh0l
Jul 12 2016 07:42
lol my solution is almost identical to the wiki solution
@periman2 do you mean something like slice?
bradulz
@bradulz
Jul 12 2016 07:43
JSON.stringify() might be of use @periman2
Pericles
@periman2
Jul 12 2016 07:43
idk does slice works in objects?
Jack
@jh0l
Jul 12 2016 07:43
which challenge is iths
bradulz
@bradulz
Jul 12 2016 07:43
wait nvm
Jack
@jh0l
Jul 12 2016 07:43
you might be beyond me
Pericles
@periman2
Jul 12 2016 07:44
I'm in seek and destroey
destroy *
I already found a way to do it but I don't think it actually needs a loop so I'm trying for a better way
SBeard
@etacalpha
Jul 12 2016 07:45
@periman2 why not use .forEach or .map
willfree108
@willfree108
Jul 12 2016 07:45
or .filter
Markus Kiili
@Masd925
Jul 12 2016 07:45
@periman2 .filter() is the most proper method there.
nikwin333
@nikwin333
Jul 12 2016 07:46
Hi. Who worked with OneDrive File Picker JavaScript SDK v7.0??? Please, help me. I can't download file to OneDrive account, we use OneDrive File Picker JavaScript SDK v7.0 like described in the doc (An http, https, or data URI for the file to be uploaded. OneDrive for Business and SharePoint only supports data URI values.). We create a request with date uri for pdf: data:application/pdf;base64,..... and next going the content of the file in base64. When we try to download normal files, we get the issue: "Request URI Too Large onedrive", when we download small files we can save them, but the files are empty or we can't open it.
Jack
@jh0l
Jul 12 2016 07:46
@Masd925 is there any reason why the wiki solution used a while loop instead a for loop for Chunky Monkey?
Pericles
@periman2
Jul 12 2016 07:47
I know but I need to filter all the arguments from 1 to the end through the 0th argument that's whatt I'm trying to do
@Masd925 did you do it just by using filter without making a loop?
Markus Kiili
@Masd925
Jul 12 2016 07:47
@Jhollond No. The best while loop solution is maybe a bit more elegant than the for loop solution (I haven't seen the wiki solution).
@periman2 With filter you can avoid looping arr.
Nathaniel Nasarow
@Torgian
Jul 12 2016 07:48
hey guys, need help again xD I'm doing an API call to check if twitch streams are online. I then try to add "online" or "offline" next to the div, but it's not doing so for some reason. I'm guessing it's a syntax thing, but not sure.
supertrek
@supertrek
Jul 12 2016 07:49

Global vs Local Scope in Functions
Tried to google this and looked for previous articles but to no avail

Instructions
Add a local variable to myOutfit to override the value of outerWear with "sweater".

Code:
// Setup
var outerWear = "T-Shirt";

function myFunction() {
// Only change code below this line
var outerWear = "sweater";

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

myFunction();

Error Msg:
myOutfit should return "sweater"

Pericles
@periman2
Jul 12 2016 07:53
I\ll try all those options right now
when I try to use slice or any other funtion on "arguments" object it says "slice is not a function"
which probably means it doesn't work in objects right?
bradulz
@bradulz
Jul 12 2016 07:57
@supertrek does having no var on outerWear inside the function change anything?
Markus Kiili
@Masd925
Jul 12 2016 07:57
@periman2 Slice works on arrays and strings. Arguments is an array-like object (only element access and length property similar to arrays, but no array methods).
Jack
@jh0l
Jul 12 2016 07:57
help slasher
CamperBot
@camperbot
Jul 12 2016 07:57

:point_right: algorithm slasher flick [wiki]

Algorithm Slasher Flick

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

For example: slasher([1, 2, 3], 2); must return [3].

Relevant Links

:pencil: read more about algorithm slasher flick on the FCC Wiki

Pericles
@periman2
Jul 12 2016 07:58
no I really don't want to see the code I wanna figure it out somehow
but thanks @Jhollond
CamperBot
@camperbot
Jul 12 2016 07:58
periman2 sends brownie points to @jhollond :sparkles: :thumbsup: :sparkles:
:cookie: 263 | @jhollond |http://www.freecodecamp.com/jhollond
Pericles
@periman2
Jul 12 2016 07:59
@Masd925 Yeah that's what I figured now I have to find a way to extract information out of arguments though
not even arguments.values() won't work
Jack
@jh0l
Jul 12 2016 08:00
@periman2 oh I was just seeing the wiki examples for the one I just did
Markus Kiili
@Masd925
Jul 12 2016 08:01
@periman2 You can only use arguments[i] and arguments.length. Also you can turn arguments object into a real array if you like to use array methods on it.
Pericles
@periman2
Jul 12 2016 08:02
@Masd925 That's what I just only now discovered! I can use Array.from(arguments)! That works. Thank you though. I should be studying harder before I come here :P
CamperBot
@camperbot
Jul 12 2016 08:02
:star2: 2084 | @masd925 |http://www.freecodecamp.com/masd925
periman2 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
supertrek
@supertrek
Jul 12 2016 08:04
bradulz no it doesnt
Caitlin Sophia
@ocarno5
Jul 12 2016 08:06
Can someone give me a hand with the Record Collection task?
Ahmed Fouad
@FoushWare
Jul 12 2016 08:07
(profile Lookup)----javascript [i think my code is good why can't pass this challenge

//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"]
}
];

var j=0;
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i=0;i<contacts.length;i++){

if(contacts[i][firstName]!==firstName){

  if(j==contacts.length-1)
  return "No such contact";
  else{
  j++;
  continue;
  }
}


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

else {
  return contacts[i][prop];

   }

}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Kristian", "lastName");

Alex T.
@lx-t
Jul 12 2016 08:07
@ocarno5 What is the problem? Can you post your code here?
Caitlin Sophia
@ocarno5
Jul 12 2016 08:07
function updateRecords(id, prop, value) {

  if (prop !== "tracks" && value !== ""){
    collection[id][prop] = value;
  } 
  else if (prop == "tracks" && collection.hasOwnProperty(prop) === false) {
    collection[id].tracks = [];
    collection[id][prop].push(value);
  }
  else if (prop == "tracks" && value !== "") {
    collection[id][prop].push(value);
  }
  else if(value === ""){
    delete collection[id][prop];
  }
  return collection;
}
The last part where it deletes the property, it wont delete arrays? only numbers/strings?
Ahmed Fouad
@FoushWare
Jul 12 2016 08:08
can anyone give me a hand please
Caitlin Sophia
@ocarno5
Jul 12 2016 08:09
@lionmoon60 maybe, depends on what it is haha
Alex T.
@lx-t
Jul 12 2016 08:09
@ocarno5 It only deletes a property
Caitlin Sophia
@ocarno5
Jul 12 2016 08:10
@lx-t I know, but one of the properties of my object is an array, it will delete props that are numbers/string, but it just deletes the content of array props?
I don't know why it doesn't work?
Alex T.
@lx-t
Jul 12 2016 08:11
@ocarno5 Which test it doesn't pass?
Caitlin Sophia
@ocarno5
Jul 12 2016 08:11
The last two
Ahmed Fouad
@FoushWare
Jul 12 2016 08:11

function updateRecords(id, prop, value) {
if (value === '') {
delete collection[id][prop];
} else if (prop !== 'tracks') {
collection[id][prop] = value;
} else {
if(collection[id].hasOwnProperty("tracks")===false){
var arr=[];
arr.push(value);
collection[id][prop]=arr;
}
else
collection[id][prop].push(value);
}

return collection;
}

@ocarno5 this works for me
Alex T.
@lx-t
Jul 12 2016 08:13
@ocarno5 The mistake is in this part of your code:
collection.hasOwnProperty(prop)
@ocarno5 You forgot to access a collection record by it's id
Caitlin Sophia
@ocarno5
Jul 12 2016 08:14
Okay, I changed the order and it now passes the last one but not the second to last,
@lx-t okay I'll try that
Ahmed Fouad
@FoushWare
Jul 12 2016 08:14
@ocarno5 try my solution
Caitlin Sophia
@ocarno5
Jul 12 2016 08:14
@lionmoon60 @lx-t thank you! It works now
CamperBot
@camperbot
Jul 12 2016 08:14
ocarno5 sends brownie points to @lionmoon60 and @lx-t :sparkles: :thumbsup: :sparkles:
:cookie: 423 | @lx-t |http://www.freecodecamp.com/lx-t
:cookie: 219 | @lionmoon60 |http://www.freecodecamp.com/lionmoon60
bradulz
@bradulz
Jul 12 2016 08:14
@lionmoon60 she won't learn from that though
Alex T.
@lx-t
Jul 12 2016 08:14
@ocarno5 You're welcome.
Caitlin Sophia
@ocarno5
Jul 12 2016 08:15
I realised that the order of my code was wrong, so I rearranged some and it worked but not fully, I would never have seen the collection[id].hasOwnProperty(prop) by myself haha
Ahmed Fouad
@FoushWare
Jul 12 2016 08:15
can anyone help me please with record collection
i wrote the code i think this is true but it didn't works why?
patrickbarth
@patrickbarth
Jul 12 2016 08:17
@lionmoon60 Well, what's your problem?
Could you show what you wrote?:)
Ahmed Fouad
@FoushWare
Jul 12 2016 08:17

function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i=0;i<contacts.length;i++){

if(contacts[i][firstName]!==firstName){

  if(j==contacts.length-1)
  return "No such contact";
  else{
  j++;
  continue;
  }
}


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

else {
  return contacts[i][prop];

   }

}

// Only change code above this line
}

patrickbarth
@patrickbarth
Jul 12 2016 08:19
Why do you do j++ in 8th line? You have yet not declared a var named j
Ahmed Fouad
@FoushWare
Jul 12 2016 08:20

var j=0;
function lookUpProfile(firstName, prop){
// Only change code below this line
for(var i=0;i<contacts.length;i++){

if(contacts[i][firstName]!==firstName){

  if(j==contacts.length-1)
  return "No such contact";
  else{
  j++;
  continue;
  }
}


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

else {
  return contacts[i][prop];

   }

}

i declared it before the for loop
patrickbarth
@patrickbarth
Jul 12 2016 08:21
Ah okay:)
Ahmed Fouad
@FoushWare
Jul 12 2016 08:21
:smile:
patrickbarth
@patrickbarth
Jul 12 2016 08:21
I think the first problem, is your structure;)
Ahmed Fouad
@FoushWare
Jul 12 2016 08:22
how? :smile:
patrickbarth
@patrickbarth
Jul 12 2016 08:23
And is it possible that this is the exercise "Profile Lookup"?
And I think the problem is that you changed code above the line which says "Only change code below this line"
This leads to an error, but should also be displayed on the lefthand side, when you scroll down a little bit;)
patrickbarth
@patrickbarth
Jul 12 2016 08:30
So just declare j before the loop;)
thuytn
@Sophia-nguyen
Jul 12 2016 08:32

Hi, I have one json tree like this

 data = [
            {
                "id": 4,
                "name": 'name_of_4',
                "children": [
                    {
                        "id": 1,
                        "name": 'name_of_1',
                        "children": []
                    },
                    {
                        "id": 6,
                        "name": 'name_of_3',
                        "children": []
                    }
                ]
            },
            {
                "id": 6,
                "name": 'name_of_6',
                "children": [
                    {
                        "id": 5,
                        "name": 'name_of_5',
                        "children": [
                            {
                                "id": 6,
                                "name": 'name_of_3',
                                "children": []
                            }
                        ]
                    }
                ]
            }
        ];

And I want search all child have name == name_of_3. Then result like this

 data = [
            {
                "id": 4,
                "name": 'name_of_4',
                "children": [
                    {
                        "id": 6,
                        "name": 'name_of_3',
                        "children": []
                    }
                ]
            },
            {
                "id": 6,
                "name": 'name_of_6',
                "children": [
                    {
                        "id": 5,
                        "name": 'name_of_5',
                        "children": [
                            {
                                "id": 6,
                                "name": 'name_of_3',
                                "children": []
                            }
                        ]
                    }
                ]
            }
        ];

Any solution for this?

patrickbarth
@patrickbarth
Jul 12 2016 08:36
Do you have any reason why the result looks exactly like this?
es_python
@espython
Jul 12 2016 08:39
hello coders any suggestions about counting cards exercise
i'm stuck on it
Pericles
@periman2
Jul 12 2016 08:40
So.. as far as I can see for now, destroyer needs a loop :(
but it's okay I'll revisit another time
thanks ! @Masd925 @Jhollond
CamperBot
@camperbot
Jul 12 2016 08:41
periman2 sends brownie points to @masd925 and @jhollond :sparkles: :thumbsup: :sparkles:
:warning: periman2 already gave jhollond points
:warning: periman2 already gave masd925 points
Robert Skalko
@RobertSkalko
Jul 12 2016 08:41
quick question, why is random(min,max) like this: Math.random() (max - min) + min; instead of just being : max + min
patrickbarth
@patrickbarth
Jul 12 2016 08:41
@robertx32 You forgot some brackets;)
Robert Skalko
@RobertSkalko
Jul 12 2016 08:42
its just an example code
thuytn
@Sophia-nguyen
Jul 12 2016 08:42
@patrickbarth because I need one json data to render template like tree
patrickbarth
@patrickbarth
Jul 12 2016 08:42
it's random()*(max-min) + min
Robert Skalko
@RobertSkalko
Jul 12 2016 08:42
yea but why is max - min
patrickbarth
@patrickbarth
Jul 12 2016 08:42
@espython Where exactly do you get stuck?
@robertx32 it's the amplitude
So it's the difference between the highest an the lowest number
Robert Skalko
@RobertSkalko
Jul 12 2016 08:43
i think i got it
es_python
@espython
Jul 12 2016 08:43
the algorithm @patrickbarth
Pericles
@periman2
Jul 12 2016 08:44
@robertx32 because max-min gives you a starting point
patrickbarth
@patrickbarth
Jul 12 2016 08:44
@espython but where exactly? Do you have written something that does not work or do you not know where to begin or something else?
Robert Skalko
@RobertSkalko
Jul 12 2016 08:44
so if there wasnt - min, the max would be increased too much
so if i wanted only max, i'd just need to multiply by max
es_python
@espython
Jul 12 2016 08:44

``` var count = 0;

function cc(card) {

var count=0;
for (card>=2 && card<=6){
  count = count +1;
}
else if(card>=7 && card<=9){
  count = count+0;
}
 else if(card==10 || card =='J'||card =='Q'||card =='K'||card =='A') {
  count = count-1;
}

if(count>0){
    string = count +" "+ "Bit"
  return string ;
}
 if(count<=0){
     string = count +" "+ "Hold";

  return  string;
}```

}```

patrickbarth
@patrickbarth
Jul 12 2016 08:45
@robertx32 Let's say you want some random numbers between 200 and 230
anvarov
@anvarov
Jul 12 2016 08:45
hi, i stucked at roman-numeral-converter bonfire "Convert the given number into a roman numeral. All roman numerals answers should be provided in upper-case." Please can you help me, I can't find appropriate approach to solve, for example i was thinking about mapping each numbers to letter manually but it is too long and illogical.
es_python
@espython
Jul 12 2016 08:46
This message was deleted
patrickbarth
@patrickbarth
Jul 12 2016 08:46
@robertx32 by 230-200 you get te range which is 30. Then you multiply it with Math.random() so you highest value would be 29 and your lowest 0 then you add 200(your min) so your lowest number is 0+200 = 200 and your highest is 29+200 = 29
Pericles
@periman2
Jul 12 2016 08:47
@robertx32 you're in Generate Random Whole Numbers within a Range right?
Kartik Mudgal
@Sprinting
Jul 12 2016 08:47
@anvarov you were on the right path, but don't map each number to letter you can't do that anyway, map the important ones and then see how you can combine to get the result :)
Robert Skalko
@RobertSkalko
Jul 12 2016 08:47
oh i get it, so the first part is defining a range, and second part is ensuring the it has the lowest point
Pericles
@periman2
Jul 12 2016 08:47
@robertx32 you got it !
Rohan Mohammad
@reolander
Jul 12 2016 08:48
@anvarov one approach would be to divide the given number X by 1000 first (X % 1000) and concat the quotient of X % 1000 with M. Try to proceed like this.
Robert Skalko
@RobertSkalko
Jul 12 2016 08:48
thanks @periman2 and @patrickbarth , it was a tiny confusion
CamperBot
@camperbot
Jul 12 2016 08:48
robertx32 sends brownie points to @periman2 and @patrickbarth :sparkles: :thumbsup: :sparkles:
:cookie: 257 | @periman2 |http://www.freecodecamp.com/periman2
:cookie: 229 | @patrickbarth |http://www.freecodecamp.com/patrickbarth
patrickbarth
@patrickbarth
Jul 12 2016 08:48
@espython It should be "Bet" not "bit"
No problem;)
anvarov
@anvarov
Jul 12 2016 08:51
@Sprinting @rohan222 thank you, I will try
CamperBot
@camperbot
Jul 12 2016 08:51
anvarov sends brownie points to @sprinting and @rohan222 :sparkles: :thumbsup: :sparkles:
:cookie: 274 | @rohan222 |http://www.freecodecamp.com/rohan222
:cookie: 312 | @sprinting |http://www.freecodecamp.com/sprinting
anvarov
@anvarov
Jul 12 2016 08:55
and another question, probably my question is dumb) what the word algorithm does mean? is "one approach would be to divide the given number X by 1000 first (X % 1000) and concat the quotient of X % 1000 with M. Try to proceed like this." can be regarded as algorithm
patrickbarth
@patrickbarth
Jul 12 2016 08:56
@anvarov Yes
An algorithm is just a sequence of commands. So it could be in any language
;)
anvarov
@anvarov
Jul 12 2016 08:58
This message was deleted
sophie90909
@sophie90909
Jul 12 2016 08:59
challenge 135
anvarov
@anvarov
Jul 12 2016 08:59
@patrickbarth so var a; var b; function (a, b) { return a + b; } (); can be regarded as algorithm?
anvarov
@anvarov
Jul 12 2016 09:01
Wikipedia is too scientific for me yet))
patrickbarth
@patrickbarth
Jul 12 2016 09:01
Yes because you give the command to create a var named a and a var named b and to create a new function;)
anvarov
@anvarov
Jul 12 2016 09:02
@patrickbarth thank you :)
CamperBot
@camperbot
Jul 12 2016 09:02
anvarov sends brownie points to @patrickbarth :sparkles: :thumbsup: :sparkles:
:cookie: 233 | @patrickbarth |http://www.freecodecamp.com/patrickbarth
patrickbarth
@patrickbarth
Jul 12 2016 09:02
So if anyone who understands the language could read your "algorithm" and with this would no what to do you can call i "algorithm";)
*know
Rahul Moje
@Rahul-Moje
Jul 12 2016 09:08
@sophie90909 var remainder=11%3;
Shivaji
@psrijan
Jul 12 2016 09:19

Hey there. I am trying to getJSON string from a file for my RandomQuoteMachine. I tried to use the jquery function .getJson("<local file system>") using local file system url. However this didn't work . I read that we can't have files on our drive as our browser doesn't allow it for security reasons. So i tried doing so by keeping the file in xamp server htdocs and online in my google drive. However, neither of them worked. I think for xamp server we need to give the password and username to access the files. Does anyone has any idea about this?
My code using drive link
$.getJSON("https://drive.google.com/file/d/0B6GOZrq_5t7aWlFnemVrbEMzZ1E/view?usp=sharing", function(json) {
console.log("we are inside folks");
console.log(json.array[0].quote + json.array1.writer);

    });

using localhost
$.getJSON("http://localhost/quotelist.json", function(json) {
console.log("we are inside folks");
console.log(json.array[0].quote + json.array1.writer);
});

tried this aswell
$.getJSON("http://localhost/quotelist.json", function(json) {
console.log("we are inside folks");
console.log(JSON.stringify(json));
});

$.getJSON("https://drive.google.com/file/d/0B6GOZrq_5t7aWlFnemVrbEMzZ1E/view?usp=sharing", function(json) {
console.log("we are inside folks");
console.log(JSON.stringify(json);
});
also tried

Markus Kiili
@Masd925
Jul 12 2016 09:21
@periman2 Destroyer needs two loops or iterations. One through arr and one through the arguments. Using filter avoids one loop and using indexOf avoids another.
Jack
@jh0l
Jul 12 2016 09:21
help falsy bouncer
CamperBot
@camperbot
Jul 12 2016 09:21

:point_right: algorithm falsy bouncer [wiki]

Algorithm Falsy Bouncer

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

Remove all falsy values from an array.

Relevant Links

:pencil: read more about algorithm falsy bouncer on the FCC Wiki

Jack
@jh0l
Jul 12 2016 09:22
help mutatiions
CamperBot
@camperbot
Jul 12 2016 09:22
no wiki entry for: mutatiions
Jack
@jh0l
Jul 12 2016 09:22
help mutations
CamperBot
@camperbot
Jul 12 2016 09:22

:point_right: algorithm mutations [wiki]

Algorithm Mutations

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

  • Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array..

Relevant Links

:pencil: read more about algorithm mutations on the FCC Wiki

Pericles
@periman2
Jul 12 2016 09:23
@Masd925 I managed to do it with one loop using filter if you want I can pm you my code to tell me your thoughts on it
Markus Kiili
@Masd925
Jul 12 2016 09:23
@periman2 Sure.
Gaurav Tolani
@Gauravtolani
Jul 12 2016 09:27
var myStr = "FirstLine\nSecondLine";
why is this not leaving a line...?
Teresa Garriot
@garriottteresa
Jul 12 2016 09:29
Can someone point me in the right direction? I am in the javascript "Stand in Line". It looks like they are asking to use a combo of .pop and .shift but I cannot get this function to work.
Rahul Moje
@Rahul-Moje
Jul 12 2016 09:29
var Bike = function() {

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

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

};
var myBike = new Bike();
myBike.getGear() should return 4 after calling myBike.setGear(4).
myBike.getGear() should return 3 after calling myBike.setGear(3).
myBike.getGear() should return 1 after calling myBike.setGear(1).
need help
Subramanya Chakravarthy
@chakrihacker
Jul 12 2016 09:30
help ending
CamperBot
@camperbot
Jul 12 2016 09:30

:point_right: algorithm confirm the ending [wiki]

Algorithm Confirm the Ending

:checkered_flag: Problem Explanation:

The function is a whole Boolean operation. You need to return true if the first argument ends with the second argument. This means that for the problem script, it should return true for the confirmEnding('Bastian', 'n'); case.

Relevant Links

:pencil: read more about algorithm confirm the ending on the FCC Wiki

Jan Pěnčík
@janpencik
Jul 12 2016 09:31
@garriottteresa Just put comma between your .pop and .shift and it will work just fine.
Teresa Garriot
@garriottteresa
Jul 12 2016 09:33
@janpencik here is the task:
Shivaji
@psrijan
Jul 12 2016 09:33
@janpencik can you help me out really stuck
Teresa Garriot
@garriottteresa
Jul 12 2016 09:33

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

Shivaji
@psrijan
Jul 12 2016 09:34
@janpencik how do i put the url for getJSON()
   $.getJSON("http://localhost/quotelist.json", function(json) {
       console.log("we are inside folks");
        console.log(JSON.stringify(json));
    });
this doesn't work
@garriottteresa
can you look into this proble
Jan Pěnčík
@janpencik
Jul 12 2016 09:38
@garriottteresa one of the commands you want to return will look like this (just add comma and shift command similar to this command and it will work)
return arr.push(item)
Vikash Saini
@Enigma10
Jul 12 2016 09:44
@Rahul-Moje hello
about @Rahul-Moje
CamperBot
@camperbot
Jul 12 2016 09:44
:cookie: 235 | @rahul-moje |http://www.freecodecamp.com/rahul-moje
Pedro Abel Díaz Sánchez
@coderHook