These are chat archives for FreeCodeCamp/Help

29th
Aug 2017
Stephen James
@sjames1958gm
Aug 29 2017 00:24

@YuserahN The code is returning a function with one parameter arg2 (when only one argument is given)
When you call that returned function you are supplying arg2.
so addTogether(2)(3) - arg2 is becomes three because
addTogether(2) results in :

function(arg2) {
        // Check for non-numbers
        if (2 === undefined || checkNum(arg2) === undefined) {
          return undefined;
        } else {
          // if numbers then add them.
          return 2 + arg2;
        }
      }

and that function is called with (3)

Rowdy
@rcash
Aug 29 2017 01:49
Hello! Could someone help me with a JS timer I've been working on? I can get it to work online in places like jsfiddle but when I split the HTML & JS file up it doesn't work
Alexander Køpke
@alexanderkopke
Aug 29 2017 01:58
@rcash how are you splitting up the files?
Alexander Køpke
@alexanderkopke
Aug 29 2017 02:04
@rcash for the js file to be executed by the index.html document you'll need to link to it via script tags, preferably put just before the body tag. Here I named the js file main.js. If the js files is located in a different folder you'll have to point to it via the folder name as well such as src="folderName/main.js"
<script src="main.js"></script>
</body>
Rowdy
@rcash
Aug 29 2017 03:08
@alexanderkopke Thanks alexander! It turned out not to be the linking but where the js file was being loaded happened before the html div was created
CamperBot
@camperbot
Aug 29 2017 03:08
rcash sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:star2: 1645 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
Darren
@DarrenfJ
Aug 29 2017 05:28
evening fCC
@Josebuendia sorry man, stepped out of the room and missed your final replies...
prakash chandra yadav
@prakashyadav008
Aug 29 2017 05:31
hey everyone
a little help
as soon as i remove the overflow:hidden property the background-color becomes invisible
Jill Lee
@jill-lee
Aug 29 2017 05:34
Anyone can help me with css3 CDN?
https://imgbb.com/
Darren
@DarrenfJ
Aug 29 2017 05:34
@prakashyadav008 i'm not a much of a master of CSS.. but what are yah trying to do with it?
Manish Giri
@Manish-Giri
Aug 29 2017 05:38
@DarrenfJ do you wanna see a fight?
Darren
@DarrenfJ
Aug 29 2017 05:38
yes!
@phoenix-burn how is imgbb as a site for holding images?
I'm looking for something with no bells and whistles and no upvoting that I can just use to hold images for things like codepen projects...
scroll down
@DarrenfJ I would say take a look at Amazon s3
there's s simple sign up and setup, but the free tier should be enough for your images
Darren
@DarrenfJ
Aug 29 2017 05:41
of course! haven't even explored Amazon at all for that
totally forgot about aws's
thanks @Manish-Giri
CamperBot
@camperbot
Aug 29 2017 05:41
darrenfj sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6475 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Aug 29 2017 05:41
@DarrenfJ ty
CamperBot
@camperbot
Aug 29 2017 05:41
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1992 | @darrenfj |http://www.freecodecamp.com/darrenfj
Manish Giri
@Manish-Giri
Aug 29 2017 05:42
ooh 8 more
Jill Lee
@jill-lee
Aug 29 2017 05:43
@DarrenfJ it's ok but cant hold images more than 1000px I mean its not that clear
@DarrenfJ It's a great image hosting site for codepen and for small images.
Darren
@DarrenfJ
Aug 29 2017 05:44
i always love a good verbal sparring.. thanks for the link Manish :D
i'm so uncertain of anything now i rarely say 'it cannot be that way' lol!
thanks @phoenix-burn for the site info
CamperBot
@camperbot
Aug 29 2017 05:46
darrenfj sends brownie points to @phoenix-burn :sparkles: :thumbsup: :sparkles:
:cookie: 160 | @phoenix-burn |http://www.freecodecamp.com/phoenix-burn
Manish Giri
@Manish-Giri
Aug 29 2017 05:46
:+1:
Eric Miller
@ericmiller777
Aug 29 2017 05:46
Hey guys
How do i use the hasOwnproperty
collection.hasOwnProperty(source);
always returns false
even if i do somthing like
collection[2].hasOwnPRoperty(source);
which i know is true
Manish Giri
@Manish-Giri
Aug 29 2017 05:48
let obj = {a: "hello"};
obj.hasOwnProperty("a"); //true
Eric Miller
@ericmiller777
Aug 29 2017 05:50
collection.hasOwnProperty("Capulet");
returns false
Manish Giri
@Manish-Giri
Aug 29 2017 05:51
what do you think collection is?
Eric Miller
@ericmiller777
Aug 29 2017 05:51
its an array
Darren
@DarrenfJ
Aug 29 2017 05:51
so weird. i went to look for my solution and it's not an exercise i have.. but i have it passed...
Manish Giri
@Manish-Giri
Aug 29 2017 05:51
so how will you run an object function on an array?
Eric Miller
@ericmiller777
Aug 29 2017 05:51
of objects
Darren
@DarrenfJ
Aug 29 2017 05:51
cause i passed where art thou an earlier version
Eric Miller
@ericmiller777
Aug 29 2017 05:51
well i mean
Manish Giri
@Manish-Giri
Aug 29 2017 05:51
collection.hasOwnProperty("Capulet");
Eric Miller
@ericmiller777
Aug 29 2017 05:51
i could make it collection[2] same result
?
Manish Giri
@Manish-Giri
Aug 29 2017 05:52
well
Capulet isn't a property
its the value for the last property
so you should do collection[2].hasOwnProperty("last"); instead
which should give you Capulet
prakash chandra yadav
@prakashyadav008
Aug 29 2017 05:54
@DarrenfJ was checking something
but found that happening
Eric Miller
@ericmiller777
Aug 29 2017 05:54
trying it
Darren
@DarrenfJ
Aug 29 2017 05:55
@prakashyadav008 ah it's cool man.. realizing i don;t have enough brain power tonight to actually help anyone...
prakash chandra yadav
@prakashyadav008
Aug 29 2017 05:55
as soon as i remove the overflow property the background:color becomes invisible
Eric Miller
@ericmiller777
Aug 29 2017 05:55
@Manish-Giri thanks
CamperBot
@camperbot
Aug 29 2017 05:55
ericmiller777 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6476 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Aug 29 2017 05:56
np
Eric Miller
@ericmiller777
Aug 29 2017 06:00
@prakashyadav008 thanks a weird issue, could you link your source?
CamperBot
@camperbot
Aug 29 2017 06:00
ericmiller777 sends brownie points to @prakashyadav008 :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @prakashyadav008 |http://www.freecodecamp.com/prakashyadav008
Eric Miller
@ericmiller777
Aug 29 2017 06:01
meant "thats" :P
Darren
@DarrenfJ
Aug 29 2017 06:02
@ericmiller777 he's got a codepen link above...
Eric Miller
@ericmiller777
Aug 29 2017 06:02
@darren thanks
CamperBot
@camperbot
Aug 29 2017 06:02
ericmiller777 sends brownie points to @darren :sparkles: :thumbsup: :sparkles:
:cookie: 55 | @darren |http://www.freecodecamp.com/darren
Darren
@DarrenfJ
Aug 29 2017 06:03
it does seem to do what he's saying.. (make the colour visible if you comment out the overflow )...
shrug i hate CSS just enough to realize I cannot solve this without delving into stack overflow...
for hours ;)
but thanks @ericmiller777 for taking it on
CamperBot
@camperbot
Aug 29 2017 06:04
darrenfj sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 275 | @ericmiller777 |http://www.freecodecamp.com/ericmiller777
Darren
@DarrenfJ
Aug 29 2017 06:04
i have no brain power tonight
thanks @ericmiller777
CamperBot
@camperbot
Aug 29 2017 06:04
darrenfj sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:warning: darrenfj already gave ericmiller777 points
Eric Miller
@ericmiller777
Aug 29 2017 06:04
well why is he doing #overflow
Darren
@DarrenfJ
Aug 29 2017 06:04
oh man, i think i borked camperbot
Eric Miller
@ericmiller777
Aug 29 2017 06:04
noythings tagged
Darren
@DarrenfJ
Aug 29 2017 06:04
camperbot
wherefore art thee
Eric Miller
@ericmiller777
Aug 29 2017 06:05
i have it working how can i linked the fixed version?
@prakashyadav008 just remove the # before overflow
@prakashyadav008
.body{
  margin:0;
  padding:0;
}

