These are chat archives for FreeCodeCamp/HelpJavaScript

14th
May 2016
Moisés Man
@moigithub
May 14 2016 00:00
its like the t u have on ur code
@123xylem :point_up: May 13, 2016 6:52 PM
96street
@96street
May 14 2016 00:02
so the expression isn't 'true'?
Moisés Man
@moigithub
May 14 2016 00:03
if( Boolean(arr[i]) == true ) {
answer.push([i]);
}
in this case u can use == true cuz Boolean function transform whatever value to a "boolean" value
but == true on a condition expression is implicit
Chris Cullen
@123xylem
May 14 2016 00:04
@moigithub are you saying that site just will not work full stop?
96street
@96street
May 14 2016 00:05

function bouncer(arr) {

  var answer = [];
  var t = Boolean(true);

  for(i = 0; i < arr.length; i++) {
  if(Boolean(arr[i]) == true) {
    answer.push([i]);
  }
  } 
  return answer;
}

bouncer([7, "ate", "", false, 9]);
@moigithub
it's returning numbers not strings
Moisés Man
@moigithub
May 14 2016 00:07
openweather dont suport https protocol....
and chrome version5+ dont allow u use geonavigation without https
and codepen dont allow u mix https: with http:
@123xylem
the only way is using https for chrome geonavigation
and a https proxy(like this https://jsonp.afeld.me) for openweather api (then u will have https on both sides)
96street
@96street
May 14 2016 00:07
it returns [[0], 1, [4]]
Moisés Man
@moigithub
May 14 2016 00:07
@96street what u pushing to answer array ??
it should be the elemtn of the array not the index i
96street
@96street
May 14 2016 00:08
arr[i]
Moisés Man
@moigithub
May 14 2016 00:08
recheck ur code :)
96street
@96street
May 14 2016 00:09
got it :)
thankyou @moigithub
CamperBot
@camperbot
May 14 2016 00:09
96street sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1133 | @moigithub |http://www.freecodecamp.com/moigithub
96street
@96street
May 14 2016 00:09

function bouncer(arr) {

  var answer = [];
  var t = Boolean(true);

  for(i = 0; i < arr.length; i++) {
  if(Boolean(arr[i]) === true) {
    answer.push(arr[i]);
  }
  } 
  return answer;
}

bouncer([7, "ate", "", false, 9]);
Moisés Man
@moigithub
May 14 2016 00:10
yw :) @96street
another way is using filter method :)
and u can remove the var t ... etc line
96street
@96street
May 14 2016 00:11
could regex work too?
Moisés Man
@moigithub
May 14 2016 00:11
also.. on a if (conditional expression) === true is implicit.. so u can just do like this
if( Boolean(arr[i]) )
Chris Cullen
@123xylem
May 14 2016 00:12
@moigithub can u tell me how to use chrom neonav in https?
Moisés Man
@moigithub
May 14 2016 00:12
regex .. dont think so
on ur browser address url bar.. add https:// to ur link @123xylem
been pasting the full url above.. few times :P
96street
@96street
May 14 2016 00:13
oh didn't know you don't even need to define the Boolean obj

function bouncer(arr) {

  var answer = [];

  for(i = 0; i < arr.length; i++) {
  if(Boolean(arr[i])) {
    answer.push(arr[i]);
  }
  } 
  return answer;
}

bouncer([7, "ate", "", false, 9]);
Chris Cullen
@123xylem
May 14 2016 00:15
@moigithub Ok Ok .. Well the geo is now working
96street
@96street
May 14 2016 00:15
last thing, can you just tell me why this doesn't work? @moigithub
function bouncer(arr) {

  var answer = [];

  for(i = 0; i < arr.length; i++) {
  if(arr[i] === true) {
    answer.push(arr[i]);
  }
  } 
  return answer;
}

bouncer([7, "ate", "", false, 9]);
Chris Cullen
@123xylem
May 14 2016 00:16
So my weather api just needs to be a https one now?
I thought the ajax code solved that
Moisés Man
@moigithub
May 14 2016 00:18
@96street cuz the elemtn on ur array its not exactly === true
u need to use a function to convert those values to a boolean
it could be evaluated to a truthy /falsey value.. but u cant directly say ===
first u will need to coerse it to a boolean using functions or logical/bit operators
96street
@96street
May 14 2016 00:19
how is: if(Boolean(arr[i])) different?
Wendy Medeiros
@wendyr21
May 14 2016 00:19

'
var count = 0;

