These are chat archives for FreeCodeCamp/HelpJavaScript

22nd
Nov 2017
Jason Luboff
@JLuboff
Nov 22 2017 00:00
@tiagocorreiaalmeida Oh...and I'll still code. Need to keep studying for my next certification too
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 00:01
oh yeah, I would say with all this cold will feel good to stay at home and sleep a bit more but seems there's hot :D
Jason Luboff
@JLuboff
Nov 22 2017 00:01
Ya... it's supposed to be 90F tomorrow. Ugh.. Whats the temp over there (wherever you are)?
Oh, portugal.
You must have recently added your location lol
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 00:02
atually 2 months ago or something :D but yeah around 8celsius when I leave home while sleepwalking
then gets to around 15 celsius during the day and finally will rain tomorrow
it only rained around 2 3 here since august end so you can imagine there's quite a few problems with water starting to missing
times*
Jason Luboff
@JLuboff
Nov 22 2017 00:04
Thats a bit chilly.
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 00:05
yeah :D anyway will have some rest its allready 00:05 here, see ya
Jason Luboff
@JLuboff
Nov 22 2017 00:05
See ya
Conor Murphy
@cmurphy580
Nov 22 2017 01:52
if any has a minute, can you play with this and see if any problems come up? Also let me know if there a better way to get it done if you know one.
Stephen James
@sjames1958gm
Nov 22 2017 01:58
@cmurphy580 I didn't see any problems - pretty cool. Only suggestion might be to use Math.abs for clarity, well for me it seems clearer the purpose
if (Math.abs(delta) > 0.5)
Conor Murphy
@cmurphy580
Nov 22 2017 02:00
@sjames1958gm awesome! thanks for the help
CamperBot
@camperbot
Nov 22 2017 02:00
cmurphy580 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8706 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Nov 22 2017 02:01
I guess another thing - it is not clear from the first page that you should slide to the left to get more info. I wouldn't have known except for the title of the project.
texirv0203
@texirv0203
Nov 22 2017 03:08

hi,
I am trying to add another condition to my if statement.
If I click the Danger button only I should execute the below if condition.
so I pasted this method playerJumping() in the if statment.

can you tell me how to fix it.
both html and typescript are in separate file


player.html
<li [hidden]="DangerVisible"><a [class.disabled]="DangerDisable" (click)="playerJumping()" href="javascript:;" class="playerSpeakingDangerBtn">Danger</a></li><li [class.DangerHidden]="DangerVisible">



player.ts
if (soccerNetworkCount > 1 && soccerDayCount > 1 && soccerNetworkCount == networkInt && playerJumping()) {
                        networkInt = 1;
                        $('.nationalTransposeView .k-playerSpeakingr-layout > tbody > tr:last-child .k-playerSpeakingr-times > .k-playerSpeakingr-table > tbody > tr').eq(row).css({ "border-bottom-color": "#ffccdd" });
                        $('.nationalTransposeView .k-playerSpeakingr-content > .k-playerSpeakingr-table > tbody > tr').eq(row).find('td').css({ "border-bottom-color": "#ffccdd" });
                    } else {
                        networkInt += 1;
                    }