.container{
  background-color: green;
  margin:auto;

  overflow:hidden;
}

.header{
  float:left;  
}

.search-bar{
  float:right;
}

input{
  #float:left;
}

span{
  background-color:blue;
  float:right;
}
@prakashyadav008 what browser are you using?
Darren
@DarrenfJ
Aug 29 2017 06:08
@ericmiller777 i think he did it deliberately because when you have overflow working it removes the green background
Eric Miller
@ericmiller777
Aug 29 2017 06:08
it doesnt for me?
Darren
@DarrenfJ
Aug 29 2017 06:08
or something like that..
i think we lost him though
kyle-kauzlarich
@kyle-kauzlarich
Aug 29 2017 06:09

javascript challenege stand in line im just looking for some new ideas for it
the challenege is

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

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

and my current code is


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

  return item;  // Change this line
}

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

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

can anyone point me tords some commands that should lead me to the answer?

Eric Miller
@ericmiller777
Aug 29 2017 06:09
how can i link a screenshot on here?
Darren
@DarrenfJ
Aug 29 2017 06:09
@ericmiller777 this is his original Q "as soon as i remove the overflow:hidden property the background-color becomes invisible"
Eric Miller
@ericmiller777
Aug 29 2017 06:09
I tryed that too
it causes other issues which could be fixed by using a bootstrap "row", but the green background stays.
Darren
@DarrenfJ
Aug 29 2017 06:11
@kyle-kauzlarich item is the item they want you to add at the end no?
Eric Miller
@ericmiller777
Aug 29 2017 06:11
im sure theres a way to do it without bootstrap too
Darren
@DarrenfJ
Aug 29 2017 06:11
@kyle-kauzlarich and you are adding this; arr.push(testArr[0]);
kyle-kauzlarich
@kyle-kauzlarich
Aug 29 2017 06:14
@DarrenfJ the item is what is supposed to come at the end and yes i was trying the push/pop shift/unshift commands to no avail it seems the pourpous is supposed to be a que
Darren
@DarrenfJ
Aug 29 2017 06:15
yes...
it is
so you have item from the function call... then you are trying to push the first number in the testArray instead of the item
@kyle-kauzlarich for example you are sending the function this info: nextInLine(testArr, 6)
so they want you to add the 6 to the end of the array.. but your push command isn't adding the variable item, it's adding something else..
it's doing this instead.. arr.push(testArr[0]);
@kyle-kauzlarich also.. you are returning the item here return item; but you actually need to return the thing you remove from the front of the array instead
kyle-kauzlarich
@kyle-kauzlarich
Aug 29 2017 06:20
@DarrenfJ thank you
CamperBot
@camperbot
Aug 29 2017 06:20
kyle-kauzlarich sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1993 | @darrenfj |http://www.freecodecamp.com/darrenfj
Darren
@DarrenfJ
Aug 29 2017 06:21
camperbots back ;)
thanks @ericmiller777 for the missed thanks from earlier
CamperBot
@camperbot
Aug 29 2017 06:22
darrenfj sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:warning: darrenfj already gave ericmiller777 points
Eric Miller
@ericmiller777
Aug 29 2017 06:22
lol @darr\thanks
@darren thanks
CamperBot
@camperbot
Aug 29 2017 06:22
ericmiller777 sends brownie points to @darren :sparkles: :thumbsup: :sparkles:
:warning: ericmiller777 already gave darren points
Rishabh Kashyap
@iamrkcheers
Aug 29 2017 06:36

