These are chat archives for FreeCodeCamp/HelpFrontEnd

1st
Dec 2018
inji010203
@inji010203
Dec 01 2018 01:23
@all can you help me with this one...I a stuck for past one week https://stackoverflow.com/questions/53265169/css-position-absolute-making-the-tetxbox-go-down
yozhikvtumane
@yozhikvtumane
Dec 01 2018 12:06
Hello! I need some help please with portfolio page challenge. https://yozhikvtumane.github.io/fcc-portfolio/ in projects section I have those boxes made with flex, and when you resize page they become with different height
Can I get a hint how to fix it please?
yozhikvtumane
@yozhikvtumane
Dec 01 2018 12:33
Alrighty, I added word-break: break-all and it's fine now, but I don't like how text breaks letter by letter
Spyrantis Theodoros
@thodorisanta
Dec 01 2018 12:34
anyone here?
Spyrantis Theodoros
@thodorisanta
Dec 01 2018 12:44
i noticed that in this chalenge: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/-iterate-through-the-keys-of-an-object-with-a-for---in-statement
when i use:
function countOnline(obj) {
  // change code below this line
  let i=0;
  for(let user in obj){ 
    if(obj.user.online === true){
       i++;
    }
  }
  return i;
  // change code above this line
}
it doesnt even return anything
so i tried using brackets, so instead of obj.user.online. i used : obj[user]["online"]
and it works
can someone please explain me why?
yozhikvtumane
@yozhikvtumane
Dec 01 2018 12:49
Because user here is not a key but a variable, and you try to access through a key name
try to add console.log(user) inside a loop to see what I mean
Spyrantis Theodoros
@thodorisanta
Dec 01 2018 13:01
@yozhikvtumane if i write it like this : user.online it shows in the console the same thing as this obj[user]["online"]
yozhikvtumane
@yozhikvtumane
Dec 01 2018 13:05
How does the object look like? @thodorisanta
Spyrantis Theodoros
@thodorisanta
Dec 01 2018 13:25
@yozhikvtumane
Alan
Jeff
Sarah
Ryan
0
Spyrantis Theodoros
@thodorisanta
Dec 01 2018 14:00
is there a way where using dot (".") will be more efficient than brackets?
Aditya
@ezioda004
Dec 01 2018 14:03
@thodorisanta Efficient? Both bracket and dot access has its use cases. In short dot access is a subset of bracket access.
Spyrantis Theodoros
@thodorisanta
Dec 01 2018 14:12
@ezioda004 yeah but my understanding from the above is that brackets can do everything dot can do but dot cant do what i tried above. So im basically asking if there would be a case where brackets wont work and dot will do the job.
Aditya
@ezioda004
Dec 01 2018 14:15
@thodorisanta Bracket would cover all the cases where dot works but vice versa isnt true. The advantage of using dot access is the readability/simpler syntax.
Spyrantis Theodoros
@thodorisanta
Dec 01 2018 14:17
@ezioda004 thats what i thought. thanks!
krckyboy
@krckyboy
Dec 01 2018 18:46
Let me know what you think of a website I finished today, as it's for my portfolio: https://krckyboy.github.io/John-s-Bar/
yozhikvtumane
@yozhikvtumane
Dec 01 2018 19:09
@krckyboy awesome!
krckyboy
@krckyboy
Dec 01 2018 19:11
Thank you! @yozhikvtumane
yozhikvtumane
@yozhikvtumane
Dec 01 2018 21:57
image.png
@krckyboy
Edge Win10
krckyboy
@krckyboy
Dec 01 2018 23:03
@yozhikvtumane Thank you a lot!