function cc(card) {
// Only change code below this line
count = count;
switch(card){
case "2":
case "3" :
case "4" :
case "5" :
case "6" :
count++;
break;
case "7" : case"8": case "9":
break;
case "10": case "J": case "Q": case "K":
count--;
break;
}

if (count > 0){
return count + " Bet";
}
else{
return count + " Hold";
}
'

that isn't working for me.. the code view
Moisés Man
@moigithub
May 14 2016 00:20
@123xylem yes ur api weather need https.... but openweather dont support https
thats why i said u can use a https proxy
Jacob Hodgins
@JacobHodg
May 14 2016 00:20
Hey campers. I am so damn confused
Moisés Man
@moigithub
May 14 2016 00:21
@wendyr21 the numbers are not strings...
2 is not equal to "2"
u should remove the quotes...
Stephen James
@sjames1958gm
May 14 2016 00:21
@wendyr21 Check your case 10 operation
Aravind Vasudevan
@AravindVasudev
May 14 2016 00:21

For the Truncate a String problem in JS Algorithms, it says that if the num is less than 3, don't add the ellipsis, but they've a test case like this : 'truncateString("A-", 1)'

What should I do?

Here's my Code :

function truncateString(str, num) {

  return str.length > num ? num - 3 <= 3 ? str.substr(0, num) : str.substr(0, num - 3) + "..." : str;

}
Moisés Man
@moigithub
May 14 2016 00:22
@96street cuz Boolean is a function.. it convert whatever value u pass to true or false
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
u can read there.. n see the examples
Stephen James
@sjames1958gm
May 14 2016 00:22
@sjames1958gm nvm I thought it was only one - but my eyes aren't working
Jacob Hodgins
@JacobHodg
May 14 2016 00:22
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.
Aravind Vasudevan
@AravindVasudev
May 14 2016 00:22
  • testcase : truncateString("A-", 1) should return "A...".
Stephen James
@sjames1958gm
May 14 2016 00:22
@AravindVasudev That is not what they said. reread
96street
@96street
May 14 2016 00:23
| it convert whatever value u pass to true or false
that's what i missed, thanks
Moisés Man
@moigithub
May 14 2016 00:23
:+1:
Aravind Vasudevan
@AravindVasudev
May 14 2016 00:24
@sjames1958gm Thanks! Didn't read the problem properly :smile:
CamperBot
@camperbot
May 14 2016 00:24
aravindvasudev sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1100 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Moisés Man
@moigithub
May 14 2016 00:24
Wendy Medeiros
@wendyr21
May 14 2016 00:25
@moigithub thanks i will try that
CamperBot
@camperbot
May 14 2016 00:25
wendyr21 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1134 | @moigithub |http://www.freecodecamp.com/moigithub
Jacob Hodgins
@JacobHodg
May 14 2016 00:25
@moigithub Thanks. I know the solution involves these two functions but I cannot get it right
CamperBot
@camperbot
May 14 2016 00:25
jacobhodg sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1135 | @moigithub |http://www.freecodecamp.com/moigithub
Jacob Hodgins
@JacobHodg
May 14 2016 00:25
I'll do more reading
Moisés Man
@moigithub
May 14 2016 00:25
probably u can post ur code :) @JacobHodg
Stephen James
@sjames1958gm
May 14 2016 00:26
@AravindVasudev :+1:
Chris Cullen
@123xylem
May 14 2016 00:27
@moigithub Any idea how to use a web proxy in coding?
I have never been taught this stuff
Moisés Man
@moigithub
May 14 2016 00:28
its the same thing as u using in ur ajax
copy ur weather url
Chris Cullen
@123xylem
May 14 2016 00:28
yea
Moisés Man
@moigithub
May 14 2016 00:28
paste into this sitehttps://jsonp.afeld.me/
then copy the new url..
and replace to ur ajax
so u end up with something like this
https://jsonp.afeld.me/?callback=?&url=http://openweather/dunnowhat
@123xylem
$ajax({url: 'https://jsonp.afeld etc et cetc' ........})
Wendy Medeiros
@wendyr21
May 14 2016 00:29
@sjames1958gm i will try tx
CamperBot
@camperbot
May 14 2016 00:29
wendyr21 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1101 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Jacob Hodgins
@JacobHodg
May 14 2016 00:32
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));
I dont understand how you can apply push and shift function here when there is no var specified
Moisés Man
@moigithub
May 14 2016 00:33
@JacobHodg function nextInLine(arr, item) { <-- here u have 2 variables (arguments/parameters whatever u wanna call em :P)
arr
item
Jacob Hodgins
@JacobHodg
May 14 2016 00:35

```function nextInLine(arr, item) {
// Your code here
item.push();
arr.shift();
return arr; // Change this line
}

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

function nextInLine(arr, item) {
  // Your code here
item.push();
  arr.shift();
  return arr;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Moisés Man
@moigithub
May 14 2016 00:37
push and shift are arrays methods....
urarray.push( what u wanna push )
urarray.shift()
Stephen James
@sjames1958gm
May 14 2016 00:37
@JacobHodg push is an operation on arr passing in item.
Moisés Man
@moigithub
May 14 2016 00:37
also shift give u back the removed element
then u can do somethign with it
Chris Cullen
@123xylem
May 14 2016 00:40
@moigithub https://codepen.io/123xylem/pen/WwPKrj?editors=1011 I have used the proxy https but im not sure where its going wrong
I replaced the lat and lon in the urls with my formula
Moisés Man
@moigithub
May 14 2016 00:40
:point_up: May 13, 2016 7:28 PM @123xylem
@123xylem ur ajax url still the same..
Moisés Man
@moigithub
May 14 2016 00:41
the reason to use the https proxy.. is this
jquery.min.js:4 Mixed Content: The page at 'https://codepen.io/123xylem/pen/WwPKrj?editors=0010' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.openweathermap.org/data/2.5/weather?lat=-14.07546&lon=-75.7341811%20&appid=e208fe0b7ca28abf8f466a603cc3c90d'. This request has been blocked; the content must be served over HTTPS.
Chris Cullen
@123xylem
May 14 2016 00:42
I put in the https proxy url with my lat lon formula attached to the end where their lat lon was
Moisés Man
@moigithub
May 14 2016 00:42
codepen dont allow u to use https (on ur url) + http (on ur ajax )
it call that "Mixed content"
Vlad Fernandes
@Vlad-Fernandes
May 14 2016 00:42
Profile Lookup
Chris Cullen
@123xylem
May 14 2016 00:43
OLD URL
"http://api.openweathermap.org/data/2.5/weather?lat=" + position.coords.latitude + "&lon=" + position.coords.longitude + " &appid=e208fe0b7ca28abf8f466a603cc3c90d"
Jacob Hodgins
@JacobHodg
May 14 2016 00:43
function nextInLine(arr, item) {
  // Your code here
  arr.push();
  arr.shift();
  return shift;  // 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));
Vlad Fernandes
@Vlad-Fernandes
May 14 2016 00:43
help Profile Lookup
CamperBot
@camperbot
May 14 2016 00:43

:point_right: challenge profile lookup [wiki]

Checkpoint: Profile Lookup

Instructions

We have an array of objects representing different people in our contacts lists.

A lookUp function that takes firstName and a property (prop) as arguments has been pre-written for you.

The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about challenge profile lookup on the FCC Wiki

Chris Cullen
@123xylem
May 14 2016 00:43
NEW URL... WITH LAT LON ON END js "https://jsonp.afeld.me/?callback=%24.ajax&url=https%3A%2F%2Fapi.forecast.io%2Fforecast%2F277456e188667dfbea5da1e28cdaa7cb%2F" +position.coords.latitude + "%2C" +position.coords.longitude
Moisés Man
@moigithub
May 14 2016 00:43
@JacobHodg whta u wanna/need push into the array ??
@123xylem on the link u posted i still see the old url.. probably u didnt save ?
Jacob Hodgins
@JacobHodg
May 14 2016 00:44
the number to the end of the array and the first element removed
Moisés Man
@moigithub
May 14 2016 00:44
@JacobHodg if i recall the instruction.. say push the item onto the array
or something like that
Jacob Hodgins
@JacobHodg
May 14 2016 00:45
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.
Moisés Man
@moigithub
May 14 2016 00:45
yea that :P
push method add the item to the end of the array
according to the documentation the syntax is
urarray.push(whatever valur u wanna add )
Chris Cullen
@123xylem
May 14 2016 00:45
@moigithub Now I save it if you can see
Jacob Hodgins
@JacobHodg
May 14 2016 00:47
function nextInLine(arr, item) {
  // Your code here
 arr.push(item);
return arr.shift();

}

// 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));
That worked
Moisés Man
@moigithub
May 14 2016 00:48
:+1: @JacobHodg
demipixel
@demipixel
May 14 2016 00:49
@JacobHodg tip: You can do console.log("Before " + testArr) and that'll output 1,2,3,4,5. Up to you if you think it's easier to read, but it's faster to write :P
Christian
@cenamorado1
May 14 2016 00:49
help Profile Lookup
CamperBot
@camperbot
May 14 2016 00:49

:point_right: challenge profile lookup [wiki]

Checkpoint: Profile Lookup

Instructions

We have an array of objects representing different people in our contacts lists.

A lookUp function that takes firstName and a property (prop) as arguments has been pre-written for you.

The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about challenge profile lookup on the FCC Wiki

Christian
@cenamorado1
May 14 2016 00:50
help Check for Palindromes
CamperBot
@camperbot
May 14 2016 00:50

:point_right: algorithm check for palindromes [wiki]

Explanation:

Our goal for solving this problem is tidying up the string passed in, and checking whether it is in fact a palindrome.

  • If you are unsure of what a palindrome is, it is a word or phrase that when reversed spells the same thing forwards or backwards. A simple example is mom, when you reverse the letters, it spells the same thing! Another example of a palindrome is race car. When we take out anything that is not a character it becomes racecar which is the same spelled forwards or backwards!

Once we have determined whether it is a palindrome or not we want to return either true or false based on our findings.

:pencil: read more about algorithm check for palindromes on the FCC Wiki

Moisés Man
@moigithub
May 14 2016 00:50
@123xylem i see u changed ur api now...
if ur new api uses https <-- u DONT need the proxy.. the idea of using that proxy is cuz proxy uses https.. somehow to bypass the "Mixed content" codepen error
OLD URL "http://api.openweathermap.org/data/
NEW URL... WITH LAT LON ON END js "htt ps:// jsonp .afeld .me/?callback=%24.ajax&url=https%3A%2F%2Fapi.forecast.io%
u changed from openweather to forecast
Jacob Bogers
@jacobbogers
May 14 2016 00:53
hello?
Nicholas
@nugoose
May 14 2016 00:53
its me, again
Richard Donnell
@radonn24
May 14 2016 00:54
Hey guys! I am asking for some help! I am getting hung up on "Finding a Remainder in JavaScript" ... could anyone help explain the correct way I should be solving this? https://www.freecodecamp.com/challenges/finding-a-remainder-in-javascript
Jacob Hodgins
@JacobHodg
May 14 2016 00:54

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

}

// 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));```
What's horrible is that I don't really understand why this worked. I am still confused and don't want to move on to the next challenge. The instructions want me to push the number to the end of the array. First, what is the number? is that item, presumably? Why is item the number? Then it wants me to remove the first element of array. I am assuming that is arr?

function nextInLine(arr, item) { // Your code here arr.push(item); return arr.shift(); } // 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));
Jacob Bogers
@jacobbogers
May 14 2016 00:55
if i have several radio buttons in one group (same name) is there a specific i can register that gives the "value" of a specific js event i can listen for for the whole radio group?
event.value?
Moisés Man
@moigithub
May 14 2016 00:55
@JacobHodg ur function accept 2 arguments...
arr and item
function nextInLine(arr, item) {
@JacobHodg if u check below.. here is when its get called
var testArr = [1,2,3,4,5];
console.log(nextInLine(testArr, 6)); // Modify this line to test
96street
@96street
May 14 2016 00:56
i'm abit confused with exactly how the filter(); method works - can someone explain how I can use it here?
function destroyer(arr) {
  // Remove all the values
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
@moigithub
Richard Donnell
@radonn24
May 14 2016 00:56
Nevermind, I figured out my issue! :D
Jacob Bogers
@jacobbogers
May 14 2016 00:57
hahah, i was going to say the same thing about my issue)
Jacob Hodgins
@JacobHodg
May 14 2016 00:57
@moigithub well that is confusing because there it is written as testArr, and not arr
Moisés Man
@moigithub
May 14 2016 00:57

@JacobHodg sooo

var testArr = [1,2,3,4,5];
nextInLine(testArr, 6)

is the same thing as
nextInLine( [1,2,3,4,5], 6 );

Richard Donnell
@radonn24
May 14 2016 00:57
@jacobbogers :sunglasses:
Sean DiSanti
@badc0ded
May 14 2016 00:58
@96street , you step through the arguments and filter arr for each of them
Moisés Man
@moigithub
May 14 2016 00:58
@JacobHodg testArr is the GLOBAL variable...
arr and item are the arguments ur funciton use
Chris Cullen
@123xylem
May 14 2016 00:58
@moigithub ahh my bad
96street
@96street
May 14 2016 00:59
so for loop through the arr? @badc0ded
Sean DiSanti
@badc0ded
May 14 2016 00:59
filter actually checks the whole array for you
Moisés Man
@moigithub
May 14 2016 00:59
@JacobHodg if u match the funciton header.. with the function call
function nextInLine(arr, item) { <-- u have 2 variables
nextInLine( [1,2,3,4,5], 6 ); <-- u passing 2 values (separated by comma)
arr will be == [1,2,3,4,5]
and item will be == 6
so arr variable is an array
item variable is anumber
Sean DiSanti
@badc0ded
May 14 2016 00:59
the only loop you need is to check the arguments
96street
@96street
May 14 2016 01:00
right
Sean DiSanti
@badc0ded
May 14 2016 01:00
because arguments[0] will be the array to filter
Chris Cullen
@123xylem
May 14 2016 01:00
@moigithub the openweather api URL isnt giving me a lat lon entry point now.. http://api.openweathermap.org/data/2.5/forecast/city?id=524901&APPID=e208fe0b7ca28abf8f466a603cc3c90d
96street
@96street
May 14 2016 01:01
arguments[0]? @badc0ded
Jacob Hodgins
@JacobHodg
May 14 2016 01:01
@moigithub Thanks for your help. I appreciate you taking the time to try to explain this to me. That does make sense.
CamperBot
@camperbot
May 14 2016 01:01
jacobhodg sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:warning: jacobhodg already gave moigithub points
Sean DiSanti
@badc0ded
May 14 2016 01:01
yes, based on the arguments object
Jacob Hodgins
@JacobHodg
May 14 2016 01:01
I need to take a step back and read a book, watch some tutorials or something
96street
@96street
May 14 2016 01:01
arguments[0] is only the first index of arr, no? @badc0ded
Jacob Hodgins
@JacobHodg
May 14 2016 01:01
does this come fairly straightforwardly for most people?
Sean DiSanti
@badc0ded
May 14 2016 01:02
let me see your code, i believe in the test cases, the first argument is an array, and then subsequent arguments are values to remove from the array
96street
@96street
May 14 2016 01:02
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Sean DiSanti
@badc0ded
May 14 2016 01:02
yes, 3 arguments are being passed there
96street
@96street
May 14 2016 01:02
oh so would arguments[0] be the array here?
Sean DiSanti
@badc0ded
May 14 2016 01:02
the first is an array
yes
96street
@96street
May 14 2016 01:02
that makes sense
Sean DiSanti
@badc0ded
May 14 2016 01:02
so you can do something like....
Moisés Man
@moigithub
May 14 2016 01:03
@JacobHodg not really.. depends on ur previous knowledge
Sean DiSanti
@badc0ded
May 14 2016 01:03
var args = Array.from(arguments); to turn arguments into a normal array
Jacob Hodgins
@JacobHodg
May 14 2016 01:03
I started FCC with pretty much zero previous knowledge
Although I created a sweet dragon ball z website on geocities back in 1997!
lol
Moisés Man
@moigithub
May 14 2016 01:04
:D
96street
@96street
May 14 2016 01:04
what does from do? @badc0ded
demipixel
@demipixel
May 14 2016 01:05
mmm
I think I have the best palindromes solution but I'm not sure
Moisés Man
@moigithub
May 14 2016 01:05
http://api.openweathermap.org/data/2.5/weather?lat=-14.07546&lon=-75.7341811%20&APPID=e208fe0b7ca28abf8f466a603cc3c90d
u using different parameters...
@123xylem
here one url with lat and lon paramters
IF u still wanna use openweather...
if u switch to the other.. if that uses https .. then u no need to include the proxy
Sean DiSanti
@badc0ded
May 14 2016 01:05
it creates an array from an array like or iterable object
96street
@96street
May 14 2016 01:06
im still confused exactly what this is doing: var args = Array.from(arguments); @badc0ded
can u just explain it
Sean DiSanti
@badc0ded
May 14 2016 01:06
yes, arguments is a special object
demipixel
@demipixel
May 14 2016 01:07
var palindrome=s=>(s=s.toLowerCase().replace(/[ ,._\-\/\\()]/g, '').split('')).reduce((e,c,i)=>e&&c==s[s.length-i-1],true);
Sean DiSanti
@badc0ded
May 14 2016 01:07
it has a length property like an array it isn't one
so using splice, slice, etc won't work
that line takes the values contained in arguments, makes an array of them, and assigns that array to the variable args
Christopher Sparling
@ChristopherSparling
May 14 2016 01:08
Doing the Local Scope and Functions problem and it won't register a success. Anyone else have problems with the detection on there?
Sean DiSanti
@badc0ded
May 14 2016 01:09
then you could do something like args = args.slice(1); to disregard the array you're filtering
and then filter the array based on whether the contents are contained in args
96street
@96street
May 14 2016 01:10
ok cheers i'll work off that
Sean DiSanti
@badc0ded
May 14 2016 01:11
good deal
Jacob Hodgins
@JacobHodg
May 14 2016 01:12
Would anyone here recommend the book "Head First JavaScript Programming" by Eric Freeman and Elizabeth Robson?
Chris Cullen
@123xylem
May 14 2016 01:13
@moigithub I ran that url through the proxy but it cant find site
Sean DiSanti
@badc0ded
May 14 2016 01:14
@JacobHodg i would, but that's based completely on other people's reviews of other books in the head first series
there are plenty of free resources though
if you're considering buying it
i always send people to w3schools.com first
it's a great resource i use at least once a week for a quick reference
IT couldnt use your url or my url in the proxy
daiwik
@daiwik
May 14 2016 01:23
This message was deleted
This message was deleted
tekac
@tekac
May 14 2016 01:28
var power = function(base, exponent) {
    var result = 1;
    for (var count = 0; count < exponent; count++)
    result *= base;
    return result;
}
power(2, 10);
Why when I make var result = 1; does it return 1024, but if I make it var result; it returns NaN?
Giovanny hernandez
@AndresEdoc90
May 14 2016 01:28
need help with my lookUpProfile function.

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

// Only change code above this line
}

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

["Pizza","Coding","Brownie Points"] is what currently is being outputted

"Kristian", "lastName" should return "Vos"
"Sherlock", "likes" should return ["Intriguing Cases", "Violin"]
"Harry","likes" should return an array
"Bob", "number" should return "No such contact"
"Akira", "address" should return "No such property"

Stephen James
@sjames1958gm
May 14 2016 01:30
@AndresEdoc90 make sure you spell your variables the same.
Lizzy
@DevElisabeth
May 14 2016 01:31

Help would be greatly appreciated! Here's my code for Stand in Line: function nextInLine(arr, item) {
// Your code here
nextInLine = arr.push(item);
nextInLine = arr.shift();
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));

CamperBot
@camperbot
May 14 2016 01:31
no wiki entry for: would be greatly appreciated heres my code for stand in line function nextinlinearr item your code here nextinline arrpushitem nextinline arrshift return item change this line test setupvar testarr 12345 display codeconsolelogbefore jsonstringifytestarrconsolelognextinlinetestarr 6 modify this line to testconsolelogafter jsonstringifytestarr
Giovanny hernandez
@AndresEdoc90
May 14 2016 01:33
@sjames1958gm I am not seeing any misspells
Chris Cullen
@123xylem
May 14 2016 01:33
PLease help. I have used a proxy for my http openweatherAPI because chrome wont allow http. but its not working... https://codepen.io/123xylem/pen/WwPKrj?editors=1011
Ken Haduch
@khaduch
May 14 2016 01:33
@AndresEdoc90 - this is a frequently-asked exercise... one thing that you have to make sure of is that your loop can test all of the contacts (if it needs to) and it should need to with the test data that is used. In other words - you cannot just exit if the firstName doesn't match on the first try. Check your test conditions - and as @sjames1958gm said, make sure you are consistent on your variable names spelling.
Richard Donnell
@radonn24
May 14 2016 01:36
This message was deleted
Norvin Burrus
@ndburrus
May 14 2016 01:37
@veganlizzy it appears that the function/name (nextInLine) is being used a couple of times: once as a function, then again as a var/iable...
NEETWizardJanus
@NEETWizardJanus
May 14 2016 01:38
why does this person's code create hexagons? I see nothing that creates hexagons aside from <div class"hexagon one"> and when I do the same thing as him I don't get hexagons.
Ken Haduch
@khaduch
May 14 2016 01:38

@radonn24 Any lesson on the concatenation of variables to form a string should help you - basically if you have two variables and want to make a sentence, you do something like this:

var word1 = "My";
var word2 = "sentence";

var theString = word1 + ' ' + word2; // should be equal to "My sentence"

straightforward to just use the variables in a similar way.

Giovanny hernandez
@AndresEdoc90
May 14 2016 01:39
@khaduch my mistake, had props instead of prop, still no working though
diaokarolyn
@diaokarolyn
May 14 2016 01:41
can someone give me theanswer for 146
NEETWizardJanus
@NEETWizardJanus
May 14 2016 01:41
how do you display things anywhere you want? nothing I make wants to overlap.
Lizzy
@DevElisabeth
May 14 2016 01:41
@ndburrus thanks for pointing out my mistake! I'm still confused tho. After I removed nextInLine as a variable, I was able to complete two of my tasks but still struggle to finish these "nextInLine([2], 1) should return 2" and
"nextInLine([5,6,7,8,9], 1) should return 5". Any help would be greatly appreciated.
CamperBot
@camperbot
May 14 2016 01:41
veganlizzy sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 346 | @ndburrus |http://www.freecodecamp.com/ndburrus
NEETWizardJanus
@NEETWizardJanus
May 14 2016 01:42
i hate myself. I'm such a useless retard.
die, you old turd.
Lizzy
@DevElisabeth
May 14 2016 01:42
@NEETWizardJanus You got this!
diaokarolyn
@diaokarolyn
May 14 2016 01:42
plz help eme
Norvin Burrus
@ndburrus
May 14 2016 01:43
@veganlizzy can you post the updated code, please? :)
Giovanny hernandez
@AndresEdoc90
May 14 2016 01:43
@diaokarolyn can you post the problem on here
Sara
@sarita3
May 14 2016 01:43
@NEETWizardJanus Time for a break? what are you working on?
Lizzy
@DevElisabeth
May 14 2016 01:43
This message was deleted
NEETWizardJanus
@NEETWizardJanus
May 14 2016 01:44
@sarita3 I just started. I'm trying to work on a clock. I've only managed to edit someone else's.
Ken Haduch
@khaduch
May 14 2016 01:45
@AndresEdoc90 - you have to look at the rest of my comment - you have to realize (if you do not know) that any time your return from the function, then the function ends and returns the value. So the code that you have that returns "No such contact" is going to return that value when it doesn't get a match on the firstName - since there are four contact names in the list, you have to make sure that your code can check all of them for a match, in case it is looking for the last name on the list, for example. So you have to allow for that to happen in your code.
Sara
@sarita3
May 14 2016 01:45
I wish I could help you. I am still working through the exercises of JavaScript. I feel discouraged myself…..I feel that this is hard
NEETWizardJanus
@NEETWizardJanus
May 14 2016 01:45
@sarita3 this is my edited clock. It looks pretty nice but I wanted to do it in jQuery so the code was tidier and more flexible, but I can't even get shapes to appear without being all messed up. http://codepen.io/NEETWizardJanus/pen/KzJNEq
Sara
@sarita3
May 14 2016 01:46
@NEETWizardJanus I wish I could help you, I haven’t made it that far yet. I am still working through the exercises of JavaScript. I feel discouraged myself…..
Lizzy
@DevElisabeth
May 14 2016 01:46