Ken Haduch
@khaduch
Nov 22 2017 03:43
@greaneym :point_up: November 21, 2017 4:59 PM - I didn't see this because you mistyped my tagname... and just clicked it now, I get a big 404 error...
@JLuboff - :point_up: November 21, 2017 6:39 PM - congratulations!
Ogundele Olumide
@Lumexralph
Nov 22 2017 08:56
@JLuboff i love aggregates, is champ around? did I miss it?
Markus Kiili
@Masd925
Nov 22 2017 11:32
@Lumexralph Yo.
ronald
@ronstarcool
Nov 22 2017 12:06
hi folks, i need help on socket.js . i have the basics working, but i need room-spaces for my game. 1 vs 1
AbrisM
@AbrisM
Nov 22 2017 15:09
Happy Thanksgiving week everyone
Ken Haduch
@khaduch
Nov 22 2017 15:32
@AbrisM - same to you - enjoy the week!
Mark
@vinarius
Nov 22 2017 16:04
Morning everyone
Nerando Johnson
@Nerajno
Nov 22 2017 16:08
greetings
var channels =["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin", "comster404","RealKraftyy?"];
//Runs Jquery
$(document).ready(function(){
  // Fetches FCC Stream info and api status call
  //The main api
  var url2 = "https://wind-bow.glitch.me/twitch-api/streams/";
  var i = 0;
  var url3 = url2+channels[i];
  var channelsAppended = []
  while (i <channels.length){
    // console.log(url2+channels[i]);
    channelsAppended.push(url3);
    console.log("channelsAppended");
    i++;
    // console.log(channelsAppended[i]);
  }
Nerando Johnson
@Nerajno
Nov 22 2017 16:15
trying to get it to loop through the channels and add the url2 to to each and push then to channelsAppended as an array
asking for a friend
Mark
@vinarius
Nov 22 2017 16:16
so
you want the final output to be https://wind-bow.glitch.me/twitch-api/streams/ESL_SC2 for example?
Nerando Johnson
@Nerajno
Nov 22 2017 16:17
yup
@vinarius
Mark
@vinarius
Nov 22 2017 16:17
well lets walk through it together
Nerando Johnson
@Nerajno
Nov 22 2017 16:18
go for it
Mark
@vinarius
Nov 22 2017 16:18
first thing i do is simplify the problem, in this case drop the array and the loop and just focus on one element as an example, then once you figure it out you can create the loop for the other elements
so lets take channels[0] as an example. "ESL_SC2"
what can i do to put that together with url2
Nerando Johnson
@Nerajno
Nov 22 2017 16:18
ok
Mark
@vinarius
Nov 22 2017 16:19
what is putting two strings together known as
Nerando Johnson
@Nerajno
Nov 22 2017 16:19
concatination ?
Mark
@vinarius
Nov 22 2017 16:19
you got it
what would it look like for this example to concatenate url2 and url1
?
Mark
@vinarius
Nov 22 2017 16:21
well what would the code look like to get that result
when you use the '+' operator between two strings you are effectively concatenating them together
Nerando Johnson
@Nerajno
Nov 22 2017 16:22
url3 = url2.concat(channel[i]);
?
Mark
@vinarius
Nov 22 2017 16:23
you dont need to use the .concat method, i would also advise using a for loop instead of a while loop because you know how many times you need to loop
Nerando Johnson
@Nerajno
Nov 22 2017 16:24
11
ok lemmie experiment and be back
@vinarius thank you
Mark
@vinarius
Nov 22 2017 16:24
in your code you are declaring url3 and assigning it a variable once. its outside your loop
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:25
Hey guys
Nerando Johnson
@Nerajno
Nov 22 2017 16:25
ok
@vinarius ok i see what you are saying
Mark
@vinarius
Nov 22 2017 16:29
see if you can understand my code
//try this instead
var updatedChannels = [];
//for loop because we know how many times we need to loop - through channels.length - the length of your array
for(var i=0; i < channels.length; i{
updatedChannels[i] = url2 + channels[i];
}
}
i would also advise writing all code inside your doc.ready statement as a best practice
it wont do much in your specific example but in larger applications your code will be execute before your page loads and could potentially slow the load time of your website / app
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:36
Idk how to pass my first mongo challenge
Mark
@vinarius
Nov 22 2017 16:37
whats your code?
@RoniqueRicketts are you on the installing mongo challenge?
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:41
@vinarius yes I am.
Mark
@vinarius
Nov 22 2017 16:41
ok, are you using c9.io?
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:42
@vinarius Yes I am on c9 i did to first part by installing the learnyoumongo
Mark
@vinarius
Nov 22 2017 16:42
ok, so you can type 'learnyoumongo' and it presents the menu of challenges?
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:43
@vinarius yes it show that and thus my previous statement, Idk what the first challenge is asking me for.
Mark
@vinarius
Nov 22 2017 16:43
type 'mongod --version' in your terminal
what does it say
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:45
command not found
know what i'm o start over
Mark
@vinarius
Nov 22 2017 16:45
you dont have mongodb installed
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:46
I can see the challenge when i type learnyoumongo
I'm o start over and see what I miss
Margaret Greaney
@greaneym
Nov 22 2017 16:51
@khaduch , sorry about mistype, here is my pen so far, still not working due to hoisting problem and still trying to figure out how to make this work on codepen,
I will try putting the two js files as pen assets in pens, and see if that works.
Ken Haduch
@khaduch
Nov 22 2017 16:56
@greaneym - hello Margaret - yes, I would try separating out the JS files into separate pens and see how that works...
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 16:58
@vinarius fixed man thanks'
CamperBot
@camperbot
Nov 22 2017 16:58
roniquericketts sends brownie points to @vinarius :sparkles: :thumbsup: :sparkles:
:cookie: 370 | @vinarius |http://www.freecodecamp.org/vinarius
Mark
@vinarius
Nov 22 2017 16:58
:thumbsup:
Ken Haduch
@khaduch
Nov 22 2017 17:00
@greaneym - it is displaying some stuff, though...
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 19:15
hello everyone
Max Voronov
@maxv
Nov 22 2017 19:27
@tiagocorreiaalmeida Hi! :)
Chris
@bestintown23
Nov 22 2017 20:01
Good afternoon, how can i get my hamburger icon to show on the same line with my logo in my nav bar? https://codepen.io/bestintown23/pen/bYoqrO
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:14
when I run this with youmongo nothing happen mongod --port 27017
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:19
learnyourmongo can eventually lead you to pick a gun and do bad stuff
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:20
@tiagocorreiaalmeida really?
lol
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:20
tbh there's a course from mongo university that you should sign in will teach you quite some things its about 7 weeks with a final project
Next Session:
Start: 09 Jan 2018 at 17:00 UTC
even if you learn somethings join for it, there's alot more than what we think
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:22
@tiagocorreiaalmeida is it free
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:22
100% :D
im doing it myself
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:22
:D running to course
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:22
and @RoniqueRicketts the above command might not work cause the port you are setting is a default port
but try to run
mongod --port 12345
and then set back to
mongod --port 27017
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:23
@tiagocorreiaalmeida I'm lost
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:23
anyway if you guys can look into my tradingbook app and point all the things that are wrong or could be done better what are the errors and existent mistakes
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:23
I think I shall try this another time
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:23
can you print me what learnyourmongo is asking for?
Hi there, can someone help me out with this?

This is what I have.
function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift([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));

Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:28
you have to add 1 element to the end and remove the first one right?
karinafarina
@karinafarina
Nov 22 2017 20:29
yes
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:29
shift
doesnt take arguments
;)
var a = [1, 2, 3];
var b = a.shift();