I am currently on the 'nodejs' module in the 'backend part' of fcc.
However, I can't seem to install 'learnyounode' via the following cmd 'npm install -g learnyounode'.
I get the following error ..

npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/learnyounode failed, reason: geta
ddrinfo EAI_AGAIN registry.npmjs.org:443

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Rishabh\AppData\Roaming\npm-cache\_logs\2017-08-29T06_28_4
3_884Z-debug.log

Any help is appreciated. Thank You.

Darren
@DarrenfJ
Aug 29 2017 06:38
i'm off to bed guys.. iv'e been no help tonight.. too sleeepy
codeOn roomies :D
Manish Giri
@Manish-Giri
Aug 29 2017 06:40
@DarrenfJ ty
CamperBot
@camperbot
Aug 29 2017 06:40
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:warning: manish-giri already gave darrenfj points
__mifflin__
@cdrainxv
Aug 29 2017 06:41
:bye:
Manish Giri
@Manish-Giri
Aug 29 2017 06:43
@cdrainxv :wave:
__mifflin__
@cdrainxv
Aug 29 2017 06:43
Hullo!
Rishabh Kashyap
@iamrkcheers
Aug 29 2017 06:53

I am currently on the 'nodejs' module in the 'backend part' of fcc.
However, I can't seem to install 'learnyounode' via the following cmd 'npm install -g learnyounode'.
I get the following error ..

npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/learnyounode failed, reason: geta
ddrinfo EAI_AGAIN registry.npmjs.org:443

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Rishabh\AppData\Roaming\npm-cache\_logs\2017-08-29T06_28_4
3_884Z-debug.log

Any help is appreciated. Thank You.

Claudio Restifo
@Marmiz
Aug 29 2017 07:55

@iamrkcheers usually the parameters goes at the end of the command:

npm install learnyounode -g

If it fails try with root permissions:

sudo npm install learnyounode -g
Owais Ahmed
@owaisehmed
Aug 29 2017 08:10
Need help
https://codepen.io/OwaisEhmed/pen/zdRozE
How do i make the well box short in size? padding doesn't seem to work
Panagiotis Tsimpoukellis
@PanChee00
Aug 29 2017 08:18
Hello guys. I need some help creating my portfolio page at fcc. could someone help me?
Johnny
@JohnnyBizzel
Aug 29 2017 09:06
@PanChee00 "some help" sounds vague.
Dhananjay Sood
@DhananjaySood
Aug 29 2017 10:39
@PanChee00 Follow their guidelines and user story
prakash chandra yadav
@prakashyadav008
Aug 29 2017 11:11
@ericmiller777 still not solved
banana
@Like-Watermelon
Aug 29 2017 11:58

https://www.freecodecamp.cn/challenges/profile-lookup#?solution=%2F%2F%E5%88%9D%E5%A7%8B%E5%8C%96%E5%8F%98%E9%87%8F%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUp(firstName%2C%20prop)%7B%0A%2F%2F%20%E8%AF%B7%E6%8A%8A%E4%BD%A0%E7%9A%84%E4%BB%A3%E7%A0%81%E5%86%99%E5%9C%A8%E8%BF%99%E6%9D%A1%E6%B3%A8%E9%87%8A%E4%BB%A5%E4%B8%8B%0A%20%20%20%20for%20(var%20i%20%3D%200%3Bi%20%3C%20contacts.length%3Bi%2B%2B)%20%7B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for(var%20attr%20in%20contacts%5Bi%5D)%20%7B%0A%20%20%20%20%20%20%20%20%20%20if(contacts%5Bi%5D%5Battr%5D%20%3D%3D%20firstName%20%26%26%20contacts%5Bi%5D%5Bprop%5D)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20contacts%5Bi%5D%5Bprop%5D%3B%0A%20%20%20%20%20%20%20%20%20%20%7D%20else%20if(contacts%5Bi%5D%5Battr%5D%20!%3D%20firstName)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20%22No%20such%20contact%22%3B%0A%20%20%20%20%20%20%20%20%20%20%7D%20else%20if(contacts%5Bi%5D%5Bprop%5D%20!%3D%20prop)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20%22No%20such%20property%22%3B%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%0A%20%20%20%20%7D%0A%2F%2F%20%E8%AF%B7%E6%8A%8A%E4%BD%A0%E7%9A%84%E4%BB%A3%E7%A0%81%E5%86%99%E5%9C%A8%E8%BF%99%E6%9D%A1%E6%B3%A8%E9%87%8A%E4%BB%A5%E4%B8%8A%0A%7D%0A%0A%2F%2F%20%E4%BD%A0%E5%8F%AF%E4%BB%A5%E4%BF%AE%E6%94%B9%E8%BF%99%E4%B8%80%E8%A1%8C%E6%9D%A5%E6%B5%8B%E8%AF%95%E4%BD%A0%E7%9A%84%E4%BB%A3%E7%A0%81%0AlookUp(%22Harry%22%2C%20%22likes%22)%3B%0A这个要怎么写? for(var attr in contacts[i]) {
if(contacts[i][attr] == firstName && contacts[i][prop]) {
return contacts[i][prop];
} else if(contacts[i][attr] != firstName) {
return "No such contact";
} else if(contacts[i][prop] != prop) {
return "No such property";
}

}

}
我写成这样但是如果我不加这两个判断else if(contacts[i][attr] != firstName) {
return "No such contact";
} else if(contacts[i][prop] != prop) {
return "No such property";
} 的话,这三个就通过"Kristian", "lastName" 应该返回 "Vos"
"Sherlock", "likes" 应该返回 ["Intriguing Cases", "Violin"]
"Harry","likes" 应该返回一个数组,加了以后这两个"Bob", "number" 应该返回 "No such contact"
"Akira", "address" 应该返回 "No such property" 就不通过了