@ndburrus My apologies, wrong code:
function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();
return item; // Change this line
}

// Test Setup
var testArr = [2];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

nostrahistoria
@nostrahistoria
May 14 2016 01:46
Hi. Can someone help with Make Object Properties Private?

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

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

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

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

var Bike = function() {

  // Only change code below this line.

  var gear = 10;

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

  this.setGear = function() {
    gear -= 5;
  };

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

var myCar = new Car();

var myBike = new Bike();
NEETWizardJanus
@NEETWizardJanus
May 14 2016 01:47
@sarita3 I can't get through the lessons. They're too slow for me. I've been skimming through them though.
Lizzy
@DevElisabeth
May 14 2016 01:47
@ndburrus ^^Is the edited code I am now using^^
Mike Olo
@michaelolo24
May 14 2016 01:47
can someone please help me with Where art thou ?
help Where art thou
CamperBot
@camperbot
May 14 2016 01:48

:point_right: algorithm where art thou [wiki]

Problem Explanation

Write an algorithm that will take an array for the first argument and return an array with all the objects that matches all the properties and values in the Object passed as second parameter.

:pencil: read more about algorithm where art thou on the FCC Wiki

Giovanny hernandez
@AndresEdoc90
May 14 2016 01:48
@khaduch yes, and this happens in my code. For the test cases where either the firstname or property are not found it is successful.
Mike Olo
@michaelolo24
May 14 2016 01:48

function whereAreYou(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  var myKeys = Object.keys(source); // Place keys in Array
  var keyLen = myKeys.length; // obtain length of Keys
   // Set counter that will increase if Key and value is found
  var count = 0;
 collection.forEach(function(person){

       myKeys.forEach(function(key){

         if(person.hasOwnProperty(key) && person[key] === source[key]){
           count++;
         }

         if(count === keyLen) arr.push(person);


       });

  });



  // Only change code above this line
  return count;
}
Norvin Burrus
@ndburrus
May 14 2016 01:48
help format @veganlizzy
CamperBot
@camperbot
May 14 2016 01:48

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

Mike Olo
@michaelolo24
May 14 2016 01:48
I can't figure out how to reset count for each collection
Coy Sanders
@coymeetsworld
May 14 2016 01:48
@nostrahistoria you have the methods private, but you need to fix Bike
you have getGear defined twice , for instance
nostrahistoria
@nostrahistoria
May 14 2016 01:48
@coymeetsworld How so?
Coy Sanders
@coymeetsworld
May 14 2016 01:49
and also getGear should not have a parameter while setGear should
Sara
@sarita3
May 14 2016 01:49
@NEETWizardJanus I have no experience at all outside of FreeCodeCamp so I feel like I have to go through them. It is very time consuming, but I myself feel dumb a lot of the time, trying to figure it out. Hang in there.
Coy Sanders
@coymeetsworld
May 14 2016 01:49
the functions operate differently for Car and for Bike
nostrahistoria
@nostrahistoria
May 14 2016 01:50
Can you give me some code to start it? @coymeetsworld
Coy Sanders
@coymeetsworld
May 14 2016 01:50
there's not much code to write so if i give you a bit I give it all :)
but I can say that getGear should be similar to getSpeed for Car
and setGear should be similar to accelerate, except instead of incrementing speed you're just assigning it a value
NEETWizardJanus
@NEETWizardJanus
May 14 2016 01:51
@sarita3 thanks. good luck.
CamperBot
@camperbot
May 14 2016 01:51
neetwizardjanus sends brownie points to @sarita3 :sparkles: :thumbsup: :sparkles:
:cookie: 234 | @sarita3 |http://www.freecodecamp.com/sarita3
Sara
@sarita3
May 14 2016 01:52
@NEETWizardJanus Same to you.
nostrahistoria
@nostrahistoria
May 14 2016 01:53
@coymeetsworld I am lost. Can you start out slowly? I never took a coding class before in college.
Coy Sanders
@coymeetsworld
May 14 2016 01:54
Ok so look at the Car function that was created @nostrahistoria
nostrahistoria
@nostrahistoria
May 14 2016 01:54
@coymeetsworld ok
Lizzy
@DevElisabeth
May 14 2016 01:54
This message was deleted
Coy Sanders
@coymeetsworld
May 14 2016 01:55
you're going to be providing similar functionality but instead for a Bike
nostrahistoria
@nostrahistoria
May 14 2016 01:55
@coymeetsworld Of course.
Coy Sanders
@coymeetsworld
May 14 2016 01:55
Car has a private variable called speed, Bike has a private variable called gear
Lizzy
@DevElisabeth
May 14 2016 01:55
This message was deleted
Coy Sanders
@coymeetsworld
May 14 2016 01:55
Car has a function called getSpeed which returns the speed value of the Car
Lizzy
@DevElisabeth
May 14 2016 01:56
This message was deleted
nostrahistoria
@nostrahistoria
May 14 2016 01:56
@coymeetsworld Yes.
Coy Sanders
@coymeetsworld
May 14 2016 01:56
for Bike you need to do the same thing, but instead of speed, you want to return the value of gear
because Bikes don't have a speed variable, only Cars do.
does that make sense?
nostrahistoria
@nostrahistoria
May 14 2016 01:56
@coymeetsworld yes. Let me work on it. BRB
Coy Sanders
@coymeetsworld
May 14 2016 01:56
ok
going to be going out in a bit just FYI, maybe like 30 mins or so
Ken Haduch
@khaduch
May 14 2016 01:58
@AndresEdoc90 - so, if you took out that code that returns "No such contact" - just take it out altogether, does it change anything?
Giovanny hernandez
@AndresEdoc90
May 14 2016 01:59
@khaduch yes it does, it removes the check mark for that test case
nostrahistoria
@nostrahistoria
May 14 2016 02:00
  this.getGear = function() {
    return gear;
  };

  this.setGear = function() {
    return gear;
  };
What am I doing wrong? @coymeetsworld
Ken Haduch
@khaduch
May 14 2016 02:01
@AndresEdoc90 - that's good - so what does your code look like without that? And how many of the tests pass?
Giovanny hernandez
@AndresEdoc90
May 14 2016 02:04
it goes from two passed down to one, so it's doing what it is suppose to. My second and third if conditions are doing their jobs successfully. The first if is the only one that is not accomplishing its task
@khaduch
the code that returns "No such contact" and "No such property" is not the problem
Coy Sanders
@coymeetsworld
May 14 2016 02:06
@nostrahistoria so setGear needs to take in a value
Isaac Abrahamson
@IsaacAbrahamson
May 14 2016 02:06

Working on Seek and Destroy, and can't seem to get it to work:


function destroyer(arr) { 
  arr = arr.filter(checkElement);
  return arr;
}

function checkElement(arr) {
  var args = Array.prototype.slice.call(arguments);
  args = args.splice(1, args.length); // remove array from args

  for (var i = 0; i < args.length; i++) {
    if (arr.indexOf(args[i])) {
      return false;
    }
  }  
}

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

It says arr.indexOf is not a function? Am I doing this right?

Coy Sanders
@coymeetsworld
May 14 2016 02:06
like accelerate does
in setGear, as the name implies you are "setting" the "gear" variable
so that means you don't return it, you're changing it
nostrahistoria
@nostrahistoria
May 14 2016 02:07

@coymeetsworld ```
this.setGear = function(change) {
gear += change;
};

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

```

Coy Sanders
@coymeetsworld
May 14 2016 02:07
close @nostrahistoria, but look at the test cases
setGear(3) should set gear variable to 3
setGear(4) should set gear variable to 4, its not incrementing it like accelerate would
nostrahistoria
@nostrahistoria
May 14 2016 02:08
@coymeetsworld What is wrong?
Coy Sanders
@coymeetsworld
May 14 2016 02:08
setGear you don't want to increment the gear you just want to change it to the value.
nostrahistoria
@nostrahistoria
May 14 2016 02:09
It worked! Thanks @coymeetsworld I am going to study that code now. Have a nice evening!
CamperBot
@camperbot
May 14 2016 02:09
nostrahistoria sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 836 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
May 14 2016 02:09
great success! @nostrahistoria gj
Isaac Abrahamson
@IsaacAbrahamson
May 14 2016 02:10
@coymeetsworld any idea whats wrong on my code?
Coy Sanders
@coymeetsworld
May 14 2016 02:10
let me look
Ken Haduch
@khaduch
May 14 2016 02:10
@IsaacAbrahamson - check the documentation for the return value of the .indexOf() method - something looks funny in your test code...
Giovanny hernandez
@AndresEdoc90
May 14 2016 02:11
@khaduch My mistake. I see what you were saying, I commented out both the third and the second if, and the other test cases worked
Coy Sanders
@coymeetsworld
May 14 2016 02:12
@IsaacAbrahamson i think its how you're trying to remove the array from args
Ken Haduch
@khaduch
May 14 2016 02:12
@AndresEdoc90 - ok... can you please repost your code? As it is now...
Lizzy
@DevElisabeth
May 14 2016 02:12
Someone please help

function nextInLine(arr, item) {
// Your code here
arr.push(item)
arr.shift()
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([], 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

So confused by Stand in Line
Coy Sanders
@coymeetsworld
May 14 2016 02:12
@veganlizzy you don't want to return item there
Coy Sanders
@coymeetsworld
May 14 2016 02:13
also, you need semi colons to end each of your lines (i.e. arr.push and arr.shift)
Lizzy
@DevElisabeth
May 14 2016 02:13
@coymeetsworld when I remove return item I can no longer complete the first task.
Coy Sanders
@coymeetsworld
May 14 2016 02:13
you want to return something but not item
you want to return the first item in the array that you are removing through arr.shift()
consequently, the return value of arr.shift() is the item you remove from arr
so if your array was [1,2,3,4,5] and you run arr.shift(), your array would now be [2,3,4,5] and arr.shift() would return you that 1
so instead of returning item, you would just return the value from arr.shift()
Lizzy
@DevElisabeth
May 14 2016 02:16
thanks @coymeetsworld ! That finally makes sense. I still don't understand return completely. Or how to express the value of the first element. arr[0] does not seem to work.
CamperBot
@camperbot
May 14 2016 02:16
veganlizzy sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 837 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
May 14 2016 02:17
which part of return don't you understand? @veganlizzy
Ken Haduch
@khaduch
May 14 2016 02:17
@AndresEdoc90 - okay, your third if condition there has a problem... you are testing each contact for something - not sure what, though. The variable prop has the name of a property that may or may not be in that particular contacts's object. But you are comparing the name of a property to a property value - so that doesn't work. You could actually duplicate your first if statement, so that you know that you have a first name match (that way, you know that you're looking at the correct contact) and then use the .hasOwnProperty() but check for a false return. In other words - the first name matches, and the contact does not have the property, then you can return "No such property". But you have to make sure that you are matching the first name for both cases.
Coy Sanders
@coymeetsworld
May 14 2016 02:18
@veganlizzy
var arr = [1,2,3,4,5];
arr.push(6);
console.log(arr); //would print out [1,2,3,4,5,6]
var removedItem = arr.shift();
console.log(arr); //would now print out [2,3,4,5,6]
console.log(removedItem); //would print out 1, which was the first item in the array arr which you removed.
Carlos Antonio
@fulvi0
May 14 2016 02:19
How is going guys, i’ll need feedback for my code, i’m working on Build a random generato quote machine.
http://codepen.io/fulvi0/pen/MyxzyE?editors=0010
Coy Sanders
@coymeetsworld
May 14 2016 02:20
@fulvi0 your random button sometimes doesn't print out a quote, sometimes spits out 2 quotes
M Phillips
@melluvia
May 14 2016 02:20
OK it's not working and I don't know why?
//JSON API Call
$(document).ready(function() {
  var long;
    var lat;


     if (navigator.geolocation) {

  navigator.geolocation.getCurrentPosition(function(position) {

    long = position.coords.longitude;
    lat = position.coords.latitude;

  var api="http://api.openweathermap.org/data/2.5/weather?lat='+lat+'&lon='+long+'&appid=9887a4684d44ab8428308aee2e17bbe0";

  $.getJSON(api, function(data) {
    //JSON call for OpenWeather API
    var dataType = data.weather[0].description;
    var kTemp = data.main.temp;
    var windSpeed = data.wind.speed;
    var city = data.name;

    //kelvin
    fTemp = (kTemp)*(9/5)-459.67;
    //farenheit

    cTemp = kTemp-273;

    console.log(city);
    $("#api").html(api);
  });

        });
     }
});
Carlos Antonio
@fulvi0
May 14 2016 02:21
i’m trying to figurate out why its this happening @coymeetsworld
Coy Sanders
@coymeetsworld
May 14 2016 02:21
are you on Chrome @melluvia? geolocation no longer works on non secure connections
M Phillips
@melluvia
May 14 2016 02:21
yes
how do I make it work?
Bobby McDonald
@BobbyMcWho
May 14 2016 02:22
@melluvia use the IP API
Coy Sanders
@coymeetsworld
May 14 2016 02:22
I haven't went back and fixed my version yet, but someone point ed me to using http://ip-api.com/json to get your location instead
@melluvia
so try that out, you would need to make another getJSON call to do that.
M Phillips
@melluvia
May 14 2016 02:23
ok I'll look into doing that thanks @coymeetsworld and @BobbyMcWho
CamperBot
@camperbot
May 14 2016 02:23
melluvia sends brownie points to @coymeetsworld and @bobbymcwho :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @bobbymcwho |http://www.freecodecamp.com/bobbymcwho
:cookie: 838 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
May 14 2016 02:23
You may need to modify your code around a bit to use it since you're making another asynchronous call
M Phillips
@melluvia
May 14 2016 02:23
ok
Coy Sanders
@coymeetsworld
May 14 2016 02:24
can't just have the 2 JSON calls one-by-one, I would have the your weather call nested inside your get location call. Not sure if anyone has a better way but that's how I worked through a similar issue on twitch challenge
Bobby McDonald
@BobbyMcWho
May 14 2016 02:24
@melluvia You can check out how I used it in mine if you like
M Phillips
@melluvia
May 14 2016 02:25
ok cool ty
Bobby McDonald
@BobbyMcWho
May 14 2016 02:25
You have to open it on codepen cuz the embed won't load your ip
M Phillips
@melluvia
May 14 2016 02:26
ok np
Bobby McDonald
@BobbyMcWho
May 14 2016 02:26
 function getIp()  {$.ajax({
        type: 'GET',
        url: 'http://ip-api.com/json',
        success: function(data) {
            zip = data.zip;
            $('#address').attr('value',zip);
        },
        complete: getTemp
    });}
I used the Zip, but you can pull whatever piece (LatLon, City Name, Zip) that you want to pass
M Phillips
@melluvia
May 14 2016 02:28
interesting
Bobby McDonald
@BobbyMcWho
May 14 2016 02:30
Aravind Vasudevan
@AravindVasudev
May 14 2016 02:40

For the Falsy Bouncer problem under JS Algo, Here's my Solution :

function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  return arr.filter(function(val) {
    if(val === false || val === null || val === 0 || val === "" || val === undefined || val === NaN)
      return false;
    else 
      return true;
  });
}

For some reason, null is not removed
Can someone help me with this please?

Kyle W Pilkinton
@tadake
May 14 2016 02:49
hey guys i just finished the data scripting challenges and i was wondering what all can be done with javascript in front end developing? is anything more taught in the front end course that coincides with javascript?
it might help if you nest if statements @AravindVasudev
Justin Woodward
@jwoo92
May 14 2016 02:53
i have been working on my random quote generator and am having trouble figuring out how to use an API in my javascript with json/ ajax. i reviewed the api, json, ajax catagory with no luck. does anyone have any other sources they may be useful for my issue?
Ken Haduch
@khaduch
May 14 2016 02:57
@AravindVasudev You might find something useful if you look at the Boolean object, they list it in the lesson links...
ALINATSUI
@ALINATSUI
May 14 2016 03:04
@jwoo92 I'm grappling with API's myself (working on weather app)...how come you're using an API for the random quote generator?
Justin Woodward
@jwoo92
May 14 2016 03:05
@ALINATSUI i do not want to use an array, i want to learn how to actually use an API with json and ajax.
Bobby McDonald
@BobbyMcWho
May 14 2016 03:06
I used an API for the quote generator
ALINATSUI
@ALINATSUI
May 14 2016 03:06
oh @jwoo92....did you check jquery's json's page?
@BobbyMcWho How'd you get started with API? The exercises on FCC seemed to oversimplify the actual process....
Kyle W Pilkinton
@tadake
May 14 2016 03:09
where are some other places to learn about apis??
ALINATSUI
@ALINATSUI
May 14 2016 03:10
Yeah @tadake, I'd like to know that too....
Chris Lacaille
@ChrisL108
May 14 2016 03:10
Does my weather app work on someone else's browser? Chrome won't let geolocation over HTTP :/
http://codepen.io/chris1545/pen/grQRmG
Bobby McDonald
@BobbyMcWho
May 14 2016 03:11
@ChrisL108 use IP API
Chris Lacaille
@ChrisL108
May 14 2016 03:12
@BobbyMcWho alright I'll check that out
Justin Woodward
@jwoo92
May 14 2016 03:12
@BobbyMcWho would you have any suggestions on how to grasp the whole API's with json/ajax concept?
buiphuking
@buiphuking
May 14 2016 03:13
@ChrisL108
open location on chrome
i guess so
ALINATSUI
@ALINATSUI
May 14 2016 03:13
@ChrisL108 I'm not getting my city when I run your app...
Taneisha S. Mitchell-Gayle
@taneipoo
May 14 2016 03:14
wiki mutations
CamperBot
@camperbot
May 14 2016 03:14

:point_right: algorithm mutations [wiki]

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..
:pencil: read more about algorithm mutations on the FCC Wiki
Chris Lacaille
@ChrisL108
May 14 2016 03:14
I also copy pasted this to CodePen from Sublime so I might have missed something
It works on a localhost server
Taneisha S. Mitchell-Gayle
@taneipoo
May 14 2016 03:14
need ya'll help
Loganust
@Loganust
May 14 2016 03:14
stuck on this one
Write a switch statement which tests val and sets answer for the following conditions:
1 - "alpha"
2 - "beta"
3 - "gamma"
4 - "delta"
here is what i have
Marvin Andara
@babycakez
May 14 2016 03:15
Hello guys. I am having trouble with geolocation in javascript. When I run the code on codepen it doesnt work but when I linked it on here it did. http://codepen.io/Babycakez/pen/jqRaaB
Taneisha S. Mitchell-Gayle
@taneipoo
May 14 2016 03:15
@sjames1958gm @llamatarianism
my code not adding up
Loganust
@Loganust
May 14 2016 03:15
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;
}
Marvin Andara
@babycakez
May 14 2016 03:15
My location services are on I dont understand whats going on lol.
Taneisha S. Mitchell-Gayle
@taneipoo
May 14 2016 03:15
this is what I have var fPart = arr[0].toLowerCase().split(""); var lPart = arr[1].split(""); for (var i = 0; i < lPart.length; i++) { return fPart[i].indexOf(lPart[i]) ? true:false; }
This message was deleted
Chris Lacaille
@ChrisL108
May 14 2016 03:16
@babycakez You're probably having a similar problem I was having. Have you tried it on a different browser?
Ken Haduch
@khaduch
May 14 2016 03:17
@Loganust you have val coming in as the function argument - that is the value that you should use in your switch statement. that's the first problem - you should be setting the variable answer with the value that they are expecting for each case.
Marvin Andara
@babycakez
May 14 2016 03:17
@ChrisL108 No but I will now.
Bobby McDonald
@BobbyMcWho
May 14 2016 03:18
Ugh, they need to update this challenge
Chris Lacaille
@ChrisL108
May 14 2016 03:18
@BobbyMcWho I know! lol
Marvin Andara
@babycakez
May 14 2016 03:19
@ChrisL108 Thanks man. It works on safari but not chrome sigh. Isnt that api from google?
CamperBot
@camperbot
May 14 2016 03:19
babycakez sends brownie points to @chrisl108 :sparkles: :thumbsup: :sparkles:
:cookie: 217 | @chrisl108 |http://www.freecodecamp.com/chrisl108
Chris Lacaille
@ChrisL108
May 14 2016 03:19
@babycakez Chrome has an update that doesn't allow getting location over HTTP I think is what it was
big security update*
Bobby McDonald
@BobbyMcWho
May 14 2016 03:19
@babycakez use IP API
Loganust
@Loganust
May 14 2016 03:21
@khaduch tried this and still isnt working

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

}

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

Mike Moss
@MMux
May 14 2016 03:21
help steamroller
CamperBot
@camperbot
May 14 2016 03:21

:point_right: algorithm steamroller [wiki]

Explanation:

This problem seems simple but you need to make sure to flatten any array, regardless of the level which is what adds a bit of difficulty to the problem.

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

Marvin Andara
@babycakez
May 14 2016 03:21
@BobbyMcWho @ChrisL108 Thank you. I was moving along at good speed but that speedbump killed me.
CamperBot
@camperbot
May 14 2016 03:21
babycakez sends brownie points to @bobbymcwho and @chrisl108 :sparkles: :thumbsup: :sparkles:
:warning: babycakez already gave chrisl108 points
:cookie: 294 | @bobbymcwho |http://www.freecodecamp.com/bobbymcwho
Chris Lacaille
@ChrisL108
May 14 2016 03:22
@babycakez Yeah there was alot of time wasted there for me too
Learning! right? lol
Bobby McDonald
@BobbyMcWho
May 14 2016 03:22
I waste time watching this chat XD
taoqian1215
@taoqian1215
May 14 2016 03:24
Palindromes
Chris Lacaille
@ChrisL108
May 14 2016 03:24
@BobbyMcWho :thumbsup: ikr
Norvin Burrus
@ndburrus
May 14 2016 03:24
@Loganust hmmm.... there are two (2) var/iables. review/check the purpose/s of them.... :)
Jason
@jasonetaylor
May 14 2016 03:24
@taoqian1215 yobananaboy
Loganust
@Loganust
May 14 2016 03:25
@ndburrus solved it, feel dumb now lol
thank you
@khaduch Thanks for the help figured it out
CamperBot
@camperbot
May 14 2016 03:25
loganust sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1113 | @khaduch |http://www.freecodecamp.com/khaduch
Norvin Burrus
@ndburrus
May 14 2016 03:26
@Loganust ...that feeling is just a mirage.... at no time was the champ (you) ever in trouble! :+1:
Loganust
@Loganust
May 14 2016 03:26
@ndburrus thanks!
CamperBot
@camperbot
May 14 2016 03:26
loganust sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 347 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
May 14 2016 03:26
@Loganust welcome, anytime.... :sparkles:
Tiffany White
@twhite96
May 14 2016 03:27
Need some help with this waypoint
Nesting for loops

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
You need to multiply the product variable by each number in the sub-array of arr
That is my code so far
Islam Ibakaev
@dagman
May 14 2016 03:30
@twhite96 do u know how for loop works?
Norvin Burrus
@ndburrus
May 14 2016 03:30
@twhite96 ...ok. it it looks like the code needs to handle the following next: "it multiplies the product variable by each number in the sub-arrays of arr" do you have an idea how to do it?
Tiffany White
@twhite96
May 14 2016 03:31
Yes, @dagman
Islam Ibakaev
@dagman
May 14 2016 03:31
@twhite96 ok why this i < product;???
Tiffany White
@twhite96
May 14 2016 03:32
Because I tried arr.length and it didn’t pass the test
Islam Ibakaev
@dagman
May 14 2016 03:33
@twhite96 do u understand how much times the outer for loop will be iterate in case i < product;?
Tiffany White
@twhite96
May 14 2016 03:33
@ndburrus yeah. I figured that
@dagman yes. It will be an infinite loop. I get that
Islam Ibakaev
@dagman
May 14 2016 03:34
@twhite96 nope
Norvin Burrus
@ndburrus
May 14 2016 03:34
@twhite96 ok. i see the issue i think you're discussing now.... the structure of the array/s iteration needs work... :)
Islam Ibakaev
@dagman
May 14 2016 03:34
@twhite96 only 1 time
Tiffany White
@twhite96
May 14 2016 03:35
Yeah. @ndburrus. I am trying to figure out how to multiply product in this instance
Islam Ibakaev
@dagman
May 14 2016 03:36
@twhite96 first you should have a good knoweledge of how for loop concept works
Norvin Burrus
@ndburrus
May 14 2016 03:36
@twhite96 the following may be useful: "JavaScript for Loop" {ref: http://www.w3schools.com/js/js_loop_for.asp}
for (i = 0; i < cars.length; i++) {
text += cars[i] + "<br>";
}
Islam Ibakaev
@dagman
May 14 2016 03:38
@twhite96 i bet when you get a good grasp of for loop concept you find solution to this task in no time
Norvin Burrus
@ndburrus
May 14 2016 03:40
@twhite96 the following two statements look interesting:
1)   var product = 1;
2)   for (var i = 0; i < product; i++) {
Tiffany White
@twhite96
May 14 2016 03:40
I got it, @ndburrus
The example you posted helped
Norvin Burrus
@ndburrus
May 14 2016 03:41
@twhite96 ...super! onward & upward :)
Tiffany White
@twhite96
May 14 2016 03:41
Thank you @ndburrus
CamperBot
@camperbot
May 14 2016 03:41
twhite96 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
May 14 2016 03:41
@twhite96 you're welcome, anytime...! :+1:
Islam Ibakaev
@dagman
May 14 2016 03:42
yep yw
:smile:
iigmir
@iigmir
May 14 2016 03:49

