These are chat archives for FreeCodeCamp/HelpJavaScript

21st
Jan 2017
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:00
@Margaret2 what am I then ........
Margaret
@Margaret2
Jan 21 2017 00:00
the Black Panther? :D
from Civil War
Ademola Adegbuyi
@ooade
Jan 21 2017 00:00
@johnnunns return z and you're done :wink:
I'd prefer to be Iron Man :wink:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:01
@Margaret2 nah....
Margaret
@Margaret2
Jan 21 2017 00:01
hmm...
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:01
@Margaret2 am thinking Hulk
Margaret
@Margaret2
Jan 21 2017 00:01
lol
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:02
or Ant Man
Margaret
@Margaret2
Jan 21 2017 00:02
ooh ant man, yes! :+1:
Ademola Adegbuyi
@ooade
Jan 21 2017 00:02
Ant Man @Lumexralph
:clap:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:03
@ooade :laughing:
John Nunns
@johnnunns
Jan 21 2017 00:03
how on earth am i printing this - [, , , , , 1, 2, 3, 4, 5]
haha
Ademola Adegbuyi
@ooade
Jan 21 2017 00:03
@johnnunns Now you're getting reasonable results, right?
@johnnunns Looks good tho. On to the next level
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:04
or let me see Antulk
Ademola Adegbuyi
@ooade
Jan 21 2017 00:04
Lets see what you got
Margaret
@Margaret2
Jan 21 2017 00:04
:flushed: !? @Lumexralph
Ademola Adegbuyi
@ooade
Jan 21 2017 00:04
@Lumexralph na, don't slice n join em
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:04
@ooade @Margaret2 Antulk
John Nunns
@johnnunns
Jan 21 2017 00:04
function countBy(x, n) {
  var z = [];
  z.length = n;
for(i=x; i<=n; i+=x){ 
 z.push(i);
 console.log(i);
  }
  return z;
}
when (2,4) is run i just get [,,,,,2,4] though
Ademola Adegbuyi
@ooade
Jan 21 2017 00:05
@Margaret2 What should be the result of 2, 4?
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:05
@ooade :laughing: like those 2 characters.....
Margaret
@Margaret2
Jan 21 2017 00:05
@johnnunns because you are pushing stuff on to the end instead of inserting it in the right place
Stephen James
@sjames1958gm
Jan 21 2017 00:05
@johnnunns don't set the length then push - you are adding to length
@johnnunns just push
Margaret
@Margaret2
Jan 21 2017 00:06
@ooade [2, 4]
Ademola Adegbuyi
@ooade
Jan 21 2017 00:06
Dear God
Margaret
@Margaret2
Jan 21 2017 00:06
lol
John Nunns
@johnnunns
Jan 21 2017 00:06
@ooade [2,4,6,8,10]
Ademola Adegbuyi
@ooade
Jan 21 2017 00:06
@johnnunns why did you set the length?
@johnnunns It should be [2, 4]??
@Lumexralph What character am i?
John Nunns
@johnnunns
Jan 21 2017 00:07
no n equals the length of the array
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:07
some codes are scary :smile:
Margaret
@Margaret2
Jan 21 2017 00:07
@johnnunns @ooade no wait, (2,5) -> [2,4,6,8,10]
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:07
@ooade let me see.....
Margaret
@Margaret2
Jan 21 2017 00:07
(2,4) -> [2,4,6,8]
John Nunns
@johnnunns
Jan 21 2017 00:07
yeah sorry 2,4 would just be 2,4,6,8
Ademola Adegbuyi
@ooade
Jan 21 2017 00:07
@Margaret2 yeah :+1:
John Nunns
@johnnunns
Jan 21 2017 00:08
so I set the length so n would tell it that's how many numbers to go in
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:08
Wolverine
John Nunns
@johnnunns
Jan 21 2017 00:08
but just got a lot of commas
haha
Ademola Adegbuyi
@ooade
Jan 21 2017 00:08
@Lumexralph Wolverine seem nice :laughing:
@johnnunns what did you do again?
Margaret
@Margaret2
Jan 21 2017 00:09
@johnnunns you're getting commas because you have to either set the length of the array or use push, can't do both
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:10
Flash and Wolverine @Margaret2 @ooade
John Nunns
@johnnunns
Jan 21 2017 00:10
well just using push doesn't work with my for loop i guess
function countBy(x, n) {
  var z = [];

for(i=x; i<=n; i+=x){ 
 z.push(i);
 console.log(i);
  }
  return z;
}
Stephen James
@sjames1958gm
Jan 21 2017 00:10
@johnnunns need a differeent loop from 0 to n - 1
John Nunns
@johnnunns
Jan 21 2017 00:11
I have to nest one? @sjames1958gm
this is on codewars btw @sjames1958gm
Ademola Adegbuyi
@ooade
Jan 21 2017 00:11
@johnnunns you should also always try to declare your variable in the loop too
Stephen James
@sjames1958gm
Jan 21 2017 00:11
@johnnunns no use the loop to count to n
Ademola Adegbuyi
@ooade
Jan 21 2017 00:12
@johnnunns I'm on codewars too :tongue:
Margaret
@Margaret2
Jan 21 2017 00:12
@johnnunns right, you should be counting from 0 to n, because n is how many times you have to add a number to the array
0 to n-1 i mean
David Amanze
@GodKingShogun
Jan 21 2017 00:12
can someone give me advise on the chunky monkey chanllenge. i started it and not sure how to complete it

function chunkArrayInGroups(arr, size) {
  // Break it up. 
  var davidAwesome=[];
  for (var i=0; i<arr.length; i++) {

   }


return davidAwesome;
}
Margaret
@Margaret2
Jan 21 2017 00:13
@GodKingShogun you have to change this: i++ so you can go through the array by size instead of by 1
David Amanze
@GodKingShogun
Jan 21 2017 00:13
challenge*
Margaret
@Margaret2
Jan 21 2017 00:14
and change davidAwesome to margaretSplendid @GodKingShogun
:trollface:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:14
@Margaret2 :+1:
@GodKingShogun or var antulk
Margaret
@Margaret2
Jan 21 2017 00:14
LOL
Coding Machine
@EphremL
Jan 21 2017 00:15
Access Array Data with Indexes can someone help me with this question
Ademola Adegbuyi
@ooade
Jan 21 2017 00:15
SMH :trollface:
John Nunns
@johnnunns
Jan 21 2017 00:15
@sjames1958gm clarifying so I need a separate for loop or just to rework my current one to count to n-1?
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:15
@ooade lol
Margaret
@Margaret2
Jan 21 2017 00:15
@EphremL what have you tried
David Amanze
@GodKingShogun
Jan 21 2017 00:15
@Margaret2 will this suffice

function chunkArrayInGroups(arr, size) {
  // Break it up. 
  var margaretSplendid=[];
  for (var i=0; i<arr.length; i+=size ) {
    }


return margaretSpendid;
}
Joseph
@revisualize
Jan 21 2017 00:15
function someArguments (name) {
     console.log(name);
     console.log(arguments);
     return "Hello " + name;
}
someArguments("Happy", "Feet", "has", "rhythm", "soul", "groove", "and", "when", "he", "starts", "to", "tap", "his", "feet.", "He", "really", "shakes", "his", "tail", "feather");
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:15
@EphremL what have you done?
Margaret
@Margaret2
Jan 21 2017 00:16
@GodKingShogun that is perfect :+1:
David Amanze
@GodKingShogun
Jan 21 2017 00:16