console.log(a); // [2, 3]
console.log(b); // 1
nothing like mdn
maybe a search or two would be the solution here eheh
Margaret Greaney
@greaneym
Nov 22 2017 20:30
hello, I am still having problems with putting my react rogue game on codepen.io but will still try because need to add the sass. But I did add it successfully to my gists on github, at this link,https://bl.ocks.org/greaneym/fad9cbdb56af9d9b48467d22a7e587e0
it still needs some attributions and comments.
If anyone can tell me the env on codepen that would use browser.js that would help I think. When I use the babel preprocess or not, the react part has errors or does not show up. Thanks for any help.
I will come back later. Thanks for all the help so far.
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:34
I am not doing this mongodb thing I quit. I'm gonna do my first project.
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:39
I did the same
nothing better than have to do something and findout how to do it
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:53
true
:)
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:54
I learned some quite important stuff trough an udemy course that was probably the best setup I could get still there's multiple ways of doing it
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:54
ok I shall youtube soon
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 20:56
about nodejs and mongo wont be there alot of troubles finding what you need :D
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 20:56
really now
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 21:10
https://rr-fcc-timestamp.glitch.me/10-10-10 idk if this is what the challenge is actually asking me for
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 21:14
can't remember it ahaha let me see mine
Johnny
@JohnnyBizzel
Nov 22 2017 21:16
@RoniqueRicketts Mine does the date in more natural language: {"unix":1390867200,"natural":"January 28, 2014"}
Tiago Correia
@tiagocorreiaalmeida
Nov 22 2017 21:17
you need to dive your unix time
by 1000
cause that aint the unix time
image.png
and returns null for correct data ehehe, are you using momentjs?
Johnny
@JohnnyBizzel
Nov 22 2017 22:02
Thanks are appreciated
Ronique Ricketts
@RoniqueRicketts
Nov 22 2017 22:04
@JohnnyBizzel nice. @tiagocorreiaalmeida ok ill xhwxk ir
Johnny
@JohnnyBizzel
Nov 22 2017 22:05
:+1: