These are chat archives for FreeCodeCamp/Help

17th
Jul 2017
Sam Goldberg
@sgoldber61
Jul 17 2017 00:04
Hi guys, I've been working on the twitchTV stream status and the api calls suddenly stopped working... a lot (but not all) of the streamer data is not being returned. Has this happened to anyone else?
korzo
@korzo
Jul 17 2017 00:05
@sgoldber61 Api was down for some time and it looks like freecodecamp proxy is no longer working
Sam Goldberg
@sgoldber61
Jul 17 2017 00:06
oh man... that's rough. I've been using the freecodecamp proxy myself.
korzo
@korzo
Jul 17 2017 00:07
@sgoldber61 It looks like it's working again.
Sam Goldberg
@sgoldber61
Jul 17 2017 00:08
hmm... on my pen a few of the streamers are showing up, but not most of them https://codepen.io/sgoldber61/pen/eRbddP
previously, all of the streamers showed up
korzo
@korzo
Jul 17 2017 00:10
@sgoldber61 proxy is still up and down. some requests are ok, some return 400 error
Sam Goldberg
@sgoldber61
Jul 17 2017 00:12

Yeah, i'm getting a 400 error for most of them...

Well thanks I'll just wait until tomorrow.

Nick Janne
@njanne19
Jul 17 2017 01:17
I'm thinking about using RotJS to make my roguelike dungeon sim because it seems the most simple way to do so. Does anybody know of a good tutorial to get RotJS setup and for me to start actually using it
Veronica Eulenberg
@HappyViki
Jul 17 2017 01:50
@HappyViki
I have an advanced JS question
Why does it print out 6 ababa’s instead of 12?
function perm(a, b, c) {
  return (a *= c + 1);
}

function permutations(letters, permNum) {
  var arr = [];
  var n1 = 0;
  var n2 = 1;
  for (var i = 1; i <= permNum; i++) {
    if (n1 === letters.length) n1 = 0;
    if (n2 > letters.length - 1) n2 = 0;
    var x = letters[n1];
    var y = letters[n2];
    letters[n1] = y;
    letters[n2] = x;

    arr.push(letters.join(""));
    n1++;
    n2++;
  }
  return arr;
}

// HELP HERE
function z(a, b, c, d) {
  for (var i = 0; i < b.length; i++) {
    if (b[i] === b[i - 1] && b[i] !== undefined && b[i-1] !== undefined){
      return a.concat();
    }
  }
  console.log(b)
  return a.concat(b);
}
// END HELP

function permAlone(str) {
  var letters = str.split("");
  var permNum = letters.reduce(perm, 1);
  var permutation = permutations(letters, permNum);
  var alone = permutation.reduce(z, []);
  return alone.length;
}
console.log("1", permAlone("aaabb"));
Kyle Holm
@thekholm80
Jul 17 2017 02:54
@njanne19 use the official tutorial
just the part 1 was enough for me to learn how to use it to generate my map
randomppl
@randomppl
Jul 17 2017 03:02
Hello, flash games can be made on JS too?
RakeshNerkar
@Rakesh18754
Jul 17 2017 03:17
is this mul(2)(3)(4) type of method called as a curry in Javascript?
Santi Valdez
@SantiValdez
Jul 17 2017 03:29
Guys, im at the symetric difference challenge for JS. I dont understand how the third test case sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) expects this result [1, 4, 5] when 5 shows up in all arguments.
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:30
@SantiValdez Can you show your current source code
Santi Valdez
@SantiValdez
Jul 17 2017 03:32
I havent started yet I was planning the code but looking at the tests I am sudenly very confused by that one..
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:32
@SantiValdez Would you mind posting a link to the challenge?
It'd make helping you easier :)
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:33
no worries
BRB
watching alebra primer so i can help you
Nick Janne
@njanne19
Jul 17 2017 03:34
I've been racking my brain on this. Does anybody understand why my double .map . render not work with React?
https://codepen.io/njanne19/pen/WOPVZj?editors=0011
Manish Giri
@Manish-Giri
Jul 17 2017 03:35
react-dom.min.js:14 Uncaught TypeError: Cannot read property 'state' of undefined
@njanne19
Santi Valdez
@SantiValdez
Jul 17 2017 03:36
thanks for taking the time @nsuchy
CamperBot
@camperbot
Jul 17 2017 03:36
santivaldez sends brownie points to @nsuchy :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @nsuchy |http://www.freecodecamp.com/nsuchy
Manish Giri
@Manish-Giri
Jul 17 2017 03:38
here
 export() {
    console.log(this.state.pos);
  }
@njanne19
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:39
@SantiValdez Ok I watched the primar on symmetric difference - needed a few minutes to get a solid understanding
I'm working on a solution that can handle any number of arguements
not just expecting 2 arrays
what if the user passes say 500 arrays
think big
Santi Valdez
@SantiValdez
Jul 17 2017 03:42
yeah I realized I had to do it that way when some tests were passing like 4 arguments
Nick Janne
@njanne19
Jul 17 2017 03:43
@Manish-Giri Thanks for helping me fix that, but the map still doesn't render. I'm not sure why
CamperBot
@camperbot
Jul 17 2017 03:43
njanne19 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6266 | @manish-giri |http://www.freecodecamp.com/manish-giri
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:43
I'm going to write a solution and then explain to you why it works
Kyle Holm
@thekholm80
Jul 17 2017 03:48
@njanne19 you need to bind your instance of this. generally best to do it in the constructor.
Manish Giri
@Manish-Giri
Jul 17 2017 03:48
xxx.png
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:48
function symDiff(arrayOne, arrayTwo) { // We need to check the synmetric difference - this function will handle it for us.
  var result = []; // define the result array to store our calculation

  arrayOne.forEach(function(item) { // check if items in array 1 are in array 2
    if (arrayTwo.indexOf(item) < 0 && result.indexOf(item) < 0) {
      result.push(item);
    }
  });

  arrayTwo.forEach(function(item) { // check if items in array 2 are in array 1
    if (arrayOne.indexOf(item) < 0 && result.indexOf(item) < 0) {
      result.push(item);
    }
  });

  return result;
}

function sym() { // remove args from the function arguements - they'll be handled later
  var args = []; // define args here =
  for (var i = 0; i < arguments.length; i++) { // a simple for loop that creates an array from all arguements is good enough to get us started.
    args.push(arguments[i]); // the array we create will be an array with TWO sub arrays.
  }

  return args.reduce(symDiff); // use the array.reduce method with our symDiff function as the call back to solve the problem
}

sym([1, 2, 3], [5, 2, 1, 4]);
Manish Giri
@Manish-Giri
Jul 17 2017 03:48
because there's nothing to render?
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:48
@SantiValdez
Kyle Holm
@thekholm80
Jul 17 2017 03:48
constructor(props) {
    super(props);
    let map = generateMap();
    this.state = {
      map: map
    };
    this.export = this.export.bind(this);
  }
results:
image.png
Nathaniel Suchy
@nsuchy
Jul 17 2017 03:49
@SantiValdez Now you got me distrated watching algebra videos - im not supposed to do collage till next year - I was taking break for freeCodeCamp :P
Nick Janne
@njanne19
Jul 17 2017 03:50
@thekholm80 for what method do I need to bind this
Santi Valdez
@SantiValdez
Jul 17 2017 03:50
@nsuchy haha thanks a lot! Ill take a few minutes to understand the code well
CamperBot
@camperbot
Jul 17 2017 03:50
:warning: santivaldez already gave nsuchy points
santivaldez sends brownie points to @nsuchy :sparkles: :thumbsup: :sparkles:
Kyle Holm
@thekholm80
Jul 17 2017 03:52
@njanne19 you have an error Uncaught TypeError: Cannot read property 'state' of undefined that means when you're using this to reference this.state.map in your export() class method it's not sure what this you mean
Manish Giri
@Manish-Giri
Jul 17 2017 03:52
@thekholm80 :bow:
Kyle Holm
@thekholm80
Jul 17 2017 03:52
that's why you bind it
as a general rule, always bind any class methods you create. and it's more performant to do so in the constructor()
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:54
That's the part of react I don't like
Manish Giri
@Manish-Giri
Jul 17 2017 03:55
there's always =>
Kyle Holm
@thekholm80
Jul 17 2017 03:55
you can use arrow functions to intrinsically bind, but it's less performant
because it will re-bind every render
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:55
Yeah...
Kyle Holm
@thekholm80
Jul 17 2017 03:55
still better than angular
lol
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:56
You know funny part? @thekholm80
Last month, we used this question as a screening question. What do you think is better? React or Angular or AngularJS
Kyle Holm
@thekholm80
Jul 17 2017 03:57
better in what way?
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:57
Whoever indulged in this argument even for a second, we directly rejected them...
Kyle Holm
@thekholm80
Jul 17 2017 03:57
each has it's place
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:58

@thekholm80

Better in what way? Aren't you the one who said it? lol

still better than angular

haha
Kyle Holm
@thekholm80
Jul 17 2017 03:58
they are both good at what they do, it mostly comes down to preference
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:58
Yo..
Kyle Holm
@thekholm80
Jul 17 2017 03:58
I just like ripping on angular
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:58
we use React for views. backed by Angular
Kyle Holm
@thekholm80
Jul 17 2017 03:58
because it's fun
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:58
Agreed...
The same way I like to rip on java people :D
Kyle Holm
@thekholm80
Jul 17 2017 03:59
java people are the worst
and people that use neo4j
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 03:59
I have a feeling.. We are long lost brothers :D
Kyle Holm
@thekholm80
Jul 17 2017 03:59
:O
lol
my mom has some explaining to do
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 04:00
:D
Nick Janne
@njanne19
Jul 17 2017 04:03
@thekholm80 I binded the method, but my divs still don't appear to show up
Claudio Restifo
@Marmiz
Jul 17 2017 04:04

we used this question as a screening question. What do you think is better? React or Angular or AngularJS

Feels like a trap question:

do you like pineapple on pizza?

Kyle Holm
@thekholm80
Jul 17 2017 04:06
fruit on pizza is an abomination
Ankit Tiwari
@anku255
Jul 17 2017 04:07

Here is a (naively) simple password checker that looks for between 3 and 6 characters and at least one number:

let password = "abc123";
let checkPass = /(?=\w{3,6})(?=\D*\d)/;
checkPass.test(password); // Returns true

Can someone explain how this works?

Kyle Holm
@thekholm80
Jul 17 2017 04:09
@njanne19 you didn't return your inner map
{this.props.board.map((row) => {
          row.map((cell) => {  // need return this
            return (<div id={cell.id} className={cell.status}></div>)
          });
            })}
Nick Janne
@njanne19
Jul 17 2017 04:10
@thekholm80 Oh my god. thank you
CamperBot
@camperbot
Jul 17 2017 04:10
njanne19 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1344 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Claudio Restifo
@Marmiz
Jul 17 2017 04:10

@anku255
https://regex101.com/r/t1kIL7/1

There's a nice explanation on the left

Kyle Holm
@thekholm80
Jul 17 2017 04:10
so
{this.props.board.map((row) => {
         return  row.map((cell) => {
            return (<div id={cell.id} className={cell.status}></div>)
          });
    })}
@Manish-Giri thanks
CamperBot
@camperbot
Jul 17 2017 04:12
thekholm80 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6267 | @manish-giri |http://www.freecodecamp.com/manish-giri
andrea
@girlcodecrush
Jul 17 2017 04:17
I'm currently working on a tribute page. Regarding alignment of image and text, I'm having a hard time. What I want is the image on the left-hand side of the page and the text, description of the image, on the right, next to the image.
I used css float and p element, but it didn't work out.

<style>

#image {
  float:left;
}
p {
  font-family:monospace;
  color:black;
  font-size:13px;
  font-style:italic;
}

</style>

<p>
<img src="https://cdn.theculturetrip.com/images/56-284004-nam-june-paik-reclining-buddha-copy.jpg" alt="Nam June Paik, Reclining Buddha, 1994/2002. Two-channel video installation with two 9-inch color monitors, reclining stone Buddha, 41.9 x 52.1 x 30.5 cm. Nam June Paik Estate | &#xA9; Ben Blackwell">
TV Buddha(1974), one of his most well-known series, playfully commented on the relationship between technology and human spirituality through a closed-circuit video installation and a bronze Buddha sculpture. The Buddha, sitting opposite the TV, would be looking at his own image on TV, creating an infinite looping of the image and a sense of introspection and self-reflection.
</p> The above is the code I used. What is the correct way to do so?

Kyle Holm
@thekholm80
Jul 17 2017 04:22
#image is targeting an id called image
Kevin
@kevinwr
Jul 17 2017 04:22
Can anyone help explain to me why I would use a code editor over an IDE, and vise versa? If IDE's have more power and better integration and understanding of particular languages, why wouldn't someone just want to learn and use an IDE?
Kyle Holm
@thekholm80
Jul 17 2017 04:22
if i had to compile code i'd use an IDE for sure
Claudio Restifo
@Marmiz
Jul 17 2017 04:23
^ pretty much.
If compiles it usually goes over an IDE
Kyle Holm
@thekholm80
Jul 17 2017 04:24
but my Atom is pretty and i'm not giving it up
Claudio Restifo
@Marmiz
Jul 17 2017 04:24
colors
don't get confused with Visual IDE, many IDE's just run in the terminal and has no visual impact on your code.
So you still need an editor to write your code and then compile it via CLI
andrea
@girlcodecrush
Jul 17 2017 04:27
Can I have some input about alignment of both image and text together, like said just now?
Kyle Holm
@thekholm80
Jul 17 2017 04:27
again, @girlcodecrush your float: css has an id selector but you don't have any id='image' in your html
Claudio Restifo
@Marmiz
Jul 17 2017 04:28
@girlcodecrush as @thekholm80 suggested you are not targeting the image
Kyle Holm
@thekholm80
Jul 17 2017 04:28
#image means id='image'
Claudio Restifo
@Marmiz
Jul 17 2017 04:30

@girlcodecrush
if you want to keep this syntax:

#image {
  float:left;
}

then your image need an ID=image

<img class="..." src="..." id="image"

Otherwise just change the CSS selector:

img { /*target all the img */
  float:left;
}
andrea
@girlcodecrush
Jul 17 2017 04:30
ok. Then, to place the text to the right-hand side of the image, is it right to use p element?
Claudio Restifo
@Marmiz
Jul 17 2017 04:39

@girlcodecrush in this example yes. Since you have only one image and one p by using the general p selector you are moving all p.

But in general that's not a good idea. If later on you want to add new paragraph that behave differently you will have harder time to select them.

I usually create specific classes so that I know what I'm targeting.
example:

<img class="navigation_image_left" ...
<p class="image_left_paragraph" ...
.navigation_image_left {
 /*my style*/
}

.image_left_paragraph {
/* my style */
}
shivam gupta
@shivamg11000
Jul 17 2017 04:54
whats the scope of this.refs
andrea
@girlcodecrush
Jul 17 2017 04:56
@Marmiz Thanks for your input!
CamperBot
@camperbot
Jul 17 2017 04:56
girlcodecrush sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 996 | @marmiz |http://www.freecodecamp.com/marmiz
Claudio Restifo
@Marmiz
Jul 17 2017 04:56
@girlcodecrush anytime! happy coding :sparkles:
Eric Miller
@ericmiller777
Jul 17 2017 05:08
hey guys
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var array = [];
  array = arr;
  array.slice(0, size);
  return array;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
why does my slice not work
shivam gupta
@shivamg11000
Jul 17 2017 05:11
slice works your function does not works as you want
@ericmiller777
Eric Miller
@ericmiller777
Jul 17 2017 05:11
I just wanna see it return a, b
array = arr.slice(0, num) works
.
shivam gupta
@shivamg11000
Jul 17 2017 05:12
and array.slice(0,size) does not alter the array , it just returns the slice
use return array.slice(0,size)
Eric Miller
@ericmiller777
Jul 17 2017 05:14
@shivamg11000 thanks
CamperBot
@camperbot
Jul 17 2017 05:14
ericmiller777 sends brownie points to @shivamg11000 :sparkles: :thumbsup: :sparkles:
:cookie: 398 | @shivamg11000 |http://www.freecodecamp.com/shivamg11000
Anthony DeSordi
@desordi3
Jul 17 2017 05:14
question: so I’m about to start the tribute page project. whats the best way to go about doing it? im learning html and css from a book on the side as well but i dont really know how to go about doing it
should i just create the barebones html site and then add css and bootstrap stuff as i learn more on the side?
Darren
@DarrenfJ
Jul 17 2017 05:15
evening fCC
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 05:15
@desordi3 Yes. That is a right way to do it...
Just create barebone and then fill it in with content
Anthony DeSordi
@desordi3
Jul 17 2017 05:15
for example, ill be checking out other peoples code for their tribute pages and they’re using boostrap stuff that hasnt been taught yet (such as class=jumbotron class=carde) etc
Eric Miller
@ericmiller777
Jul 17 2017 05:15
you shouldve learned all you need to pass the requirements
yes when i asked people told me it was fine to use anything
@DarrenfJ hello
Sweet Coding :)
@SweetCodingInc
Jul 17 2017 05:16
@desordi3 Don't look at what other people have done.. Do it on your own... Once you do it, then look around and see if you can integrate something that you like
Anthony DeSordi
@desordi3
Jul 17 2017 05:18
hmmm alright
shivam gupta
@shivamg11000
Jul 17 2017 05:19
whats the scope of this.refs
in react
Claudio Restifo
@Marmiz
Jul 17 2017 05:19

@desordi3 those classes won't be taught into FCC, but you can find them into Bootstap documentation.

The logic now is that you should do some research on your own.
Let's say you decided to use Bootstrap as CSS library, and you want to make a footer.
Start searching into Bootstrap documentation for "footer" and see what you got from there :)

Viktor Tiutiun
@vittorioVT
Jul 17 2017 05:19
hello everybody
Claudio Restifo
@Marmiz
Jul 17 2017 05:19
@shivamg11000 assigning a reference (a unique name) to a component
shivam gupta
@shivamg11000
Jul 17 2017 05:19
@vittorioVT :wave:
Claudio Restifo
@Marmiz
Jul 17 2017 05:19
so you can access it anywhere
Viktor Tiutiun
@vittorioVT
Jul 17 2017 05:19
@DarrenfJ hi
Claudio Restifo
@Marmiz
Jul 17 2017 05:19
also from the console
Darren
@DarrenfJ
Jul 17 2017 05:19
@desordi3 yah they encourage you to explore the internet to find out how to do more on you projects than what's taught
shivam gupta
@shivamg11000
Jul 17 2017 05:19
@Marmiz this.refs is giving empty object in this
https://codepen.io/shivamg11000/pen/NgmYge?editors=0111
Viktor Tiutiun
@vittorioVT
Jul 17 2017 05:19
@shivamg11000 hi :smile:
Darren
@DarrenfJ
Jul 17 2017 05:19
in some cases you almost have to
Anthony DeSordi
@desordi3
Jul 17 2017 05:19
@Marmiz Pretty much what I was thinking, read search ask etc
Darren
@DarrenfJ
Jul 17 2017 05:20
hey guys! :D @vittorioVT @Marmiz
Claudio Restifo
@Marmiz
Jul 17 2017 05:20
@DarrenfJ :wave:
Anthony DeSordi
@desordi3
Jul 17 2017 05:20
ill start with the html first then worry about css and boostrap after. thanks guys
Claudio Restifo
@Marmiz
Jul 17 2017 05:21
@shivamg11000 and what exactly is the ref here?
this.refs.input.value
shivam gupta
@shivamg11000
Jul 17 2017 05:22
@Marmiz in the Input Component
Claudio Restifo
@Marmiz
Jul 17 2017 05:22
@shivamg11000 you haven't declared it
shivam gupta
@shivamg11000
Jul 17 2017 05:22
what
I have set ref in the input tag in the Input Component
@Marmiz
Claudio Restifo
@Marmiz
Jul 17 2017 05:25

@shivamg11000 well in your render you need a

ref={ input => .... }

https://facebook.github.io/react/docs/refs-and-the-dom.html
I don't see it

shivam gupta
@shivamg11000
Jul 17 2017 05:25
@Marmiz well I have used refs that way like ref="input" and it worked
previously
Claudio Restifo
@Marmiz
Jul 17 2017 05:28

@shivamg11000 I saw it now. Hard without any comment. Soz.
Anyway you have this error:

addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

I suggest you not to use the minified version of React or you won't see them

shivam gupta
@shivamg11000
Jul 17 2017 05:29
ok
what that means
@Marmiz
so that means no refs on functional components
thats bad
Claudio Restifo
@Marmiz
Jul 17 2017 05:31
@shivamg11000 that you are giving ref to the Input component but try to access inside Github card.
simply switch to
  render(){
    return (
      <div className="GithubCard">
        <Input handleInput={this.handleInput} ref="input"/>
        <Main />
        <Details />
      </div>
    );
shivam gupta
@shivamg11000
Jul 17 2017 05:32
@Marmiz ref will be passed as props or it will be set as property on INput
component
@Marmiz ok thanks
CamperBot
@camperbot
Jul 17 2017 05:35
shivamg11000 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 997 | @marmiz |http://www.freecodecamp.com/marmiz
Claudio Restifo
@Marmiz
Jul 17 2017 05:35
@shivamg11000 but I'm still puzzled. What do you want to accomplish?
refs are generally displeased in React. You generally wants for 3rd party library integrations
shivam gupta
@shivamg11000
Jul 17 2017 05:37
I want to get the input text after typing something to the input
@Marmiz
and pressing enter
Manish Giri
@Manish-Giri
Jul 17 2017 05:39
then store the input in state
Claudio Restifo
@Marmiz
Jul 17 2017 05:39
@shivamg11000 since Input is a child of GCard you can simply have a state in the card, and handle the event from there:
that's the general flow in react
This is taken straight from the docs. See how they handle change and submit
class NameForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {value: ''};

    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    this.setState({value: event.target.value});
  }

  handleSubmit(event) {
    alert('A name was submitted: ' + this.state.value);
    event.preventDefault();
  }

  render() {
    return (
      <form onSubmit={this.handleSubmit}>
        <label>
          Name:
          <input type="text" value={this.state.value} onChange={this.handleChange} />
        </label>
        <input type="submit" value="Submit" />
      </form>
    );
  }
}
Manish Giri
@Manish-Giri
Jul 17 2017 05:41
generally you'll have a container component which maintains state and renders other children "presentational components" which just renders jsx
Darren
@DarrenfJ
Jul 17 2017 05:41
@Manish-Giri Manish :D
Manish Giri
@Manish-Giri
Jul 17 2017 05:41
@DarrenfJ buddy!
long time no see
how've you been?
__mifflin__
@cdrainxv
Jul 17 2017 05:42
Why is Ed Sheeran in G.O.T?
Darren
@DarrenfJ
Jul 17 2017 05:45
busy busy
shivam gupta
@shivamg11000
Jul 17 2017 05:45
@Marmiz yeah in the example both onChange and onSubmit is used , this way it could be accomplished, but it increases the code unnecessarily
Darren
@DarrenfJ
Jul 17 2017 05:45
but might have some free'er time in August to play around with junk again
i've also been trying to go to bed before 3 am.. and since fCC gitter is now more of a ghost town i try to come on in the day more now
what have you been up to?
Coy Sanders
@coymeetsworld
Jul 17 2017 05:48
to sing @cdrainxv
Maisie Williams is a big fan they've been trying to set it up for years
Claudio Restifo
@Marmiz
Jul 17 2017 05:49
@shivamg11000 well you want one event that keep track of the "name" changed into the input, and another to submit it.
having a state provides multiple benefits with the cost of a few boilerplate code
Eric Miller
@ericmiller777
Jul 17 2017 05:49
hey guys
shivam gupta
@shivamg11000
Jul 17 2017 05:49
@ericmiller777 :wave:
Eric Miller
@ericmiller777
Jul 17 2017 05:50
function slasher(arr, howMany) {
  // it doesn't always pay to be first
  return arr.splice(howMany, 3);
}

slasher([1, 2, 3, 4, 5], 152);
Manish Giri
@Manish-Giri
Jul 17 2017 05:50
@DarrenfJ I've been mainly learning Redux, finishing the data viz cert, and my research of course
shivam gupta
@shivamg11000
Jul 17 2017 05:50
@Marmiz so the refs thing will be deprecated in the future
Eric Miller
@ericmiller777
Jul 17 2017 05:50
I left 3 there
Manish Giri
@Manish-Giri
Jul 17 2017 05:50
which is going slower than *****
Eric Miller
@ericmiller777
Jul 17 2017 05:50
just to check
and it worked
but why 3 lol
seems pretty much whatever i do works with that one
Darren
@DarrenfJ
Jul 17 2017 05:51
@ericmiller777 hey buddy :D
Claudio Restifo
@Marmiz
Jul 17 2017 05:52
@shivamg11000 nope. But the way react is designed to work, refs has not much reason to exists besides few cases.
They explain it here:
https://facebook.github.io/react/docs/refs-and-the-dom.html
Darren
@DarrenfJ
Jul 17 2017 05:52
@Manish-Giri when are yah done done school?
Claudio Restifo
@Marmiz
Jul 17 2017 05:52
In short, in a system with virtual dom, states and props why you would need to access the DOM nodes?
Manish Giri
@Manish-Giri
Jul 17 2017 05:52
officially by December, but my defense will be much earlier, say in August
@DarrenfJ
Darren
@DarrenfJ
Jul 17 2017 05:52
cooooool
Manish Giri
@Manish-Giri
Jul 17 2017 05:53
@DarrenfJ then I'll be like this
__mifflin__
@cdrainxv
Jul 17 2017 05:54
@coymeetsworld: Figured as much. I actually enjoyed this episode…
Lady Lyanna Mormont might be favourite… sorry Arya.
@Manish-Giri: That’s me everyday...
Manish Giri
@Manish-Giri
Jul 17 2017 05:54
lol
Eric Miller
@ericmiller777
Jul 17 2017 05:55
so guys, doing these algorithms how much of this is used in a real job?
Coy Sanders
@coymeetsworld
Jul 17 2017 05:55
no way Arya was :fire: :fire: :fire:
Mormont was bad ass as usual too but Arya is just killing it
Viktor Tiutiun
@vittorioVT
Jul 17 2017 05:56
@ericmiller777 The first parameter of metod defines the position where new elements should be added (spliced in). The second parameter defines how many elements should be removed.
__mifflin__
@cdrainxv
Jul 17 2017 05:57
Yeah… literally.
Eric Miller
@ericmiller777
Jul 17 2017 05:57
@vittorioVT I got that, just why no matter how many i add to the array, does the test say i passed, no matter if i just leave that 3 there
Claudio Restifo
@Marmiz
Jul 17 2017 05:57

@ericmiller777

so guys, doing these algorithms how much of this is used in a real job?

on the job you just stackoveflow... if not answered yet you wait for someone to reply and blame some other department for the delay.
(dev ops... always the dev ops)

Manish Giri
@Manish-Giri
Jul 17 2017 05:57
@ericmiller777 less than 1%
Eric Miller
@ericmiller777
Jul 17 2017 05:58
oh because they just want the numbers taken away
Manish Giri
@Manish-Giri
Jul 17 2017 05:58
algos out there are much much more convoluted..
Eric Miller
@ericmiller777
Jul 17 2017 05:58
so as long as I have the fisrt number its always passing
@vittorioVT thanks
CamperBot
@camperbot
Jul 17 2017 05:58
ericmiller777 sends brownie points to @vittoriovt :sparkles: :thumbsup: :sparkles:
:cookie: 786 | @vittoriovt |http://www.freecodecamp.com/vittoriovt
Darren
@DarrenfJ
Jul 17 2017 06:00
@ericmiller777 algos really are used to teach you how to think logically and how to break a problem down into components..
Eric Miller
@ericmiller777
Jul 17 2017 06:01
@DarrenfJ that makes sense i guess
Darren
@DarrenfJ
Jul 17 2017 06:02
and then completely ignore them in everyday life ;)
Darren
@DarrenfJ
Jul 17 2017 06:09
ok peeps gotta scoot to sleep.. my usual kudos to the people who hang out and make this place a place worth still visitting... thanks and brownies
thanks @Manish-Giri @Marmiz @coymeetsworld @vittorioVT @Marmiz
CamperBot
@camperbot
Jul 17 2017 06:09
darrenfj sends brownie points to @manish-giri and @marmiz and @coymeetsworld and @vittoriovt :sparkles: :thumbsup: :sparkles:
:cookie: 787 | @vittoriovt |http://www.freecodecamp.com/vittoriovt
:cookie: 998 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 6269 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 2972 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Darren
@DarrenfJ
Jul 17 2017 06:09
and of course the often mysterious and elusive cdrain ;0
Manish Giri
@Manish-Giri
Jul 17 2017 06:09
@DarrenfJ ty
CamperBot
@camperbot
Jul 17 2017 06:09
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1907 | @darrenfj |http://www.freecodecamp.com/darrenfj
Darren
@DarrenfJ
Jul 17 2017 06:09
thanks @cdrainxv
CamperBot
@camperbot
Jul 17 2017 06:09
darrenfj sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:star2: 2762 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
Viktor Tiutiun
@vittorioVT
Jul 17 2017 06:10
@DarrenfJ thanks
Coy Sanders
@coymeetsworld
Jul 17 2017 06:10
later @DarrenfJ
DarrenfJ @DarrenfJ tap dances off stage
__mifflin__
@cdrainxv
Jul 17 2017 06:10

thanks @Manish-Giri @Marmiz @coymeetsworld @vittorioVT @Marmiz @DarrenfJ

See you! :wave:

CamperBot
@camperbot
Jul 17 2017 06:10
cdrainxv sends brownie points to @manish-giri and @marmiz and @coymeetsworld and @vittoriovt and @darrenfj :sparkles: :thumbsup: :sparkles:
:cookie: 788 | @vittoriovt |http://www.freecodecamp.com/vittoriovt
:cookie: 999 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 1908 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 2973 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
:star2: 6270 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jul 17 2017 06:11
@cdrainxv ty
CamperBot
@camperbot
Jul 17 2017 06:11
manish-giri sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:star2: 2763 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
Manish Giri
@Manish-Giri
Jul 17 2017 06:11
@Marmiz ty
CamperBot
@camperbot
Jul 17 2017 06:11
manish-giri sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1000 | @marmiz |http://www.freecodecamp.com/marmiz
__mifflin__
@cdrainxv
Jul 17 2017 06:11

1000 :star2:

Manish Giri
@Manish-Giri
Jul 17 2017 06:11

1000

Coy Sanders
@coymeetsworld
Jul 17 2017 06:11
:stars: :stars: :stars:
Manish Giri
@Manish-Giri
Jul 17 2017 06:12
does this syntax look right?
const addMessage = (message) => ({type: ADD, message});
It's a Redux action creator
Coy Sanders
@coymeetsworld
Jul 17 2017 06:12
looks ok to me you have to export it too
Viktor Tiutiun
@vittorioVT
Jul 17 2017 06:13
@cdrainxv thanks and you
CamperBot
@camperbot
Jul 17 2017 06:13
vittoriovt sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:star2: 2764 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
Coy Sanders
@coymeetsworld
Jul 17 2017 06:14
I get an error when I try to write my action creators like that though @Manish-Giri, you might need a return statement
Manish Giri
@Manish-Giri
Jul 17 2017 06:14
@coymeetsworld the return for each case won't do?
Coy Sanders
@coymeetsworld
Jul 17 2017 06:14
nvm its fine w/o return
oh, type needs to be string
Manish Giri
@Manish-Giri
Jul 17 2017 06:15
@coymeetsworld here's the whole thing
// define ADD, addMessage(), messageReducer(), and store here:
const ADD = 'ADD';
const addMessage = message => ({type: ADD, message});

const messageReducer = (state = [], action) => {
  switch(action.type) {
    case ADD: return [...message, action.message];
    default: return state;
   }

}
const store = Redux.createStore(messageReducer);
store.dispatch(addMessage("Hello World"));
Coy Sanders
@coymeetsworld
Jul 17 2017 06:16
why have the type as a constant? why not just use a literal string?
Manish Giri
@Manish-Giri
Jul 17 2017 06:16
That's the way they have it setup
I'm doing the redux challenges on FCC beta
Coy Sanders
@coymeetsworld
Jul 17 2017 06:16
oh i see
Manish Giri
@Manish-Giri
Jul 17 2017 06:17
also, that's why no exports
Coy Sanders
@coymeetsworld
Jul 17 2017 06:18
what challenge is it?
Manish Giri
@Manish-Giri
Jul 17 2017 06:18
all tests fail, except the first one
go here, then select react redux 03 from the dropdown
I'm trying not to hit the "solution code" button, lol
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:21
hey
Coy Sanders
@coymeetsworld
Jul 17 2017 06:22
yeah looking now
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:23
does anyone know how to access global variables in javascript
.?
Manish Giri
@Manish-Giri
Jul 17 2017 06:23
first mistake is this - [...action.message, action.message];
I had just ...message earlier
@coymeetsworld
@prakashyadav008 same way as regular variables
no special syntax
Coy Sanders
@coymeetsworld
Jul 17 2017 06:24
yeah thats a problem
just saw that, should be an obj
Manish Giri
@Manish-Giri
Jul 17 2017 06:24
what should be obj?
Coy Sanders
@coymeetsworld
Jul 17 2017 06:24
what you're returning
also you don't use spread operator on action.message or message
it should be the state
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:25
i am trying to set global variables inside function but it shows undefined when i try to view it using alert
Manish Giri
@Manish-Giri
Jul 17 2017 06:25
oh yeah spread should be on state
return [...state, action.message];
Coy Sanders
@coymeetsworld
Jul 17 2017 06:26
oh wait it is an array nvm
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:26
i am trying to view the latitude global varible using alert in function changeBackground()
Coy Sanders
@coymeetsworld
Jul 17 2017 06:26
but yeah spread needs to go on state
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:26
@Manish-Giri
Manish Giri
@Manish-Giri
Jul 17 2017 06:27
dafuq
it worked
I just deleted this line - store.dispatch(addMessage("Hello World"));
@coymeetsworld
Coy Sanders
@coymeetsworld
Jul 17 2017 06:27
oh for me too
seems like a bug
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:28
@Manish-Giri can u help me out
Manish Giri
@Manish-Giri
Jul 17 2017 06:28
@prakashyadav008 so, I might be wrong, but this is your order -
$(document).ready(function(){
  getLocation();
  getWeather();
  changeBackground();
});
Coy Sanders
@coymeetsworld
Jul 17 2017 06:28
then again, I guess it doesn't explicitly ask you to do that
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:28
ya
Manish Giri
@Manish-Giri
Jul 17 2017 06:29
getLocation() and getWeather() have AJAX requests in them, so when JS fires off the request, it continues to execute changeBackground(), at which point, latitude and longitude are still undefined.
Hence the result.
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:29
ohh
so ill hav to delay the third function
how do i resolve it
..?
Manish Giri
@Manish-Giri
Jul 17 2017 06:30
try either nesting changeBackground() in the last ajax request, or use promises..
although promises might be a bit difficult to learn at this stage
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:30
is there any other way
..?
Manish Giri
@Manish-Giri
Jul 17 2017 06:31
async/await
that's even more advanced, lol

@coymeetsworld I looked at this test case

Dispatching addMessage against the store should add a new message to the array of messages held in state.

thought they were asking me to dispatch, so...

Coy Sanders
@coymeetsworld
Jul 17 2017 06:31
yeah
15502272672
@15502272672
Jul 17 2017 06:32

jQuery 有一个.remove() 的方法可以移除HTML元素

试着使用.remove()方法来移除页面上的target4元素吧.

Coy Sanders
@coymeetsworld
Jul 17 2017 06:32
my guess is its failing test cases where they run it in the background
maybe they do a test where they verify the length of the array
Manish Giri
@Manish-Giri
Jul 17 2017 06:32
if you use promises, you can do something like
getLocation.then(getWeather()).then(changeBackground())
@prakashyadav008
@coymeetsworld probably
@coymeetsworld thx for looking
CamperBot
@camperbot
Jul 17 2017 06:33
manish-giri sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 2974 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
prakash chandra yadav
@prakashyadav008
Jul 17 2017 06:34
how to use async and sync
fdemaa
@fdemaa
Jul 17 2017 06:36
hey @Manish-Giri can you take a look at my code , and tell me why my dom" name " is not appearing on my page ?
i dont know what to do lol
Coy Sanders
@coymeetsworld
Jul 17 2017 06:37
np @Manish-Giri
Manish Giri
@Manish-Giri
Jul 17 2017 06:39
@fdemaa sure, post it
@prakashyadav008 it's async and await..
and it also uses promises behind the scenes
fdemaa
@fdemaa
Jul 17 2017 06:40
My quote is on the page but my name dom is not
Manish Giri
@Manish-Giri
Jul 17 2017 06:42

you can probably rewrite

getLocation.then(getWeather()).then(changeBackground())

to

async function getLocation() {
 try {
    let res = await getWeather();
   await changeBackground(res);
 }
 catch(e) {
   console.log(e);
 }
}
uh
@fdemaa what's "name dom"?
fdemaa
@fdemaa
Jul 17 2017 06:57
@Manish-Giri hey i make it work, i was using a name for one of my variables wich was the same as the name for one of my properties of my objects
i change the name of the variable and it works
prakash chandra yadav
@prakashyadav008
Jul 17 2017 07:04
got it @Manish-Giri
coder130
@coder130
Jul 17 2017 07:08
hey guys i am having trouble in the Profile Lookup challenge
xiaoyimeng
@xiaoyimeng
Jul 17 2017 07:08

<input type="text" placeholder="cat photo URL">

<form action="/submit-cat-photo的action"></form>

coder130
@coder130
Jul 17 2017 07:09

my code is for(i = 0; i < contacts.length; i++) {
for(j = 0; j< contacts[i].length; j++ ) {
if(firstName == contacts[i][j].firstName) {
if(prop == contacts[i][j][prop]) {
return contacts[i][j][prop];
}
return "No such property";
}

else {
return "No such contact";
}
}
}

i dont know what is wrong here
xiaoyimeng
@xiaoyimeng
Jul 17 2017 07:09
如何把你的文本框嵌套进form元素?謝謝
coder130
@coder130
Jul 17 2017 07:10
anyone?
__mifflin__
@cdrainxv
Jul 17 2017 07:11
No such contact should be outside of your for loop.
coder130
@coder130
Jul 17 2017 07:12
@cdrainxv tried it
got an error
__mifflin__
@cdrainxv
Jul 17 2017 07:14
Why do you need two for loops for? You only need one… It’s not a multi-dimensional array.
coder130
@coder130
Jul 17 2017 07:14
@cdrainxv it is. First the various contacts and then their info
18580326615
@18580326615
Jul 17 2017 07:16

what's the css class? for example: "Your < style > contains a pink - text CSS class that sets color to pink." i have been used this: "<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
.pink-text{
color: pink;;
}
</style>

<h1 class="pink-text">Hello World!</h1>

__mifflin__
@cdrainxv
Jul 17 2017 07:16
No it isn’t… their info are just key value pairs… it’s only a 1 dimensional array.
@18580326615: color: pink;; Too much semi-colons.
coder130
@coder130
Jul 17 2017 07:18
@cdrainxv right the other is an object not array
18580326615
@18580326615
Jul 17 2017 07:19
what's semi-colons?
@cdrainxv what's semi-colons?
__mifflin__
@cdrainxv
Jul 17 2017 07:19
;
18580326615
@18580326615
Jul 17 2017 07:20
ok, thanks
__mifflin__
@cdrainxv
Jul 17 2017 07:20
@coder130: Yeah… that means you don’t need to loop twice.
张志洋
@ZhangZhiiyang
Jul 17 2017 07:20
@18580326615 分号 ;
Claudio Restifo
@Marmiz
Jul 17 2017 07:30
@cdrainxv @Manish-Giri @coymeetsworld @DarrenfJ
:sparkles: Thanks guys!! :heart: :heart:
CamperBot
@camperbot
Jul 17 2017 07:30
marmiz sends brownie points to @cdrainxv and @manish-giri and @coymeetsworld and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2975 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
:star2: 2765 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
:star2: 1909 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 6273 | @manish-giri |http://www.freecodecamp.com/manish-giri
Coy Sanders
@coymeetsworld
Jul 17 2017 07:30
thx @Marmiz
Claudio Restifo
@Marmiz
Jul 17 2017 07:30
leesThanThree all of you
shivam gupta
@shivamg11000
Jul 17 2017 07:34
to use api call in componentDidMount or ComponentWillMount
Claudio Restifo
@Marmiz
Jul 17 2017 07:36
@shivamg11000 Didmount
so you don't block the rendering
Manish Giri
@Manish-Giri
Jul 17 2017 07:37
@Marmiz just finished the fcc lessons on react+redux
I think I'm gonna be ded
shivam gupta
@shivamg11000
Jul 17 2017 07:39
@Marmiz I have put the api call in componentWillUpdate, and it looks like it goes into infinite loop
Claudio Restifo
@Marmiz
Jul 17 2017 07:39
@Manish-Giri I was intimidated the first time I had to do it too,
but now, after working in a big project with Redux - Immutable - Saga I have to say that it makes way more sense
probably just practice
Manish Giri
@Manish-Giri
Jul 17 2017 07:40
do you have a few minutes to take a look at something for me?
Claudio Restifo
@Marmiz
Jul 17 2017 07:40
@shivamg11000 yep cos will update force a re-rendering. So you are render and re-render over and over again
shivam gupta
@shivamg11000
Jul 17 2017 07:40
yeah
Claudio Restifo
@Marmiz
Jul 17 2017 07:41
the API should goes into componentDidMount as FB suggest
@Manish-Giri sure thing
(If I can help :) )
fico
@imfico
Jul 17 2017 07:41
https://freecodecamp.cn/challenges/target-elements-by-id-using-jquery#?solution=fccss%0A%20%20%24(document).ready(function()%20%7B%0A%20%20%20%20%24(%22button%22).addClass(%22animated%20bounce%22)%3B%0A%20%20%20%20%24(%22.well%22).addClass(%22animated%20shake%22)%3B%0A%20%20%20%20%24(%22%23target3%22).addclass(%22animated%20fadeOut%22)%3B%0A%0A%20%20%7D)%3B%0Afcces%0A%0A%3C!--%20%E8%AF%B7%E5%8F%AA%E4%BF%AE%E6%94%B9%E8%BF%99%E6%9D%A1%E6%B3%A8%E9%87%8A%E4%BB%A5%E4%B8%8A%E7%9A%84%E4%BB%A3%E7%A0%81%20--%3E%0A%0A%3Cdiv%20class%3D%22container-fluid%22%3E%0A%20%20%3Ch3%20class%3D%22text-primary%20text-center%22%3EjQuery%20Playground%3C%2Fh3%3E%0A%20%20%3Cdiv%20class%3D%22row%22%3E%0A%20%20%20%20%3Cdiv%20class%3D%22col-xs-6%22%3E%0A%20%20%20%20%20%20%3Ch4%3E%23left-well%3C%2Fh4%3E%0A%20%20%20%20%20%20%3Cdiv%20class%3D%22well%22%20id%3D%22left-well%22%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target1%22%3E%23target1%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target2%22%3E%23target2%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target3%22%3E%23target3%3C%2Fbutton%3E%0A%20%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%3Cdiv%20class%3D%22col-xs-6%22%3E%0A%20%20%20%20%20%20%3Ch4%3E%23right-well%3C%2Fh4%3E%0A%20%20%20%20%20%20%3Cdiv%20class%3D%22well%22%20id%3D%22right-well%22%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target4%22%3E%23target4%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target5%22%3E%23target5%3C%2Fbutton%3E%0A%20%20%20%20%20%20%20%20%3Cbutton%20class%3D%22btn%20btn-default%20target%22%20id%3D%22target6%22%3E%23target6%3C%2Fbutton%3E%0A%20%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%3C%2Fdiv%3E%0A%20%20%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A
Manish Giri
@Manish-Giri
Jul 17 2017 07:41
@Marmiz go here and select React Redux 08 from the list.
Claudio Restifo
@Marmiz
Jul 17 2017 07:43
@Manish-Giri const for action type?
Manish Giri
@Manish-Giri
Jul 17 2017 07:44
@Marmiz not Redux 08
React Redux 08
Claudio Restifo
@Marmiz
Jul 17 2017 07:44
@Manish-Giri oh :D connect to message?
Manish Giri
@Manish-Giri
Jul 17 2017 07:44
yup
Victor Popescu
@VicPopescu
Jul 17 2017 07:44
@imfico $("#target3").addclass("animated fadeOut"); make sure it's addClass
Claudio Restifo
@Marmiz
Jul 17 2017 07:45
@Manish-Giri what about it?
Manish Giri
@Manish-Giri
Jul 17 2017 07:45

@Marmiz this is the description

In the last lesson, the component you connected to Redux was named Presentational, and this wasn't arbitrary. This term generally refers to React components that are not directly connected to Redux. They are simply responsible for the presentation of UI and do this as a function of the props they receive. By contrast, container components are connected to Redux. These are typically responsible for dispatching actions to the store and often pass store state to child components as props.

I'm assuming point they're trying to make is that you connect only "container" components to Redux, and these container components should render the presentational components.
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:46
hello, familiar faces :cat:
Manish Giri
@Manish-Giri
Jul 17 2017 07:47
Because presentational components don't have any state, they just render jsx
@diomed :wave: :cat:
long time no c
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:47
really?
Manish Giri
@Manish-Giri
Jul 17 2017 07:47
:yum:
fico
@imfico
Jul 17 2017 07:47
@VicPopescu 3Q
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:48
@Manish-Giri do u have siblings?
Manish Giri
@Manish-Giri
Jul 17 2017 07:48
@diomed not real ones
cousins
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:48
oh, just me then
Manish Giri
@Manish-Giri
Jul 17 2017 07:48
:smiling_imp:
did you watch GoT?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:49
no
Coy Sanders
@coymeetsworld
Jul 17 2017 07:49
get on it then cmon
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:50
haha, I will... some time during the day.probably @ evening
Coy Sanders
@coymeetsworld
Jul 17 2017 07:50
hopefully you don't see any spoilers
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:50
@Manish-Giri do u still have that sketch file I sent u last year?
Manish Giri
@Manish-Giri
Jul 17 2017 07:50
uh
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:51
@coymeetsworld not that I didn't see any spoilers, I in fact didn't see a trailer at all :smile:
Manish Giri
@Manish-Giri
Jul 17 2017 07:51
I think so
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:51
do u know it's name
Manish Giri
@Manish-Giri
Jul 17 2017 07:51
lol
I need to look for it
Coy Sanders
@coymeetsworld
Jul 17 2017 07:51
trailers != spoilers
had to turn off my phone most of the day until i watched it
Manish Giri
@Manish-Giri
Jul 17 2017 07:52
I've only watched first 10 mins of S1 ep 01
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:53
so , it was that bad, huh
Claudio Restifo
@Marmiz
Jul 17 2017 07:54

@Manish-Giri yep. It's based upon this model.

So that you have containers:

- Homepage
 -- action.js
 -- reducer.js
 --constants.js
 --index.js (where you actually write the React component)
 ... (all other related stuff like CSS and so
// homepage index.js
import all the stuff

create component{(
// handle all the logic
render(){
// a bunch of UI
<CustomList {...someProps} />
}
)}

// connect to store and such

And then your component

//customList
function customList({ loading, error, onChange}) {
if (error) {
 return //some jsx markup or other component
}
}

make sense?
(it never does ;) )

Manish Giri
@Manish-Giri
Jul 17 2017 07:55
uh
@Marmiz what I was curious about was - if you connect only container components to Redux
May Kittens Devour Your Soul
@diomed
Jul 17 2017 07:57
beach people right now
.
Manish Giri
@Manish-Giri
Jul 17 2017 07:58
why is that they're connecting a component called Presentational to redux?
Also, this Presentational component has both state and renders JSX too, shouldn't it be split into a child component that does just the rendering?
BuntyBru
@BuntyBru
Jul 17 2017 07:59

hello mates

need a help
i created a vertical pill and its acquiring the whole page right now
How do i decrease its width?

image.png
i am attaching the code here
Please help people

For your convenience the body part

<body>
<ul class="nav nav-pills nav-stacked">
<li><a href="#">Option 1</a></li>
<li><a href="#">Option 2</a></li>
<li><a href="#">Option 3</a></li>
<li><a href="#">Option 4</a></li>
</ul>

</body>

shivam gupta
@shivamg11000
Jul 17 2017 08:07
anyone experience with this
componentWillUpdate(){
  return true;
}
heroiczero
@heroiczero
Jul 17 2017 08:08
@BuntyBru You could use the bootstrap grid system to occupy only a specific space of the webpage http://getbootstrap.com/css/#grid or like in the example https://www.w3schools.com/bootstrap/bootstrap_tabs_pills.asp
Claudio Restifo
@Marmiz
Jul 17 2017 08:09

@Manish-Giri Maybe presentational is just a higer order component (HOC) a component that renders other component
(like react-router or react-redux are just hoc)

Then yes, in general you have this presentational that connects to the store and defer the UI to some other sub-component.
But it's just for your structure... you can do as you like :)

BuntyBru
@BuntyBru
Jul 17 2017 08:09
@heroiczero
ok mate
i am trying that
@heroiczero
thanks mate, It worked
CamperBot
@camperbot
Jul 17 2017 08:10
buntybru sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1498 | @heroiczero |http://www.freecodecamp.com/heroiczero
Claudio Restifo
@Marmiz
Jul 17 2017 08:11
@shivamg11000 what do you want to accomplish?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:11
@Marmiz do u vue?
shivam gupta
@shivamg11000
Jul 17 2017 08:13
@Marmiz nothing, just saying any experience with , I just experienced that
mistakenly it went on a infinte loop
my laptop hanged and I have to remove battery to stop it
codepen didn't stopped the infinte loop
May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:14
lol
shivam gupta
@shivamg11000
Jul 17 2017 08:15
now how am I supposed to open the pen again
if it goes infinte loop again
May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:15
better delete it
shivam gupta
@shivamg11000
Jul 17 2017 08:15
can't do that
their must be a key combination in ubuntu to kill all process
Claudio Restifo
@Marmiz
Jul 17 2017 08:16
@diomed yep, I did a project with Vue
May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:18
@shivamg11000 there are some magic words only Manish Giri knows
that kill it
@Marmiz would u check something 4 me???
and try to implement it
Claudio Restifo
@Marmiz
Jul 17 2017 08:24
@diomed If I can :)
strawberrygirl
@strawberrygirl
Jul 17 2017 08:25
Why does it always remind me that my new img element is missing a right angle bracket?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:25
I'm trying to implement thiss: https://github.serafin.io/vuebar/#installation
and I want it to LOOK like that
like on that page
@strawberrygirl maybe u didn't close it >
strawberrygirl
@strawberrygirl
Jul 17 2017 08:26
😭
What should I do?
shivam gupta
@shivamg11000
Jul 17 2017 08:28
so to use this.setState() from componentDidMount or not
Claudio Restifo
@Marmiz
Jul 17 2017 08:30
@diomed I have never used Vue with codepen. The struggle with implementing templates and adding it to the markup was too much.
Even for prototyping I use the Vue-CLI and create a new simple repo
Claudio Restifo
@Marmiz
Jul 17 2017 08:40
anyway I think you are missing a closing div at the end
May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:42
who? me?
Claudio Restifo
@Marmiz
Jul 17 2017 08:43
yes
May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:43
it's funny how this doesn't work at all when I save it on pc
I closed it tho, but nothing changes...
maybe I should ask creator :/
Claudio Restifo
@Marmiz
Jul 17 2017 08:52

@diomed I feel like you need to include the bar in vue.
The library list two alternatives:
Alternative 1: Include in browser

<script src="vuebar.js"></script>

Alternative 2: Include in your build

import Vuebar from 'vuebar';
Vue.use(Vuebar);

Since you are in codepen probably the alternative 1 is the one you need, but it probably will be blocked by codepen

May Kittens Devour Your Soul
@diomed
Jul 17 2017 08:55
@Marmiz I am not sure to what do I apply this .vb class
RakeshNerkar
@Rakesh18754
Jul 17 2017 09:16

a function returns a object but at any random time interval

i want to monitor that function that whenever it returns the value the screen should get updated

how can i achieve this?

Victor Popescu
@VicPopescu
Jul 17 2017 09:36
@Rakesh18754 deferred object
@Rakesh18754 or a callback
RakeshNerkar
@Rakesh18754
Jul 17 2017 09:40
@VicPopescu can u give a small example
Victor Popescu
@VicPopescu
Jul 17 2017 09:43
@Rakesh18754 Something like this, I guess...
function doDisplay(object){
//do the update screen part here
}

function getObject(callback){
//getting the object
callback(object); //calling the callback, the doDisplay function
}

getObject(doDisplay);
this is how async functions work by passing a callback. the callback is a function that will get executed after you get the data
@Rakesh18754 this is what you wanted?
RakeshNerkar
@Rakesh18754
Jul 17 2017 09:49
My senior was saying that i have to attach an eventlistner to it
Victor Popescu
@VicPopescu
Jul 17 2017 09:50
@Rakesh18754 you use es5 or es6?
RakeshNerkar
@Rakesh18754
Jul 17 2017 09:50
@VicPopescu is their any other metod using event listner on window object
Es 5 or 6 any thing i cn use
Victor Popescu
@VicPopescu
Jul 17 2017 09:51
@Rakesh18754 dunno what exactly you want to do, if you can use es6 then use promises. Where you get the data from? Request or user input?
RakeshNerkar
@Rakesh18754
Jul 17 2017 09:52
It is just a funtion ..with timer which logs data at specified intervals
Victor Popescu
@VicPopescu
Jul 17 2017 09:52
well if you have access in that function, why don't you just use a simple callback?
RakeshNerkar
@Rakesh18754
Jul 17 2017 09:53
@VicPopescu basically how in a news feed app u have...life update i want to implement a dummy project of that
Live
*live update
Aita Kane
@aita-kane
Jul 17 2017 09:56
hello can someone help me please what's can I do to have this effect on this website . Actually when you scroll the video resize itself and reveal the content under . The website : http://www.goodorganiconly.com/
Victor Popescu
@VicPopescu
Jul 17 2017 09:56
@Rakesh18754 pfff if you want to listen for DOM appends then thats beyond my knowledge
@Rakesh18754 there is Mutation Observer. If you need something like that read this https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
cykins4good
@cykins4good
Jul 17 2017 10:14
Hi to all .I am trying to style my portfolio page but its not responding and do not know what might be the problem.This is my link https://codepen.io/cykins4good/pen/weOqbd
I want to design all the background of my page fro my name down to the end of my photograph yellow color.How can i do this
May Kittens Devour Your Soul
@diomed
Jul 17 2017 10:22
@cykins4good u must have , after each element
p, h2, h3{ background-color: yellow;}
Sudhanshu1992
@Sudhanshu1992
Jul 17 2017 10:35
hi guys,
Does anybody know about Datatable jquery plugin
shivam gupta
@shivamg11000
Jul 17 2017 10:39
any react guy up
ChoiYoungdo
@ChoiYoungdo
Jul 17 2017 10:54
Hey guys, I'm using .load() to display different HTML files to a div within my index.html - It does work but it slows the the website overtime and crashes the session making the site unresponsive. Do we have an alternative method for this?
Put it simply my goal for this is to load/display another HTML file to a div within my index. Anyone care to help? :)
Stephen James
@sjames1958gm
Jul 17 2017 11:05
@shivamg11000 What's the issue. I am no react expert, but maybe we can figure it out.
shivam gupta
@shivamg11000
Jul 17 2017 11:07
well I have added a event onSubmit on a form which takes the input as entered from it,
the problem is that input is outputting correct in the onSubmit() but the the.state.input is showing the previous stored
Stephen James
@sjames1958gm
Jul 17 2017 11:10
And . . .
GithubCard component -> onSubmit function
console.log()
@sjames1958gm
cykins4good
@cykins4good
Jul 17 2017 11:14
i want to wrap the background of my page from my name till my photograph in color yellow but it not responding despite all trials https://codepen.io/cykins4good/pen/weOqbd
Stephen James
@sjames1958gm
Jul 17 2017 11:14
@shivamg11000 What is the problem? That the input is not in the state when you call loadData?
@shivamg11000 Add a parameter to loadData - and pass this.state.input in componentDidMount and pass input in onSubmit
shivam gupta
@shivamg11000
Jul 17 2017 11:25
@sjames1958gm this time error is unexpected , see the console
Stephen James
@sjames1958gm
Jul 17 2017 11:25
@shivamg11000 When you do what?
shivam gupta
@shivamg11000
Jul 17 2017 11:27
@sjames1958gm I did the same that you told
see the code
Stephen James
@sjames1958gm
Jul 17 2017 11:27
@shivamg11000 You are still using the this.state.input in the URL.
I meant what user action did you do to get the error?
shivam gupta
@shivamg11000
Jul 17 2017 11:30
@sjames1958gm I didn't get you, but there's only one thing user can do, type the id and press enter
Stephen James
@sjames1958gm
Jul 17 2017 11:31
@shivamg11000 You need to use the function parameter in the github URL and pass the original this.state.input in component did mount.
shivam gupta
@shivamg11000
Jul 17 2017 11:32
which function
@sjames1958gm
Stephen James
@sjames1958gm
Jul 17 2017 11:33
@shivamg11000 The function that you just changed to add a parameter to. loadData
url : `https://api.github.com/users/${input}`
KinderPreet Singh
@kindercappy
Jul 17 2017 11:33
Please check out my calculator app. Do report any bugs you find.
https://codepen.io/kindercappy/full/mwgaGN/
shivam gupta
@shivamg11000
Jul 17 2017 11:34
@sjames1958gm ok I didn't see that
whats your github ID, let me type that and check it
Stephen James
@sjames1958gm
Jul 17 2017 11:34
@shivamg11000 sjames1958gm -
shivam gupta
@shivamg11000
Jul 17 2017 11:34
ok now its working fine
@sjames1958gm
Stephen James
@sjames1958gm
Jul 17 2017 11:35
@shivamg11000 :+1:
shivam gupta
@shivamg11000
Jul 17 2017 11:35
now I have question when It was initially setState in onSubmit function console.log(this.state) was outputting the previous sotred values , why?
@sjames1958gm
Stephen James
@sjames1958gm
Jul 17 2017 11:36
@shivamg11000 setState doesn't update the state immediately, so the previous state was still there when loadData tried to use it.
shivam gupta
@shivamg11000
Jul 17 2017 11:42
@sjames1958gm I know thats true for some lifecycle methods but I didn't expected it for normal function or event handler
KKRkk
@KKRkk
Jul 17 2017 11:43
anyone help
Stephen James
@sjames1958gm
Jul 17 2017 11:44
@shivamg11000 It is true for all functions.
https://facebook.github.io/react/docs/react-component.html#setstate
It says here that setState enqueues the state change.
@KKRkk Depends on the help needed.
shivam gupta
@shivamg11000
Jul 17 2017 11:44
@sjames1958gm its not true for componentDidUpdate I think
knight2
@knight2
Jul 17 2017 11:45

I am on the FCC Sass section, for creating variables and using them to change CSS.
http://beta.freecodecamp.com/en/challenges/sass/store-data-with-sass-variables
The challenge test case for red font is broken (issues open on github)

And the in browser web editor won't show red text.

I tried doing it in sublime text, but the text doesn't turn red. I used package controller to install Sass and Sass builder, but still isn't working.


<style>
  $text-color: red;

  .header{
    text-align: center;
  }
  .blog-post h2 {
    color: $text-color;
  }
</style>

<h1 class="header">Learn Sass</h1>
<div class="blog-post">
  <h2>Some random title</h2>
  <p>This is a paragraph with some random text in it</p>
</div>
<div class="blog-post">
  <h2>Header #2</h2>
  <p>Here is some more random text.</p>
</div>
<div class="blog-post">
  <h2>Here is another header</h2>
  <p>Even more random text within a paragraph</p>
</div>
They just want you to add the variable $text-color: red; and set h2 and blogpost to it
shivam gupta
@shivamg11000
Jul 17 2017 11:46
@sjames1958gm thanx for the help, highly appreciated
CamperBot
@camperbot
Jul 17 2017 11:46
shivamg11000 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8089 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 17 2017 11:46
@knight2 How is the sass getting "compiled" into css in sublime?
@shivamg11000 :+1:
knight2
@knight2
Jul 17 2017 11:50
@sjames1958gm I installed Sass Builder, and under tools -> build system I have sass(compressed) selected. I hit control + B, and console says
'sass' is not recognized as an internal or external command, operable program or batch file.
Stephen James
@sjames1958gm
Jul 17 2017 11:51
@knight2 Sorry, I don't use sublime text, so don't know the setup. Maybe someone else is on that knows.
knight2
@knight2
Jul 17 2017 11:51
From googling, looks like I also need to install ruby?
Frustrating that FCC makes you use their in browser editor and doesn't actually help you set up a proper program
knight2
@knight2
Jul 17 2017 11:59
Well, found a "solution". This codepen has configurations for SASS. Guess i'll use that till I figure out how to properly configure sublime text or another editor.
https://codepen.io/ragnarok12/pen/Hwnip
shivam gupta
@shivamg11000
Jul 17 2017 12:09
any idea how to make the input placeholder text blink after a setInterval @sjames1958gm
Ankit Tiwari
@anku255
Jul 17 2017 12:11
image.png
In the this challenge I am unable to pass a test. Can somebody look into this?
let repeatNum = "42 42 42";
let reRegex = /(\d+)\s\1\s\1/; // Change this line
let result = reRegex.test(repeatNum);
EpicTriffid
@EpicTriffid
Jul 17 2017 12:13
Can anyone tell me why my API call isn't working? Its meant to work when you type a term into the search box, but im not getting any errors or anything. Its just that nothing is happening https://codepen.io/EpicTriffid/pen/WOYrzg
Stephen James
@sjames1958gm
Jul 17 2017 12:21
@shivamg11000 No, I don't sorry.
@anku255 You need to use anchors, ^ and $ so you can only match the whole string.
/^(\d+)\s\1\s\1$/
Stephen James
@sjames1958gm
Jul 17 2017 12:26
@EpicTriffid
This works resultsbox.html(JSON.stringify(result)); Not sure why only result without stringify is not working.
EpicTriffid
@EpicTriffid
Jul 17 2017 12:35
@sjames1958gm Thankyou :) Im not sure either. The Wikipedia API is unlike any of the others I've used and its definitely added a whole layer of complexity i dont understand
CamperBot
@camperbot
Jul 17 2017 12:35
epictriffid sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8090 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Joshua Friedman
@jsf2008
Jul 17 2017 12:56
Good morning/afternoon/evening. Could someone help me understand where I'm derping on some HTML?
cykins4good
@cykins4good
Jul 17 2017 12:57
i need to extend the yellow color to stop after my photo column before PORTFOLIO https://codepen.io/cykins4good/pen/weOqbd
Kamal
@kpbro
Jul 17 2017 13:04
https://codepen.io/kamalpancholi/pen/jwepBw?editors=0010
why temperature is not changing from C to F?
Joshua Friedman
@jsf2008
Jul 17 2017 13:05
Because you didn't link the code to your temp
you just created a button to switch
tundeiness
@tundeiness
Jul 17 2017 13:17
@tundeiness
any heads up on how to use this API ---> https://fcc-weather-api.glitch.me/
can anyone help..I'm still not clear despite the explanation that it is an icon API..the issue is how do I connect to it? at least I need to know the parameters that was used.
madhuri soni
@sonimadhuri
Jul 17 2017 13:19
@cykins4good wrap that section within a div and give the div class="yellowbackground"
cykins4good
@cykins4good
Jul 17 2017 14:03
@sonimadhuri i did that already, but my yellow colour stopped before my photograph while the black colour is not responding at all.
@sonimadhuri i did that already, but my yellow colour stopped before my photograph while the black colour is not responding at all. https://codepen.io/cykins4good/pen/weOqbd
madhuri soni
@sonimadhuri
Jul 17 2017 14:14
@cykins4good btw why do you have two body tags in your pen
cykins4good
@cykins4good
Jul 17 2017 14:23
i that the result is good but the correction has removed my navigation Bar completely and my texts are not being centered @sonimadhuri
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:24
@cykins4good u can't just have things like this
<div class="nameToPhoto" 
<hr1>back-ground color yellow</hr1>
</div>
every div must be closed:
<div class="nameToPhoto">
 <hr1>back-ground color yellow</hr1>
</div>
Anthony DeSordi
@desordi3
Jul 17 2017 14:26
can somebody rip apart my first project? dont have much bootstrap in there since im still learning how to properly use it so i pretty much have simple html and some css
cykins4good
@cykins4good
Jul 17 2017 14:26
Yes i understand but how can i have my navigation bar back at the top left of my page and my text be centralized @diomed
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:27
@desordi3 looks ok
delete <html>
Anthony DeSordi
@desordi3
Jul 17 2017 14:29
got it
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:29
@desordi3 delete </img>
images don't need closing tag
Anthony DeSordi
@desordi3
Jul 17 2017 14:30
@diomed thank you!
CamperBot
@camperbot
Jul 17 2017 14:30
desordi3 sends brownie points to @diomed :sparkles: :thumbsup: :sparkles:
:star2: 5175 | @diomed |http://www.freecodecamp.com/diomed
Anthony DeSordi
@desordi3
Jul 17 2017 14:30
little overlook
would you say its good enough to not think twice about submitting it and moving on to the next project?
and then obv coming back to it in the future once i have more skills
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:31
yes, it's good
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:39
@cykins4good this is also not to happen:
<div class="row">
< class="col-md-8">
u need to have div before any class with a col
Joshua Friedman
@jsf2008
Jul 17 2017 14:40
Can anyone check to see why my push function won't work?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:40
madhuri soni
@sonimadhuri
Jul 17 2017 14:41
@cykins4good its not because of the change i unknowingly removed it
Anthony DeSordi
@desordi3
Jul 17 2017 14:49
what exactly does bootstrap jumbotron do?
JohnPaulWalsh
@JohnPaulWalsh
Jul 17 2017 14:51
.jumbotron {
    padding-top: 30px;
    padding-bottom: 30px;
    margin-bottom: 30px;
    color: inherit;
    background-color: #eee;
}
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:52
@desordi3 it's basically a header
Margaret
@Margaret2
Jul 17 2017 14:52
@desordi3 the jumbotron is intended for featured content, so it gives it some padding + a background color, it also sets an h1 element inside it to 63px
cykins4good
@cykins4good
Jul 17 2017 14:52
Thanks to @diomed @sonimadhuri
CamperBot
@camperbot
Jul 17 2017 14:52
cykins4good sends brownie points to @diomed and @sonimadhuri :sparkles: :thumbsup: :sparkles:
:cookie: 328 | @sonimadhuri |http://www.freecodecamp.com/sonimadhuri
:star2: 5176 | @diomed |http://www.freecodecamp.com/diomed
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:52
:disappointed: If u say so @Margaret2
Margaret
@Margaret2
Jul 17 2017 14:53
@diomed what? wasn't trying to undermine you :fish_cake:
Anthony DeSordi
@desordi3
Jul 17 2017 14:53
@diomed @Margaret2 thank you guys!
CamperBot
@camperbot
Jul 17 2017 14:53
desordi3 sends brownie points to @diomed and @margaret2 :sparkles: :thumbsup: :sparkles:
:warning: desordi3 already gave diomed points
:star2: 2859 | @margaret2 |http://www.freecodecamp.com/margaret2
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:53
:fish_cake:
:cat:
Margaret
@Margaret2
Jul 17 2017 14:54
cats love fish cakes right :yum:
cykins4good
@cykins4good
Jul 17 2017 14:54
@diomed @sonimadhuri i need to design my background colour: black from PORTFOLIO to the end of my end.how will i do that https://codepen.io/cykins4good/pen/weOqbd
May Kittens Devour Your Soul
@diomed
Jul 17 2017 14:54
yup yup yup
in the tribute page example, what is the “col-xs-12” doing exactly?
and the <div class="col-xs-12 col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:06
it creates row in xtra small screens
that whole line you're witnessing is TRUE responsiveness
because page is shown differently on different screens.
Anthony DeSordi
@desordi3
Jul 17 2017 15:08
is that essential for every web page?
only because im on mobile now and i dont necessarily “see” the rows on the mobile part
unless im understanding rows wrong
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:09
that IS essential for every web page whose designer is smart enough to make it responsive
Anthony DeSordi
@desordi3
Jul 17 2017 15:10
Got it. so for example, i added the class=row and col xs 12 to my tribute page but didnt see a visual change
should i be seeing something change or is it behind the scenes?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:11
col-xs-12 IS row
because 1 row = 12 columns
Margaret
@Margaret2
Jul 17 2017 15:12
a col-xs-12 div should be inside a row div, the 12 columns means it takes up the whole row
row and col-xs-12 classes should not be on the same div
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:14
@Margaret2 can we do this instead:
<div class="row col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
oops... I guess not
Margaret
@Margaret2
Jul 17 2017 15:14
not supposed to do that, the row should be in a separate div
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:14
:disappointed:
I'm such a :sweet_potato:
Margaret
@Margaret2
Jul 17 2017 15:15
bootstrap :gun:
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:15
@Margaret2 lets move to Bulma & never look back
Margaret
@Margaret2
Jul 17 2017 15:15
:smile:
Anthony DeSordi
@desordi3
Jul 17 2017 15:15
<div class="container-fluid">
  <div class="jumbotron">
    <div class="row">
      <div class="col-xs-12">
<head>
<link href="https://fonts.googleapis.com/css?family=Baloo+Bhaina|Lato|Open+Sans|Oswald|Raleway|Roboto" rel="stylesheet">  
  <title>Tribute to Joe Rogan</title>
  </head>

 <body>
   <h1>Joe Rogan</h1>
   <h2><em>Stand up Comedian, UFC Enthusiast, Legendary Podcaster </em></h2>
   <div>
   <img src="https://prod-academy-wp-content-uploads.s3.amazonaws.com/2017/03/roganweb.jpg" alt="Joe Rogan Lifting Weights" class="center" class="img-responsive" width="90%" max-width="900px" id="Joe Rogan">   
   </div>
  <h3 class="text-center">Joe Rogan throughout the Years</h3>
  <div id="Ordered_List">
  <ul>
    <li><strong>August 1967</strong> - Born in Newark, New Jersey.</li>
    <li><strong>August 1988</strong> -  Performs his first stand up routine in Boston, MA.</li>
    <li><strong>1990</strong> - Joe moves to New York City to pursue a career as a full-time comedian.</li>
    <li><strong>1994</strong> - Moves to Los Angeles to explore more career opportunities.</li>
    <li><strong>September 1994</strong> - Accepted a development deal with Disney and secured his first major acting role in the show <em>Hardball.</em></li>
    <li><strong>1995</strong> - Starred in the NBC sitcom <em>News Radio.</em></li>
    <li><strong>1997</strong> - Begins working for the Ultimate Fighting Championship as a backstage and post-fight interviewer.</li>
    <li><strong>2001</strong> - Accepted an offer from NBC to host <em>Fear Factor</em>, which helped make Joe a household name.</li>
    <li><strong>2005</strong> - Joe confronts Carlos Mencia on stage at <em>The Comedy Store</em> for stealing jokes.</li>
    <li><strong>August 2010</strong> - Starts the podcast <em>The Joe Rogan Experience</em>, where guests discuss politics, current events, philosophy, and various other topics.</li>
    <li><strong>2013</strong> - Hosted his own six-episode television show <em>Joe Rogan Questions Everything</em> on the SyFy network.</li>
    </div>
<blockquote>
  <p id="quote">
  "When someone comes along and expresses him or herself as freely as they think, people flock to it. They enjoy it."
  </p> </blockquote>
    <footer id="footer">- Joe Rogan on human behavior.</footer>
    <hr />
    <p id="Wiki-Link">If you have time, you can read more about Joe on his <a href="https://en.wikipedia.org/wiki/Joe_Rogan">Wikipedia Page.</a></p>

  </body>
   </div>
   </div>
   </div>
   </div>
sorry for the wall of text but i have the “col xs 12” correctly inside of the “class=row” div correct?
Margaret
@Margaret2
Jul 17 2017 15:16
@desordi3 lol you don't put head and body inside a div
Anthony DeSordi
@desordi3
Jul 17 2017 15:16
yeah i thought that looked weird
Margaret
@Margaret2
Jul 17 2017 15:16
don't even need head and body elements in codepen
all divs should be inside the body
that's the main code for your page
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:17
especially if u don't know how they're used :yum:
Anthony DeSordi
@desordi3
Jul 17 2017 15:17
got it
so after taking out head and body elements, the div placement is correct right?
Margaret
@Margaret2
Jul 17 2017 15:18
it looks ok, not sure whether the jumbotron is supposed to go inside or outside the row
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:18
<link href="https://fonts.googleapis.com/css?family=Baloo+Bhaina|Lato|Open+Sans|Oswald|Raleway|Roboto" rel="stylesheet">  
  <title>Tribute to Joe Rogan</title>
still has to go in head
which is in Settings
  • stuff 4 head