function chunkArrayInGroups(arr, size) {
  // Break it up. 
  var margaretSplendid=[];
  for (var i=0; i<arr.length; i+=size ) {
    }


return margaretSplendid;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
Coding Machine
@EphremL
Jan 21 2017 00:16

// Example
var ourArray = [1,2,3];
var ourData = ourArray[0]; // equals 1

// Setup
var myArray = [1,2,3];

// Only change code below this line.

var myData= [1];
so far nothing i have tried worked.
Joseph
@revisualize
Jan 21 2017 00:16
@EphremL You're not accessing myArray
David Amanze
@GodKingShogun
Jan 21 2017 00:16
@EphremL what are you suppose to be doing
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:16
@EphremL where's your myArray?
Joseph
@revisualize
Jan 21 2017 00:16
They're supposed to be getting data out of myArray
Ademola Adegbuyi
@ooade
Jan 21 2017 00:16
@johnnunns your current one can still work fine. Your second argument in the for loop would just change to z.length < n;
Margaret
@Margaret2
Jan 21 2017 00:16
@GodKingShogun so now you have to get the value that is at position i in the array and add it to margaretSplendid
Ademola Adegbuyi
@ooade
Jan 21 2017 00:17
about @Margaret2
CamperBot
@camperbot
Jan 21 2017 00:17
:star2: 1284 | @margaret2 |http://www.freecodecamp.com/margaret2
Coding Machine
@EphremL
Jan 21 2017 00:17
i tried to do var myData = myArray; but it doesnt work.
Ademola Adegbuyi
@ooade
Jan 21 2017 00:17
Well, you have lotta brownies :smile:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:17
@EphremL use the index number to access it
Garrus Napp
@GarrusNapp
Jan 21 2017 00:17
@EphremL consider their example one more time var ourData = ourArray[0];
Margaret
@Margaret2
Jan 21 2017 00:17

@EphremL example:

var ourData = ourArray[0];

your code should replace our with my

Manish Giri
@Manish-Giri
Jan 21 2017 00:18
@GodKingShogun :wave:
Coding Machine
@EphremL
Jan 21 2017 00:18
let me try
Margaret
@Margaret2
Jan 21 2017 00:18
about @ooade
CamperBot
@camperbot
Jan 21 2017 00:18
:cookie: 833 | @ooade |http://www.freecodecamp.com/ooade
David Amanze
@GodKingShogun
Jan 21 2017 00:18
@Manish-Giri hello manish sama
Ademola Adegbuyi
@ooade
Jan 21 2017 00:18
:laughing:
Coding Machine
@EphremL
Jan 21 2017 00:18
it worked thank you @Margaret2 , @Lumexralph
CamperBot
@camperbot
Jan 21 2017 00:18
ephreml sends brownie points to @margaret2 and @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1285 | @margaret2 |http://www.freecodecamp.com/margaret2
:cookie: 794 | @lumexralph |http://www.freecodecamp.com/lumexralph
David Amanze
@GodKingShogun
Jan 21 2017 00:19
@Margaret2 if i use +=size as the final expression wont some elements be skipped in my array
Margaret
@Margaret2
Jan 21 2017 00:19
@GodKingShogun isn't that the point
Ademola Adegbuyi
@ooade
Jan 21 2017 00:19
@GodKingShogun Hold your katana and imagine chunking the arr in groups
Margaret
@Margaret2
Jan 21 2017 00:19
@GodKingShogun like (["a", "b", "c", "d"], 2) should return ["b", "d"]
Coding Machine
@EphremL
Jan 21 2017 00:20
Modify Array Data With Indexes how does this one work.
David Amanze
@GodKingShogun
Jan 21 2017 00:20
@Margaret2 no i am suppose to make multi dimensional arrays with elements with the giving size
Margaret
@Margaret2
Jan 21 2017 00:20
or was it [["a", "b"], ["c", "d"]] @GodKingShogun
David Amanze
@GodKingShogun
Jan 21 2017 00:20
@Margaret2 yes the latter
John Nunns
@johnnunns
Jan 21 2017 00:20
@ooade well it definitely worked, can we run exactly through what that for loop is saying? I'll say what i'm interpreting it as first and then maybe you can give some clarity
Margaret
@Margaret2
Jan 21 2017 00:20
ok, so try using .slice() to get a slice out of the array @GodKingShogun
Margaret Greaney
@greaneym
Jan 21 2017 00:20
hello I need some help with css please. I have a background image that I want to use clip-path with to clip the bottom.
John Nunns
@johnnunns
Jan 21 2017 00:20
function countBy(x, n) {
  var z = [];

for(var i=x; z.length<n; i+=x){ 
 z.push(i);
 console.log(i);
  }
  return z;
}
Margaret Greaney
@greaneym
Jan 21 2017 00:21
clip-path: inset(10px 20px 130px 40px);
Ademola Adegbuyi
@ooade
Jan 21 2017 00:21
@johnnunns Yay!
Margaret
@Margaret2
Jan 21 2017 00:21
@GodKingShogun and then push it into your new array
Margaret Greaney
@greaneym
Jan 21 2017 00:21
how do I use that to clip the background image please?
Coding Machine
@EphremL
Jan 21 2017 00:21
nvm i understand
John Nunns
@johnnunns
Jan 21 2017 00:22
so for (2,5) - 2 is the initial value of i. as long as the bracket length of z is less than 5 - i will increment by 2
Margaret
@Margaret2
Jan 21 2017 00:22
@johnnunns don't start from x, start from i=0 and go up to i<=n-1
Ademola Adegbuyi
@ooade
Jan 21 2017 00:22
@johnnunns Taking 2 and 5 as arguments. You start at 2, keep on looping till z gets full, and increment by 2 :smile:
John Nunns
@johnnunns
Jan 21 2017 00:22
and the push is just to get i into z
Margaret Greaney
@greaneym
Jan 21 2017 00:22
html {
background: url(http://classroomclipart.com/images/gallery/Weather/Clouds/beautiful_blue_sky.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
//opacity: 0.;
//z-index: 10;
clip-path: inset(10px 20px 130px 40px);
}
but that does not work to clip the bottom of the image.
Margaret
@Margaret2
Jan 21 2017 00:22
@greaneym this is a JavaScript room, not really for CSS, try in the main help room https://gitter.im/freecodecamp/help
Margaret Greaney
@greaneym
Jan 21 2017 00:23
ok thanks
Ademola Adegbuyi
@ooade
Jan 21 2017 00:23
@johnnunns a while/ do while loop would have just been cool
David Amanze
@GodKingShogun
Jan 21 2017 00:23
@Margaret2 so this is what i have so far

function chunkArrayInGroups(arr, size) {
  // Break it up. 
  var margaretSplendid=[];
  for (var i=0; i<arr.length; i++ ) {
    arr.slice(size);
  }


return margaretSplendid;
}
John Nunns
@johnnunns
Jan 21 2017 00:23
@Margaret2 starting at zero wouldn't work would it?
David Amanze
@GodKingShogun
Jan 21 2017 00:23
im not sure when to push it
would it be in the loop or outside the loop
Ademola Adegbuyi
@ooade
Jan 21 2017 00:24
@GodKingShogun you're slicing em and you're not pushing to margetSplendid :wink:
Margaret
@Margaret2
Jan 21 2017 00:24
@johnnunns a loop from 0 to 3 is what you need if you want to add 4 numbers to your array
Coding Machine
@EphremL
Jan 21 2017 00:24

// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];

// Only change code below this line.
var myData = myArray[0][0];
var myArray = myData[8];
Access MultiDimensional Arrays With Indexes: Help me with this i really dont understand.
Margaret
@Margaret2
Jan 21 2017 00:24
@GodKingShogun arr.slice(size) will always return the same slice though, try arr.slice(i, size)
then it will start from the current position rather than the beginning
of the array
John Nunns
@johnnunns
Jan 21 2017 00:25
maybe it's just another way of doing it but the code I have is working. Not when I change it though
Margaret
@Margaret2
Jan 21 2017 00:25
oh, well if it's working, great! :+1:
James Shore
@Jimbobmahooley
Jan 21 2017 00:26
function mutation(arr) {
  var indexPoint = [];
  for (var i=0; i < arr[1].length; i++) {
 indexPoint.push(arr[0].toLowerCase().indexOf(arr[1].toLowerCase()[i]));
  }
  for (var j=0; j < indexPoint.length; j++) {
    if (indexPoint[j] < 0) {
      return false;
    }
    else {
      return true;
    }
  }
}
Hello, I am currently doing the mutations challenge and it works for all the test cases except, mutation(["hello", "hey"]) it returns true when it should return false, if someone could help I'd really appreciate it, also I'm not sure whether this is the best way to do it so any ideas on that would be great as well, thanks in advance :smile:
John Nunns
@johnnunns
Jan 21 2017 00:26
thanks guys, @Margaret2 @ooade
CamperBot
@camperbot
Jan 21 2017 00:26
johnnunns sends brownie points to @margaret2 and @ooade :sparkles: :thumbsup: :sparkles:
:star2: 1286 | @margaret2 |http://www.freecodecamp.com/margaret2
:cookie: 834 | @ooade |http://www.freecodecamp.com/ooade
Manish Giri
@Manish-Giri
Jan 21 2017 00:26
@EphremL var myArray = myData[8]; is wrong
John Nunns
@johnnunns
Jan 21 2017 00:26
expect 1000 more questiongs here in a second
Ademola Adegbuyi
@ooade
Jan 21 2017 00:26
@johnnunns LOL :smile:
Coding Machine
@EphremL
Jan 21 2017 00:26
where did i go wrong @Manish-Giri
David Amanze
@GodKingShogun
Jan 21 2017 00:27
@Margaret2 still not sure when and how i would push the slices into my empty array
Manish Giri
@Manish-Giri
Jan 21 2017 00:27
@EphremL so, I'm guessing you need to fetch the number 8 from the array
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];
Coding Machine
@EphremL
Jan 21 2017 00:28
nvm , i figured it out its supposed to be addition such as 4+4 to make 8 but thanks anyway @Manish-Giri
CamperBot
@camperbot
Jan 21 2017 00:28
ephreml sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3905 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jan 21 2017 00:28
not quite
but okay
Ademola Adegbuyi
@ooade
Jan 21 2017 00:28
@GodKingShogun You can't just push. You need to do some calc on the slice method
Your Senpai is here :smile:
John Nunns
@johnnunns
Jan 21 2017 00:29
function countBy(x, n) {
  var z = []
  for (var i = 1; i <= n; i++) {
    z.push(x* i);
  }
  return z
}
David Amanze
@GodKingShogun
Jan 21 2017 00:29
@ooade idu
John Nunns
@johnnunns
Jan 21 2017 00:29
looks like i overcomplicated it :)
Toby King
@shiv379
Jan 21 2017 00:30
I'm having a jQuery/JSON problem. Trying to use the API http://forismatic.com/en/api/ to get a random quote and I'm getting the error
"No 'Access-Control-Allow-Origin' header is present on the requested resource"
From what I read this is because it's a cross-domain request. But isn't that half the purpose of AJAX and APIs??
Stephen James
@sjames1958gm
Jan 21 2017 00:30
@johnnunns that looks good
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:31
@shiv379 nope, CORS issue is a security protocol by browsers to avoid unsecure connection
John Nunns
@johnnunns
Jan 21 2017 00:31
@sjames1958gm wasn't my solution haha
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:31
@shiv379 you should use JSON-P if the API supports it, that's one of the ways to avoid CORS issues
Stephen James
@sjames1958gm
Jan 21 2017 00:32
@johnnunns oh oops
John Nunns
@johnnunns
Jan 21 2017 00:32
but a good code to discuss for me @sjames1958gm
so where I was mistaken is I thought I had to set n to be the length, but just saying i<=n naturally does that?
David Amanze
@GodKingShogun
Jan 21 2017 00:33
@ooade still there
Stephen James
@sjames1958gm
Jan 21 2017 00:34
@johnnunns When you push n times you get length n ( I am not a fan of setting array length because you end up with null values)
Ademola Adegbuyi
@ooade
Jan 21 2017 00:34
@johnnunns Did you join the FreeCodeCamp clan?
@GodKingShogun Yeah
David Amanze
@GodKingShogun
Jan 21 2017 00:34
@ooade you were saying i needed to do some calculation on the slice
John Nunns
@johnnunns
Jan 21 2017 00:35
@ooade I'll do that now!
@sjames1958gm Ok, after almost giving myself a migraine, I think I comprehend it
you're pushing each time until i equals the "length"
Ademola Adegbuyi
@ooade
Jan 21 2017 00:37
@GodKingShogun Yeah. Slice can take two argument(startIndex and StopIndex ) so you need to figure out a way to hack the both of em to walk you through the result
David Amanze
@GodKingShogun
Jan 21 2017 00:37
@Manish-Giri how is the anime suggestions going
Ademola Adegbuyi
@ooade
Jan 21 2017 00:38
Anime freaks :laughing:
David Amanze
@GodKingShogun
Jan 21 2017 00:38
@ooade would i have it like slice(i,size)
Ademola Adegbuyi
@ooade
Jan 21 2017 00:39
@GodKingShogun what about the second iteration?
size will remain the same, the only thing that changes is i
Stephen James
@sjames1958gm
Jan 21 2017 00:40
@johnnunns yes.
David Amanze
@GodKingShogun
Jan 21 2017 00:40
@ooade isn't that what i want
Ademola Adegbuyi
@ooade
Jan 21 2017 00:41
@GodKingShogun I meant .slice(i, i + size)
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:42
@ooade FreeCodeCamp clan? what's it about?
Edin
@sombrerox
Jan 21 2017 00:42
What's the issue here guys ? I get: "TypeError: Cannot read property 'visits' of undefined
at greetCustomer:25:36
at eval:47:1
at eval"
var customerData = {
  'Joe': {
    visits: 1
  },
  'Carol': {
    visits: 2
  },
  'Howard': {
    visits: 3,
  },
  'Carrie': {
    visits: 4
  }
};

function greetCustomer(firstName) {
  var greeting = "";

  // your code here

  if (customerData.hasOwnProperty(firstName) === false){

     greeting = "Welcome! Is this your first time?";

  } else if (customerData.firstName.visits === 1){

      greeting = "Welcome back, Joe! We're glad you liked us the first time!";

  } else if (customerData.firstName.visits > 1){

      greeting = "Welcome back, Carol! So glad to see you again!";

  }
    return greeting;

}

greetCustomer("Joe");
Ademola Adegbuyi
@ooade
Jan 21 2017 00:43
@GodKingShogun
First iteration -> slice(0, 4);
Second ----- -- > slice(4, 8); and so..
@Lumexralph Codewars decided to go the ninja way, we have different clans. Might be a school, organization or so.. We have stuffs like kata, clan n so.. :smile:
P. Silva
@psilva00
Jan 21 2017 00:44
@sombrerox try bracket notation instead: customerData[firstName].visits
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:45
@sombrerox customerData.firstName firstName is a parameter not a valid identifier in your object, dot method won't work use bracket method
Edin
@sombrerox
Jan 21 2017 00:46
@Lumexralph oh wow, you're right, let me try it
David Amanze
@GodKingShogun
Jan 21 2017 00:46
@ooade lets say the size is 2 and the array is [1,2,3,4] and the slice is slice(i,i+2) wont slice return [1,2,3] which would be wrong
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:46
@ooade i still don't get
Ademola Adegbuyi
@ooade
Jan 21 2017 00:47
@Lumexralph check out codewars.com
Edin
@sombrerox
Jan 21 2017 00:47
@Lumexralph ty man, it really was the issue, thank you again
CamperBot
@camperbot
Jan 21 2017 00:47
sombrerox sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 795 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ademola Adegbuyi
@ooade
Jan 21 2017 00:47
@GodKingShogun slice will return [1, 2] not [1, 2, 3]
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:47
@ooade i understand... how does that apply to FCC clan?
@sombrerox :+1:
Ademola Adegbuyi
@ooade
Jan 21 2017 00:48
@GodKingShogun The second argument is like a stop point, not an index
@Lumexralph Just to see ourselves. LOL :smile:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:50
oh
i'll go with naruto then
Ademola Adegbuyi
@ooade
Jan 21 2017 00:51
hmmm..
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:51
Genin, Chunin, Jonin, kage, Jinchuriki
David Amanze
@GodKingShogun
Jan 21 2017 00:51
@ooade ok got it but if we are looping through the array and slice is the way it is won it still be wrong. like if [1,2,3,4] was our array the first iteration would retun [1,2] and the second would return [2,3]
Ademola Adegbuyi
@ooade
Jan 21 2017 00:52
I'm an anime freak. You'll just get tired if i start @Lumexralph :laughing:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:52
@ooade then don't
Ademola Adegbuyi
@ooade
Jan 21 2017 00:52
@GodKingShogun Now you're getting there
David Amanze
@GodKingShogun
Jan 21 2017 00:52
@ooade im a bigger anime freak than you SENPAI
Ademola Adegbuyi
@ooade
Jan 21 2017 00:52
@GodKingShogun Almost done :smile:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:52
@GodKingShogun :large_blue_diamond:
Ademola Adegbuyi
@ooade
Jan 21 2017 00:52
@GodKingShogun What?!!! Watching anime since birth :laughing:
@GodKingShogun What remains is to increment your loop with the size, instead of 1
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:53
@GodKingShogun :smile: you're Japanese ?
the Shogun in your name picked my interests Shogunate
David Amanze
@GodKingShogun
Jan 21 2017 00:54
@ooade i can name all the mist swordsmen and their sword name SENPAI
from naruto
Ademola Adegbuyi
@ooade
Jan 21 2017 00:54
@GodKingShogun You're an anime Nerd then
David Amanze
@GodKingShogun
Jan 21 2017 00:54
@ooade HAI
Ademola Adegbuyi
@ooade
Jan 21 2017 00:54
Mist guys!! Can't remember em all sef
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:54
@GodKingShogun seriously?! you're an Anime geek
@ooade they are 7
David Amanze
@GodKingShogun
Jan 21 2017 00:55
@Lumexralph yes and i am a proud one
Ademola Adegbuyi
@ooade
Jan 21 2017 00:55
It's been long i saw naruto
I completed it with manga :laughing:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:55
@ooade i saw it all
Ademola Adegbuyi
@ooade
Jan 21 2017 00:56
@Lumexralph I still need to see Naruto's battle with Sasuke tho :worried:
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:56
@GodKingShogun i came across it in a book am currently reading
David Amanze
@GodKingShogun
Jan 21 2017 00:56
@ooade i can name all the captains and vice captains and their swords, shikai and bankai name from bleach
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:56
@ooade very bloody battle, they lost an arm each
Ademola Adegbuyi
@ooade
Jan 21 2017 00:57
@GodKingShogun Hahaha.. ... Can you name all the quincy's :wink:
David Amanze
@GodKingShogun
Jan 21 2017 00:57
FUCK QUINCYS LOL
Ogundele Olumide
@Lumexralph
Jan 21 2017 00:57
@ooade fought from dawn till dusk
Coding Machine
@EphremL
Jan 21 2017 00:57
Global Scope and Functions: can somone help me with this
Ademola Adegbuyi
@ooade
Jan 21 2017 00:58
Or all the Heuco Mundo dudes, From Rank 1 to the end :wink:
David Amanze
@GodKingShogun
Jan 21 2017 00:58
@ooade jk. i dont read manga. still waiting for the anime adaptation for the rest of bleach
Ademola Adegbuyi
@ooade
Jan 21 2017 00:58
@EphremL What did you try?
David Amanze
@GodKingShogun
Jan 21 2017 00:58
i was disappointed with the fullbring arc
Ademola Adegbuyi
@ooade
Jan 21 2017 00:58
@GodKingShogun Couldn't wait :laughing:
Coding Machine
@EphremL
Jan 21 2017 00:58
nothing i really dont understand this @ooade
David Amanze
@GodKingShogun
Jan 21 2017 00:59
i was also disappointed with ichigo's ass pull transformation from the aizen arc too
up until then it was going superb
Coding Machine
@EphremL
Jan 21 2017 00:59
after i finish this im gonna go get some clorax
Ademola Adegbuyi
@ooade
Jan 21 2017 00:59
@EphremL global variables are declared without the var keywords while local variable are declared with the var keyword
@GodKingShogun You wanted more :laughing:
@GodKingShogun Saitama will beat his ass :laughing:
Waiting for OPM S2 :smile:
David Amanze
@GodKingShogun
Jan 21 2017 01:01
@ooade if you subtract the full bring arc and ichigo's transformation bleach is still easily top 10 animes so yea i want more
Ademola Adegbuyi
@ooade
Jan 21 2017 01:01
@GodKingShogun Yeah, bleach is one of my best
leruzal
@leruzal
Jan 21 2017 01:02
anybody help me with counting cards challenge
Ademola Adegbuyi
@ooade
Jan 21 2017 01:02
I'll rate it higher than Naruto
@leruzal Your code?
Coding Machine
@EphremL
Jan 21 2017 01:02
nah @ooade Naruto is pretty good as far as anime goes
Ademola Adegbuyi
@ooade
Jan 21 2017 01:02
It's 2:02 AM. LOL
@EphremL Naruto was my first anime :smile:
Bleach was just something else :laughing:
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:03
@leruzal show your code
David Amanze
@GodKingShogun
Jan 21 2017 01:03
@ooade if you read about kubo who is the bleach writer and what he was going through you would understand why the quality of bleach dipped
Coding Machine
@EphremL
Jan 21 2017 01:03
did you finish shippeden? @ooade
Ademola Adegbuyi
@ooade
Jan 21 2017 01:03
I love bleach's soundtrack too :smile:
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:03
@ooade @GodKingShogun seriously!
leruzal
@leruzal
Jan 21 2017 01:03

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card==2||card==3||card==4||card==5||card==6)

    return "1 Bet" ; 

  // 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');