360截图--139202109.png
这个是怎么回事,应该怎么写
杨明宇
@MY-Superhero
Aug 29 2017 12:07
blob
libentboniphace
@libentboniphace
Aug 29 2017 13:27
Your <style> should have a pink-text CSS class with its color set to pink.
Stephen James
@sjames1958gm
Aug 29 2017 13:30
@Like-Watermelon You don't need two loops - you can directly access the property
collection[i].firstName
or
collection[i][prop]
Alexandar B
@ace1122sp
Aug 29 2017 14:15
hey people.. :wave: in React, is it better to do one large state update or more smaller direct ones?
Kyle Holm
@thekholm80
Aug 29 2017 14:15
state updates are batched, so a bunch of small updates could be processed like one big update
do whatever makes the most sense for your workflow
Alexandar B
@ace1122sp
Aug 29 2017 14:16
@thekholm80 ty.. i have some performance issues with my app, so i'm trying to optimize it..
CamperBot
@camperbot
Aug 29 2017 14:16
:star2: 1455 | @thekholm80 |http://www.freecodecamp.com/thekholm80
ace1122sp sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
Kyle Holm
@thekholm80
Aug 29 2017 14:17
i ran into a bit of slowdown with my Game of Life. I guess using huge datasets as state isn't good when you're calling updates many times a second
Alexandar B
@ace1122sp
Aug 29 2017 14:22

also when i have multiple objects inside my state, and when I want to update one of the props of one of the objects, should I update the whole object or just that property? for example

this.state = { obj1: {
a: 'ace', b: 'boa'}, 
obj2: {
a: 11, b: 22}
}

if I want to update obj1.a = 'ace' to obj1.a = 'alec', how should I do it? yeah, that's the problem.. when I add more than 400 fields to my grid in GoL there is a masive slowdown..

Kyle Holm
@thekholm80
Aug 29 2017 14:28
you should never mutate state, you should always replace the entire value
meaning, create a new object with the updated values, then call setState to replace the old object with the new object
Alexandar B
@ace1122sp
Aug 29 2017 14:32
//a solution
const obj1 = { a: 'alec', b: 'boa'};
this.setState({obj1,});