Hi there, I want to make a year calculator. Here's my code:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title> Year Calculator </title>
        <meta charset="UTF-8" />
        <script>
function year_calculator()
{
    var year_entered =  document.getElementById("input_year").value;
    document.getElementById("output").innerHTML = year_entered; 
}
        </script>
    </head>
    <body>
        <br />
        <form>
            What the format of that year is?
            <br />
            When that year is? <input type="text" name="inputyear" id="input_year" /> <br />
            <input type="submit" onclick="year_calculator();" />
        </form>
        <br />
        <p id="output"></p>
    </body>
</html>

The problem is, when I submit my input, value may show, but disappear in seconds. I really don't know why...any answer?

Krishna
@krisskb
May 14 2016 04:03

Hello All, Could you help me what is wrong in this code. It should return empty array, but getting [null]
function bouncer(arr) {
// Don't show a false ID to this bouncer.
return arr.filter(function(val){
switch (val) {
case false:
case null:
case 0:
case undefined:
case "":
case NaN:
return false;
default:
return true;
}
});
}

bouncer([false, null, 0, NaN, undefined, ""]);

buiphuking
@buiphuking
May 14 2016 04:06

@krisskb

return arr.filter(function(val){
return val;
});

try this. let see what happen

Eduardo Campaña
@orballo
May 14 2016 04:06