Ademola Adegbuyi
@ooade
Jan 21 2017 01:03
@EphremL Yeah, i did
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:03
@EphremL i finished it
Ademola Adegbuyi
@ooade
Jan 21 2017 01:04
@Lumexralph I told you :laughing:
Coding Machine
@EphremL
Jan 21 2017 01:04
im waiting for baruto to come out
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:04
@leruzal increment or decrement count based on the condition don't return it yet
Ademola Adegbuyi
@ooade
Jan 21 2017 01:04
@Lumexralph I'm working on creating a site for this kinda discussion :laughing:
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:04
@EphremL nah i think am done with long Anime
Ademola Adegbuyi
@ooade
Jan 21 2017 01:04
@EphremL I thought it was out
David Amanze
@GodKingShogun
Jan 21 2017 01:05
Naruto and shippuden has i think 40 percent filler
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:05
@ooade got loads of books to read
Margaret
@Margaret2
Jan 21 2017 01:05
@leruzal you have to count up the score first, with an if statement or a switch statement, and then with a separate if statement return the right words
Coding Machine
@EphremL
Jan 21 2017 01:05
@ooade it out but not avalaible yes
yet*
Coy Sanders
@coymeetsworld
Jan 21 2017 01:05
@GodKingShogun i would say over half
David Amanze
@GodKingShogun
Jan 21 2017 01:05
but its still easily top 5 animes lol
Ademola Adegbuyi
@ooade
Jan 21 2017 01:05
@Lumexralph Then take on "Attack on Titans, One Punch Man, Ao No Exorcist, Mob Psycho 100 and so...
Coding Machine
@EphremL
Jan 21 2017 01:06
earlier i was watching Naruto the Movie 3: Guardians of the Crescent Moon Kingdom but i had to do hour of code
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:06
Flash !!
leruzal
@leruzal
Jan 21 2017 01:06
@Margaret2 u mean add the count
Coding Machine
@EphremL
Jan 21 2017 01:06
Boruto: Naruto the Movie english adio not out
David Amanze
@GodKingShogun
Jan 21 2017 01:06
@coymeetsworld its a lot regardless lol
not all the fillers are bad though
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:06
@leruzal she meant in your if statements decrement count or increment count
Margaret
@Margaret2
Jan 21 2017 01:06
@leruzal yeah, count is the variable that keeps track of the score. The tests will call the function multiple times in a row to change the count
Ademola Adegbuyi
@ooade
Jan 21 2017 01:07
@EphremL I prefer to watch in Japanese :laughing:
Coy Sanders
@coymeetsworld
Jan 21 2017 01:07
@GodKingShogun yeah some of it is ok, I didn't know what filler was until I started watching Naruto
David Amanze
@GodKingShogun
Jan 21 2017 01:07
and they give a better understanding to the Naruto verse
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:07
@coymeetsworld yeah a lot of fillers
Coding Machine
@EphremL
Jan 21 2017 01:07
oh :laughing:
Coy Sanders
@coymeetsworld
Jan 21 2017 01:07
and I kept wondering, when are they going to go after Sasuke? Or when is Naruto going to get trained? They're spending alot of time on these side missions lol
Coding Machine
@EphremL
Jan 21 2017 01:07
i didnt like the way that Madara was made in naruto
Coy Sanders
@coymeetsworld
Jan 21 2017 01:08
yeah and I only watch it subbed
only a few anime i can stand in English
Ademola Adegbuyi
@ooade
Jan 21 2017 01:08
Madara was perfect :smile:
Coding Machine
@EphremL
Jan 21 2017 01:08
his backstory tho...
Ademola Adegbuyi
@ooade
Jan 21 2017 01:08
@coymeetsworld Yeah, English sucks :laughing:
David Amanze
@GodKingShogun
Jan 21 2017 01:08
you know which anime tops all of them and has less than 10 percent filler i think. if it has more it doesnt feel like filler
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:09
@leruzal you know how to increment and decrement, right?
Toby King
@shiv379
Jan 21 2017 01:10
@Lumexralph thanks I changed the source and it's working now. Frustrating when you come up against these issues which make what should be simple so much more complicated!
CamperBot
@camperbot
Jan 21 2017 01:10
shiv379 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 796 | @lumexralph |http://www.freecodecamp.com/lumexralph
Coding Machine
@EphremL
Jan 21 2017 01:10
the only anime i dont like is going to be dargon ball z
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:10
@EphremL why?
@shiv379 cool
leruzal
@leruzal
Jan 21 2017 01:10
@Lumexralph +
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:11
@leruzal count++ and that should give you idea of decrement count too
Coding Machine
@EphremL
Jan 21 2017 01:11
because i just dont like the action base they have . i watch a couple of episodes but i soon became unintreasted
David Amanze
@GodKingShogun
Jan 21 2017 01:12
@EphremL i haven't watched any of the db until dragon ball super because the animation is just so bad and i cant get over it. if you have played the games enough time then you can pretty much fill in the story line of the events before super
Jamil Akhtar
@frontender007
Jan 21 2017 01:12
anyone knows how to generate prime numbers ?
Ademola Adegbuyi
@ooade
Jan 21 2017 01:12
@EphremL i didn't watch DZB
:laughing:
Coding Machine
@EphremL
Jan 21 2017 01:12
i feel what you mean @GodKingShogun
Ademola Adegbuyi
@ooade
Jan 21 2017 01:13
And they still hype Goku well :smile:
David Amanze
@GodKingShogun
Jan 21 2017 01:13
i got to ep 4 of dragon ball and i wanted to end everything lol
Coding Machine
@EphremL
Jan 21 2017 01:13
@ooade you should at least give it a try people say it's good but i didnt like it.
lol same @GodKingShogun :shipit:
Ademola Adegbuyi
@ooade
Jan 21 2017 01:13
@EphremL Didn't like it too.. I replaced it with One Piece then :smile:
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:14
@frontender007 tried anything?
Coding Machine
@EphremL
Jan 21 2017 01:14
OHHHHH, ONE PEICE IS THE BEST I HAVE WATCHED!!! :laughing:
David Amanze
@GodKingShogun
Jan 21 2017 01:14
@ooade literally the greatest anime mankind has
Coding Machine
@EphremL
Jan 21 2017 01:14
yesss
Ademola Adegbuyi
@ooade
Jan 21 2017 01:14
@EphremL @GodKingShogun I wish to have Haki :laughing:
leruzal
@leruzal
Jan 21 2017 01:15
@Lumexralph so i am gonna make an if statement to increment the count
for 23456
Jamil Akhtar
@frontender007
Jan 21 2017 01:15
@Lumexralph created a for loop but don't know what condition to check to get the prime
Toby King
@shiv379
Jan 21 2017 01:15
I'm desperately trying not to get hooked on Naruto! Normally I prefer shorter shows. Attack on Titan, Psycho Pass, Seven Deadly Sins...
Coding Machine
@EphremL
Jan 21 2017 01:15
lol
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:15
@leruzal yes , you'll need another
David Amanze
@GodKingShogun
Jan 21 2017 01:15
@shiv379 those are all good animes to watch
season two of aot an sds come out this year
Coding Machine
@EphremL
Jan 21 2017 01:16
i like luffy way too much i feel like im addicted to one peiece
leruzal
@leruzal
Jan 21 2017 01:16
@Lumexralph but what i should do with the count 789
it should be zero should i return 0
Ademola Adegbuyi
@ooade
Jan 21 2017 01:16
@GodKingShogun Yeah..... Waiting for AOT
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:16
@leruzal ignore it,because adding 0 will not change the value of count
@leruzal go to the next test
Coding Machine
@EphremL
Jan 21 2017 01:17
attack on titans is pretty good too! @shiv379 i have been watching it latley
Ademola Adegbuyi
@ooade
Jan 21 2017 01:17
@shiv379 Pyscho pass is also cool :smile:
Toby King
@shiv379
Jan 21 2017 01:17
@GodKingShogun I can't wait for S2 of AoT! I see Warner Bros have picked it up for a live action too. I'm sure they'll ruin it
Ademola Adegbuyi
@ooade
Jan 21 2017 01:18
Yeah, me too
David Amanze
@GodKingShogun
Jan 21 2017 01:18
@EphremL i like zorro more. what ep did you catch up to one piece and realize that you would have to wait 7 days, 168 hours,10080 mins, 604800 secs for another eps lol
Toby King
@shiv379
Jan 21 2017 01:18
@EphremL its got a great mix of action, story, and stunning visuals
Coding Machine
@EphremL
Jan 21 2017 01:18
i havent started Phscho pass yet im like watching 3 animes at a time cuz i cant stop myself :laughing:
lol @GodKingShogun
Toby King
@shiv379
Jan 21 2017 01:19
@ooade cool, but disturbing!! I've not watched season 2 yet but there were some seriously dark moments in s1
Ademola Adegbuyi
@ooade
Jan 21 2017 01:20
@frontender007 I check for prime numbers by looping down with the number, then i'll check if a particular index is divisible by the number then exit the loop by returning false, then when it reaches the end and finds no match, return true :smile:
Toby King
@shiv379
Jan 21 2017 01:20
One Punch Man was good fun too. I hope we got more of that.
David Amanze
@GodKingShogun
Jan 21 2017 01:20
im going to have to rewatch aot s1 before season 2 comes out
Coding Machine
@EphremL
Jan 21 2017 01:20
have any of you watched Kenichi
Ademola Adegbuyi
@ooade
Jan 21 2017 01:20
@shiv379 Don't think Mob Psycho S2 is out
David Amanze
@GodKingShogun
Jan 21 2017 01:21
@EphremL classic
Coding Machine
@EphremL
Jan 21 2017 01:21
i finished it but that anime was so good.
Ademola Adegbuyi
@ooade
Jan 21 2017 01:21
@shiv379 One Punch Man is also one of my best
Who have seen Hellsing :wink:
Coding Machine
@EphremL
Jan 21 2017 01:21
and btw Kenichi was my first anime
Ademola Adegbuyi
@ooade
Jan 21 2017 01:21
I don't really like the anime tho
David Amanze
@GodKingShogun
Jan 21 2017 01:21
lol its funny how we turned a javascript chat into an anime chat
Coding Machine
@EphremL
Jan 21 2017 01:22
One punch man is on pause for me cuz thats when i found out about one peice
Ademola Adegbuyi
@ooade
Jan 21 2017 01:22
LOL :smile:
David Amanze
@GodKingShogun
Jan 21 2017 01:23
@EphremL i wish i hadn't watch one piece so i could experience it again
Ademola Adegbuyi
@ooade
Jan 21 2017 01:23
Same ere
Coding Machine
@EphremL
Jan 21 2017 01:23
IKR i wanna do the same lol
Toby King
@shiv379
Jan 21 2017 01:23
I haven't got around to one piece yet but I've heard a lot about it. Isn't it like a million episodes though?
leruzal
@leruzal
Jan 21 2017 01:23