//b solution, I don't know is this even proper
const newProp = 'alec';
this.setState({obj1: {a: newProp,}});
what do you suggest between these two?
Saber I.
@icybears
Aug 29 2017 14:34
what are you trying to do ?
add a property to an object ?
Alexandar B
@ace1122sp
Aug 29 2017 14:35
to update prop in a more effiecient way
Saber I.
@icybears
Aug 29 2017 14:35
so your state has one object with mutliple props and u want to update a specific prop ?
Alexandar B
@ace1122sp
Aug 29 2017 14:35
no, 2 objects and each has 2 properties.. and I want to update only one property
Saber I.
@icybears
Aug 29 2017 14:37
this.setState( (prevState) => {
   prevState.myObj.MyProp = newValue;
return (
          {
             myObj: prevState.myObj;
          }
        )
}
Alexandar B
@ace1122sp
Aug 29 2017 14:37
so IDK should I update the whole obj1, or there is a way to only update the specific property..
Saber I.
@icybears
Aug 29 2017 14:38
1- always use this.setState() to update your data
2- this.setState accepts a callback that takes the "Previous state" which is an object holding all your state. You can modify it and everything u want, then return the new data.
3- when you modify property1 of object1 of your state, you don't have to worry about the other properties, you only return the new update to that specific piece of information u wanted to update, that's what is in the return statement of that function
it returned myObj with the new prop modified (since that's what we did with the prevState.myObj.myProp), and react will update that piece of information, leaving ur other objects and properties the same
Alexandar B
@ace1122sp
Aug 29 2017 14:43
@icybears so, if I understand you well, my a solution updates the whole object which is unnecessary, and your solution updates only that specific prop? here is my solution, so you can see...
//a solution
const obj1 = { a: 'alec', b: 'boa'};
this.setState({obj1,});

//b solution, I don't know is this even proper
const newProp = 'alec';
this.setState({obj1: {a: newProp,}});
Saber I.
@icybears
Aug 29 2017 14:44
yes
please re-read the code I gave I made a mistake
I now replaced myObj with the modified version of myObj inside prevState
hence myObj: prevState.myObj is correct
Alexandar B
@ace1122sp
Aug 29 2017 14:46
@icybears ok, thanks a lot.. that's exactly what I was looking for.. :D
CamperBot
@camperbot
Aug 29 2017 14:46
ace1122sp sends brownie points to @icybears :sparkles: :thumbsup: :sparkles:
:cookie: 94 | @icybears |http://www.freecodecamp.com/icybears
Saber I.
@icybears
Aug 29 2017 14:48
:+1:
Saber I.
@icybears
Aug 29 2017 14:56
@ace1122sp think of it as "merging" a new piece of updated information into the "state". State is where all your data is gathered.
Garrus Napp
@GarrusNapp
Aug 29 2017 15:06
sup guys
Stephen James
@sjames1958gm
Aug 29 2017 15:07
@GarrusNapp :wave:
Garrus Napp
@GarrusNapp
Aug 29 2017 15:08
not much traffic since help button disappeared from challanges, right? :|
AnikIqbal
@AnikIqbal
Aug 29 2017 15:09
Can anyone help me to clone the old version freecodecamp?
Ian Hicks
@ijhicks
Aug 29 2017 15:11
Hi looking for some help with using the getLocation method
Garrus Napp
@GarrusNapp
Aug 29 2017 15:11
@ijhicks what's the issue
Ian Hicks
@ijhicks
Aug 29 2017 15:12
basically I need to have an api call wait till after the getlocation has run successfully, but for whatever reason its jumping ahead
i have the pen one sec
i was looking at the .post method.. but im not sure if that s what i need, or how to implement it in the right way
Garrus Napp
@GarrusNapp
Aug 29 2017 15:14
@ijhicks call your weatherAsk() from the inside of success()
Alexandar B
@ace1122sp
Aug 29 2017 15:14
@icybears yeah, i understand that, but i didn't know how to update only one 'nested' property without updating the whole object in which that property is... :D i'm working on the Game of Life, so the efficiency is a really big issue :D :fearful:
Ian Hicks
@ijhicks
Aug 29 2017 15:15
@GarrusNapp oh damn.. that was too easy, thank you!!
CamperBot
@camperbot
Aug 29 2017 15:15
ijhicks sends brownie points to @garrusnapp :sparkles: :thumbsup: :sparkles:
:cookie: 840 | @garrusnapp |http://www.freecodecamp.com/garrusnapp
Garrus Napp
@GarrusNapp
Aug 29 2017 15:16
@ijhicks no prob :+1:
Mike Batista
@mbmontana
Aug 29 2017 15:22
I'm stuck on the Chunky Monkey challenge. I think I'm pretty close. Anyone got a little hint to help point me in the right direction?
function chunkArrayInGroups(arr, size) {
  // Break it up.
var subArray = [];
  var newArray = [];
  for (i = 0; i < size; i++) {
    for (j = 0; j < arr.length; j++); 


  {subArray = arr.slice(0, size);}
    newArray.push(subArray);}
  return newArray;
}

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4);
Julien Midedji
@ResamVi
Aug 29 2017 15:27
@mbmontana your second for loop has a semicolon
weird indendation
welp. this kind of stuff happens when people dont just use K&R ¯\(ツ)
Mike Batista
@mbmontana
Aug 29 2017 15:29
@ResamVi I got rid of the semicolon. What's K&R?
@ResamVi And the bigger question is, should I be nesting for loops or is there another way to do this?
Julien Midedji
@ResamVi
Aug 29 2017 15:30

@mbmontana

if(condition) {
  statement
}

K&R

if(condition)
{
  statement
}

BSD I think

@mbmontana i dont remember what the task is from code tho
Stephen James
@sjames1958gm
Aug 29 2017 15:47
@mbmontana There is no need to nest
@sjames1958gm You should loop for arr.length / size times and slice a size chunk each loop
Mike Batista
@mbmontana
Aug 29 2017 16:38
@sjames1958gm The instructions say to write a function. Do I need to write my own function within the function that's already there?
Darren
@DarrenfJ
Aug 29 2017 16:52
morning fCC
@cdrainxv buddy! yer in Pennsylvania now? Weren't you in Calgary or something before?
Tiago Correia
@tiagocorreiaalmeida
Aug 29 2017 16:57
@sjames1958gm is ok to pm you?just a little question nothing about code at all
Stephen James
@sjames1958gm
Aug 29 2017 17:38
@tiagocorreiaalmeida Sure
@mbmontana The function body is already there - you implement it
Joseph
@revisualize
Aug 29 2017 18:13
:wave:
Rishabh Kashyap
@iamrkcheers
Aug 29 2017 18:46

I am at the FCC Backend Development -> ExpressJS exercise.
The exercise requires to run the following command ..

git clone https://github.com/FreeCodeCamp/fcc-expressworks.git && chmod 744 fcc-expressworks/setup.sh && fcc-expressworks/setup.sh && source ~/.profile

However, it displays the following error ..

'chmod' is not recognized as an internal or external command,
operable program or batch file.

Also, I am doing all of this on my local Computer environment.
Any help is appreciated.
Thank You.

Stephen James
@sjames1958gm
Aug 29 2017 18:58
@iamrkcheers What kind of computer - chmod is a linux/unix command
Alexander Køpke
@alexanderkopke
Aug 29 2017 18:59
@iamrkcheers yeah it sounds like you're on a windows computer
Tiago Correia
@tiagocorreiaalmeida
Aug 29 2017 19:14
image.png
im at the branches part on github would be apprecited some help what im missing?
Manish Giri
@Manish-Giri
Aug 29 2017 19:17
you don't seem to have an upstream remote
do git remote -v
@tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Aug 29 2017 19:18
image.png
Manish Giri
@Manish-Giri
Aug 29 2017 19:22
why did you name it update?
doesn't it ask for upstream?
Tiago Correia
@tiagocorreiaalmeida
Aug 29 2017 19:26
it doesnt, and will name it update then
nm*
I named it update to test
if I got to the gibut page its ok there
so I have atually no idea what's missing here
Manish Giri
@Manish-Giri
Aug 29 2017 19:41
you're supposed to name your remote as upstream
Tiago Correia
@tiagocorreiaalmeida
Aug 29 2017 19:42
I did that a few steps before I need to do it again?sorry im new to this
Manish Giri
@Manish-Giri
Aug 29 2017 19:43
if you did it, why is your remote named as update and not upstream?
normally you'd do
git remote add upstream URL-to-upstream
Tiago Correia
@tiagocorreiaalmeida
Aug 29 2017 19:44
cause it said I could name it anythign I wanted I think thanks and sorry to bother you
Manish Giri
@Manish-Giri
Aug 29 2017 19:44
np
Aminu Ibrahim Abubakar
@AminuSufi585
Aug 29 2017 20:28
Hi there
Aminu Ibrahim Abubakar
@AminuSufi585
Aug 29 2017 20:54
it appears that all the campers are not around
Tiago Correia
@tiagocorreiaalmeida
Aug 29 2017 20:55
hey
Darren
@DarrenfJ
Aug 29 2017 20:55
fCC!
@Manish-Giri hey thanks for helping out ;)
CamperBot
@camperbot
Aug 29 2017 20:56
darrenfj sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6479 | @manish-giri |http://www.freecodecamp.com/manish-giri
Darren
@DarrenfJ
Aug 29 2017 20:56
brownies for yah :D
@AminuSufi585 we're not in here as much as in the past since not as many people visit anymore
Daniel
@dkapexhiu
Aug 29 2017 20:57
@dkapexhiu
what am i doing wrong in this? https://codesandbox.io/s/z6788p4ro3
to see the ProductForm.js
Aminu Ibrahim Abubakar
@AminuSufi585
Aug 29 2017 20:57
OK @DarrenfJ but why?
Darren
@DarrenfJ
Aug 29 2017 20:58
@AminuSufi585 used to be there was a help button on each exercise that took you here, but they removed it... so less people come
Aminu Ibrahim Abubakar
@AminuSufi585
Aug 29 2017 20:58
Ok I understand
Darren
@DarrenfJ
Aug 29 2017 20:58
so if you sit in here waiting to help you can wait an hour or more and eventually go off and code instead...
so less people in === less volunteers also in to help out
but the main chat is always very busy
Aminu Ibrahim Abubakar
@AminuSufi585
Aug 29 2017 20:59
I use to help before, but for quite a while I was not active on FCC
Darren
@DarrenfJ
Aug 29 2017 20:59
and they usually know their stuff too and are happy to help out too...
yah they removed the button, maybe 2 months ago? So it's relatively new thing
Aminu Ibrahim Abubakar
@AminuSufi585
Aug 29 2017 21:00
Yes of course
I realise it now.. Even me its because I have this gitter app installed on my system
Darren
@DarrenfJ
Aug 29 2017 21:01
nice :D
Aminu Ibrahim Abubakar
@AminuSufi585
Aug 29 2017 21:01
So I easily see notifications once I am online
Darren
@DarrenfJ
Aug 29 2017 21:05
yah.. i usually have the gitter open in a window and just pop in and out now to see what's up
Manish Giri
@Manish-Giri
Aug 29 2017 21:06
@DarrenfJ ty
CamperBot
@camperbot
Aug 29 2017 21:06
manish-giri sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1994 | @darrenfj |http://www.freecodecamp.com/darrenfj
Darren
@DarrenfJ
Aug 29 2017 21:11
ok guys, I'm off... back to test and end my work day...
Greta Piliponytė
@gpiliponyte
Aug 29 2017 21:16
guys, how old were you when you started coding? :D
Joshua Arnett
@josha5
Aug 29 2017 21:22
Can anyone here help me with displaying numbers on a calculator I'm building?
Ross Scarborough
@SourceHorse
Aug 29 2017 21:24
can some people try this out and see if there are any bugs?
Ross Scarborough
@SourceHorse
Aug 29 2017 22:40
@razvanlikespizza can you clarify?
Razvan
@razvanlikespizza
Aug 29 2017 22:40
@SourceHorse Solved it..I dont need these bitches to help me. I am too smart.
Ross Scarborough
@SourceHorse
Aug 29 2017 22:41
@razvanlikespizza you didn't post a question
Razvan
@razvanlikespizza
Aug 29 2017 22:41
I posted an image, but I deleted it.
Ross Scarborough
@SourceHorse
Aug 29 2017 22:41
ah
Razvan
@razvanlikespizza
Aug 29 2017 22:42
@SourceHorse thanks anyways bitch, you were the kindest bitch from here.
CamperBot
@camperbot
Aug 29 2017 22:42
razvanlikespizza sends brownie points to @sourcehorse :sparkles: :thumbsup: :sparkles:
:cookie: 267 | @sourcehorse |http://www.freecodecamp.com/sourcehorse
Zhenyu
@A7bert
Aug 29 2017 22:43
Is it okay to ask question here?
Razvan
@razvanlikespizza
Aug 29 2017 22:44
@A7bert YES
piteto
@piteto
Aug 29 2017 22:55
when do we ask questions on the forums and when do we use this room?
Razvan
@razvanlikespizza
Aug 29 2017 22:56
@piteto Choose what yo want, but here you get faster answers
piteto
@piteto
Aug 29 2017 22:57
hmmm, okay
do I have to do the front-end part of free code camp? I'm already a front-end dev, but want to learn back end
faster answers, huh? ;)
Sudeep Narkar
@sudeepnarkar
Aug 29 2017 23:03
Hello guys
I logged back in after months and all my progress is lost
I can see the solutions though
Any help would be appreciated
piteto
@piteto
Aug 29 2017 23:04
I don't think anyone is here...
@rfnash ?? do you know?
Razvan
@razvanlikespizza
Aug 29 2017 23:05
@piteto I said the same thing..."fasters answers, huh?" ..yeah.I know.
piteto
@piteto
Aug 29 2017 23:06
I will try another room and see if anyone knows
Stephen James
@sjames1958gm
Aug 29 2017 23:09
@piteto YOu can do which ever you wish
piteto
@piteto
Aug 29 2017 23:10
Do I get certified in front end if I finish back end or do I have to go through all these front end challenges too?
adding styles to my elements and summing up numbers in an array is going to get old fast
Stephen James
@sjames1958gm
Aug 29 2017 23:16
@piteto you wont get the front end cert unless you do the front end challenges
mstellaluna
@mstellaluna
Aug 29 2017 23:16
@piteto you can skip around as you wish as long as you complete the challenges marked with a * . those are needed for the certs.
Ai rui 艾瑞
@aisolae
Aug 29 2017 23:18