@iigmir I'm not sure about what do you want to do with that code, but so far I see you want to print on the web the value entered in the text field, so this is how I solved it:
```

<body>
<br />
<form>
What the format of that year is?
<br />
When that year is? <input type="text" name="inputyear" id="input_year" /> <br />
<input id="getYear" type="submit">
</form>
<br />
<p id="output"></p>
</body>

ooops
Ok, here it is:
<body>
  <br />
  <form>
    What the format of that year is?
    <br />
    When that year is? <input type="text" name="inputyear" id="input_year" /> <br />
    <input id="getYear" type="submit">
  </form>
  <br />
  <p id="output"></p>
  <script>
     document.getElementById("getYear").addEventListener('click', function (e) {
      e.preventDefault();
      var year_entered = document.getElementById("input_year").value;
      document.getElementById('output').textContent = year_entered;
    });
  </script>
</body>
Hope you find it helpful
Krishna
@krisskb
May 14 2016 04:14
@buiphuking, yes it has worked
Justin Woodward
@jwoo92
May 14 2016 04:15
im still struggling with using an api to get a random quote. would anyone have any sources that may help me?
Sean DiSanti
@badc0ded
May 14 2016 04:15
you don't necessarily have to use an api, i think on mine i even used a static array of quotes
Krishna
@krisskb
May 14 2016 04:15
thanks @buiphuking , now I want to check why your code worked
CamperBot
@camperbot
May 14 2016 04:15
krisskb sends brownie points to @buiphuking :sparkles: :thumbsup: :sparkles:
:cookie: 7 | @buiphuking |http://www.freecodecamp.com/buiphuking
buiphuking
@buiphuking
May 14 2016 04:16
@Orballo
i'm not sure about your code, but if you wan to get this year, try getfullyear()
Justin Woodward
@jwoo92
May 14 2016 04:16
@badc0ded i know, i am trying to learn how to use an api rather than using an array.
Sean DiSanti
@badc0ded
May 14 2016 04:16
cool, what api are you trying to use and what result are you getting?
Eduardo Campaña
@orballo
May 14 2016 04:17
@buiphuking Actually I was answering to @iigmir but I messed it up with the markdown in the first place :(
Justin Woodward
@jwoo92
May 14 2016 04:19
that is the thing, i am not sure if i am using a proper API or not. i google for quote or random quote API's. after going over FCC's JSON API's and AJAX catagory, it helped a little, but i am not there fully with understanding. i observed how the challenges were doing it and tried adjusting to the googled API i found. here is my code pen so far my random quote machine
@badc0ded
Sean DiSanti
@badc0ded
May 14 2016 04:20
taking a look
it's responding with a 401 error saying that the request is not authorized
one second will look at the site and see what they say
and just so you know, to see that, i pressed f12 and went to network
then cleared the panel, and hit your button
selecting the request lets you see the response and parameters on the right
going to the domain in another tab shows that they require signing up at theysaidso.com
signing up will probably get you an api key to include in your request
maybe an appid or something
different api's do it differently
but that's first step going to theysaidso.com
kirbyedy
@kirbyedy
May 14 2016 04:23
@jwoo92 did you registered on their site?
Justin Woodward
@jwoo92
May 14 2016 04:24
@kirbyedy i did not
Travis
@dukenukethem
May 14 2016 04:24
dang @jwoo92 you're soaring through this :)
Justin Woodward
@jwoo92
May 14 2016 04:25
@badc0ded thanks for looking into it. im not committed to that API, any quote API will do if you or anyone else has a suggestion.
CamperBot
@camperbot
May 14 2016 04:25
jwoo92 sends brownie points to @badc0ded :sparkles: :thumbsup: :sparkles:
:cookie: 359 | @badc0ded |http://www.freecodecamp.com/badc0ded
kirbyedy
@kirbyedy
May 14 2016 04:25
@jwoo92 well thats your first problem
Justin Woodward
@jwoo92
May 14 2016 04:25
@dukenukethem hey man nice to see you popping back in. im sure youre right there with me
kirbyedy
@kirbyedy
May 14 2016 04:25
try one of the free quote api
Sean DiSanti
@badc0ded
May 14 2016 04:25
that's somethign you're going to run into with a lot of api's so it's probably not a bad idea to stick with that one
Justin Woodward
@jwoo92
May 14 2016 04:26
@kirbyedy thanks for looking into my problem as well.
CamperBot
@camperbot
May 14 2016 04:26
jwoo92 sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:cookie: 989 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
Travis
@dukenukethem
May 14 2016 04:26
I honestly took the day off and have been lazy in terms of coding
been reviewing some of the basic algorithm challenges.
Justin Woodward
@jwoo92
May 14 2016 04:27
@badc0ded so it is common to have a lot of API's request that you register with them first? API's are brand new to me
buiphuking
@buiphuking
May 14 2016 04:27
@dukenukethem
you mean optimize ?
Travis
@dukenukethem
May 14 2016 04:27
@buiphuking more like remembering why i wrote it the way i wrote it ha
Sean DiSanti
@badc0ded
May 14 2016 04:27
yes, even free ones. that way they can track statistics etc
Kyle W Pilkinton
@tadake
May 14 2016 04:28
is there anyway i can get more info on apis? ive just finished the section covering them and im a little lost.
Justin Woodward
@jwoo92
May 14 2016 04:28
here is another API i found, but i see it only loads one quote when i enter it into my broswer. is that normal? http://quotesondesign.com/api/3.0/api-3.0.json
Sean DiSanti
@badc0ded
May 14 2016 04:29
one sec i'll link a good video that helped me out a while back
he's got a couple of good videos
now that i think about it, i don't remember if that one was in php or javascrpt
same basics regardless of language though
kirbyedy
@kirbyedy
May 14 2016 04:32
Diogo Righi
@diogorighi
May 14 2016 04:32
Hello
Where is the best place to help the beginners?
kirbyedy
@kirbyedy
May 14 2016 04:33
help for what?
CamperBot
@camperbot
May 14 2016 04:33
no wiki entry for: for what
Sean DiSanti
@badc0ded
May 14 2016 04:33
@diogorighi at the beginning
what kind of help are you looking for?
Diogo Righi
@diogorighi
May 14 2016 04:34
oh, I don't really need help. I just wanted to help
aha
Sean DiSanti
@badc0ded
May 14 2016 04:34
even better
all of the help rooms get pretty active with people needing help
and 'letsPair' is a room for finding paired programming partners
Diogo Righi
@diogorighi
May 14 2016 04:36
oh, that's nice
I'm a little bit overwhelmed
Sean DiSanti
@badc0ded
May 14 2016 04:36
yeah i just found that one today with the new room list
Diogo Righi
@diogorighi
May 14 2016 04:37
is there any way to jump the MAP challenges on the beginning ?
buiphuking
@buiphuking
May 14 2016 04:37
@dukenukethem
if you have something cool, tell me ^^!
rphares
@rphares
May 14 2016 04:38
@diogorighi , only challenges marked with a * are required for certification,
you can use the map to jump ahead if you are already familiar with earlier, unscarred challenges :blush:
Diogo Righi
@diogorighi
May 14 2016 04:39
oh, nice! thanks @rphares
CamperBot
@camperbot
May 14 2016 04:39
diogorighi sends brownie points to @rphares :sparkles: :thumbsup: :sparkles:
:star2: 4548 | @rphares |http://www.freecodecamp.com/rphares
Travis
@dukenukethem
May 14 2016 04:39
@buiphuking nothing cool imo haha; just gnarled code that im trying to understand :x
rphares
@rphares
May 14 2016 04:39
sure thing~
Amanda Daley
@DaisyDream
May 14 2016 04:42
having some problems with the last palindrome test
do you know how to deal with the '\' character?
Lizzy
@DevElisabeth
May 14 2016 04:43

Help would be greatly appreciated because I believe my code is correct but it won't clear for "Introducing Else If Statements":
function testElseIf(val) {
if (val > 10) {
return "Greater than 10";
} else if (val < 5) {
return "Smaller than 5";
} else {
return "Between 5 and 10";
}

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

CamperBot
@camperbot
May 14 2016 04:43
no wiki entry for: would be greatly appreciated because i believe my code is correct but it wont clear for introducing else if statementsfunction testelseifval if val 10 return greater than 10 else if val 5 return smaller than 5 else return between 5 and 10 change this value to testtestelseif7
Sean DiSanti
@badc0ded
May 14 2016 04:43
i believe in that one @veganlizzy you can strip non letter characters before checking it
Cruzick
@cruzick
May 14 2016 04:43
which requirement aren't you meeting?
hudsontaylor
@hudsontaylor
May 14 2016 04:45

Hi, I am stuck on the Stand in Line JavaScript exercise here is my code:
function nextInLine(arr, item) {
// Your code here
testArr.push(item);
return testArr.shift(); // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

cannelflow
@cannelflow
May 14 2016 04:45
@veganlizzy first check val <5 then val >10
buiphuking
@buiphuking
May 14 2016 04:45
@veganlizzy
if(val <5){}
else if( val <10){between ...}
else{greater than 10}
Lizzy
@DevElisabeth
May 14 2016 04:45
@badc0ded not sure what you mean and @cruzick it currently reads as a syntax error and will not show any of the requirements, however before refreshing the page it seemed to think there were not 2 "else" statements.
hudsontaylor
@hudsontaylor
May 14 2016 04:45
I am meeting all of the requirements except for the third.
Sean DiSanti
@badc0ded
May 14 2016 04:46
i'm sorry, i misread the name, that was actually supposed to be for @DaisyDream
cannelflow
@cannelflow
May 14 2016 04:46
function nextInLine(arr, item) {<====passing arr as argument
// Your code here
testArr.push(item);<=== so should be like arr.push 
return testArr.shift(); // Change this line
}
@HudsonTaylor11
and same for shift
Justin Woodward
@jwoo92
May 14 2016 04:48
@badc0ded will the youtube video you posted assist me in learning proper code structuring with use of the quote API?
hudsontaylor
@hudsontaylor
May 14 2016 04:48
@cannelflow So what are suggesting I change?
Amanda Daley
@DaisyDream
May 14 2016 04:48
@badc0ded not sure if removing the non-letter characters is in the spirit of the test: palindrome("0_0 (: /-\ :) 0-0") should return true.
hudsontaylor
@hudsontaylor
May 14 2016 04:48
you*
Justin Woodward
@jwoo92
May 14 2016 04:48
@kirbyedy thanks for the API
CamperBot
@camperbot
May 14 2016 04:48
jwoo92 sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:warning: jwoo92 already gave kirbyedy points
Amanda Daley
@DaisyDream
May 14 2016 04:48
''' palindrome("0_0 (: /-\ :) 0-0");
CamperBot
@camperbot
May 14 2016 04:48
:bulb: to format code use backticks! ``` more info
Amanda Daley
@DaisyDream
May 14 2016 04:48
```palindrome("0_0 (: /-\ :) 0-0");
cannelflow
@cannelflow
May 14 2016 04:48
@HudsonTaylor11 instead of testArr.push(item) do like arr.push(item)
Amanda Daley
@DaisyDream
May 14 2016 04:49
bah
cannelflow
@cannelflow
May 14 2016 04:49
same for shift @HudsonTaylor11
Sean DiSanti
@badc0ded
May 14 2016 04:49
help palindrome
CamperBot
@camperbot
May 14 2016 04:49

:point_right: algorithm check for palindromes [wiki]

Explanation:

Our goal for solving this problem is tidying up the string passed in, and checking whether it is in fact a palindrome.

  • If you are unsure of what a palindrome is, it is a word or phrase that when reversed spells the same thing forwards or backwards. A simple example is mom, when you reverse the letters, it spells the same thing! Another example of a palindrome is race car. When we take out anything that is not a character it becomes racecar which is the same spelled forwards or backwards!

Once we have determined whether it is a palindrome or not we want to return either true or false based on our findings.

:pencil: read more about algorithm check for palindromes on the FCC Wiki

Sean DiSanti
@badc0ded
May 14 2016 04:49
"When we take out anything that is not a character it becomes racecar which is the same spelled forwards or backwards!"
hudsontaylor
@hudsontaylor
May 14 2016 04:49
@cannelflow Thanks so much! This worked.
CamperBot
@camperbot
May 14 2016 04:49
hudsontaylor11 sends brownie points to @cannelflow :sparkles: :thumbsup: :sparkles:
:star2: 1155 | @cannelflow |http://www.freecodecamp.com/cannelflow
Sean DiSanti
@badc0ded
May 14 2016 04:50
i promise i wasn't suggesting anything to subvert the intent of the challenge
Diogo Righi
@diogorighi
May 14 2016 04:51
@HudsonTaylor11 you are using the name of the array that is passed as parameters. Inside the function, the name of the array passed matches the name of the argument. arr in this case
hudsontaylor
@hudsontaylor
May 14 2016 04:51
Thanks!
cannelflow
@cannelflow
May 14 2016 04:52
palindrome("0_0 (: /-\ :) 0-0")
so if you remove everything except alphabet and number it should be like 0000 which is palindrome
@diogorighi
Sean DiSanti
@badc0ded
May 14 2016 04:53
pretty sure that one was for @DaisyDream too.
cannelflow
@cannelflow
May 14 2016 04:54
@DaisyDream :point_up: May 14, 2016 10:22 AM
Tim
@codemymind
May 14 2016 04:54
Thank you for your help today @bitgrower I appreciate you Ma'am
CamperBot
@camperbot
May 14 2016 04:54
codemymind sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star2: 1048 | @bitgrower |http://www.freecodecamp.com/bitgrower
Sean DiSanti
@badc0ded
May 14 2016 04:54
at least you can blame autocomplete for yours kind of, i was way off
cannelflow
@cannelflow
May 14 2016 04:54
looks i tagged someone else :p
Justin Woodward
@jwoo92
May 14 2016 04:57
with how my javascript is right now, wouldnt my page bring up the json data? http://codepen.io/jwoo/pen/yOwxXZ?editors=1010
Diogo Righi
@diogorighi
May 14 2016 04:58
@jwoo92 when you make requests to another domain, you have to use jsonp
Sean DiSanti
@badc0ded
May 14 2016 04:59
what? no you don't
jsonp just means it's padded for human readability
Diogo Righi
@diogorighi
May 14 2016 05:00
if you make a request outside your domain, you have cross domain issues
Sean DiSanti
@badc0ded
May 14 2016 05:01
cors and jsonp are different things
Sean DiSanti
@badc0ded
May 14 2016 05:03
the reason that worked is because @michael-krebs actually passed parameters saying what to return and how
and http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en&json=? works also, so you don't get the impresson jsonp is required
Amanda Daley
@DaisyDream
May 14 2016 05:05
thanks everyone. It works. I was hitting a wall because I got started before reading the whole thing
Diogo Righi
@diogorighi
May 14 2016 05:06
@badc0ded it's not only for human readability. take a look: https://en.wikipedia.org/wiki/JSONP
Saurav Joshi
@sunny713015
May 14 2016 05:07
Hey
Please help me on Finding the longest word in a string..

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

findLongestWord("The quick brown fox jumped over the lazy dog");

Justin Woodward
@jwoo92
May 14 2016 05:08
@badc0ded @kirbyedy may i ask how did you guys get the added part of that link after api/1.0/ ?
Sean DiSanti
@badc0ded
May 14 2016 05:09
@diogorighi i had not heard of it being used that way, i definitely stand corrected
thanks @diogorighi
CamperBot
@camperbot
May 14 2016 05:09
badc0ded sends brownie points to @diogorighi :sparkles: :thumbsup: :sparkles:
:cookie: 17 | @diogorighi |http://www.freecodecamp.com/diogorighi
Sean DiSanti
@badc0ded
May 14 2016 05:09
still totally wasn't needed for this issue though ;)
Diogo Righi
@diogorighi
May 14 2016 05:09
;)
Sean DiSanti
@badc0ded
May 14 2016 05:10
@sunny713015 you've got a couple issues there
the first is in your for declaration; you want your exit condition to include your iterator (i)
like i < splitString.length
in your case you're telling it to only loop while longestWord (0) is greater than the length of splitString (never)
buiphuking
@buiphuking
May 14 2016 05:12
@sunny713015
var splitString = str.split(' '); // have a blank space
Saurav Joshi
@sunny713015
May 14 2016 05:12
thanks guys its done
Sean DiSanti
@badc0ded
May 14 2016 05:12
additionally inside the loop you're not checking that the length of splitString[i] is greater than longestWord
cool, good job
Justin Woodward
@jwoo92
May 14 2016 05:13
@badc0ded http://api.forismatic.com/api/1.0/ <------- with this being the API address, do i have to maunally add in the getQuote method like you guys did to make it work in my jquery code?
Sean DiSanti
@badc0ded
May 14 2016 05:13
that's how you tell it what you want @jwoo92
if you wanna know why, take a look here: http://forismatic.com/en/api/
if you do this, you can see on the console that you are getting a cross domain error
and it will work
but you show parse the json before showing
jorgon1022
@jorgon1022
May 14 2016 05:18
Hi guys
any of you interested in solving a riddle?
Sean DiSanti
@badc0ded
May 14 2016 05:18
sure
Diogo Righi
@diogorighi
May 14 2016 05:18
always
jorgon1022
@jorgon1022
May 14 2016 05:19
var num=36;
var l=100;
var y=5;
var i=1;

var emptyArr=[];
for(var iterate=0;iterate<=num;iterate++){
    if (num%l===0){
        num=num-100;
        emptyArr.push(l)

    }
     else if(num%y===0){
        num=num-5;
        emptyArr.push(y)

    }
    else if(num%i===0){
        num=num-1;
        emptyArr.push(i);

    }

}

console.log(emptyArr);
check out the following code
[ 1, 5, 5, 5, 5, 5, 5 ]
Saurav Joshi
@sunny713015
May 14 2016 05:20
Title Case a Sentence any hints?
jorgon1022
@jorgon1022
May 14 2016 05:20
when I run this, I get the following. Why though? I should be getting seven 5's and one 1
Sean DiSanti
@badc0ded
May 14 2016 05:21
easy riddle. the answer is you're doing it wrong
what do i win
iigmir
@iigmir
May 14 2016 05:21
@Orballo addEventListener......Well, thanks anyway. I am doing year format coventor.
CamperBot
@camperbot
May 14 2016 05:21
iigmir sends brownie points to @orballo :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @orballo |http://www.freecodecamp.com/orballo
jorgon1022
@jorgon1022
May 14 2016 05:21
essentially, what I want to get is I want it to show me the number of 5s it takes and the number of 1s it takes to get 36
Diogo Righi
@diogorighi
May 14 2016 05:21
hahaha
jorgon1022
@jorgon1022
May 14 2016 05:22
@badc0ded bonus points
Diogo Righi
@diogorighi
May 14 2016 05:22
i'll test here, @jorgon1022
Sean DiSanti
@badc0ded
May 14 2016 05:22
one sec taking your code to a console
jorgon1022
@jorgon1022
May 14 2016 05:22
what the heck am I doing wrong? I even wrote it down on a piece of paper but dont understand why its not working
@diogorighi @badc0ded sweet. looking forward to seeing what you guys find
Diogo Righi
@diogorighi
May 14 2016 05:23
You wanna know how many 5's and how many 1's to get 36, right?
Saurav Joshi
@sunny713015
May 14 2016 05:23
@badc0ded can you give any hints on Title Case a Sentence
wiki Title Case a Sentence
CamperBot
@camperbot
May 14 2016 05:23

:point_right: algorithm title case a sentence [wiki]

Explanation:

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

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

Sean DiSanti
@badc0ded
May 14 2016 05:23
@sunny713015 yes, start by showing code. it's the best way to get help with anything, and formatting it readably helps also
help format
CamperBot
@camperbot
May 14 2016 05:23

:point_right: code formatting [wiki]

Multi line Code

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

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

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

Single line Code

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

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

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

Aleksandar B.
@aleksandar-b
May 14 2016 05:24
@jorgon1022 maybe because you are changing num. Then all if/else statement recieved updated nnum
Justin Woodward
@jwoo92
May 14 2016 05:24
@diogorighi is the getQuote method universal or specific to that API only? how did/why you add &jsonp=? ?
jorgon1022
@jorgon1022
May 14 2016 05:25
@samosale can you expand? Because initially I am trying to change num. Everytime it iterates, I need it to subtract whether it be 1, 5, or 100
Diogo Righi
@diogorighi
May 14 2016 05:25
@jwoo92 it's not universal. it's on the documentation of the api. take a look here: http://forismatic.com/en/api/
jorgon1022
@jorgon1022
May 14 2016 05:25
so it starts off with 36. 36%1=0 so subtract 1
now its 35. 35%5 =0 so subtract 5
and so on. until it goes down to zero. once it hits zero, it should break out of the loop
Justin Woodward
@jwoo92
May 14 2016 05:28
@diogorighi how/why did you have a ? right before method and jsonp equalling a '?' ?
that is the only thing i do not understand after looking it over
Diogo Righi
@diogorighi
May 14 2016 05:29
@jorgon1022 just a minute
jorgon1022
@jorgon1022
May 14 2016 05:29
@diogorighi no problem
Diogo Righi
@diogorighi
May 14 2016 05:30
when you make a HTTP GET REQUEST, you use the ? before the params
WHY is a good question, i don't know why
Aleksandar B.
@aleksandar-b
May 14 2016 05:33
@jorgon1022 because on 6 iteration your var iterate becomes greater than var num which is then 5 and var iterate is then 6, and that breaks the loop.
https://repl.it/CQio
Justin Woodward
@jwoo92
May 14 2016 05:34
the api does not mention a '?' symbol in its reference. so with that said i would put it together like this: http://api.forismatic.com/api/1.0/method=getQuote&lang=en&format=json
Sean DiSanti
@badc0ded
May 14 2016 05:34
@jorgon1022 at the end, num is still equal to 5
it's not going down to zero
Aleksandar B.
@aleksandar-b
May 14 2016 05:34
iterate<=num // false
Sean DiSanti
@badc0ded
May 14 2016 05:34
var num=36;
var l=100;
var y=5;
var i=1;

var emptyArr=[];
for(var iterate=0;iterate<=num;iterate++){
    if (num%l===0){
        console.log('num%l===0:',iterate);
        num=num-100;
        console.log('num:', num);
        emptyArr.push(l)

    }
     else if(num%y===0){
        console.log('num%y===0:', iterate)
        num=num-5;
        console.log('num:', num);
        emptyArr.push(y)

    }
    else if(num%i===0){
        console.log('num%i===0:',iterate)
        num=num-1;
        console.log('num:', num);
        emptyArr.push(i);

    }

}

console.log(emptyArr);
TanYiXun
@TanYiXun
May 14 2016 05:34

function destroyer(arr,arg1,arg2) {
  // Remove all the values
  var arr2=arr.filter(function func1(a){
  a=arg1;
},
 function func2(b){
   b=arg2;
 });




  return arr2;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Guys can anyone help me with seek and destroy?
jorgon1022
@jorgon1022
May 14 2016 05:35
@samosale yeah its not going down to zero
Sean DiSanti
@badc0ded
May 14 2016 05:35
which means that your exit condition is getting hit too soon, OR you can just add num to the array at the end
jorgon1022
@jorgon1022
May 14 2016 05:36
@badc0ded wait. did you figure it ouy?
Sean DiSanti
@badc0ded
May 14 2016 05:36
should set your exit condition to > 0
instead of <= num
wait
blah
one second
exit condition should be num > 0
jorgon1022
@jorgon1022
May 14 2016 05:37
hmm. let me check
Sean DiSanti
@badc0ded
May 14 2016 05:38
continue condition i mean
sorry long day
jorgon1022
@jorgon1022
May 14 2016 05:38
its ok. thank you for this
i dont understand it but I will do my best to intepret it
Sean DiSanti
@badc0ded
May 14 2016 05:39
you do understand it, the loop was exiting before it was done working
which means the continue condition was wrong
Aleksandar B.
@aleksandar-b
May 14 2016 05:39
@jorgon1022 you should be using while loop
while(num)
jorgon1022
@jorgon1022
May 14 2016 05:40
@badc0ded heres the kicker. its still wrong lol
this returns the same answer that I had initially
it returns six 5s and one 1
jorgon1022
@jorgon1022
May 14 2016 05:41
@samosale thats what I started with initially but it still didnt work
Sean DiSanti
@badc0ded
May 14 2016 05:41
my count shows 7
jorgon1022
@jorgon1022
May 14 2016 05:41
@badc0ded i literally copied and pasted this into my code and thats what my output gives me
Sean DiSanti
@badc0ded
May 14 2016 05:41
yes, i didn't change the continue condition
in what i pasted
what i pasted was to add the output to help you find the answer
but then i went on to spell it out
Aleksandar B.
@aleksandar-b
May 14 2016 05:42
my count also shows 7
jorgon1022
@jorgon1022
May 14 2016 05:43
@badc0ded @samosale thank you both
CamperBot
@camperbot
May 14 2016 05:43
:cookie: 362 | @badc0ded |http://www.freecodecamp.com/badc0ded
jorgon1022 sends brownie points to @badc0ded and @samosale :sparkles: :thumbsup: :sparkles:
:cookie: 613 | @samosale |http://www.freecodecamp.com/samosale
jorgon1022
@jorgon1022
May 14 2016 05:43
i got it
Sean DiSanti
@badc0ded
May 14 2016 05:43
no problem, glad to help
jorgon1022
@jorgon1022
May 14 2016 05:44
@badc0ded ill still never understand why my initial code didnt work
haha
Sean DiSanti
@badc0ded
May 14 2016 05:44
because the iterator was higher than num
which is when you told it to stop
Eldar Tinjić
@EldarT90
May 14 2016 05:45
created short URL:
{ _id: 5736bac630d784fda00bd713,
URL: 'www.yahoo.com',
data: null,
hash: '110ccd',
created_at: Sat May 14 2016 05:42:30 GMT+0000 (UTC),
hits: 1 }
retrieving short URL: 110ccd
retrieve result:
{ _id: 5736bac630d784fda00bd713,
URL: 'www.yahoo.com',
data: null,
hash: '110ccd',
created_at: Sat May 14 2016 05:42:30 GMT+0000 (UTC),
hits: 1 }
Sean DiSanti
@badc0ded
May 14 2016 05:45
that's why i added the iterator to the output too
Eldar Tinjić
@EldarT90
May 14 2016 05:45
i get code , which is 110ccd for shortened link
but how to use this in order to get to yahoo.com
Sean DiSanti
@badc0ded
May 14 2016 05:45
as soon as the iterator was higher than num (7 > 5) it exited
jorgon1022
@jorgon1022
May 14 2016 05:45
so basically, the iterator was going up and the number was going down , it eventually got the point where the iterator was greater than the number and thats what caused it to stop
Sean DiSanti
@badc0ded
May 14 2016 05:46
yep
jorgon1022
@jorgon1022
May 14 2016 05:46
@badc0ded got it
Sean DiSanti
@badc0ded
May 14 2016 05:46
good deal
Diogo Righi
@diogorighi
May 14 2016 05:47
@jwoo92 hey, try using a better documented API. Also, make a research on JSONP
Justin Woodward
@jwoo92
May 14 2016 05:49
@diogorighi thanks for the help, i really do appreciate it.
CamperBot
@camperbot
May 14 2016 05:49
jwoo92 sends brownie points to @diogorighi :sparkles: :thumbsup: :sparkles:
:cookie: 20 | @diogorighi |http://www.freecodecamp.com/diogorighi
Diogo Righi
@diogorighi
May 14 2016 05:49
@jwoo92 you're welcome! ;)
Chris Cullen
@123xylem
May 14 2016 06:09
Hey could you advise me how to style my weather app so the black box and text are more centered? https://codepen.io/123xylem/pen/WwPKrj?editors=1010
Justin Woodward
@jwoo92
May 14 2016 06:10
here is my update on my random quote generator. it is not working though. did i convert my json data to html incorrectly? http://codepen.io/jwoo/pen/yOwxXZ?editors=0010
Saurav Joshi
@sunny713015
May 14 2016 06:12
This message was deleted
CamperBot
@camperbot
May 14 2016 06:12
:bulb: to format code use backticks! ``` more info
Justin Woodward
@jwoo92
May 14 2016 06:12
@diogorighi are you able to check out my current code? i believe i may have incorrectly converted my json data to html.
Cruzick
@cruzick
May 14 2016 06:13
Question for JavaScript gurus out there
why does the below code work outside of a loop, but inside of a loop it doesn't increment as expected?
if (str[0] != " ") {
result += 1;
}
inside of a loop using str[i]
Saurav Joshi
@sunny713015
May 14 2016 06:15

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

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Return Largest Numbers in Arrays
whats wrong?
Cruzick
@cruzick
May 14 2016 06:16
jello?
Saurav Joshi
@sunny713015
May 14 2016 06:17
anyone?
Sean DiSanti
@badc0ded
May 14 2016 06:17
o
, jere
ack sorry was off the home row
one sec i can help
Cruzick
@cruzick
May 14 2016 06:18
awesome thanks
Justin Woodward
@jwoo92
May 14 2016 06:20
@badc0ded hey i believe i am getting closer as well if you are available to review my code.
i do know my json to html conversion is incorrect
Saurav Joshi
@sunny713015
May 14 2016 06:21
@badc0ded can you help?
Sean DiSanti
@badc0ded
May 14 2016 06:21
@cruzick i would need to see it in context, where it's not working i mean. and what does not working mean?
yes, i can help
@sunny713015 you're assigning the wrong way in your condition
wait, one sec sorry i was thinking different challenge
i have to look at this one
oh, your condition is just wrong
you're comparing an array to a number
Adam Parker
@amichaelparker
May 14 2016 06:23
@sunny713015 haven't looked at the rest of the logic, but you probably meant to return 'largestArr'
Sean DiSanti
@badc0ded
May 14 2016 06:24
this comparison if(largestArr < arr[i][j]) isn't valid
as largestArr is an array and the other is a number
@jwoo92 i can take a look at your code but i'd need the link again
Saurav Joshi
@sunny713015
May 14 2016 06:25
k
Justin Woodward
@jwoo92
May 14 2016 06:25
@badc0ded my commented out code is what i had, it may explain what i want to do, but i understand the forEach method will cycle through all my stuff and not do what i want with that code. http://codepen.io/jwoo/pen/yOwxXZ?editors=0010
Saurav Joshi
@sunny713015
May 14 2016 06:26
@badc0ded what do I do of that?
Justin Woodward
@jwoo92
May 14 2016 06:26
i just want to select the quoteText and quoteAuthor
Saurav Joshi
@sunny713015
May 14 2016 06:27
I was trying to apply longest string method here..
But I don't that's going to work
There it is @badc0ded
Saurav Joshi
@sunny713015
May 14 2016 06:28
I am getting the largest number in return, how do I compare with an array.
Justin Woodward
@jwoo92
May 14 2016 06:29
@badc0ded can i use getElementById method?
Cruzick
@cruzick
May 14 2016 06:29
I'm not asking for solution to this, just asking why the str[i] doesn't work in the loop
Sean DiSanti
@badc0ded
May 14 2016 06:29
@cruzick your continue condition in the second for loop is wrong
it only continues if i (0) is greater than str.length
so nothing inside of that loop executes
Cruzick
@cruzick
May 14 2016 06:29
lol
jeebus I need to go to sleep
Sean DiSanti
@badc0ded
May 14 2016 06:30
one sec @jwoo92
Cruzick
@cruzick
May 14 2016 06:30
thanks for pointing that out for my blind eyes
@badc0ded thanks!
CamperBot
@camperbot
May 14 2016 06:30
cruzick sends brownie points to @badc0ded :sparkles: :thumbsup: :sparkles:
:cookie: 363 | @badc0ded |http://www.freecodecamp.com/badc0ded
Sean DiSanti
@badc0ded
May 14 2016 06:30
no problem, i'm glad i could help
almost to your penn @jwoo92 just doing a styling thing for @123xylem
Saurav Joshi
@sunny713015
May 14 2016 06:31
@badc0ded some help here too
Sean DiSanti
@badc0ded
May 14 2016 06:32
you can't compare an array and a discreet value
they're not the same thing
you can compare an element in an array to another discreet value
Saurav Joshi
@sunny713015
May 14 2016 06:33
I know but what I do to compare array's?
Adam Parker
@amichaelparker
May 14 2016 06:33
@sunny713015 you don't need to
Eldar Tinjić
@EldarT90
May 14 2016 06:34
what is the command that redirects me to other page or rather website
in express.js
whathever i use it wonr work
all tutorials are for page redirecting based on parsam
Adam Parker
@amichaelparker
May 14 2016 06:35
@sunny713015 like @badc0ded said, you need a single value stored somewhere that you can compare the current array value being tested against
Saurav Joshi
@sunny713015
May 14 2016 06:36
okay @amichaelparker
Sean DiSanti
@badc0ded
May 14 2016 06:37
ok, jumping onto your pen now @jwoo92
Adam Parker
@amichaelparker
May 14 2016 06:37
sorry if that doesn't make a lot of sense... trying not to totally solve it, but I'm also too tired to do words right :D
Bob Evermore
@BeeQuickest
May 14 2016 06:37
Anybody available to help me understand why my solution to the Find Largest Number In Arrays is not accepted even though I get the correct output?
Adam Parker
@amichaelparker
May 14 2016 06:38
@BeeQuickest drop what you've got in chat :)
Grzegorz
@bluznierca1
May 14 2016 06:38
Hi guys! ;)
Adam Parker
@amichaelparker
May 14 2016 06:38
helllooo
Bob Evermore
@BeeQuickest
May 14 2016 06:39
js