@Lumexralph
```

if (card >= 2 && card <= 6) count++;
else if (card >= 7 && card <= 9);
else count--;
``` thats my code so far now how to make a specific return for each of them

Coding Machine
@EphremL
Jan 21 2017 01:23
Noir was the only anime i didnt like
leruzal
@leruzal
Jan 21 2017 01:24

  if (card >= 2 && card <= 6) count++;
  else if (card >= 7 && card <= 9);
  else count--;
Coding Machine
@EphremL
Jan 21 2017 01:24
@shiv379 you should its really good! trust me once you start there is no going back.
David Amanze
@GodKingShogun
Jan 21 2017 01:24
i think i was hooked when i saw sanjis back story and how owner zeff starved himself and gave sanji all the food but most people say its arlong park
Ademola Adegbuyi
@ooade
Jan 21 2017 01:24
@leruzal looks good
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:25
@leruzal if (card >= 2 && card <= 6) what if it's 2?
Coding Machine
@EphremL
Jan 21 2017 01:25
what do you guys think about RahXephon my friend suggested it but i havent watched it yet
leruzal
@leruzal
Jan 21 2017 01:25
@Lumexralph its greater than or equal
so it will work with 2
however its not the prob
David Amanze
@GodKingShogun
Jan 21 2017 01:26
@EphremL haven't seen it
leruzal
@leruzal
Jan 21 2017 01:26
i wanna make a specific return for each now
@Lumexralph
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:26
@leruzal you need to create another condition
Ademola Adegbuyi
@ooade
Jan 21 2017 01:27
@leruzal :+1:
Coding Machine
@EphremL
Jan 21 2017 01:27
@GodKingShogun what's your favorite anime of all time?
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:27
@leruzal else if (card >= 7 && card <= 9); eliminate this statement it's not doing anything
David Amanze
@GodKingShogun
Jan 21 2017 01:27
@EphremL just looked it up and saw it was a mech anime. if you are looking for a mech anime you should watch code geass
Toby King
@shiv379
Jan 21 2017 01:28
@EphremL lol I'm afraid for my time! I'm already doing five online courses, a teacher training course, and three roles at my job!
Jamil Akhtar
@frontender007
Jan 21 2017 01:28
@ooade can you elaborate a little more please ?
David Amanze
@GodKingShogun
Jan 21 2017 01:28
@EphremL easily one piece
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:28
@leruzal create another condition to decrement count
Coding Machine
@EphremL
Jan 21 2017 01:28
lol @GodKingShogun i love one piece
leruzal
@leruzal
Jan 21 2017 01:29
@Lumexralph its already in else
Coding Machine
@EphremL
Jan 21 2017 01:29
@shiv379 in your free time u should try one piece but now are way to busy
David Amanze
@GodKingShogun
Jan 21 2017 01:29
@EphremL no other anime has made me feel surprised and despair and enjoyment longer than one piece has
Coding Machine
@EphremL
Jan 21 2017 01:30
lol, i still remeber my first time watching it it was way too good of a start with the devil fruit and everything
David Amanze
@GodKingShogun
Jan 21 2017 01:31
@EphremL some animes depreciate over time but one piece just gets better and better and its been in the game for a long time
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:31
@leruzal what's the challenge? returning count + string ?
Coding Machine
@EphremL
Jan 21 2017 01:31
yeA, thats cuz one peice is irresistible
Ademola Adegbuyi
@ooade
Jan 21 2017 01:31

@frontender007 Let's say i want to check if 7 is a prime number or not:

Loop through(i) from 6 to 1 or 1 to 6; the latter is preferable
I'll Check if 7 is divisible by (i)
If it's divisivle, i'll return false in the loop to stop the loop
Then i'll return true outside the loop

@EphremL The humor alone :laughing:
David Amanze
@GodKingShogun
Jan 21 2017 01:32
@EphremL one piece video game needs some work though lol. bought burning blood on release date and so dissapointed
Coding Machine
@EphremL
Jan 21 2017 01:33
i havent played game yet but im look forward to it
David Amanze
@GodKingShogun
Jan 21 2017 01:34
@EphremL i dont want to tell you what to do but DONT GET THE GAME lol. or at least rent it first to see if you like it instead of what my silly self did and bought the game for 80 bucks
leruzal
@leruzal
Jan 21 2017 01:34

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card==2||card==3||card==4||card==5||card==6) count++ ;
 else if(card==7||card==8||card==9) ;

  else count--;
if (count++) return count+' Bet';
 else if (count===0) return count+ "Hold";
  else return count+ " Hold ";




  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc('J'); cc('Q'); cc(7); cc('K'); cc('A');
tell me what is wrong please
Coy Sanders
@coymeetsworld
Jan 21 2017 01:35
if (count++) return count+' Bet';
 else if (count===0) return count+ "Hold";
  else return count+ " Hold ";
couple of issues
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:35
@leruzal how do you check if a number is greater than 0?
Coy Sanders
@coymeetsworld
Jan 21 2017 01:35
count++ shouldn't be in the if statement, that will always return true
Coding Machine
@EphremL
Jan 21 2017 01:35
lol @GodKingShogun
leruzal
@leruzal
Jan 21 2017 01:37
@coymeetsworld it will be true if the the cards are 2,3,4,5,6
Coy Sanders
@coymeetsworld
Jan 21 2017 01:38
no, count++ increments the count value by 1
also count is a running count
meaning it changes as cc is called several times
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:38
@leruzal you should be checking if count is greater than 0 before returning count+' Bet';
Coy Sanders
@coymeetsworld
Jan 21 2017 01:39
so its not if the cards are 2-6 necessarily
leruzal
@leruzal
Jan 21 2017 01:40
ok got it

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card==2||card==3||card==4||card==5||card==6) count++ ;
 else if(card==7||card==8||card==9) ;

  else count--;
if (count>0) return count+' Bet';
  if (count===0) return 0+ "Hold";
  if(count<0) return count+ " Hold";
one more step i have a problem with 0 hold case
Diego Mayer
@Chrono79
Jan 21 2017 01:41
@leruzal if (count===0) return 0+ "Hold"; is wrong, you missed a space there
leruzal
@leruzal
Jan 21 2017 01:42
@Chrono79 how it is supposed to be
just passed it @Chrono79 i just missed a space
Diego Mayer
@Chrono79
Jan 21 2017 01:42
@leruzal if(count<0) return count+ " Hold"; you could use <= or simply else, because in your previous if you used count>0
leruzal
@leruzal
Jan 21 2017 01:42
@Lumexralph @coymeetsworld ty
CamperBot
@camperbot
Jan 21 2017 01:42
leruzal sends brownie points to @lumexralph and @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 797 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 1884 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jan 21 2017 01:43
np @leruzal, look at what @Chrono79 wrote that is the better option. You don't need 3 if statements
you could actually make due with 1
Josh
@JoshSki2416
Jan 21 2017 01:50
Hello I am on challenge 143 and I am not seeing my error var myStr="FirstLine\;\n\SecondLine\\;\rThirdLine"; ??? thanks
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:51
@JoshSki2416 remove ; in between your string
@JoshSki2416 \;\n\SecondLine\\;\rThirdLine
Diego Mayer
@Chrono79
Jan 21 2017 01:51
@JoshSki2416 look at the table, you have more \than needed there too
Josh
@JoshSki2416
Jan 21 2017 01:52
okay i see
thanks @Lumexralph @Chrono79
CamperBot
@camperbot
Jan 21 2017 01:52
joshski2416 sends brownie points to @lumexralph and @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 798 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 3187 | @chrono79 |http://www.freecodecamp.com/chrono79
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:53
@JoshSki2416 :+1:
djphp11
@djphp11
Jan 21 2017 01:56

Hello, Challenge 170:

function nextInLine(arr, item) {
removed = arr.shift();
arr.push(item);
return removed;
}

This won't pass the first step which wants my function to return a value of 1.
but One is never input so how can i shift something never there and return it?

Ogundele Olumide
@Lumexralph
Jan 21 2017 01:57
@djphp11 your order of operation is wrong, push before you shift
djphp11
@djphp11
Jan 21 2017 01:57
thanks ill try this
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:57
@djphp11 all the best
djphp11
@djphp11
Jan 21 2017 01:58
ahhh makes sense, and works! thanks
Ogundele Olumide
@Lumexralph
Jan 21 2017 01:58
@djphp11 :+1:
Terence Stone
@Tmstone
Jan 21 2017 02:02
Hello World. I just completed my Tribute page.
CamperBot
@camperbot
Jan 21 2017 02:02

welcome to FreeCodeCamp @Tmstone!

Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:02
Good evening guys
Ogundele Olumide
@Lumexralph
Jan 21 2017 02:03
@Tmstone it's cool, very cool
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:03
Having a little trouble with this challenge, I've got everything to work except one criteria and I'm cluess as to how to go about it. This is the code:

function truncateString(str, num) {
  var spliceStr = "";
  var threeDots = "...";
 if (str.length >= num) {
      if (num < 3) {
     spliceStr = str.slice(0, num);
     spliceStr += threeDots;
     return spliceStr;
   }
   else {
   spliceStr = str.slice(0, num - 3);
   spliceStr += threeDots;
   return spliceStr;
   }
 }

  else
   {
  return str;  
  }

}

truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2);
The issue I'm having is the string that's being used has a .length + 2 property, which works fine with my code, however I need it to pass without the +2 aswell, but I can't see where I've gone wrong lol. Any ideas?
Terence Stone
@Tmstone
Jan 21 2017 02:05
Thanks @Lumexralph
CamperBot
@camperbot
Jan 21 2017 02:05
tmstone sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 799 | @lumexralph |http://www.freecodecamp.com/lumexralph
Alex
@Joshua-A-Smith
Jan 21 2017 02:07
Do I always have to put the keyword "return" inside of a function?
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:08
@Joshua-A-Smith If you want that function to return something, I think so.
Ogundele Olumide
@Lumexralph
Jan 21 2017 02:08
@Joshua-A-Smith not always...a function can either cause a side effect or return a value
Alex
@Joshua-A-Smith
Jan 21 2017 02:08
@AdamWayne-dev
Very well thanks
CamperBot
@camperbot
Jan 21 2017 02:08
joshua-a-smith sends brownie points to @adamwayne-dev :sparkles: :thumbsup: :sparkles:
:cookie: 249 | @adamwayne-dev |http://www.freecodecamp.com/adamwayne-dev
Alex
@Joshua-A-Smith
Jan 21 2017 02:09
@Lumexralph
Ah thank you as well
CamperBot
@camperbot
Jan 21 2017 02:09
joshua-a-smith sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 800 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jan 21 2017 02:09
@AdamWayne-dev why don't you use a loop?
James Shore
@Jimbobmahooley
Jan 21 2017 02:14
Hello, I am currently working on the seek and destroy challenge and am stuck, I need some help please?
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:14
@Lumexralph To be fair, this was the first attempt at the challenge and I didn't think I'd need a loop for it. It seems to work fine without a loop, I'm now just having trouble getting past this one snag lol. I don't see why .length + 2 would work and yet .length on it's own isn't. How would I go about it with a loop?
Stephen James
@sjames1958gm
Jan 21 2017 02:17
@AdamWayne-dev > num or >= num ?
Ogundele Olumide
@Lumexralph
Jan 21 2017 02:17
@AdamWayne-dev already feeling sleepy here man wish i could spend time with it sorry good @sjames1958gm is here
Stephen James
@sjames1958gm
Jan 21 2017 02:17
@AdamWayne-dev This challenge does not need a loop
Ogundele Olumide
@Lumexralph
Jan 21 2017 02:18
good night
Stephen James
@sjames1958gm
Jan 21 2017 02:18
@Lumexralph :sleepy:
@Jimbobmahooley What is the issue? Can you show your code?
Ogundele Olumide
@Lumexralph
Jan 21 2017 02:19
@sjames1958gm :+1: sage
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:19
@Lumexralph Night man, thank you anyway
CamperBot
@camperbot
Jan 21 2017 02:19
adamwayne-dev sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 801 | @lumexralph |http://www.freecodecamp.com/lumexralph
Charan
@charan1998
Jan 21 2017 02:19
guys can anyone help me with the api for wiki search?!
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:19
@sjames1958gm Yeah I haven't got one in, I'm just missing something and I'm raking my mind for it haha
Stephen James
@sjames1958gm
Jan 21 2017 02:20
@Joshua-A-Smith You should strive to minimize your functions that have side effects.
John Nunns
@johnnunns
Jan 21 2017 02:20
You probably know the "like" system from Facebook and other pages. People can "like" blog posts, pictures or other items. We want to create the text that should be displayed next to such an item.