`var shirt = {
color : "blue",
"duration purchase" : "August 8",
Quantity : 99,
brand : "Valcono",
}

var shirtDuration= shirt.["duration purchase"]

document.write(shirtDuration);`

'var shirt = {
color : "blue",
"duration purchase" : "August 8",
Quantity : 99,
brand : "Valcono",
}

var shirtDuration= shirt.["duration purchase"]

document.write(shirtDuration);'

sorry for posting twice
Stephen James
@sjames1958gm
Aug 29 2017 23:18
@aisolae You don't use both . and []
Ai rui 艾瑞
@aisolae
Aug 29 2017 23:18
oh
Stephen James
@sjames1958gm
Aug 29 2017 23:18
@aisolae Use three ``` and put them on their own line (use shift-enter) to get a newline
Ai rui 艾瑞
@aisolae
Aug 29 2017 23:18
got it

```var shirt = {
color : "blue",
"duration purchase" : "August 8",
Quantity : 99,
brand : "Valcono",
}

var shirtDuration= shirt.["duration purchase"]

document.write(shirtDuration);

Stephen James
@sjames1958gm
Aug 29 2017 23:19
@aisolae :+1:
Ai rui 艾瑞
@aisolae
Aug 29 2017 23:19
```
Stephen James
@sjames1958gm
Aug 29 2017 23:19
Ai rui 艾瑞
@aisolae
Aug 29 2017 23:21
var shirt = {
  color : "blue",
  "duration purchase" : "August 8",
  Quantity : 99,
  brand : "Valcono",
}

var shirtDuration= shirt.["duration purchase"]

document.write(shirtDuration);
got it, been looking for this
thanks alot
@sjames1958gm thanks
CamperBot
@camperbot
Aug 29 2017 23:21
aisolae sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8410 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 29 2017 23:22
:+1:
piteto
@piteto
Aug 29 2017 23:36
I didn't realize that @mstellaluna, thank you. Will stick to the ones marked with an asterisk
CamperBot
@camperbot
Aug 29 2017 23:36
piteto sends brownie points to @mstellaluna :sparkles: :thumbsup: :sparkles:
:cookie: 726 | @mstellaluna |http://www.freecodecamp.com/mstellaluna