function largestOfFour(arr) {

var subArray = [];
var newArray = [];
var tempLarger = 0;

for (w = 0; w < arr.length; w++) {
  console.log("arr.length = " + arr.length + " w = " + w);
  subArray=arr[w];
  var tempLargest = 0;
//  console.log("subArray = " + subArray);
  for (x = 0; x < (arr.length-1); x++) { // x represents number of subarrays within the larger array

      if (subArray[x] < subArray[x+1]) {

      tempLarger = subArray[x+1];

          if (tempLarger >= tempLargest) {
              tempLargest = tempLarger;
          }
      }
        if (subArray[x] >= subArray[x+1]) {
        tempLarger = subArray[x];

         if (tempLarger >= tempLargest) {
             tempLargest = tempLarger;
          }      
       } 
    }  
  if (w < 1) {
    newArray = tempLargest;
//    console.log("w = " + w + " newArray = " + newArray);
  } else {
  newArray = newArray + ","  + tempLargest;
//    console.log("w = " + w + " newArray = " + newArray);
  tempLargest = " "; 
  }  
}
  arr=newArray;
  console.log("arr = " + arr);
  return arr;
}

 largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Sean DiSanti
@badc0ded
May 14 2016 06:39
@jwoo92 it's easiest to just get json instead of jsonp
one second forking pen
Justin Woodward
@jwoo92
May 14 2016 06:40
@badc0ded i dont really understand the difference. my commented code is basically what i want to do.
Sean DiSanti
@badc0ded
May 14 2016 06:41
no problem
buiphuking
@buiphuking
May 14 2016 06:41
is anybody good at flexbox css3 ? help me
Adam Parker
@amichaelparker
May 14 2016 06:43
@BeeQuickest for reasons I haven't quite figured out yet, your return statement is returning a string with the numbers, rather than an array, which is what the test expects
Bob Evermore
@BeeQuickest
May 14 2016 06:44
@amichaelparker I think I know how to fix that in a jiffy. Thank you for pointing that out!
CamperBot
@camperbot
May 14 2016 06:44
beequickest sends brownie points to @amichaelparker :sparkles: :thumbsup: :sparkles:
:cookie: 386 | @amichaelparker |http://www.freecodecamp.com/amichaelparker
Adam Parker
@amichaelparker
May 14 2016 06:44
@BeeQuickest no problem :)
@BeeQuickest ohh I see... the if at the bottom is replacing the array with a string, then the else is tacking on more strings
slashgirl
@slashgirl
May 14 2016 06:49

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count = count + 1;
break;
case 7:
case 8:
case 9:
count = count;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count = count - 1;
break;
}

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

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