Margaret
@Margaret2
Jul 17 2017 15:18
ah, they have jumbotron outside row in the example, so that should be fine
Anthony DeSordi
@desordi3
Jul 17 2017 15:19
ahh okay so anything for the head i should just put in the setttings
instead of at the top of my actual html code?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:19
yes, when in codepen - yes
Anthony DeSordi
@desordi3
Jul 17 2017 15:20
Got it. so i think im starting to understand. im putting the col-xs-12 in my code because then it is responsive in regards to a small phone screen with 12 columns right?
and i have to put that in a div class=row for it to work correctly
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:21
for your first sentence - yes
for second, ask @Margaret2
Margaret
@Margaret2
Jul 17 2017 15:23
@desordi3 think of it as a fraction... let's say normally it's 4/12 columns - that's 1/3 of the width. But that would be too small on a phone, so you would do 12/12 columns = full width. So there will always be 12 columns, you just have to decide how many of them you want to use
and yes to the second sentence
Anthony DeSordi
@desordi3
Jul 17 2017 15:23
Makes perfect sense thanks alot @Margaret2
CamperBot
@camperbot
Jul 17 2017 15:24
desordi3 sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:warning: desordi3 already gave margaret2 points
Anthony DeSordi
@desordi3
Jul 17 2017 15:24
and on top of that, if i wanted to add something to my site that only took up the leftmost 3 columns, i would put that paragraph (for example) within a column xs 4 div?
4 columns*
Margaret
@Margaret2
Jul 17 2017 15:25
yeah
@diomed we are trying to stream one of BTS music videos to 100M views and it feels like forever :sweat: still at 99.1 million :P
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:26
oh lol
do u even listen some girl bands? @Margaret2
Margaret
@Margaret2
Jul 17 2017 15:26
girl bands are annoying
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:26
:joy_cat:
Margaret
@Margaret2
Jul 17 2017 15:26
:joy: maybe like boy bands are to you?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:27
yea
Margaret
@Margaret2
Jul 17 2017 15:29
i don't mind some western female singers, but K-pop girl bands are really annoying, like over-the-top girly and the dance is not very artistic, which is important to me :unamused:
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:31
@Margaret2 yesterday I discovered HAIM & they're now my favorite girl band
Margaret
@Margaret2
Jul 17 2017 15:31
for real?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:32
yup
Margaret
@Margaret2
Jul 17 2017 15:32
cool
BTS will always be special to me but recently i discovered VIXX and their music is just magical, i really :blue_heart: it
David Lars Ketch
@DavidLarsKetch
Jul 17 2017 15:35
Hey all, on the Local Weather challenge. I'm trying to use the new API freeCodeCamp posted. I don't need to .parse() the data, correct, because its already in JSON format?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:35
what's with girls in their 20es and their love for korean boy bands? lol
Anthony DeSordi
@desordi3
Jul 17 2017 15:35
Last question. Not sure why the columns arent working on mobile but on desktop the site looks really good (in regards to seperating my elements in columns 8 and columns 4 for the timeline and quote)
https://codepen.io/desordia1/full/GEedJb/
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:37
@Margaret2 so much untasteful nudity. I think I saw his nipple
Margaret
@Margaret2
Jul 17 2017 15:37
@diomed good grief what are you watching
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:38
this : 빅스 (VIXX) - 도원경(桃源境) (Shangri-La) Official M/V
David Lars Ketch
@DavidLarsKetch
Jul 17 2017 15:38
@desordi3 The columns are working for me. Maybe change the units on the font so it is responsive as well? Using px will give you the same size font no matter the viewport.
Margaret
@Margaret2
Jul 17 2017 15:38
haven't seen that one yet @diomed
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:39
well that came as first, when I googled, so..
Margaret
@Margaret2
Jul 17 2017 15:39
@diomed watch this one it's perfection
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:42
@Margaret2 I don't get it
Margaret
@Margaret2
Jul 17 2017 15:43
@desordi3 you should have another row for the col-xs-8 and col-xs-4 divs
Chris
@bestintown23
Jul 17 2017 15:45
how can i center these photos and also make them the same height and width??? https://codepen.io/bestintown23/pen/gREoxb
Margaret
@Margaret2
Jul 17 2017 15:45
@diomed haha i know i wouldn't get HAIM either ... or Katy Perry why do guys like Katy Perry ....
Kyle Holm
@thekholm80
Jul 17 2017 15:46
@diomed x
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:47
ok, that got me too. I'd hit the door as well :cat:
@Margaret2 I'm more for lily allen
Kyle Holm
@thekholm80
Jul 17 2017 15:49
I <3 lily allen
Alexander Køpke
@alexanderkopke
Jul 17 2017 15:49
who dat?
:wave:
Kyle Holm
@thekholm80
Jul 17 2017 15:49
british pop singer
@alexanderkopke :wave:
Alexander Køpke
@alexanderkopke
Jul 17 2017 15:50
ok
dang I should know these things. uk is next door
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:51
u're obviously too old
like we're all too old for K-POP
:yum:
Anthony DeSordi
@desordi3
Jul 17 2017 15:51
@DavidLarsKetch when you checked on mobile did you click full page view?
Kyle Holm
@thekholm80
Jul 17 2017 15:51
@alexanderkopke this one's my fav
Margaret
@Margaret2
Jul 17 2017 15:51
@diomed rofl there's no nudity in shangri la :joy: i just watched it
Alexander Køpke
@alexanderkopke
Jul 17 2017 15:52
went to a trance festival this weekend.. my brain is very muddled still
Kyle Holm
@thekholm80
Jul 17 2017 15:52
i wouldn't know any trance artists anymore. Used to love Paul Okenfold, Sasha & Digweed, etc
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 15:52
@bestintown23 change the height = ...; and width = ...; directly, use text-align: center; , or the bootstrap grid system to center it. lots of ways
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:53
@thekholm80 have u seen Sing Street?
Margaret
@Margaret2
Jul 17 2017 15:53
haven't listened to lily allen, i will look her up though
Kyle Holm
@thekholm80
Jul 17 2017 15:53
i haven't
@Margaret2 :point_up: July 17, 2017 9:51 AM
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:54
oh I gotta feeling u're gonna like it. Everybody pls watch Sing Street ASAP !
That includes u @Margaret2
Alexander Køpke
@alexanderkopke
Jul 17 2017 15:54
lol funny video with allen.. gets him beat up and stuff oh lord!
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:54
@alexanderkopke what video is that?
Chris
@bestintown23
Jul 17 2017 15:54
@BrewCoffeeSplash thanks
CamperBot
@camperbot
Jul 17 2017 15:54
bestintown23 sends brownie points to @brewcoffeesplash :sparkles: :thumbsup: :sparkles:
:cookie: 322 | @brewcoffeesplash |http://www.freecodecamp.com/brewcoffeesplash
Alexander Køpke
@alexanderkopke
Jul 17 2017 15:54
@alexanderkopke this one's my fav
that one
Kyle Holm
@thekholm80
Jul 17 2017 15:55
@diomed wow that movie has 96% on rotten tomato
May Kittens Devour Your Soul
@diomed
Jul 17 2017 15:55
well, I know. u totally wont be sorry
well deserved
@alexanderkopke have u not seen this
Alexander Køpke
@alexanderkopke
Jul 17 2017 15:58
true but don't like the music
Kyle Holm
@thekholm80
Jul 17 2017 15:58
Anthony DeSordi
@desordi3
Jul 17 2017 16:00
when checking my site on mobile should i be worrying about how it looks in full page view?
Kyle Holm
@thekholm80
Jul 17 2017 16:01
on codepen?
Anthony DeSordi
@desordi3
Jul 17 2017 16:01
yes sir
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:01
with a mobile first approach it should look good either way
Darren
@DarrenfJ
Jul 17 2017 16:01
morning fCC
Kyle Holm
@thekholm80
Jul 17 2017 16:01
@DarrenfJ :wave:
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:01
once you know more, you can make some custom settings to adjust for screen size
Darren
@DarrenfJ
Jul 17 2017 16:01
buddy! :D
Margaret
@Margaret2
Jul 17 2017 16:01
@desordi3 the full page view is basically the completed page, so I think that's pretty important
Kyle Holm
@thekholm80
Jul 17 2017 16:01
@desordi3 i suppose that depends on whether or not you feel the code editors are part of your design
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:01
with @media
Anthony DeSordi
@desordi3
Jul 17 2017 16:02
For some reason one of my col xs 4 elements wont fit within the page
Nathaniel Suchy
@nsuchy
Jul 17 2017 16:02
Will javascript let me adds numbers to a string variable (without converting them also to string?
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:02
in what way?
Nathaniel Suchy
@nsuchy
Jul 17 2017 16:02
I'm currently having issues with it
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:02
@nsuchy convert it back then
variables can only hold one type fyi
Nathaniel Suchy
@nsuchy
Jul 17 2017 16:02
@BrewCoffeeSplash Is that a no, not possible?
Margaret
@Margaret2
Jul 17 2017 16:02

@desordi3 i suppose that depends on whether or not you feel the code editors are part of your design

ahahahaha

BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:03
so use 2 variables
Nathaniel Suchy
@nsuchy
Jul 17 2017 16:03
@BrewCoffeeSplash thanks
CamperBot
@camperbot
Jul 17 2017 16:03
nsuchy sends brownie points to @brewcoffeesplash :sparkles: :thumbsup: :sparkles:
:cookie: 323 | @brewcoffeesplash |http://www.freecodecamp.com/brewcoffeesplash
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:03
or concate it back to whatever you need, within possibility
Margaret
@Margaret2
Jul 17 2017 16:03
@thekholm80 also the voices are nice but the music is waaay too chill for me :D
Kyle Holm
@thekholm80
Jul 17 2017 16:03
@Margaret2 which?
Margaret
@Margaret2
Jul 17 2017 16:03
all
Kyle Holm
@thekholm80
Jul 17 2017 16:04
hmm ... i don't know if i have any high energy music right now
i'm not exactly a high energy person. more like a sloth with 10 fingers
Darren
@DarrenfJ
Jul 17 2017 16:05
do sloth's have opposable thumbs?
Margaret
@Margaret2
Jul 17 2017 16:05
i love this hyper song (not kpop) x :smile: :smile:
Kyle Holm
@thekholm80
Jul 17 2017 16:06
@Margaret2 that's pretty good
Margaret
@Margaret2
Jul 17 2017 16:06
NCS is awesome
Kyle Holm
@thekholm80
Jul 17 2017 16:06
lol even the electronic music i listen to is downtempo and chill
@DarrenfJ lol
Margaret
@Margaret2
Jul 17 2017 16:07
@BrewCoffeeSplash O.o
Darren
@DarrenfJ
Jul 17 2017 16:08
@Margaret2 i can never tell when it's you cause yer icon changes so much...
Margaret
@Margaret2
Jul 17 2017 16:09
lol
Darren
@DarrenfJ
Jul 17 2017 16:10
fer 'ril
May Kittens Devour Your Soul
@diomed
Jul 17 2017 16:12
hello @DarrenfJ :cat:
@thekholm80 have u ever tried this: Bohren & der Club of Gore
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:15
@revisualize thank you
CamperBot
@camperbot
Jul 17 2017 16:15
brewcoffeesplash sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4357 | @revisualize |http://www.freecodecamp.com/revisualize
Kyle Holm
@thekholm80
Jul 17 2017 16:19
@diomed that's a little too chill lol but there are times i'd love listening to that
May Kittens Devour Your Soul
@diomed
Jul 17 2017 16:20
like .. when coding? :yum:
Kyle Holm
@thekholm80
Jul 17 2017 16:20
i need energy when I code. like skrillex or deadmau5
May Kittens Devour Your Soul
@diomed
Jul 17 2017 16:21
oh lol
how can u even think like that
Kyle Holm
@thekholm80
Jul 17 2017 16:22
energetically
May Kittens Devour Your Soul
@diomed
Jul 17 2017 16:22
dont u need clear head when coding
clarity of thoughts
Kyle Holm
@thekholm80
Jul 17 2017 16:23
my head's pretty empty, there's lots of room in there
Margaret
@Margaret2
Jul 17 2017 16:23
@diomed x
May Kittens Devour Your Soul
@diomed
Jul 17 2017 16:23
mine is emptier, but I sure do need clarity
@Margaret2 enlighten me :confused:
Margaret
@Margaret2
Jul 17 2017 16:24
app alphabet!
one app for each letter...
Kyle Holm
@thekholm80
Jul 17 2017 16:24
i do pause the music when i need to think lol. it's kind of like turning down the radio in the car when you're trying to find an address
May Kittens Devour Your Soul
@diomed
Jul 17 2017 16:25
@Margaret2 I just can't even now
Margaret
@Margaret2
Jul 17 2017 16:26
:disappointed:
Alexander Køpke
@alexanderkopke
Jul 17 2017 16:26
@thekholm80 you do that too?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 16:26
:disappointed:
Kyle Holm
@thekholm80
Jul 17 2017 16:26
@alexanderkopke lol yeah, makes no sense but ...
Alexander Køpke
@alexanderkopke
Jul 17 2017 16:27
it is like learning forward on the highway to try to see what the sign says
Kyle Holm
@thekholm80
Jul 17 2017 16:27
haha
Sydney
@SydneyWarren
Jul 17 2017 16:27
var regularUser = ["esl_sc2", "ogamingsc2", "cretetion", "freecodecamp", "storbeck", "habathcx", "robotcaleb", "noobs2ninjas"];

var onlineUsers = [];
for (var i = 0; i < regularUser.length; i++) {

  $.getJSON(`https://wind-bow.glitch.me/twitch-api/streams/${regularUser[i]}?callback=?`, function(data) {
    if (data.stream !== null) {
    return onlineUsers.push(data.stream.channel.name);
    };

  });
}
console.log(onlineUsers);
console.log(regularUser);
for (var i = 0; i < onlineUsers.length; i++) {
  for (var i = 0; i < regularUser.length; i++){
    if (onlineUsers[i] === regularUser[i]) {
      document.getElementById('onlineUsers[i]').innerHTML = "online";
    }
  }
 };
i'm never gonna figure this out on my own how come it's not working?
Kyle Holm
@thekholm80
Jul 17 2017 16:28
i'd assume it's because your api call is async so the data isn't available when you get to your loops @sydneyWarren
@thekholm80 ok i dont understand that, how come data isn't available?
Kyle Holm
@thekholm80
Jul 17 2017 16:29
because your api call hasn't resolved
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 16:29
@SydneyWarren 'onlineUsers[i]' is a string, you might want the variable instead
so, remove the ' ' first see if ti works
Sydney
@SydneyWarren
Jul 17 2017 16:31
@BrewCoffeeSplash i did but still not working
Stephen James
@sjames1958gm
Jul 17 2017 16:31
@SydneyWarren put a console.log inside your getJSON callback and you will see the logs after the getJSON call happen before the callback.
That is the nature of asynchronous behavior
Sydney
@SydneyWarren
Jul 17 2017 16:31
@thekholm80 so my arrangements is wrong i should put it up at the beginning?
Stephen James
@sjames1958gm
Jul 17 2017 16:31
The for loops need to be inside the callback
Kyle Holm
@thekholm80
Jul 17 2017 16:31
generally it's best to use the api data as part of a callback
unless you'd like to learn the magic that is promises
Sydney
@SydneyWarren
Jul 17 2017 16:32
@sjames1958gm i did that console.log(data) doesn't return anything
@thekholm80 how do i do that?
Alexander Køpke
@alexanderkopke
Jul 17 2017 16:33
@SydneyWarren you can put the loops in a function on its own and then call that from the callback
Sydney
@SydneyWarren
Jul 17 2017 16:33
so my problem isn't the syntax, it's the async?
Kyle Holm
@thekholm80
Jul 17 2017 16:33
yes
you're trying to use data before it exists
Sydney
@SydneyWarren
Jul 17 2017 16:33
ahhhh ok
so how do i fix this. i haven't learned this part at all yet
why is data taking so long to get back?
Kyle Holm
@thekholm80
Jul 17 2017 16:34
Stephen James
@sjames1958gm
Jul 17 2017 16:35
@SydneyWarren Even if the data is back quickly getJSON sends a message, then the code after the getJSON
runs, then later (even very short time) the callback is called.
The callback will have data for one user (at a time), and you can update the document inside the if (data.stream !== null)
Darren
@DarrenfJ
Jul 17 2017 16:37
@diomed buddy!
:D
Sydney
@SydneyWarren
Jul 17 2017 16:39
@thekholm80 should i have return outside the JSON get maybe?
Kyle Holm
@thekholm80
Jul 17 2017 16:40
$.getJSON(url, function (data) {
  // do everything with the data here
})
that's the simplest way
Sydney
@SydneyWarren
Jul 17 2017 16:42
oh ok thanks @thekholm80
CamperBot
@camperbot
Jul 17 2017 16:42
sydneywarren sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1345 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Abdullah Ali
@aali21
Jul 17 2017 16:45
image.png
can someone tell me how 5 divided by 2 is 2? Its clearly 2.5
image.png
Kyle Holm
@thekholm80
Jul 17 2017 16:46
5 % 2 isn't 5 divided by 2
Darren
@DarrenfJ
Jul 17 2017 16:46
@aali21 not with modulo
Kyle Holm
@thekholm80
Jul 17 2017 16:46
it's 5 modulo 2
Darren
@DarrenfJ
Jul 17 2017 16:46
it has to go in evenly
Abdullah Ali
@aali21
Jul 17 2017 16:46
But it shows (5/2)
Darren
@DarrenfJ
Jul 17 2017 16:46
so 2 goes into 5 2 times gives 4 with a remainder of 1
Abdullah Ali
@aali21
Jul 17 2017 16:46
Is math.floor modulus?
Ravi Kishore Thella
@ravikishorethella
Jul 17 2017 16:46
@DarrenfJ @thekholm80 :wave:
Darren
@DarrenfJ
Jul 17 2017 16:46
no math.floor rounds down
Kyle Holm
@thekholm80
Jul 17 2017 16:46
@ravikishorethella hey buddy
Darren
@DarrenfJ
Jul 17 2017 16:46
@ravikishorethella hey buddy!
Dylan
@dhcodes
Jul 17 2017 16:47
yeah was about to say it's the math.floor
Abdullah Ali
@aali21
Jul 17 2017 16:47
oh that makes sennse
Darren
@DarrenfJ
Jul 17 2017 16:47
to the nearest integer
Kyle Holm
@thekholm80
Jul 17 2017 16:47
@dhcodes :wave:
Abdullah Ali
@aali21
Jul 17 2017 16:47
@DarrenfJ thanks
CamperBot
@camperbot
Jul 17 2017 16:47
aali21 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1910 | @darrenfj |http://www.freecodecamp.com/darrenfj
Abdullah Ali
@aali21
Jul 17 2017 16:47
@thekholm80 thanks
CamperBot
@camperbot
Jul 17 2017 16:47
aali21 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1346 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Darren
@DarrenfJ
Jul 17 2017 16:47
and sorry that should say modulo like @thekholm80 said not modulus
Dylan
@dhcodes
Jul 17 2017 16:47
@thekholm80 :wave:
Kyle Holm
@thekholm80
Jul 17 2017 16:48
it's all about finding the remainder, or what's left over
Sydney
@SydneyWarren
Jul 17 2017 16:53
one last thing can you tell me why it stop iterating after the first time? @thekholm80
maybe instead of the outside loop i should use a foreach maybe?
Kyle Holm
@thekholm80
Jul 17 2017 16:59
i don't understand what the loop inside the callback is for
Sydney
@SydneyWarren
Jul 17 2017 17:03
not sure i'll take those out
i think i have to start from stratch i'm getting so many errors
Kyle Holm
@thekholm80
Jul 17 2017 17:04
you should check out 'rubber duck debugging'. there's something about explaining your code, line by line, out loud, that makes debugging it really easy
Sydney
@SydneyWarren
Jul 17 2017 17:04
is it for atom?
no, it's a debugging method
Sydney
@SydneyWarren
Jul 17 2017 17:06
lol oh ok i've heard of it, it actuals works?
Kyle Holm
@thekholm80
Jul 17 2017 17:06
yeah. I don't have a rubber duck, but when i get stuck i start at the beginning and talk through my code line by line until i figure out what's wrong
"first this should happen, then this, then that ..." etc
Sydney
@SydneyWarren
Jul 17 2017 17:07
ok thanks
var regularUser = ["esl_sc2", "ogamingsc2", "cretetion", "freecodecamp", "storbeck", "habathcx", "robotcaleb", "noobs2ninjas"];



$.getJSON(`https://wind-bow.glitch.me/twitch-api/streams/${regularUser[i]}?callback=?`, function(data){

});
like this will it iterate through regularUser?
Kyle Holm
@thekholm80
Jul 17 2017 17:09
you don't have anything in that code that would loop or iterate
fortunately, JS has a million different ways to loop through arrays
Sydney
@SydneyWarren
Jul 17 2017 17:13
i wanna push it all in there, is this how i do it?
 for (var i = 0; i < regularUser.length; i++) {
$.getJSON(`https://wind-bow.glitch.me/twitch-api/streams/${regularUser[i]}?callback=?`, function(data){
  var onlineUsers = [];
  if (data.stream !== null){
  onlineUsers.push(data.stream.channel.name)
  }
  console.log(onlineUsers);
});

};
Kyle Holm
@thekholm80
Jul 17 2017 17:14
that's not going to accomplish what you want. you're declaring your array onlineUsers inside the function, so every time your callback executes it will create a new array
Sydney
@SydneyWarren
Jul 17 2017 17:15
yea that's what i does
i want it not to do that
just push it in one array
Kyle Holm
@thekholm80
Jul 17 2017 17:16
how are you going to know when all of your api calls are done and you can start using the data pushed into the arrays?
Sydney
@SydneyWarren
Jul 17 2017 17:17
i dont know, i have to do everything inside the function though
Anthony DeSordi
@desordi3
Jul 17 2017 17:19
Anybody know any good books/websites for learning bootstrap grid system more in depth?
Ankit Tiwari
@anku255
Jul 17 2017 17:50
/^(1\s)?\d{3}/      // matches 1 555 and 555
//replacing () by []
/^[1\s]?\d{3}/  // doesn't match 1 555
why '?' works as expected with '()' capture groups but not with character set?
@thekholm80 I think you can explain this.
My understanding is that 'x?' makes x optional ( matches 0 or 1 time). Then why is it not working as expected with character set?
Kyle Holm
@thekholm80
Jul 17 2017 17:59
@anku255 sorry bud i'm horrible with regexp
JohnPaulWalsh
@JohnPaulWalsh
Jul 17 2017 18:00
^[1\s]? - optionally match at the start of the string a single character from the set [1\s]
Ankit Tiwari
@anku255
Jul 17 2017 18:00
@thekholm80 ah! its okay.
Anthony DeSordi
@desordi3
Jul 17 2017 18:01
@thekholm80 Thank you
CamperBot
@camperbot
Jul 17 2017 18:01
desordi3 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1347 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Kyle Holm
@thekholm80
Jul 17 2017 18:01
@desordi3 did you find what you needed there?
Ankit Tiwari
@anku255
Jul 17 2017 18:02
@JohnPaulWalsh oh.. Only a single character. It was bugging me. Thanks for clearing this.
CamperBot
@camperbot
Jul 17 2017 18:02
anku255 sends brownie points to @johnpaulwalsh :sparkles: :thumbsup: :sparkles:
:star2: 3018 | @johnpaulwalsh |http://www.freecodecamp.com/johnpaulwalsh
Abdullah Ali
@aali21
Jul 17 2017 18:06
image.png
Ive been stuck on this for quite a while now....can someone tellme where theproblem is
Ankit Tiwari
@anku255
Jul 17 2017 18:09
@JohnPaulWalsh One more doubt. Is it necessary to put alternation (|) inside a capture group?
See the code below
/^(1\s?)?(\(\d{3}\)|\d{3})/  // matches 1 555 and 1 (555)

// removing outer parenthesis 
/^(1\s?)?\(\d{3}\)|\d{3}/   // matches 1 (555) i.e. first option but doesn't match 1 555 which is second option
Djordje Lozo
@djordjelozo
Jul 17 2017 18:10
Hello can anyone tell me what this </title> code means and what is that for? Thanks alot
<form action="http://www.example.com/login/" method="post">
<label for="username">Username:</label>
<input type="text" name="username" required="required" /></title><br />
<label for="password">Password:</label>
<input type="password" name="password" required="required" />
<input type="submit" value="Submit" />
</form>
Right here after first <input>
Abdullah Ali
@aali21
Jul 17 2017 18:11
Where did u get that from
Ankit Tiwari
@anku255
Jul 17 2017 18:11
@aali21 what's the link for problem?
Djordje Lozo
@djordjelozo
Jul 17 2017 18:12
You're asking me? @aali21
@djordjelozo yes
Djordje Lozo
@djordjelozo
Jul 17 2017 18:12
Practicing with my friend and he's got some pdf
Showed me this, but neither he knows what this means
This </title> closing tag
Abdullah Ali
@aali21
Jul 17 2017 18:13
@djordjelozo i cant see an opening tag for title anywhere
JohnPaulWalsh
@JohnPaulWalsh
Jul 17 2017 18:13
@anku255 that would depend on whether you want to capture 3 digits with brackets or without, there are a number of ways to approach that, you could make the literal character ( captures optional instead
Djordje Lozo
@djordjelozo
Jul 17 2017 18:14
Just like me
I dont see opening tag
Ankit Tiwari
@anku255
Jul 17 2017 18:14
@aali21 After SecondLine you need a backslash
Djordje Lozo
@djordjelozo
Jul 17 2017 18:14
So do you think this is a mistake?
Abdullah Ali
@aali21
Jul 17 2017 18:14
@djordjelozo then just get rid of the closing tag
@anku255 ok i did that now I have a problem with the third objective
image.png
Ankit Tiwari
@anku255
Jul 17 2017 18:16
@aali21 you can't insert a backslash like that. You need to escape it. Use \\
Abdullah Ali
@aali21
Jul 17 2017 18:16
@anku255 thanks, ive done it now
CamperBot
@camperbot
Jul 17 2017 18:16
aali21 sends brownie points to @anku255 :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @anku255 |http://www.freecodecamp.com/anku255
Ankit Tiwari
@anku255
Jul 17 2017 18:18
@JohnPaulWalsh Thanks for the suggestion. But I still don't understand why is it not matching 1 555 in second case?
CamperBot
@camperbot
Jul 17 2017 18:18
anku255 sends brownie points to @johnpaulwalsh :sparkles: :thumbsup: :sparkles:
:warning: anku255 already gave johnpaulwalsh points
JohnPaulWalsh
@JohnPaulWalsh
Jul 17 2017 18:20
@anku255 you will still need to create a second capture group
^(1\s?)?(\(\d{3}\)|\d{3})
start of string optionally match (1 optional space) then 3 digits in brackets or 3 digits
youre on the right track, are you using a regex tool to work through this like https://regex101.com/ ?
Anthony DeSordi
@desordi3
Jul 17 2017 18:22
@thekholm80 didn’t but ill keep studying it. have no idea why my one of my columns just wont stay within the parameters of the site on mobile
Kyle Holm
@thekholm80
Jul 17 2017 18:23
@desordi3 sorry i wish i could help you. I never really bothered to learn much about bootstrap
Ankit Tiwari
@anku255
Jul 17 2017 18:23
@JohnPaulWalsh Yes, I am using it but sometimes it's explanation is not enough for me.
Anthony DeSordi
@desordi3
Jul 17 2017 18:24
is bootstrap essential for future front end dev job? @thekholm80
Kyle Holm
@thekholm80
Jul 17 2017 18:25
i don't believe so
I think it looks better to understand css
JohnPaulWalsh
@JohnPaulWalsh
Jul 17 2017 18:26
@anku255 beyond https://regexone.com/ i can only really suggest other regex tools or reference sites but they are a bit of a minefield tbh
Anthony DeSordi
@desordi3
Jul 17 2017 18:26
Damn i figured it was pretty important. Thanks
Ankit Tiwari
@anku255
Jul 17 2017 18:31
@JohnPaulWalsh I have completed the challenge :smile: . I finished RegExp in FCC beta before this. I have read MDN's page for RegExp. I know how RegExp works but sometimes I get confused (RegExp are lil complicated tbh) . Thanks for your help.
CamperBot
@camperbot
Jul 17 2017 18:31
anku255 sends brownie points to @johnpaulwalsh :sparkles: :thumbsup: :sparkles:
:warning: anku255 already gave johnpaulwalsh points
JohnPaulWalsh
@JohnPaulWalsh
Jul 17 2017 18:31
:+1:
Joshua Arnett
@josha5
Jul 17 2017 18:37
Does anyone help me how I can find a non repeating element in an array?
Can**
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 18:40
@josha5 like comparing array elements?
@josha5 just compare one element to all the others in the array, see if they're equal, repeat for each
similar just use javascript syntax
Adit
@adittyagi
Jul 17 2017 18:47
Hey guys ! I am having problem with Profile Lookup challenge
"If both are true, then return the "value" of that property." How do I do this ?
Anyone ?
SpaceInvader75
@SpaceInvader75
Jul 17 2017 18:55
I'm stuck on my tribute page because I'm having trouble sharing the image or something.
Conrad Kay
@conradkay
Jul 17 2017 19:06
is frontEndIdol a good blog name?
^.com
Morchid Chellali
@Morched23MJ
Jul 17 2017 19:12
I want to put my Tweet button inside the div with id="Tweet", why it's not inside it?
https://codepen.io/Morched23MJ/pen/dRLgJo
Coy Sanders
@coymeetsworld
Jul 17 2017 19:16
@SpaceInvader75 if the image is from imgur then it won't work. imgur blocks codepen reqs
Adit
@adittyagi
Jul 17 2017 19:17
@coymeetsworld Hey ! I am having problem with Profile Lookup challenge
Coy Sanders
@coymeetsworld
Jul 17 2017 19:18
need more information @adittyagi, what does your code look like?
Adit
@adittyagi
Jul 17 2017 19:18

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

  }

}