Implement a function likes :: [String] -> String, which must take in input array, containing the names of people who like an item. It must return the display text as shown in the examples:

likes [] // must be "no one likes this"
likes ["Peter"] // must be "Peter likes this"
likes ["Jacob", "Alex"] // must be "Jacob and Alex like this"
likes ["Max", "John", "Mark"] // must be "Max, John and Mark like this"
likes ["Alex", "Jacob", "Mark", "Max"] // must be "Alex, Jacob and 2 others like this"
For more than 4 names, the number in and 2 others simply increases.
```
function likes(names) {
  if(names===[]){
  console.log('no one likes this');
  }else if(likes.length===1){
  console.log(names + " likes this");
  }else if(likes.length===2){
  console.log(names + " and " + names + " like this");
  };

}
Stephen James
@sjames1958gm
Jan 21 2017 02:20
@AdamWayne-dev Your first test should be > not >=
John Nunns
@johnnunns
Jan 21 2017 02:20
am I headed in the right direction? seems not..
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:21
@sjames1958gm oh my god lmao. that was it. it passed. Thanks so much
CamperBot
@camperbot
Jan 21 2017 02:21
adamwayne-dev sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5448 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:21
It's always something so small haha
James Shore
@Jimbobmahooley
Jan 21 2017 02:21
function destroyer(arr) {
  function seek(value) {
  for (var i=1; i < arr.length; i++) {
    return value != arr[i];
    }
  }


  return arr[0].filter(seek);
}
@sjames1958gm I know this is wrong in many ways but it's all I can think of
Tyler Moeller
@TylerMoeller
Jan 21 2017 02:22
@charan1998 What's the question?
Stephen James
@sjames1958gm
Jan 21 2017 02:23
@Jimbobmahooley You need to review the arguments link in the instructions
destroyer([1, 2, 3, 1, 2, 3], 2, 3); arr is only the array there you will need to use arguments object to get to 2, 3
@AdamWayne-dev You said that length + 2 worked but length didn't - so I looked at your code where === length had significance.
That was that first if - so that is where I saw the issue.
@johnnunns Well you are not using an index with the names array in the two console.log statements.
James Shore
@Jimbobmahooley
Jan 21 2017 02:24
@sjames1958gm I did have quick look, it says it only works in the body of the function but will it work if its then inside another function, or do I not make a new function?
Adam Wayne
@AdamWayne-dev
Jan 21 2017 02:25
@sjames1958gm That's a great tip to remember, again thank you, that makes pefect sense.
CamperBot
@camperbot
Jan 21 2017 02:25
adamwayne-dev sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: adamwayne-dev already gave sjames1958gm points
Stephen James
@sjames1958gm
Jan 21 2017 02:26
@Jimbobmahooley The filter function is the right idea, but arr is the array to filter arr[0] is a number -
destroyer is a function with a body.
Your code is looking like it thinks arr[0] is [1, 2, 3, 1, 2, 3] but arr is [1, 2, 3, 1, 2, 3]
John Nunns
@johnnunns
Jan 21 2017 02:27
tried to find definition of what index means but didn't see it can you clarify? @sjames1958gm
Stephen James
@sjames1958gm
Jan 21 2017 02:27
@johnnunns The number inside the [] when as in names[0] or names[1]
John Nunns
@johnnunns
Jan 21 2017 02:28
gotcha, ok lets take a look
function likes(names) {
  if(names===[]){
  return'no one likes this';
  }else if(likes.length===1){
  return names[0] + " likes this";
  }else if(likes.length===2){
  return names[0] + " and " + names[1] + " like this";
  };

}
only passing with the else if statement
I'm sorry, the first else if statement
Alex
@Joshua-A-Smith
Jan 21 2017 02:31
@sjames1958gm
What do you mean by side effects care to elaborate?
This is the lesson I'm on btw-Make Instances of Objects with a Constructor Function
Stephen James
@sjames1958gm
Jan 21 2017 02:33
@Joshua-A-Smith side effects would be setting global variables or other ways of affecting global state (DOM manipulation, network requests, etc.)
@johnnunns likes.length? Think about what likes is
James Shore
@Jimbobmahooley
Jan 21 2017 02:33
function destroyer(arr) {
  function seek(value) {
  for (var i=1; i < arguments.length; i++) {
    return value != arguments[i];
    }
  }
  return arr.filter(seek);
}
@sjames1958gm I've still got a return in a loop though, and I've made a seek function so surely the arguments for the destroy function don't work in there?
Stephen James
@sjames1958gm
Jan 21 2017 02:34
@Jimbobmahooley Ok, so the arguments object for destroyer is different that the arguments object for seek -
The MDN page for arguments shows how to extract that to an another array
John Nunns
@johnnunns
Jan 21 2017 02:35
@sjames1958gm you're right it's just a function
Stephen James
@sjames1958gm
Jan 21 2017 02:35
@johnnunns Is there something else you should be taking the length of?
John Nunns
@johnnunns
Jan 21 2017 02:35
ok, I was then trying to figure out how exactly I could say how many arguments to compare to
Stephen James
@sjames1958gm
Jan 21 2017 02:36
@johnnunns So explain what this function is supposed to do?
John Nunns
@johnnunns
Jan 21 2017 02:36
man I'm confusing myself
M.Sohaib
@coolcoder007
Jan 21 2017 02:36

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

wordBlanks("cat" + "little" + "hit" + "slowly");

// Your code above this line
return result;
}

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

John Nunns
@johnnunns
Jan 21 2017 02:36
would names.length equal 1 or the character count of the name?
Stephen James
@sjames1958gm
Jan 21 2017 02:36
@johnnunns And me too :)
@johnnunns if names is an array then name.length would be the number of names in the array.
John Nunns
@johnnunns
Jan 21 2017 02:37
haha I'm a pretty tough student :)
M.Sohaib
@coolcoder007
Jan 21 2017 02:37
help needed
CamperBot
@camperbot
Jan 21 2017 02:37
no wiki entry for: needed
John Nunns
@johnnunns
Jan 21 2017 02:38
alrighttt we're on our way
Stephen James
@sjames1958gm
Jan 21 2017 02:38
@coolcoder007 myNoun, myAdjective, myVerb, myAdverbthese four parameters/variables will contain the
words that you should use to build a sentence (string) that you assign to result.
Jason Clifton
@Cliffcoding
Jan 21 2017 02:39

Hey guys. I was wondering if someone could throw me some insight on the first Algorithm problem, reversing a string.

function reverseString(str) {

  str.split('');
  str.reverse();
  str.join('');
  return str;
}

reverseString("hello");

I keep getting the error that str.reverse is not a function. I tried creating a variable with an array and assigning it to problem but it doesn't seem to work.

John Nunns
@johnnunns
Jan 21 2017 02:39
trying to figure out though how to set the first if statement to false. As in if no argument is introduced, log this
Brian
@BrianCodes33
Jan 21 2017 02:39
@Cliffcoding you need to chain the methods
do it all in one line
Betim Ademi
@betimademi
Jan 21 2017 02:39
Hello guys can someone help me to create a function about D'Hondt method
M.Sohaib
@coolcoder007
Jan 21 2017 02:40
@sjames1958gm how can i built a sentence. ? confused
Brian
@BrianCodes33
Jan 21 2017 02:40
@Cliffcoding return str….
@Cliffcoding split returns an array you are not using the return value - str is still a string when you try to use it.
@johnnunns if (names === undefined)
James Shore
@Jimbobmahooley
Jan 21 2017 02:42
@sjames1958gm I'm not 100% sure what you mean, but if you mean that even in the seek function I can still access the arguments passed to destroyer then that is what I need but I can't see it on the MDN page
John Nunns
@johnnunns
Jan 21 2017 02:43

function likes(names) {
if(names===undefined){
return'no one likes this';
}else if(names.length===1){
return names[0] + " likes this";
}else if(names.length===2){
return names[0] + " and " + names1 + " like this";
};

}

not sure it's working.
Stephen James
@sjames1958gm
Jan 21 2017 02:44
@Jimbobmahooley Inside the seek function there is an object called arguments - that is different to the one that destoyer has.
In order to get to the values in the destroyer arguments object you need to copy those to another object or array.
var args = Array.prototype.slice.call(arguments);
Do that before seek and then seek can access args
John Nunns
@johnnunns
Jan 21 2017 02:44
put a space between return and still fails
Stephen James
@sjames1958gm
Jan 21 2017 02:45
@johnnunns Can you tell me what the instructions are
John Nunns
@johnnunns
Jan 21 2017 02:45
You probably know the "like" system from Facebook and other pages. People can "like" blog posts, pictures or other items. We want to create the text that should be displayed next to such an item.

Implement a function likes :: [String] -> String, which must take in input array, containing the names of people who like an item. It must return the display text as shown in the examples:

likes [] // must be "no one likes this"
likes ["Peter"] // must be "Peter likes this"
likes ["Jacob", "Alex"] // must be "Jacob and Alex like this"
likes ["Max", "John", "Mark"] // must be "Max, John and Mark like this"
likes ["Alex", "Jacob", "Mark", "Max"] // must be "Alex, Jacob and 2 others like this"
For more than 4 names, the number in and 2 others simply increases.
that's all we get
Stephen James
@sjames1958gm
Jan 21 2017 02:47
@johnnunns ok you need names.length == 0 for the first case - comparing names to [] doesn't work because arrays are compared by reference not contents.
@johnnunns Otherwise you are on the right track
John Nunns
@johnnunns
Jan 21 2017 02:48
should have thought about that @sjames1958gm
James Shore
@Jimbobmahooley
Jan 21 2017 02:48
function destroyer(arr) {
  var destroyArgs = Array.prototype.slice.call(arguments);
  function seek(value) {
  for (var i=1; i < destroyArgs.length; i++) {
    return value != destroyArgs[i];
    }
  }
  return arr.filter(seek);
}
@sjames1958gm That's a lot better now thanks, however I still have a return inside a loop so it only works for the first value of destroyArgs what should I do?
CamperBot
@camperbot
Jan 21 2017 02:48
jimbobmahooley sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5449 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
John Nunns
@johnnunns
Jan 21 2017 02:49
ok, now I'm at the difficult spot, to list name[0 and 1] and all the rest be in a counter (__ others like this)
Stephen James
@sjames1958gm
Jan 21 2017 02:50
@Jimbobmahooley so if names.length > 3 you do the last case
John Nunns
@johnnunns
Jan 21 2017 02:50
wait I may have it
Stephen James
@sjames1958gm
Jan 21 2017 02:51
@Jimbobmahooley You could use a boolean or perhaps destroyerArgs.indexOf(value) instead of the for loop
John Nunns
@johnnunns
Jan 21 2017 02:52
function likes(names) {
  if(names.length===0){
  return 'no one likes this';
  }else if(names.length===1){
  return names[0] + " likes this";
  }else if(names.length===2){
  return names[0] + " and " + names[1] + " like this";
  }else if(names.length===3){
  return names[0] + ", " + names[1] + " and " + names[2] + " like this";
  }else {
  return names[0] + ', ' + names[1] + " and " + (names.length-2) + " others like this"
  };

}
got it
Stephen James
@sjames1958gm
Jan 21 2017 02:52
@johnnunns :+1:
Jason Clifton
@Cliffcoding
Jan 21 2017 02:53
@BrianCodes33 @sjames1958gm Thank you guys! I was confused. I went searching through the MDN and what you guys said clicked.
CamperBot
@camperbot
Jan 21 2017 02:53
cliffcoding sends brownie points to @briancodes33 and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 30 | @briancodes33 |http://www.freecodecamp.com/briancodes33
:star2: 5450 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jan 21 2017 02:53
@Cliffcoding :+1:
jm4876
@jm4876
Jan 21 2017 02:54
Adding a default option in Switch statements
John Nunns
@johnnunns
Jan 21 2017 02:55
@sjames1958gm stephen how does js read dates?
Stephen James
@sjames1958gm
Jan 21 2017 02:56
@johnnunns Best way is to read MDN Date object info
James Shore
@Jimbobmahooley
Jan 21 2017 02:57
@sjames1958gm Meaning an if statement?
Stephen James
@sjames1958gm
Jan 21 2017 02:59
@Jimbobmahooley
var keep = true;
for loop
if should destroy keep = false
endfor
return keep
M.Sohaib
@coolcoder007
Jan 21 2017 03:05

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
myNoun ="cat";
myAdjective="little";
myVerb="hit";
myAdverb="slowly";
worldBlanks("my" + myAdjective + myNoun + "is" + myVerb + myAdverb);
// Your code above this line
return result;
}

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

@sjames1958gm i think i can,t slove this exercise
i have been trying for yesterday
please send me the code
Stephen James
@sjames1958gm
Jan 21 2017 03:07
@coolcoder007 The parameters are already set to the words in the function. Don't set them there.
worldBlanks("my" + myAdjective + myNoun + "is" + myVerb + myAdverb); this is calling the function again so it won't work.
start with this
result = "The " + myNoun +
Then add in the other parameters as you see fit
@sjames1958gm Basically remove all the code you wrote and start with that ^^^
James Shore
@Jimbobmahooley
Jan 21 2017 03:07
@sjames1958gm It works! thanks a lot and If like the picture suggests you're a chelsea fan double respect my friend
CamperBot
@camperbot
Jan 21 2017 03:07
jimbobmahooley sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: jimbobmahooley already gave sjames1958gm points
Stephen James
@sjames1958gm
Jan 21 2017 03:08
@Jimbobmahooley :+1: I am a big time Chelsea fan - happy for this season !
James Shore
@Jimbobmahooley
Jan 21 2017 03:12
@sjames1958gm Good lad - Been a great season but could've all changed if Costa left, happy to hear he's staying though, should give us a great shot at the title, what we needed after last years dissapointment
Jamil Akhtar
@frontender007
Jan 21 2017 03:12
@sjames1958gm still not sure with prime number, need help please ?
John Nunns
@johnnunns
Jan 21 2017 03:13
Your online store likes to give out coupons for special occasions. Some customers try to cheat the system by entering invalid codes or using expired coupons.

Your mission: 
Write a function called checkCoupon to verify that a coupon is valid and not expired. If the coupon is good, return true. Otherwise, return false.

A coupon expires at the END of the expiration date. All dates will be passed in as strings in this format: "June 15, 2014"
function checkCoupon(enteredCode, correctCode, currentDate, expirationDate){

  if (enteredCode===correctCode && currentDate <= expirationDate){
  return true;
  }else{
  return false;
  };
}
they're passing the date in as a string, and do I need change that to a value?
Stephen James
@sjames1958gm
Jan 21 2017 03:15
@johnnunns Yeah use the Date object - then you can compare values.
Yoel Trujillo
@y0el22
Jan 21 2017 03:15

hi guys until now i have this code, can anybody guide me?


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

  return largest;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
`

what is wrong here?

Jamil Akhtar
@frontender007
Jan 21 2017 03:16
@y0el22 declare a variable and assign = 0 inside second loop and then compare each elements length to see if it is bigger than the previous
if is then assign the new length value to the variable or return the the element when inner loop finishes
John Nunns
@johnnunns
Jan 21 2017 03:18
date.parse did the trick
Stephen James
@sjames1958gm
Jan 21 2017 03:18
@frontender007
two loops one for the numbers
a second loop that tests if any numbers divide into the test number, if none then prime
Jamil Akhtar
@frontender007
Jan 21 2017 03:19
@sjames1958gm shall I use remainder or division operator for that ?
Krittiya Clark
@krittiyaclark
Jan 21 2017 03:20
How can I past code here with a black background? I need help with the Selecting from many options with Switch Statements challenge!
Stephen James
@sjames1958gm
Jan 21 2017 03:20
@frontender007 remainder
Jamil Akhtar
@frontender007
Jan 21 2017 03:20
@krittiyaclark type three bacckticks and press enter then paste your code in between those backticks
Margaret
@Margaret2
Jan 21 2017 03:20
'''
CamperBot
@camperbot
Jan 21 2017 03:20
:bulb: to format code use backticks! ``` more info
Margaret
@Margaret2
Jan 21 2017 03:21
@krittiyaclark click more info ^^
Jamil Akhtar
@frontender007
Jan 21 2017 03:21
@sjames1958gm thanks
CamperBot
@camperbot
Jan 21 2017 03:21
frontender007 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5451 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Margaret
@Margaret2
Jan 21 2017 03:21
@johnnunns still on codewars? :D
5451 :star2: :scream_cat:
Stephen James
@sjames1958gm
Jan 21 2017 03:22
@Margaret2 :)
Yoel Trujillo
@y0el22
Jan 21 2017 03:22
@frontender007 that was i tried but i can't do it
Stephen James
@sjames1958gm
Jan 21 2017 03:23
@y0el22 you cannot push until you complete the inner loop as @frontender007 said
Jamil Akhtar
@frontender007
Jan 21 2017 03:23
@y0el22 var biggest = 0; then compare it with each element of sub array if it is bigger then keep it , if not then assign the new number to the biggest after loop finishes push the number into biggest array
Yoel Trujillo
@y0el22
Jan 21 2017 03:25
@frontender007 you mean var largest?
Jamil Akhtar
@frontender007
Jan 21 2017 03:25
@y0el22 yeah largest, sorry
Yoel Trujillo
@y0el22
Jan 21 2017 03:26
sorry but i can't see the problem yet
why i cant push?
if is bigger push
is not do nothing
is no what my code said?
Jamil Akhtar
@frontender007
Jan 21 2017 03:27
@y0el22 you're dealing with two dimmensional arrays
Stephen James
@sjames1958gm
Jan 21 2017 03:28
@y0el22 your inner loop needs to detemine the largest then after the loop push.
Yoel Trujillo
@y0el22
Jan 21 2017 03:28
@frontender007 yes that's true
M.Sohaib
@coolcoder007
Jan 21 2017 03:28
@sjames1958gm thank you i have passed wordblanks challenge :+1:
CamperBot
@camperbot
Jan 21 2017 03:28
coolcoder007 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5452 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jan 21 2017 03:28
@coolcoder007 :+1:
Krittiya Clark
@krittiyaclark
Jan 21 2017 03:28
function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch (val) {
    case "alpha":
       console.log("alpha");
       break;
    case "beta":
       console.log("beta");
       break;
    case "gamma":
       console.log("gamma");
       break;
    case "delta":
       console.log("delta");
       break;

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

// Change this value to test
caseInSwitch(1);
@frontender007 @Margaret2 Got it. Thanks!
CamperBot
@camperbot
Jan 21 2017 03:29
krittiyaclark sends brownie points to @frontender007 and @margaret2 :sparkles: :thumbsup: :sparkles:
:cookie: 301 | @frontender007 |http://www.freecodecamp.com/frontender007
:star2: 1291 | @margaret2 |http://www.freecodecamp.com/margaret2
Jamil Akhtar
@frontender007
Jan 21 2017 03:29
@krittiyaclark :)
Stephen James
@sjames1958gm
Jan 21 2017 03:30
@krittiyaclark The cases should be testing numbers and then each one should set the answer variable to the string
Pigpigever
@pigpigever
Jan 21 2017 03:30
yes
Krittiya Clark
@krittiyaclark
Jan 21 2017 03:30
Can anyone help me what is wrong with my code?
Yoel Trujillo
@y0el22
Jan 21 2017 03:30
@sjames1958gm i think i understand but is pretty hard
i can't figure it out
Jamil Akhtar
@frontender007
Jan 21 2017 03:31
@y0el22 arr[i] is a complete array that you're looping through by using inner loop
Pigpigever
@pigpigever
Jan 21 2017 03:31
@krittiyaclark Your answer return what?
Yoel Trujillo
@y0el22
Jan 21 2017 03:31
@frontender007 yes
Jamil Akhtar
@frontender007
Jan 21 2017 03:32
now arr[i][j] will be the first element and each time round it will get the next element , you need to compare each elements value to previously store value to see if the new value is bigger than the last one or not
Pigpigever
@pigpigever
Jan 21 2017 03:32
@krittiyaclark answer in your code just set ""but you return it
its your problem
Jamil Akhtar
@frontender007
Jan 21 2017 03:32
declare a variable just before the inner loop and set it to 0
then compare each value from the sub array to it
which is definitely bigger than 0
so assign that variable with new value of the sub array
then repeat
Yoel Trujillo
@y0el22
Jan 21 2017 03:34
@frontender007 i will check, thanks for the patience
CamperBot
@camperbot
Jan 21 2017 03:34
y0el22 sends brownie points to @frontender007 :sparkles: :thumbsup: :sparkles:
:cookie: 302 | @frontender007 |http://www.freecodecamp.com/frontender007
Ryan Foley
@brahms101
Jan 21 2017 03:35
help with Stand in Line anyone?
CamperBot
@camperbot
Jan 21 2017 03:35
no wiki entry for: with stand in line anyone
Ryan Foley
@brahms101
Jan 21 2017 03:35

function nextInLine(arr, item) {

arr.push(item);
arr.shift();

return ;

I have this...don't know what to return
Pigpigever
@pigpigever
Jan 21 2017 03:36
just return arr
Jamil Akhtar
@frontender007
Jan 21 2017 03:36
@Anmar0293 type your name in myName variable between the quote
Anmar0293
@Anmar0293
Jan 21 2017 03:36
@frontender007 can I see the could please so I could understand
Ryan Foley
@brahms101
Jan 21 2017 03:37
@pigpigever arr doesn't work
Jamil Akhtar
@frontender007
Jan 21 2017 03:37
@Anmar0293 var myName = "my name is"
Pigpigever
@pigpigever
Jan 21 2017 03:37
Insert myName between "My name is " and " and I am swell!"
Jamil Akhtar
@frontender007
Jan 21 2017 03:37
@Anmar0293 delete the text inside the quotes and type in your name then on the next line use myName variable + type the text in the quotes what the instructions say
Pigpigever
@pigpigever
Jan 21 2017 03:38
@brahms101 it tells you to do ?
show me the question
Jamil Akhtar
@frontender007
Jan 21 2017 03:38
This message was deleted
Ryan Foley
@brahms101
Jan 21 2017 03:39
@pigpigever I need to return the first element of the array that was removed via .switch
Anmar0293
@Anmar0293
Jan 21 2017 03:40
I doesn't work. Could you please show me how it is done so I can analyz the code? @frontender007
Jamil Akhtar
@frontender007
Jan 21 2017 03:40
var primes = [];


for ( var i = 0; i <= 10; i++ ) {
  for ( var j = 0; j <= 10; j++ ) {
    if ( i > 1 ) {
      if ( i % j === 0 ) {
        primes.push(i);
      }
    }
  }
}

primes;
@sjames1958gm
completely confuse
Krittiya Clark
@krittiyaclark
Jan 21 2017 03:41
@sjames1958gm Passed it. Thanks!
CamperBot
@camperbot
Jan 21 2017 03:41
krittiyaclark sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 5453 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Anmar0293
@Anmar0293
Jan 21 2017 03:42
I doesn't work. Could you please show me how it is done so I can analyz the code? @frontender007
Jamil Akhtar
@frontender007
Jan 21 2017 03:42
var myName = " John";
var myStr = "My name is " + myName + " and I am swell!";
Pigpigever
@pigpigever
Jan 21 2017 03:42
@brahms101 return item?
item=arr.shift()
it is right?
Ryan Foley
@brahms101
Jan 21 2017 03:43
nope
Anmar0293
@Anmar0293
Jan 21 2017 03:46
@frontender007 Thanks a lot!
CamperBot
@camperbot
Jan 21 2017 03:46
anmar0293 sends brownie points to @frontender007 :sparkles: :thumbsup: :sparkles:
:cookie: 303 | @frontender007 |http://www.freecodecamp.com/frontender007
Jamil Akhtar
@frontender007
Jan 21 2017 03:46
@Anmar0293 welcome, do you understand whats happening in the code ?
Arvind Lairenjam
@arvind00
Jan 21 2017 03:52
hi all, need help. Math.max doesn't accept array like [7,2] but it accepts like 7,2.
Is there anyway to my my code work:
function largestOfFour(arr) {
  // You can do this!
  newArr = arr.map(function(elem){
    return Math.max(elem);
  });
  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Philip Eckert
@pae4557
Jan 21 2017 03:53
Okay, I give up. Anybody have advice for the steamroller js challenge?
Anmar0293
@Anmar0293
Jan 21 2017 03:55
what is wrong with this?
var myName = " John";
var myStr = "My name is " + myName + " and I am swell
sorry this
can anyone tell me what is wrong with this
Arvind Lairenjam
@arvind00
Jan 21 2017 03:59
@Anmar0293 remove: var lastName = "Anmar";
Anmar0293
@Anmar0293
Jan 21 2017 04:01
@arvind00 thanks a lot!
CamperBot
@camperbot
Jan 21 2017 04:01
anmar0293 sends brownie points to @arvind00 :sparkles: :thumbsup: :sparkles:
:cookie: 95 | @arvind00 |http://www.freecodecamp.com/arvind00
Anmar0293
@Anmar0293
Jan 21 2017 04:01
but if you don't mind asking you, the point was just to update the 0 value above?
@arvind00 but if you don't mind asking you, the point was just to update the 0 value above?
Arvind Lairenjam
@arvind00
Jan 21 2017 04:02
@Anmar0293 first name and lastname were already given. Yes you need to set the initial values of their lengths to 0
Ken Haduch
@khaduch
Jan 21 2017 04:05
@pae4557 - you need to use (or maybe it's easiest to use) a recursive function, so that if you find an array, you call the function again to push into that array to access its values. What have you tried so far?
Garo
@Garabed96
Jan 21 2017 04:13
guys a question about my code (it works btw took a damn while but did it myself)

function findLongestWord(str) {


  var size = 0;
  var crSize;
  var currStr="";  

  // split the string into an array of strings
  str = str.split(" ");
  // iterate throughout all the strings
  for(i=0;i<str.length;i++){
    crSize = str[i].length;
    if(crSize > size){
      size = crSize;

    }
  }



  return size;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
piyush
@piyushimraw
Jan 21 2017 04:14

guys need help just completed it last night i dunno how can i start it refactoring
too afraid to touch a function i have a phobia that it will breake it what can i do
how can i start refactoring it
//array of colors
var numberOfColor = 6;
var colors = genrateRandomColor(numberOfColor);
var h1 = document.querySelector("h1");
var resetButton = document.querySelector("#reset");
var squares = document.querySelectorAll(".square");
var pickedColor = pickColor();
var colorDisplay = document.querySelector("#colorDisplay");
var message = document.querySelector("#message");
var easyBtn = document.querySelector("#easy");
var hardBtn = document.querySelector("#hard");
colorDisplay.textContent = pickedColor;

easyBtn.addEventListener("click", function() {
this.classList.add("selected");
hardBtn.classList.remove("selected");

numberOfColor = 3;

//populating new colors in array
colors = genrateRandomColor(numberOfColor);

//picking new postion in colors array
pickedColor = pickColor();

//display picked colors
colorDisplay.textContent = pickedColor

for (var i = 0; i < squares.length; i++) {
    if (colors[i]) {
        squares[i].style.background = colors[i];
    } else {
        squares[i].style.display = "none";
    }
}

h1.style.background = "steelblue";
resetButton.textContent = "New color";
message.textContent = "";

});

hardBtn.addEventListener("click", function() {
this.classList.add("selected");
easyBtn.classList.remove("selected");

numberOfColor = 6;

//populating new colors in array
colors = genrateRandomColor(numberOfColor);

//picking new postion in colors array
pickedColor = pickColor();

//display picked colors
colorDisplay.textContent = pickedColor

for (var i = 0; i < squares.length; i++) {

    squares[i].style.background = colors[i];
    squares[i].style.display = "block";
}
h1.style.background = "steelblue";
resetButton.textContent = "New color";
message.textContent = "";

});

//adding eventListener to reset button
resetButton.addEventListener("click", function() {

//populating new colors in array
colors = genrateRandomColor(numberOfColor);

//picking new postion in colors array
pickedColor = pickColor();

//display picked colors
colorDisplay.textContent = pickedColor;


//populating squares with new colors array
for (var i = 0; i < squares.length; i++) {
    squares[i].style.background = colors[i];
}

h1.style.background = "steelblue";
resetButton.textContent = "New color";
message.textContent = "";

});

//populate colors in squares
for (var i = 0; i < squares.length; i++) {
squares[i].style.background = colors[i];

// add eventListener to squares
squares[i].addEventListener("click", function() {
    var clickedColor = this.style.background;

    // checking if clicked color is correct
    if (clickedColor === pickedColor) {
        message.textContent = "CORRECT";
        changeColors(clickedColor);
        h1.style.background = pickedColor;
        resetButton.textContent = "Play Again ?"

    } else {
        this.style.background = "#232323";
        message.textContent = "TRY AGAIN!!!";
    }

});

}
//change color of squares to correct color
function changeColors(color) {
//loop through all squares
for (var i = 0; i < squares.length; i++) {
//change color to picked color
squares[i].style.background = color;
}
}
//pick a random index from colors array
function pickColor() {
var random = Math.floor(Math.random() * colors.length);
return colors[random];
}

// make color array and populate with random color
function genrateRandomColor(num) {
//make an array
var arr = [];

//repeat num times
for (var i = 0; i < num; i++) {
    arr.push(randomColor());
}

//return the array
return arr;

}

function randomColor() {
//declaring rgb channels for random generation
var r;

Arvind Lairenjam
@arvind00
Jan 21 2017 04:14
hi, all found something new: I felt like sharing. So here it is: the use of spread ...
function largestOfFour(arr) {
  // You can do this!
  newArr = arr.map(function(elem){
    return Math.max(...elem);
  });
  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Garo
@Garabed96
Jan 21 2017 04:14
@Garabed96 nvm i got it
Jamie Lipschitz
@Jlipschitz
Jan 21 2017 04:15
@arvind00 you cannot use Math.max() on array directly, you will have to use Math.max.apply(null, myArray)
Snakee06
@Snakee06
Jan 21 2017 04:15
Write a switch statement which tests val and sets answer for the following conditions:
1 - "alpha"
2 - "beta"
3 - "gamma"
4 - "delta"
Hey guys i'm a bit unsure about this question?
how i go about setting it out
Jamie Lipschitz
@Jlipschitz
Jan 21 2017 04:16
hmm es6 spread is indeed a nice find!
Arvind Lairenjam
@arvind00
Jan 21 2017 04:16
@Jlipschitz yes that's old one, now from ES 2015 we have new one ...
Jamie Lipschitz
@Jlipschitz
Jan 21 2017 04:19
I see. The apply works a lot faster than the spread method but not that it would be visible on any one's machine now a days @arvind00
Arvind Lairenjam
@arvind00
Jan 21 2017 04:19
@Snakee06 check out the expected answer section, you might get some idea.
@Jlipschitz good info.
piyush
@piyushimraw
Jan 21 2017 04:21
how can i start refactoring this codehttp://codepen.io/tantramantra/pen/ygbBao.js
Nick Janne
@njanne19
Jan 21 2017 04:21
Hello, can someone please explain to me why my permutations array has 2 of every permutation
function permAlone(str) {
var newArray = str.split('');
var n = newArray.length;
var permutations = [];
var tmp;

    function swap(index1, index2) {
    tmp = newArray[index1];
    newArray[index1] = newArray[index2];
    newArray[index2] = tmp;
    }

    function generate(n, newArray) {
      if (n === 1) {
        permutations.push(newArray.join(''));
      } else {
        for(var i = 0; i<n-1; i++) {
          generate(n-1, newArray);
          swap(n % 2 ? 0 : i, n-1);
          permutations.push(newArray.join(''));
/*          if(n % 2 === 0) {
            swap(i, n-1);
            permutations.push(newArray.join(''));
          } else {
            swap(0, n-1);
            permutations.push(newArray.join(''));
          } */
        }
        generate(n-1, newArray);
      }      
    }  

  generate(n, newArray);


  return permutations;
}
Learn it. Use it. :)
Philip Eckert
@pae4557
Jan 21 2017 04:24
Okay so the steamroller challenge
I'm so lost
I don't even understand the structure of how to deal with the problem
Nick Janne
@njanne19
Jan 21 2017 04:25
@pae4557 If I remember it correctly, it's the one where you have to find arrays in arrays right
Philip Eckert
@pae4557
Jan 21 2017 04:25
@njanne19 Yes
Nick Janne
@njanne19
Jan 21 2017 04:26
@pae4557 Ok it seems a lot more confusing than it is and I know you can figure it out but I'll tell you the basis of what you should do. You SHOULD set up your function to loop through the array provided and check if each element is an array, then you can use recursion to see if there are arrays in the array
Philip Eckert
@pae4557
Jan 21 2017 04:29
Oh okay, so set up a function to check if any piece of the array has an array in it, then keep calling it until there are none left? @njanne19
That makes more sense than what I was trying
Nick Janne
@njanne19
Jan 21 2017 04:29
exactly that method is also known as recursions, or calling your function inside your function
I'm not sure exactly what the problem requires the answer to be, but tahts a good basis @pae4557
Philip Eckert
@pae4557
Jan 21 2017 04:30
@njanne19 Thank you!
CamperBot
@camperbot
Jan 21 2017 04:30
pae4557 sends brownie points to @njanne19 :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @njanne19 |http://www.freecodecamp.com/njanne19
Arvind Lairenjam
@arvind00
Jan 21 2017 04:36
@revisualize Nice one, bookmarked. Thanks.
CamperBot
@camperbot
Jan 21 2017 04:36
arvind00 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3073 | @revisualize |http://www.freecodecamp.com/revisualize
Jamie Lipschitz
@Jlipschitz
Jan 21 2017 04:38
@piyushimraw I think you really did a good job overall as is. perhaps fine tune variable names so it easier to differentiate (e.g. var pickedColor, var pickColor) are too similar in my opinion. possibly reduce the amount of global variables as well? you can have one object and methods for all those color changing functions. using this inside your functions might also help readability
Garo
@Garabed96
Jan 21 2017 04:38
guys please dont give the straight up answer to this it would ruin the purpose of the excersise but to get each first letter of string in an array of strings to be capital would I have to run it in a nested loop with the nested loop setting the first element of each string to capital? or is there some regex thing?
by straight up i mean dont give me code just hints
Ken Haduch
@khaduch
Jan 21 2017 04:41
@Garabed96 - sounds like you are on a pretty good track to understand it. Use a function that will convert characters to uppercase, and one that will get the part of the word that is not the first letter and concatenate them together. Keep in mind that strings are immutable, etc.
Jor
@joreyesl
Jan 21 2017 04:41
@Garabed96 you can split the string into an array. Then loop through the array, modify each word. Then join the array back to a string.
heroiczero
@heroiczero
Jan 21 2017 04:46
@Garabed96 look at string methods in the right margin of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String especially charCodeAt() and slice() and toUpperCase()
Coy Sanders
@coymeetsworld
Jan 21 2017 04:49
@Garabed96 you don't need regex, you can use one loop
Pigpigever
@pigpigever
Jan 21 2017 04:49
Falsy Bouncer
Coy Sanders
@coymeetsworld
Jan 21 2017 04:49
and then string functions
Pigpigever
@pigpigever
Jan 21 2017 04:49
who can help me :worried:
Coy Sanders
@coymeetsworld
Jan 21 2017 04:49
what do you have @pigpigever ?
Sara Shimel
@SaraRooskie
Jan 21 2017 04:50
Hi all! I need help with the Nesting For Loops challenge
I just don't understand the logic.
Ken Haduch
@khaduch
Jan 21 2017 04:50
@SaraRooskie - do you have code you can post?
Pigpigever
@pigpigever
Jan 21 2017 04:50
Maybe I can solve it now
Sara Shimel
@SaraRooskie
Jan 21 2017 04:51

@khaduch - after giving up, I found the proper code. I just don't understand it

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

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

Instructions: Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr
Ken Haduch
@khaduch
Jan 21 2017 04:51
@SaraRooskie - Do you understand the use of a for loop to iterate through one array?
Sara Shimel
@SaraRooskie
Jan 21 2017 04:51
I thought so. Maybe I don't have a complete understanding.
Pigpigever
@pigpigever
Jan 21 2017 04:52
The question asks me how to delete the value which has false、null、0、""、undefined and NaN
in a array
Coy Sanders
@coymeetsworld
Jan 21 2017 04:52
@pigpigever you need to go through the array and check for falsy values, the Boolean objects link they provide is helpful
heroiczero
@heroiczero
Jan 21 2017 04:52
@SaraRooskie you know you could use a *= operator
Ken Haduch
@khaduch
Jan 21 2017 04:53
@SaraRooskie - just look at the outer loop - for (var i = 0; i < arr.length; i++) { - it is dealing with the input argument arr, and arr.length gives a number indicating the number of elements in the array. So as you go through the arr, you can use arr[i] to access arr[0], arr[1], arr[2], etc. in sequence.
Pigpigever
@pigpigever
Jan 21 2017 04:53
@coymeetsworld just like arr=arr.filter(function(value){return Boolean(value);)??
Sara Shimel
@SaraRooskie
Jan 21 2017 04:54
@khaduch I think I am getting confused as what the 'outer' and 'inner' loops mean. Similarly, what 'i' and 'j' mean.
Coy Sanders
@coymeetsworld
Jan 21 2017 04:56
yeah something like that @pigpigever
Alex
@Joshua-A-Smith
Jan 21 2017 04:56
Is jekyll relevant to learn?
heroiczero
@heroiczero
Jan 21 2017 04:56
@SaraRooskie [[1,2],[3,4],[5,6,7]] so for the i for loop you are getting the arrays [1,2] [3,4] and [5,6, 7] and for the j for loop you are getting the numbers inside the individual arrays
Jor
@joreyesl
Jan 21 2017 04:56
@SaraRooskie Ok you have an array that contains subarrays, 'array[subarr1, subarr2, ...], your outer loop iterates through the main array.iis used to iterate through the main array, it starts ati=0and increments by 1 each time. Then your inner loop is used to iterate through each sub array. The subarrays are what actually hold numbers, so that is whyproduct = product * arr[i][j]` is inside the inner loop.
Sara Shimel
@SaraRooskie
Jan 21 2017 04:58
@khaduch @joreyesl I am not sure why this is really hard for me to grasp (I'm also really sick right now - so maybe this is common sense and I just can't process it). I'll read over what you've said a few times and try to figure it out. Thank you both for the help!
CamperBot
@camperbot
Jan 21 2017 04:58
:cookie: 301 | @joreyesl |http://www.freecodecamp.com/joreyesl
sararooskie sends brownie points to @khaduch and @joreyesl :sparkles: :thumbsup: :sparkles:
:star2: 2325 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Jan 21 2017 04:58

@SaraRooskie - then notice that each element within arr is also an array - so these are nested arrays. In order to access each element of the nested array, you need a second for loop, so that is the "inner" loop - you need a different variable, so you are using j in the inner loop, but it is performing a similar function. It is taking the individual nested arrays that you are accessing with arr[i], so you'll first be looking at the sub-array (or nested array) with the values [1,2]. Now you can see that this is an array, so it can be accessed by tacking on a second set of square brackets with the nested (inner) for loops variable j, so you are accessing arr[i][j] and as j is incremented, you will first get the value 1 and then 2, and then the inner loop will be finished. You then return to the other loop and move on to the next sub-array.

You also have a lot more responses here, so I'll let you sort through those.

Sara Shimel
@SaraRooskie
Jan 21 2017 04:58
@khaduch Thank you - I am starting to get it!
CamperBot
@camperbot
Jan 21 2017 04:58
sararooskie sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:warning: sararooskie already gave khaduch points
Ken Haduch
@khaduch
Jan 21 2017 05:00
@SaraRooskie you can try the pythontutor website - it allows you to plug your code in and then gives a visual representation of what is going on as the code loops. It takes a little while to understand what's going on, but it can be helpful. Take is easy and feel better soon!
Sara Shimel
@SaraRooskie
Jan 21 2017 05:00
@khaduch Thank you for the resource!
CamperBot
@camperbot
Jan 21 2017 05:00
sararooskie sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:warning: sararooskie already gave khaduch points
Pigpigever
@pigpigever
Jan 21 2017 05:01
@coymeetsworld thank you :)
CamperBot
@camperbot
Jan 21 2017 05:01
pigpigever sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1886 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jan 21 2017 05:01
np @pigpigever
Ken Haduch
@khaduch
Jan 21 2017 05:01
@SaraRooskie - http://pythontutor.com/javascript.html#mode=edit is the page where you can plug your code in. Start with the single loop from a previous problem and walk through that first, I would say...
Kodati Sai Kiran
@saiki96
Jan 21 2017 05:06
hello/......
can anyone let me know the twitch api url...i just want to view the JSON file?
heroiczero
@heroiczero
Jan 21 2017 05:07
@saiki96 go here and use that instead of the given url
Garo
@Garabed96
Jan 21 2017 05:09
@khaduch @heroiczero @joreyesl @coymeetsworld thank you

function titleCase(str) {

  str = str.toLowerCase();
  str = str.split(" ");
  i = 0;
  for(i=0;i<str.length;i++){

    placeHolder = str.splice(0);
    str[i] = str[i].charAt(0).toUpperCase();
    str[i] = concat(placeHolder);
  }


  return str;
}

titleCase("I'm a little tea pot");
CamperBot
@camperbot
Jan 21 2017 05:09
garabed96 sends brownie points to @khaduch and @heroiczero and @joreyesl and @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 302 | @joreyesl |http://www.freecodecamp.com/joreyesl
:cookie: 698 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2326 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1887 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Garo
@Garabed96
Jan 21 2017 05:09
thats what i have so far
but placeHolder = str.splice(0);
ruins the rest bc it deletes them all and charAt also gets rid of everything after 0... so yah
just trying to save everything after splice(0) ... uppercase charAt(0) then concat everything after charAt(0) to it
heroiczero
@heroiczero
Jan 21 2017 05:13
@Garabed96 its string.concat(); format
Ken Haduch
@khaduch
Jan 21 2017 05:15
@Garabed96 - check the functionality of .slice() for strings, too - it might help you. You really don't need the placeHolder variable in this.
Coy Sanders
@coymeetsworld
Jan 21 2017 05:16
can't change a letter in a string like that @Garabed96, strings are immutable remember?
oh wait str is an array of words now
Garo
@Garabed96
Jan 21 2017 05:21
oh im trying to splice an array lol that wont work
well i tried to *
anweshd
@anweshd
Jan 21 2017 05:22

var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

// Only change code below this line.
Math.floor(Math.random()*10);

return Math.random();
}

anyone help
wats the code
whole number
Garo
@Garabed96
Jan 21 2017 05:28
re-read the question
Kodati Sai Kiran
@saiki96
Jan 21 2017 05:28
@heroiczero i did....just wanna look the json file..imnt able to see the details ...for example.....have a look at https://wind-bow.gomix.me/twitch-api/streams
Garo
@Garabed96
Jan 21 2017 05:28
Math.floor(Math.random() * 20);
it tells you that putting everything together would look like this
@anweshd
heroiczero
@heroiczero
Jan 21 2017 05:30
@saiki96 needs a channel
Garo
@Garabed96
Jan 21 2017 05:31
me too lmao
im trashhh
heroiczero
@heroiczero
Jan 21 2017 05:34
Kodati Sai Kiran
@saiki96
Jan 21 2017 05:48
thanks a ton @heroiczero .......you are a hero indeed!
CamperBot
@camperbot
Jan 21 2017 05:48
saiki96 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 701 | @heroiczero |http://www.freecodecamp.com/heroiczero
MiguelAramburo
@MiguelAramburo
Jan 21 2017 05:52
how i post my code?
Anjali Rathod
@anjali1206
Jan 21 2017 05:52
Hello everyone. I just built a simple Random Quote Machine. Please share your reviews and feedback on it. http://codepen.io/anjali1206/pen/MJbQgX
Kodati Sai Kiran
@saiki96
Jan 21 2017 05:54
@anjali1206 its really good ....star wars quotes are really great...however...the twitter share isnt capturing the quote in the tweet
MiguelAramburo
@MiguelAramburo
Jan 21 2017 05:55
  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;

    default:
    console.log('Please pick a number from 0 to 6!');  
  }
what is wrong with my code
Anjali Rathod
@anjali1206
Jan 21 2017 05:57
@saiki96 Thank you for ur reviews. I didn't know how to add that functionality to add whole quote directly on twitter :worried: so, I just added where it will take you to tweet box
CamperBot
@camperbot
Jan 21 2017 05:57
anjali1206 sends brownie points to @saiki96 :sparkles: :thumbsup: :sparkles:
:cookie: 260 | @saiki96 |http://www.freecodecamp.com/saiki96
Charan
@charan1998
Jan 21 2017 06:04
Jamie Lipschitz
@Jlipschitz
Jan 21 2017 06:06
@charan1998 the json displays fine, more than likely it's an issue with your code. going to be hard to make suggestions without seeing it, could you post it?
Scott Spence
@spences10
Jan 21 2017 06:07
Anyone here use level?
Charan
@charan1998
Jan 21 2017 06:09
$(document).ready(function() {
$.getJSON("https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&titles=Arsenal&rvprop=content", function(json) {
console.log(JSON.stringify(json));
});
});
yoyo-92
@yoyo-92
Jan 21 2017 06:10
Hey please help me in the challenge 172 nextInLine I dont know how to do it
Charan
@charan1998
Jan 21 2017 06:10
this works if i use any other api?!
yoyo-92
@yoyo-92
Jan 21 2017 06:10
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.
Charan
@charan1998
Jan 21 2017 06:10
Do I have to include anything other than jquery for this?!
Jor
@joreyesl
Jan 21 2017 06:11
@MiguelAramburo you're not supposed to actually use console.log. You are supposed to return the value instead.
yoyo-92
@yoyo-92
Jan 21 2017 06:11
everything is fine but the fouth instruction do not walk After nextInLine(testArr, 10), testArr[4] should be 10
Jor
@joreyesl
Jan 21 2017 06:12
@yoyo-92 post your code, otherwise we can't figure out whats wrong
yoyo-92
@yoyo-92
Jan 21 2017 06:13
@joreyesl ok

function nextInLine(arr, item) {
// Your code here
arr.push(item);
return arr[0]; // 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));

Charan
@charan1998
Jan 21 2017 06:14
@Jlipschitz ?!
Jor
@joreyesl
Jan 21 2017 06:14
@yoyo-92 Ok, so you got the first part down. Now you need to remove the first number in the array. Right now you are only returning the first number in the array, but you arent actually removing it.
yoyo-92
@yoyo-92
Jan 21 2017 06:16
@joreyesl Ok let me try
Jor
@joreyesl
Jan 21 2017 06:17
@yoyo-92 if you recall there are other functions you can use to modify the beginning of an array
Sahil Sunny
@sahilsunny
Jan 21 2017 06:18
Why am I getting cannot read property 0 of undefined?
function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  var found;
  var key = Object.keys(source);
  for(var i = 0; i < collection.length; i++) {
    for(var j = 0; j < key.length; j++) {
      if(collection[i].hasOwnProperty(key[j])) {
        if(collection[i].key[j] === source.key[j]) {
          found = true;
        }
      }
      else {
        found = false;
      }
    }
    if(found) {
      arr.push(collection[i]);
    }
  }
  // Only change code above this line
  return arr;
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
Joni petriashvili
@Jonhnwhantcoding
Jan 21 2017 06:27
function convertToRoman(num) {

  var numcopy="";
 var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  for (var i=0; i < decimalValue.length; i++){
    while(num >=decimalValue[i]){
      numcopy=numcopy + romanNumeral[i];
      num = num -decimalValue;
    }
  }

  return numcopy;
}

convertToRoman(36);
guy look at my code it's not working
Jor
@joreyesl
Jan 21 2017 06:27
@sahilsunny if(collection[i].key[j] === source.key[j]) {, there is a problem. key is a variable. You have to use bracket notation.
Joni petriashvili
@Jonhnwhantcoding
Jan 21 2017 06:28
function convertToRoman(num) {

  var numcopy="";
 var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  for (var i=0; i < decimalValue.length; i++){
    while(num >=decimalValue[i]){
      numcopy=numcopy + romanNumeral[i];
      num = num -decimalValue[i];
    }
  }

  return numcopy;
}

convertToRoman(36);
not working
Sahil Sunny
@sahilsunny
Jan 21 2017 06:29
@joreyesl thankx
CamperBot
@camperbot
Jan 21 2017 06:29
sahilsunny sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 303 | @joreyesl |http://www.freecodecamp.com/joreyesl
Karan Nandha
@karann7
Jan 21 2017 06:31
Need to make a function that takes a parameter and check to see if it has an age property then returns if the person can drink or drive
_
can anyone help?
yoyo-92
@yoyo-92
Jan 21 2017 06:32
@joreyesl it works thanks!
CamperBot
@camperbot
Jan 21 2017 06:32
yoyo-92 sends brownie points to @joreyesl :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @joreyesl |http://www.freecodecamp.com/joreyesl
Jor
@joreyesl
Jan 21 2017 06:37
@karannandha post your current code?
you can try using .hasOwnProperty(prop) to check if it contains a certain property.