stucked in 203--counting cards
hello
Cruzick
@cruzick
May 14 2016 06:54
hi
Adam Parker
@amichaelparker
May 14 2016 06:54
hello
Cruzick
@cruzick
May 14 2016 06:55
Are you supposed to return bet or stay depending on count?
Adam Parker
@amichaelparker
May 14 2016 06:55
^^
Adam Parker
@amichaelparker
May 14 2016 06:56
@slashgirl right now you're just returning the count, but the output wants the count + bet / hold depending on what count is :)
Chris Cullen
@123xylem
May 14 2016 06:57
@badc0ded did u do it?
Cruzick
@cruzick
May 14 2016 06:57
Looks like you are missing the bet/stay logic for the proper return @slashgirl
Sean DiSanti
@badc0ded
May 14 2016 06:57
yes
re-ordered some of your code and changed variable names
if you want to copy the js out of there and let me know i'll delete my fork
Cruzick
@cruzick
May 14 2016 07:00
Good night peeps, happy coding
Sean DiSanti
@badc0ded
May 14 2016 07:00
have a good one @cruzick
Chris Cullen
@123xylem
May 14 2016 07:00
@badc0ded how do i find it/
?
Sean DiSanti
@badc0ded
May 14 2016 07:00
This message was deleted
Justin Woodward
@jwoo92
May 14 2016 07:02
@badc0ded thanks man. after reviewing it i was barely off. i appreciate it alot
CamperBot
@camperbot
May 14 2016 07:02
jwoo92 sends brownie points to @badc0ded :sparkles: :thumbsup: :sparkles:
:cookie: 364 | @badc0ded |http://www.freecodecamp.com/badc0ded
Sean DiSanti
@badc0ded
May 14 2016 07:03
no problem, i'm glad i could help
deleting that fork
Sean DiSanti
@badc0ded
May 14 2016 07:16
ok, it looks like campers have run out of issues. bed time for badc0de
Mujaahid
@mujaahid
May 14 2016 07:16
please someone help
function nextInLine(arr, item) {
  // Your code here
  arr = [ "hjjfj",'sdfs','fsfs'].push(item);
  item = 343 ;

arr.push(item);
  arr.unshift();
}
Sean DiSanti
@badc0ded
May 14 2016 07:16
see, i should have just run
:)
Adam Parker
@amichaelparker
May 14 2016 07:16
lol
Sean DiSanti
@badc0ded
May 14 2016 07:16
what's going on @mujaahid
don't assign the array to arr
it's already there
by hardcoding the array it will fail any test with other array
just arr.push(item)
and you don't want to store the result of that push, because it's just the length of the array after pushing
just remove the first 2 lines under "// Your code here"
and then return the arr.unshift
Mujaahid
@mujaahid
May 14 2016 07:18
okay
let me do that
Sean DiSanti
@badc0ded
May 14 2016 07:20
i promise not to even try to stop you
Mujaahid
@mujaahid
May 14 2016 07:21
still remain some errors
function nextInLine(arr, item) {
  // Your code here


arr.push(item);
 return arr.unshift();
}
Orsini
@jrorsini
May 14 2016 07:21
help Where art thou
CamperBot
@camperbot
May 14 2016 07:21