I know I have messed up a lot but........
Adit
@adittyagi
Jul 17 2017 19:26
Leave It !
Coy Sanders
@coymeetsworld
Jul 17 2017 19:27
return contacts.hasOwnProperty[firstName]; that isn't right
or this contacts.hasOwnProperty(firstName)
or the counterparts in the other for loop
also the for loop is wrong, there is alot of things wrong here
actually your first loop is ok, your 2nd is not. But, you don't need 2 for loops so just keep the first one
I would review some of the previous challenges, you have some easy issues that can be worked out if you review them
Adit
@adittyagi
Jul 17 2017 19:31
Ya you are right, actually I am coding after a few days and I have forgotten some of the concepts. I am going to revise them !
Kyle Holm
@thekholm80
Jul 17 2017 19:34
if (forgot stuff) {
  review;
}
i wish JS were that easy
Adit
@adittyagi
Jul 17 2017 20:04
return "practice makes JS easy ";
hehe
Manish Giri
@Manish-Giri
Jul 17 2017 20:40
@thekholm80 ty
CamperBot
@camperbot
Jul 17 2017 20:40
manish-giri sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1348 | @thekholm80 |http://www.freecodecamp.com/thekholm80
aRtoo
@artoodeeto
Jul 17 2017 20:41

hi guys. have this ajax call. to do a call the first will happen is when i submit a word (first to be triggered) so i log('1'); then the 2nd is a function to call for my ajax. so log('2'). then the word on the ajax should be pass on the loop that ive made. so i log('3');
then when i open the console its supposed to be

1
2
3

but the console is logging.

1
3
2

my question is why is the loop being triggered first when theres is still no data to be loop?

BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 20:54
@artoodeeto would have to see the actual code
aRtoo
@artoodeeto
Jul 17 2017 20:55
@BrewCoffeeSplash here you go sir
  function wikiViewer(term){
    $.ajax({
      //dataType:'JSONP',
      type:'GET',
      url:'https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&origin=*&formatversion=2&gsrsearch='+ term,
      success: function(data){
      items(data);
      console.log('2'); //check console
      }
    })
  }

  $('#search').on('submit', function(event){
    event.preventDefault();
    var term = $('.searchInput').val();
    $('.displayContent').text();
    wikiViewer(term);
    console.log('1'); //check console
  })

  function items(data){
    var html = "";
    var data = data.query;
    for(var i=0; i<data.pages.length; i++) {

      var description =data.pages[i].extract;
      var title = data.pages[i].title;

      html = html + "<h2 class='title'>" + title + "</h2><p class='description'>" + description + "</p>"
   }
   console.log('3'); //check console
   $(".displayContent").html(html);
   animate();
  }
May Kittens Devour Your Soul
@diomed
Jul 17 2017 20:58
help
if my div has class container shouldn't this : .container{border-radius:4px} make it rounded ???
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 20:59
      items(data);
      console.log('2');
Kyle Holm
@thekholm80
Jul 17 2017 20:59
@diomed are you using bootstrap, or is this a custom class?
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:00
looks here that log('3') is called, then consol.log('2'); is shown after
based on what's called first
May Kittens Devour Your Soul
@diomed
Jul 17 2017 21:01
@thekholm80 I'm not using bootstrap, but I am using Bulma :yum:
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:01
@artoodeeto if that makes sense at all
Kyle Holm
@thekholm80
Jul 17 2017 21:01
as long as container isn't a predefined class, .container{border-radius:4px} should work if you add a ; after the 4px
aRtoo
@artoodeeto
Jul 17 2017 21:02
@BrewCoffeeSplash right. someone told me thats my problem. but confused about the sequence.
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:02
@artoodeeto that's how you have it sequenced. log(3) is called before log(2)
just switch em
May Kittens Devour Your Soul
@diomed
Jul 17 2017 21:03
@thekholm80 but I don't need ; in real world
aRtoo
@artoodeeto
Jul 17 2017 21:03
@BrewCoffeeSplash yea. but in the actual program will it the loop first then the ajax? or the ajax then the loop?
May Kittens Devour Your Soul
@diomed
Jul 17 2017 21:03
if it's only 1 property
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:08
@artoodeeto function(data){ items(data); console.log('2'); it'll do it in that order
not sure why you have the end as log('2') while your loop is log('3')
aRtoo
@artoodeeto
Jul 17 2017 21:09
@BrewCoffeeSplash ohh. just for testing. which code runs first.
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:09
switch the log numbers, see what happens
but it always goes down the row on what's called first
aRtoo
@artoodeeto
Jul 17 2017 21:10
@BrewCoffeeSplash yea i did sir. i think i understand now. so btn will trigger the ajax. then the ajax will pass a value to the loop.
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:11
function(data) first -log('2'), which calls items(data) - log('3'), then consol.log('2') is called last
but yeah your stuff works, just needs a more verbose and correct console.log going on
Joshua Arnett
@josha5
Jul 17 2017 21:28
Hey guys I'm really struggling with an algorithm could anyone help?
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:35
post it and see who's here. I'm not that far in to be of use probably
Joshua Arnett
@josha5
Jul 17 2017 21:41

I'm trying to return non repeating elements in an array and so far my code is this. function diffArray(arr1, arr2) {
var newArray = arr1.concat(arr2);
var diffArr = [];
for(var i = 0; i < newArray.length; i++) {
for(var j = 0; j < newArray.length; j++) {

}

}

return diffArr;

}

function diffArray(arr1, arr2) {
var newArray = arr1.concat(arr2);
var diffArr = [];
for(var i = 0; i < newArray.length; i++) {
for(var j = 0; j < newArray.length; j++) {
if(newArray[i] != newArray[j]) {
//do stuff

}

}

}

return diffArr;

}

BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:44
@josha5 your two for loops shouldn't be using the same var j
nvm
lemme check more
similar problem. just different syntax since it's java
@josha5 you trying to figure out the //do stuff part?
Joshua Arnett
@josha5
Jul 17 2017 21:49
Yeah I tried using filter and other methods to no avail.
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 21:51
@josha5 just add the non-repeating elements of newArray[i] into diffArr[] in //do stuff.
@josha5 tho, i'd change that 2nd for loop you got so you don't get repeats added in
so, var j = i + 1 instead
Joshua Arnett
@josha5
Jul 17 2017 21:57
I'm just gonna try and figure it out using the filter method I can't seem to get it to worko
Uriel Guzmán
@Burinson
Jul 17 2017 22:24
Hi, guys. My code works and passed the challenge (splitting an array into smaller arrays) but it marks an error, why?
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var newArray = [];
  for (var i = 0; i = arr.length; i++) {
    newArray.push(arr.splice(0, size));
  }
  return newArray;
}

chunkArrayInGroups(["a", "b", "c", "d", "e", "f"], 2);
"Expected a conditional expression and instead saw an assignment"
The editor points that the error is here arr.length;, on the ;
Walther Cantu
@walthercantu
Jul 17 2017 22:28
Hi all! I'm a bit stuck with the Local Weather app. I'm able to call the API and get a response, but I can't figure out how to pass certain elements of the response to the html portion of my code. Here's my pen: https://codepen.io/walthercantu/pen/ZyNQmJ?editors=0010
Gary
@bluefishmarine
Jul 17 2017 22:29
@Burinson shouldn't it be i<arr.length?
that says, while i is less than arr.length, do the loop
Uriel Guzmán
@Burinson
Jul 17 2017 22:31
@bluefishmarine It doesn't work that way
If I place a >, the whole challenge fails
<
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 22:31
@Burinson thought its == or ===
a conditional instead of assignment =
Uriel Guzmán
@Burinson
Jul 17 2017 22:32
@BrewCoffeeSplash Nope, both of the fail too
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 22:32
huh
Uriel Guzmán
@Burinson
Jul 17 2017 22:32
The only one that passes the challenge is =
Try it :(
Gary
@bluefishmarine
Jul 17 2017 22:32
but you are changing the value of i
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 22:33
not sure on javascript syntax. I know java more sorry
Uriel Guzmán
@Burinson
Jul 17 2017 22:34
@bluefishmarine If I place the <, half of the required challenges on the lower left fail
I don't know why
If I place a =, all of them turn green and pass
But I get this little error on the editor, a small x
Gary
@bluefishmarine
Jul 17 2017 22:35
yeah, i see. usually in the loop the compiler expects a condition in that part, like equals, is less than, is greater than
so, i think your loop i starts at 0, then it becomes equal to arr.length, then it increases by 1, right?
Uriel Guzmán
@Burinson
Jul 17 2017 22:36
image.png
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 22:36
that's how i'm reading that loop
Uriel Guzmán
@Burinson
Jul 17 2017 22:37
image.png
@bluefishmarine Take a look at these two screenshots
@BrewCoffeeSplash Look :worried:
Gary
@bluefishmarine
Jul 17 2017 22:38
yeah, i see. hang on, let me take a look and see how i did that one
cowCrazy
@cowCrazy
Jul 17 2017 22:38
@Burinson it can't be "=" it has to be "===" because it is a condition not assigning value, but checking if it is so or not
Uriel Guzmán
@Burinson
Jul 17 2017 22:39
image.png
Gary
@bluefishmarine
Jul 17 2017 22:39
@walthercantu are you sure the ajax request worked correctly? try to console.log and see what your data contains. maybe it worked but you aren't referencing the data properly from the object
Uriel Guzmán
@Burinson
Jul 17 2017 22:39
@cowCrazy That one straight on fails all of them, wtf
cowCrazy
@cowCrazy
Jul 17 2017 22:40
@Burinson or if you need to check for a different condition maybe "<=" or ">="
Gary
@bluefishmarine
Jul 17 2017 22:40
yeah, well, when you do that the loop doesn't run because it says, i = 0, if i === arr.length, run loop
Uriel Guzmán
@Burinson
Jul 17 2017 22:41
@cowCrazy They don't work either, the first one fails half the challenges, the second fails all of them and returns me []
cowCrazy
@cowCrazy
Jul 17 2017 22:42
@Burinson that was about using "=" inside the for-loop statement.... I am reading it and I'll get back to you in a minute
Uriel Guzmán
@Burinson
Jul 17 2017 22:43
I just did something weird... and it worked, but I don't know why
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 22:43
show
Uriel Guzmán
@Burinson
Jul 17 2017 22:43
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var newArray = [];
  for (var i = 0; (i = arr.length); i++) {
    newArray.push(arr.splice(0, size));
  }
  return newArray;
}

chunkArrayInGroups(["a", "b", "c", "d", "e", "f"], 2);
I place a parenthesis and the error disappeared, and I passed the challenge
BrewCoffeeSplash
@BrewCoffeeSplash
Jul 17 2017 22:44
@Burinson that's still the same as before but with parenthesis, same answer as before, still not sure why it says you passed tho
the parenthesis doesn't make a difference
Uriel Guzmán
@Burinson
Jul 17 2017 22:49
Hm...
I'm reading, it says the error is warning me about a potential bug and that I should rather use this !!(i = arr.length);
Gary
@bluefishmarine
Jul 17 2017 22:57
try putting in a console.log(i) before the newarray.push statement
it goes 6,4,2
the condition checks for a true or false, and while there is a value that is not 0, it will run until arr.length becomes 0 at which point it will stop because 0 is a falsey value
Stephen James
@sjames1958gm
Jul 17 2017 23:00
@Burinson your code is stopping when the length of the array is zero
cowCrazy
@cowCrazy
Jul 17 2017 23:01
@Burinson still here?
Uriel Guzmán
@Burinson
Jul 17 2017 23:01
@cowCrazy Yes
cowCrazy
@cowCrazy
Jul 17 2017 23:05
@Burinson as it is suggested you should use the slice method instead of the spilce method. Also remember that in for loop you can increment by a different size than 1, ie. for (var i = 0; i < arr.length; i += <some other variable>) then you have better control on your loop, and what you try to get from it.
Gary
@bluefishmarine
Jul 17 2017 23:05

you could also do it this way ?

``` 

function chunkArrayInGroups(arr, size) {
var loops = arr.length - size;
// Break it up.
var newArray = [];
for (var i = 1; i < loops; i++) {
console.log(i);
newArray.push(arr.splice(0, size));
}
return newArray;
}

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

woops. well that didnt come out right

``` function chunkArrayInGroups(arr, size) {
var loops = arr.length - size;
// Break it up.
var newArray = [];
for (var i = 1; i < loops; i++) {
console.log(i);
newArray.push(arr.splice(0, size));
}
return newArray;
}

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

ok well im just not gonna try that anymore
Uriel Guzmán
@Burinson
Jul 17 2017 23:07
@cowCrazy
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var newArray = [];
  for (var i = 0; i < arr.length; i+=size) {

    console.log(i); newArray.push(arr.slice(i, i+size));
  }
  return newArray;
}

chunkArrayInGroups(["a", "b", "c", "d", "e", "f"], 2);
cowCrazy
@cowCrazy
Jul 17 2017 23:07
@Burinson the problem with splice here that you are modifying the array you are iterating through, and then it gives unexpected results and can end with errors too.
@Burinson so now it's working?
Uriel Guzmán
@Burinson
Jul 17 2017 23:09
@cowCrazy Yes, I believe that's the correct way, I checked the basic solution
@cowCrazy thanks
CamperBot
@camperbot
Jul 17 2017 23:09
burinson sends brownie points to @cowcrazy :sparkles: :thumbsup: :sparkles:
:cookie: 273 | @cowcrazy |http://www.freecodecamp.com/cowcrazy
cowCrazy
@cowCrazy
Jul 17 2017 23:10
@Burinson :thumbsup: always remember to add a couple of console.log() as a developer it should be your best friend :)
Uriel Guzmán
@Burinson
Jul 17 2017 23:11
@bluefishmarine thanks
CamperBot
@camperbot
Jul 17 2017 23:11
burinson sends brownie points to @bluefishmarine :sparkles: :thumbsup: :sparkles:
:cookie: 299 | @bluefishmarine |http://www.freecodecamp.com/bluefishmarine
Gary
@bluefishmarine
Jul 17 2017 23:13
@Burinson No prob. You taught me something too, when I solved this one I had a longer solution. yours is pretty good
Raj Patel
@rajp1847
Jul 17 2017 23:18
hi will anyone help me
Gary
@bluefishmarine
Jul 17 2017 23:19
we can certainly try, whats your question
Raj Patel