:point_right: algorithm where art thou [wiki]

Problem Explanation

Write an algorithm that will take an array for the first argument and return an array with all the objects that matches all the properties and values in the Object passed as second parameter.

:pencil: read more about algorithm where art thou on the FCC Wiki

Adam Parker
@amichaelparker
May 14 2016 07:26
@mujaahid you want to remove the first item in the array, .unshift() does the opposite
Sean DiSanti
@badc0ded
May 14 2016 07:27
also, saying what errors you're getting helps isolate them
Adam Parker
@amichaelparker
May 14 2016 07:27
^^
slashgirl
@slashgirl
May 14 2016 07:29
bet/stay logic for the proper return ? @cruzick
rphares
@rphares
May 14 2016 07:32
Yes-- at the end, you'll want an if/else, @slashgirl ... you were told to return the count and " Bet" or " Hold" if i recall...?
slashgirl
@slashgirl
May 14 2016 07:33
or do I need a for()? @rphares
I should use an if/else,to show the result at the end?
rphares
@rphares
May 14 2016 07:35
most people use an if count is above zero return count and bet type of thing
(note: not exact code, dont need && ;) )
slashgirl
@slashgirl
May 14 2016 07:38
ok ,let me try,thank you~~
rphares
@rphares
May 14 2016 07:41
anytime~
Diogo Righi
@diogorighi
May 14 2016 07:42
@jwoo92 sorry, just saw your mention!
Kristoforus Rua
@kru
May 14 2016 07:54

Hi all,
I want to playing with my solution at FCC when not connected to the internet. So, I test my solution using nodejs, but I must use console.log() to display my result in the terminal instead using return.
Is there a way to sets nodejs display the return value instead of using console.log?

Here is the example

function isPrime(num) {
    for ( var i = 2; i < num; i++ ) {
        if ( num % i === 0 ) {
            return false;
        }
    }
    return true;
}

function display(n) {
    var arr = [2];
    for ( var i = 3; i < n; i+=2 ) {
        if ( isPrime(i) ) {
            arr.push(i);
        }
    }
    //return arr; ('I want to make this return statement display the arr on the terminal')
    console.log(arr); 
}
Bob Evermore
@BeeQuickest
May 14 2016 07:56
I'm having trouble with the Return Largest Number In Arrays. I get what appears to be the correct output, yet the solution is not accepted. I was told earlier that my output is in string format rather than an array. Can someone show me how to determine whether my output is string or array? Here's the code: ```
js

function largestOfFour(arr) {

var subArray = [];
var newArray = [];
var tempLarger = 0;

for (w = 0; w < arr.length; w++) {
  console.log("arr.length = " + arr.length + " w = " + w);
  subArray=arr[w];
  var tempLargest = 0;
  console.log("subArray = " + subArray);
  for (x = 0; x < (arr.length-1); x++) { // x represents number of subarrays within the larger array
//      subArray[x]=valueOf(subArray[x]);
//      subArray[x+1]=valueOf(subArray[x+1]);
      if (subArray[x] < subArray[x+1]) {
// console.log("valueOf(subArray[x] = " + valueOf(subArray[x]));
      tempLarger = subArray[x+1];
console.log("tempLarger =" + tempLarger);
          if (tempLarger >= tempLargest) {
              tempLargest = tempLarger;
          }
      }
//      subArray[x]=valueOf(subArray[x]);
//      subArray[x+1]=valueOf(subArray[x+1]);

        if (subArray[x] >= subArray[x+1]) {
        tempLarger = subArray[x];

         if (tempLarger >= tempLargest) {
             tempLargest = tempLarger;
          }      
       } 
    }  
  if (w < 1) {
    newArray = tempLargest;
    console.log("w = " + w + " newArray = " + newArray);
  } else {
  newArray = newArray+","+tempLargest;
    console.log("w = " + w + " newArray = " + newArray);
  tempLargest = 0; 
  }  
}
  arr=newArray.split(',');
  console.log("arr = " + arr);
  return arr;
}

// largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Diogo Righi
@diogorighi
May 14 2016 07:57
@krua the console.log() displays on terminal
Kristoforus Rua
@kru
May 14 2016 07:58
desktop.png
Diogo Righi
@diogorighi
May 14 2016 07:58
you created the functions, but you are not executing
Kristoforus Rua
@kru
May 14 2016 07:58
This is my result if I use the return
Diogo Righi
@diogorighi
May 14 2016 08:00
also you can open chrome, open the console there, copy and paste your code
and call the functions
Kristoforus Rua
@kru
May 14 2016 08:01
@diogorighi Actually I executing the function..yes it display on the result on the terminal but didn't show when I use return
Eldar Tinjić
@EldarT90
May 14 2016 08:01
Error: Can't set headers after they are sent.
can some1 help with this error ?
Kristoforus Rua
@kru
May 14 2016 08:01
*I mean display the result on terminal
@diogorighi I know that, but I want just want to using nodejs and text editor :)
Adam Parker
@amichaelparker
May 14 2016 08:03
@BeeQuickest hello :D You mean programatically check? If you did a console.log(Array.isArray(arr)) it should spit out true or false in your browser console
@BeeQuickest otherwise, the black bar under the run tests button will be telling you "5,27,39,1001", where an array would be spit out as "[5,27,39,1001]"
Shiv
@bharthur
May 14 2016 08:08
Does Facebook's in-app browser trigger Javascript?
Justin Woodward
@jwoo92
May 14 2016 08:08
@diogorighi thats fine, im coming along on it, i just need to code my twitter button and a few other minor things here is what i have right now. http://codepen.io/jwoo/pen/yOwxXZ
Adam Parker
@amichaelparker
May 14 2016 08:09
@BeeQuickest The place where the stringifying is happening is here: if (w < 1) { newArray = tempLargest; // console.log("w = " + w + " newArray = " + newArray); } else { newArray = newArray + "," + tempLargest; // console.log("w = " + w + " newArray = " + newArray); tempLargest = " "; } (I hope that worked, it's been a while)
Bob Evermore
@BeeQuickest
May 14 2016 08:11
@amichaelparker Thanks for getting back to me. I can see that output in the black bar but it only gives me one line of output and only one of the challenges passes. I can't differentiate in the dev console between array output and string output so I'm having trouble figuring out why my first output is an array but subsequent ones are strings.
CamperBot
@camperbot
May 14 2016 08:11
beequickest sends brownie points to @amichaelparker :sparkles: :thumbsup: :sparkles:
:cookie: 387 | @amichaelparker |http://www.freecodecamp.com/amichaelparker
Diogo Righi
@diogorighi
May 14 2016 08:11
@jwoo92 cool! good work
Bob Evermore
@BeeQuickest
May 14 2016 08:13
@amichaelparker Can you give me a hint? I've tried push to add elements to the array and that gives me an error message, something to the effect that I can't push to an undefined item.
Daniel
@profoundhub
May 14 2016 08:14
Can anyone here help me with a problem I have with Angular and Yii?
Justin Woodward
@jwoo92
May 14 2016 08:15
@diogorighi thanks, im going to figure out how to use the twitter API and i need to figure how im going to get my author name to say unknown when my response.quoteAuthor = "". i tried messing around with it but never got it right.
CamperBot
@camperbot
May 14 2016 08:15
jwoo92 sends brownie points to @diogorighi :sparkles: :thumbsup: :sparkles:
:cookie: 25 | @diogorighi |http://www.freecodecamp.com/diogorighi
Adam Parker
@amichaelparker
May 14 2016 08:16
@BeeQuickest Ah, I see... you're using newArray.split(','); to break up the strings
Bob Evermore
@BeeQuickest
May 14 2016 08:17
Isn't that supposed to convert a string to an array?
Adam Parker
@amichaelparker
May 14 2016 08:17
@BeeQuickest It is, but it is making an array of strings
so instead of [5,27,39,1001], you're getting ["5","27","39","1001"]
Bob Evermore
@BeeQuickest
May 14 2016 08:18
@amichaelparker Yet when I try to use valueOf() to convert from string to value, I get error messages
Keone Martin
@Athaman
May 14 2016 08:18
you probably want parseInt() ?
Adam Parker
@amichaelparker
May 14 2016 08:19
if (w < 1) {
    newArray = tempLargest;
    //console.log("w = " + w + " newArray = " + newArray);
  } else {
  newArray = newArray+","+tempLargest;
    //console.log("w = " + w + " newArray = " + newArray);
  tempLargest = 0; 
  }
Keone Martin
@Athaman
May 14 2016 08:19
wait nevermind me >.>
Adam Parker
@amichaelparker
May 14 2016 08:20
that is where you're turning the arrays into numbers ... instead of newArray = tempLargest, maybe newArray.push(tempLargest)?
Gopitrinadh
@mgopitrinadh
May 14 2016 08:22

Hi, am new to javascript & in learning phasecan anyone help me understand what this line means in javascript

if(+variable > 0) // query: What is the importance of '+' in this condition?

Adam Parker
@amichaelparker
May 14 2016 08:22
yeah, change both of those lines to "newArray.push(tempLargest)" in both the is and else, then return newArray
*if
if (w < 1) {
    newArray.push(tempLargest);
    //console.log("w = " + w + " newArray = " + newArray);
  } else {
  newArray.push(tempLargest);
    //console.log("w = " + w + " newArray = " + newArray);
  tempLargest = 0; 
  }  
}
  //arr=newArray.split(',');
  //console.log("arr = " + arr);
  console.log(arr);
  return newArray;
}
Bob Evermore
@BeeQuickest
May 14 2016 08:26
@amichaelparker OK, I appreciate your help. Now I've created a logic error that I'll have to unwind. Thanks for your suggestions!
CamperBot
@camperbot
May 14 2016 08:26
beequickest sends