26th
Jul 2017
Joseph
@revisualize
Jul 26 2017 00:47
Hello.
monkeyfingerz
@monkeyfingerz
Jul 26 2017 00:52

function binaryAgent(str) {
// this is the array of stringed binary agents
var stringedWordsArr= str.split(" ");
//Holds the utf-16 of every binary agent code
// cypher to change binary code to decimal
// the array is used to hold cyphered numbers to be added up
var index= [128,64,32,16,8,4,2,1];
// this is the reduced number from the addItUp cypher array
var numberToReduce=0;

//this number is the utfcode for each word
var utfCode=0;
// this loop goes through the stringedWordArr array
for(var  i= 0; i<stringedWordsArr.length; i++){
//this loop goes through every 8 digit binary code and checks if it is equal to 1
for(var j =0 ; j< 8;j++){
if(stringedWordsArr[i][j]===1){
// if the stringed number is 1 add the decimal code to the utfcode number
utfCode+= index[j];
}
}
// push the converted utfcode letter to answerArray
//reset utfCode so that a new letter can be cyphered
utfCode=0;

}
// final array that needs to be combined to complete the cypher

}

binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111");
I'm doing something wrong.
please for the sake of my sanity help me
Joseph
@revisualize
Jul 26 2017 00:53
did you look up parseint()
Joel Y.
@zapcannon99
Jul 26 2017 00:53
:point_up:
it has a very nice second argument
Joseph
@revisualize
Jul 26 2017 00:54
Isn't parseint() linked on the challenge?
monkeyfingerz
@monkeyfingerz
Jul 26 2017 00:54
Yeah but why would i want to convert this letter over to a number?
Joel Y.
@zapcannon99
Jul 26 2017 00:54
so that you can use fromcharcode() easily
Joseph
@revisualize
Jul 26 2017 00:55
monkeyfingerz
@monkeyfingerz
Jul 26 2017 00:55
the argument fromcharcode() is a number
Joseph
@revisualize
Jul 26 2017 00:56
@monkeyfingerz if you don't want to use parseint() ... maybe check out www.pythontutor.com/javascript.html
Moisés Man
@moigithub
Jul 26 2017 01:00
split return an array of strings like "01000001"
stringedWordsArr[i][j] is a char like "0"
if(stringedWordsArr[i][j]===1){ <-- NOT a number
@monkeyfingerz
Joseph
@revisualize
Jul 26 2017 01:02
Oh..
Yeah. Type comparison as well with ===
Could use == and lose type comparison.
Joel Y.
@zapcannon99
Jul 26 2017 01:03
@moigithub Good eyes
monkeyfingerz
@monkeyfingerz
Jul 26 2017 01:03
@moigithub thank you very much!
CamperBot
@camperbot
Jul 26 2017 01:03
monkeyfingerz sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3532 | @moigithub |http://www.freecodecamp.com/moigithub
scarejar
@scarejar
Jul 26 2017 01:06
hello, have a general question about javascript
Joseph
@revisualize
Jul 26 2017 01:06
ok.
monkeyfingerz
@monkeyfingerz
Jul 26 2017 01:09
Using parseInt makes it so simple... I guess i was just in too deep. Thanks everyone for looking at my code and tring to help
Joseph
@revisualize
Jul 26 2017 01:09
@monkeyfingerz :D
Joel Y.
@zapcannon99
Jul 26 2017 01:10
Np
monkeyfingerz
@monkeyfingerz
Jul 26 2017 01:11
thanks @zapcannon99 & @revisualize
CamperBot
@camperbot
Jul 26 2017 01:11
monkeyfingerz sends brownie points to @zapcannon99 and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4381 | @revisualize |http://www.freecodecamp.com/revisualize
scarejar
@scarejar
Jul 26 2017 01:19
//so javascript is synchronous right? Question on when things execute

var Guy = {
pushUpCounter: 0,
doPushUp: function(){

var struggle = setTimeOut(() => { this.pushUpCounter++;}, 3000);
}
};

var militaryGuy = {
dontCheatCounter: 0,
iAmCountingAlso: function(){
dontCheatCounter++;
}
};

militaryGuy.giveMe10 = function(){

for(var i = 0; i < 10; i++){
Guy.doPushUp();

//SO THESE FUNCTIONS BELOW WONT RUN UNTIL Guy.doPushUp IS FINISHED?
this.iAmCountingAlso();
console.log(this.iAmCountingAlso);
}

}
bitcoinabdi
@bitcoinabdi
Jul 26 2017 01:25
helooo guyz
Joel Y.
@zapcannon99
Jul 26 2017 01:25
hello moto
Okay, bad reference to and old cell phone
bitcoinabdi
@bitcoinabdi
Jul 26 2017 01:26
I need help on how to add myself on a Github repo and clone it so we can work on the same project with the other friends
Joel Y.
@zapcannon99
Jul 26 2017 01:27
Dang, I can't answer cuz I haven't gotten to that point yet
Stephen James
@sjames1958gm
Jul 26 2017 01:30
@scarejar Your comment is correct. But doPushUp will finish before the this.pushUpCounter++ executes
And 3 seconds later, all 10 of the pushUps will happen at once (asynchronously, but in rapid succession)
scarejar
@scarejar
Jul 26 2017 01:32
OH
@sjames1958gm is that the same scenario with setInterval also ?
Stephen James
@sjames1958gm
Jul 26 2017 01:33
@scarejar If you do setInterval, then it will space out the calls to the function by the timeout value
hakimnasir
@hakimnasir
Jul 26 2017 01:33
anyone familar with npm express package?
Stephen James
@sjames1958gm
Jul 26 2017 01:33
@hakimnasir yes
scarejar
@scarejar
Jul 26 2017 01:34
@sjames1958gm I meant as in doPushUp will finish before setInterval executes, then this.iAmCountingAlso() will run asynch while the setInterval is still executing
Nick Janne
@njanne19
Jul 26 2017 01:35
for whatever reason my character is walking through my monsters on my roguelike can someone take a look
scarejar
@scarejar
Jul 26 2017 01:35
think it does... that explaisn everything ... thanks @sjames1958gm
CamperBot
@camperbot
Jul 26 2017 01:35
scarejar sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8163 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
hakimnasir
@hakimnasir
Jul 26 2017 01:35
@sjames1958gm i need some help using express and request. I'm learning about api's. Can i dm you?
Stephen James
@sjames1958gm
Jul 26 2017 01:35
@scarejar Yes, doPushUp will finish before the function passed to setInterval runs
@hakimnasir ok
@scarejar :+1:
scarejar
@scarejar
Jul 26 2017 01:36
@njanne19 where's teh code ?
Nick Janne
@njanne19
Jul 26 2017 01:36
The update pos logic has what to do when it runs into an enemy
Stephen James
@sjames1958gm
Jul 26 2017 01:37
@njanne19 Uncaught ReferenceError: currentDam is not defined
Nick Janne
@njanne19
Jul 26 2017 01:37
Shoot I never look at the console
Gotta build a better habit of that
Stephen James
@sjames1958gm
Jul 26 2017 01:39
@njanne19 Yes. The console is where I go first.
@njanne19 You store this.state.currentDam in damage. you shouild use that
if (damage > enemy.health) {
Nick Janne
@njanne19
Jul 26 2017 01:40
Right I totally see that now
bitcoinabdi
@bitcoinabdi
Jul 26 2017 01:58
guyz how do i join a group in github
Eric K
@EricK425
Jul 26 2017 02:24
can someone help me with Boo Who (intermediate algorithm).. why does this code not work? Shouldnt this return true for booWho(true) and booWho(false)??

function booWho(bool) {
// prim types: undefined, null, boolean, string, number
console.log(typeof bool);
if (typeof bool !== Boolean) {
return false;
}
else
return true;
}

booWho(true);
korzo
@korzo
Jul 26 2017 02:27
@EricK425 it's "boolean" not Boolean
Eric K
@EricK425
Jul 26 2017 02:27
@korzo Thats what I thought but it wont work.. "boolean is not defined"
@korzo I figured Boolean would mean a boolean from the constructor Boolean
korzo
@korzo
Jul 26 2017 02:28
@EricK425 "boolean" with quotes
Eric K
@EricK425
Jul 26 2017 02:28
@korzo it worked.. but why
@korzo is the return value from typeof a string
korzo
@korzo
Jul 26 2017 02:29
@EricK425 yes
Eric K
@EricK425
Jul 26 2017 02:29
@korzo You the man. thanks
CamperBot
@camperbot
Jul 26 2017 02:29
erick425 sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
korzo
@korzo
Jul 26 2017 02:30
@EricK425 also else is unnecessary
but you can spare 5 lines returning result of comparison
Eric K
@EricK425
Jul 26 2017 02:30
@korzo In what way
korzo
@korzo
Jul 26 2017 02:31
@EricK425 return typeof bool === "boolean"
Eric K
@EricK425
Jul 26 2017 02:31
@korzo return (!typeof bool !== "boolean") {}
@korzo ahhh
korzo
@korzo
Jul 26 2017 02:33
@EricK425 No, you have to compare with === to return true, if bool is boolean
what I wrote is whole code (except missing ; )
Name Name, Jr.
@f1ux1uxday
Jul 26 2017 02:55
how does a person chain together several elements within a query selection using jQuery?
is it like
($('#selector1 #selector2 #selector3').html() korzo @korzo Jul 26 2017 02:56 @f1ux1uxday separate with comma Name Name, Jr. @f1ux1uxday Jul 26 2017 02:56 just chaining them without spaces? when i put a comma between them, it is treated as an OR operator i need it to be treated as an AND specifically, im using this in a conditional statement Long Nguyen @longnt80 Jul 26 2017 02:58 @f1ux1uxday what's the condition? Name Name, Jr. @f1ux1uxday Jul 26 2017 02:58 if all selectors return the same html, then something happens for the tictactoe project if squares 1 2 3 and 4 all have an X, console.log('game over') or something like that the link you posted is the reason i am currently just listing all the selectors without commas "#tab3 #read_return_response_rate_ids" is in his change function oops i looked at wrong page on the link you showed, it does use a comma. and the comma is treated as an AND i wonder why that isn't happening for me Long Nguyen @longnt80 Jul 26 2017 03:03 it only show the html from the first selector @f1ux1uxday worked with .text()though Name Name, Jr. @f1ux1uxday Jul 26 2017 03:05 well aren't you calling classes two and three, but only defined class one? thats why it only logs the first selector Long Nguyen @longnt80 Jul 26 2017 03:06 what? my bad, but still the same result Name Name, Jr. @f1ux1uxday Jul 26 2017 03:07 hm very interesting Long Nguyen @longnt80 Jul 26 2017 03:08 @f1ux1uxday where will you put your if statement? I think you still have to extract the text individually, not with multiple selector if ($('.one').text() == $('.two').text() &&$('.one').text() == $('.three').text() ) something like that Name Name, Jr. @f1ux1uxday Jul 26 2017 03:14 i see, thats a good idea. i'm still having trouble with the multiple selectors approach Long Nguyen @longnt80 Jul 26 2017 03:18 @f1ux1uxday most people would store the moves in array and use the array to calculate Name Name, Jr. @f1ux1uxday Jul 26 2017 03:21 yeah i'm still not having any luck, even when extracting individually which doesn't make any sense but i should probably just do some array method Joel Y. @zapcannon99 Jul 26 2017 03:22 Why don't you post your codepen, maybe we can hunt down the problem If you are using codepen that is Name Name, Jr. @f1ux1uxday Jul 26 2017 03:22 im not using codepen, but the link is Long Nguyen @longnt80 Jul 26 2017 03:23 @f1ux1uxday is this advanced tic tac toe? 4x4? Name Name, Jr. @f1ux1uxday Jul 26 2017 03:23 haha yes i wanted to try something different abraham anak agung @padunk Jul 26 2017 03:24 @f1ux1uxday lol i'm about to make the same, but 4x4 is too complicated for me Long Nguyen @longnt80 Jul 26 2017 03:24 @f1ux1uxday the thing is, you need to define straight lines @f1ux1uxday compare the symbol alone is not enough that's where the array comes in handy Name Name, Jr. @f1ux1uxday Jul 26 2017 03:26 the lines are defined by the IDs of the individual squares 1 2 3 and 4 are a line across the top i agree that an array is probably the best way to do this Long Nguyen @longnt80 Jul 26 2017 03:27 @padunk looking back now, I think it wouldn't be much harder but writting the unbeatable AI for 4x4 board is way too hard Name Name, Jr. @f1ux1uxday Jul 26 2017 03:27 i'd like to at least figure out why it isn't working this way before trying another way abraham anak agung @padunk Jul 26 2017 03:28 @longnt80 yes, that is what i mean Long Nguyen @longnt80 Jul 26 2017 03:28 @f1ux1uxday if you can copy your code to codepen, it might be easier to check Name Name, Jr. @f1ux1uxday Jul 26 2017 03:31 cant get the Xs and Os the show up for some dumb reason ah gotta add jquery works now i mean the Xs and Os work, not the checkForWin function Nick Janne @njanne19 Jul 26 2017 03:35 I've added a lot more to my roguelike game, I'm trying to think of how I can add the darkness(the last thing I need), any thoughts https://s.codepen.io/njanne19/debug/WOPVZj/GnrnbVegJqQr GSGV @GSGV Jul 26 2017 03:41 I just want to understand exactly what i'm reading here. var arr = [ [1,2], [3,4], [5,6] ]; for (var i=0; i < arr.length; i++) { for (var j=0; j < arr[i].length; j++) { console.log(arr[i][j]); } } For is the type of loop... of course, "var i=0" is setting the start of the loop at the first array, then "i<arr.length" keeps the loop moving through each array until reaching the end of the array, but then the part at the end of "i++" is throwing me. when i see that it's adding one to a variable... so i'm trying to understand what benefit that gives here?\ Name Name, Jr. @f1ux1uxday Jul 26 2017 03:42 the i++ increases i by 1 each time Eric K @EricK425 Jul 26 2017 03:42 Can someone help me with the intermidate algorithm Arguments Optional? Im very lost in trying to figure out how to handle an argument thats being added.. I realize I need to do something with the arguments object but how can the function see the second argument when it doesnt know its there??  function addTogether() { var arg0 = arguments[0]; var arg1 = arguments[1]; function summer() { return arg0 + arg1; } if (typeof arguments[0] != "number" || typeof arguments[1] != "number" ) { return undefined; } else if (arguments.length != 2) { return summer(); } else return arguments[0] + arguments[1]; } addTogether(2,3); Long Nguyen @longnt80 Jul 26 2017 03:43 @f1ux1uxday this won't work: $('#s5').html() === $('#s6').html() ===$('#s7').html() === $('#s8').html() @f1ux1uxday try this: if ( ($('#s1').html() === $('#s2').html() &&$('#s3').html() === $('#s4').html() &&$('#s2').html() == $('#s3').html() ) || Name Name, Jr. @f1ux1uxday Jul 26 2017 03:43 so in your case it iterates through each index, or arr[0] then arr[1] then arr[2] Joel Y. @zapcannon99 Jul 26 2017 03:43 @GSGV i++ is a shorthand of writing i += 1 GSGV @GSGV Jul 26 2017 03:44 okay @f1ux1uxday so it's helping to move through each item in the array? Name Name, Jr. @f1ux1uxday Jul 26 2017 03:45 exactly and then in your second loop, each item of each sub array Joel Y. @zapcannon99 Jul 26 2017 03:46 @EricK425 arguments can be thought of as a dynamic array as you probably have observed. By checking it's length, you can see how many arguments have been passed to the function. GSGV @GSGV Jul 26 2017 03:46 got it! and the letter used to define them ie. "i" or "j" are arbitrary... i can use any two letters? Name Name, Jr. @f1ux1uxday Jul 26 2017 03:46 @longnt80 THATS IT, THANK YOU!! CamperBot @camperbot Jul 26 2017 03:46 f1ux1uxday sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles: :cookie: 460 | @longnt80 |http://www.freecodecamp.com/longnt80 Joel Y. @zapcannon99 Jul 26 2017 03:46 i and j are the variables that are defined for loops Eric K @EricK425 Jul 26 2017 03:47 @zapcannon99 Right. My confusion arises from the fact that the argument is not anticipated.. it's tacked on the end and I need to have a fucntion that recognizes that I think. Im just not sure how to use arguments in that instance Joel Y. @zapcannon99 Jul 26 2017 03:47 @GSGV so yes they are arbitrary, but make sure they match what you define in the for loop Name Name, Jr. @f1ux1uxday Jul 26 2017 03:47 @GSGV i and j are arbitrary but i is fairly standard i for iterator shivam gupta @shivamg11000 Jul 26 2017 03:48 how to implement a search bar such that until the user does not stop typing the results are not shown and implementing it without onSubmit abraham anak agung @padunk Jul 26 2017 03:49 @shivamg11000 use timeout? Joel Y. @zapcannon99 Jul 26 2017 03:50 @EricK425 Since arguments is an array, you can iterate arguments like any other. So in the case of addTogether() function, it seems you can just iterate through the arguments. Perhaps an variable that will accumulate each element in arguments would do the trick. I don't remember the tests, so I'll need to see what exactly you need to pass. GSGV @GSGV Jul 26 2017 03:50 thanks @zapcannon99 @f1ux1uxday CamperBot @camperbot Jul 26 2017 03:50 gsgv sends brownie points to @zapcannon99 and @f1ux1uxday :sparkles: :thumbsup: :sparkles: :cookie: 320 | @zapcannon99 |http://www.freecodecamp.com/zapcannon99 :cookie: 299 | @f1ux1uxday |http://www.freecodecamp.com/f1ux1uxday Name Name, Jr. @f1ux1uxday Jul 26 2017 03:53 no problemo Joseph @revisualize Jul 26 2017 03:53 Hello. abraham anak agung @padunk Jul 26 2017 03:53 arguments is not an array, it is an array-like object Eric K @EricK425 Jul 26 2017 03:53 @zapcannon99 I understand what you're saying butin the instand of addTogether(2)(3); the arguments variable will just be equal to 1.. I don't know how to access that additional argument.. its in its own world abraham anak agung @padunk Jul 26 2017 03:53 Hello Eric K @EricK425 Jul 26 2017 03:54 @zapcannon99 This is where my return function comes into play, but I don't know what tools to use to get that additonal argument Stanley Su @stanley-su Jul 26 2017 03:54 @EricK425 which additional argument? You mean the 3? Joseph @revisualize Jul 26 2017 03:54 @zapcannon99 @EricK425 How do you access the (3) part? ... Currying Eric K @EricK425 Jul 26 2017 03:54 @stanley-su Yes Stanley Su @stanley-su Jul 26 2017 03:54 @EricK425 yeah just use a return function and closure Joel Y. @zapcannon99 Jul 26 2017 03:54 @EricK425 Oh yes. :point_up: XP Stanley has the answer Eric K @EricK425 Jul 26 2017 03:55 @stanley-su So my understanding of closure though is it needs to be defined in the main function  function addTogether() { var arg0 = arguments[0]; var arg1 = arguments[1]; function summer() { return arg0 + arg1; } if (typeof arguments[0] != "number" || typeof arguments[1] != "number" ) { return undefined; } else if (arguments.length != 2) { return summer(); } else return arguments[0] + arguments[1]; } addTogether(2,3); Joseph @revisualize Jul 26 2017 03:56 function addTo() { var arg0 = arguments[0]; return function () { return arguments[0] + arg0; } } console.log(addTo(3)(4)); Stanley Su @stanley-su Jul 26 2017 03:56 @revisualize yeah that’s good Joel Y. @zapcannon99 Jul 26 2017 03:56 Seconded good Eric K @EricK425 Jul 26 2017 03:57 But how does that return function intercept that argument? how does it now become arg[0] of that functin thats whats losing me Joseph @revisualize Jul 26 2017 03:57 @EricK425 Did you see my code? Eric K @EricK425 Jul 26 2017 03:57 @revisualize Yes thats what I'm commenting on. I understand the logoic of the code but I dont know why it works Joseph @revisualize Jul 26 2017 03:57 @EricK425 It just gets passed to the inner function. Eric K @EricK425 Jul 26 2017 03:58 @revisualize I don't know how that "floating" arg no becomes arg[0] Jan Shah @JanShah Jul 26 2017 03:58 @EricK425 console.log(arguments) to see the arguments, I'm sure it will help you Joseph @revisualize Jul 26 2017 03:59 @EricK425 I don't really know the inner workings. I just know that the second ()gets passed to the inner function. How, I don't know. Don't care. Joel Y. @zapcannon99 Jul 26 2017 03:59 it's like this addTo(2)(3) does addTo(2) goes back to the line with [functionCurry] (3) which means functionCurry(3) finishes up with that curried function Joseph @revisualize Jul 26 2017 03:59 just know... It does. Eric K @EricK425 Jul 26 2017 04:00 @revisualize Thanks. Ill try to understand it CamperBot @camperbot Jul 26 2017 04:00 erick425 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles: :star2: 4382 | @revisualize |http://www.freecodecamp.com/revisualize Joseph @revisualize Jul 26 2017 04:00 @EricK425 BUT! Eric K @EricK425 Jul 26 2017 04:00 @JanShah I just did and Im seeing the arguments object. Im trying to wrap my mind around it all Joseph @revisualize Jul 26 2017 04:01 @EricK425 You know who does know all that stuff? Eric K @EricK425 Jul 26 2017 04:01 @revisualize The internets. Joseph @revisualize Jul 26 2017 04:01 Joel Y. @zapcannon99 Jul 26 2017 04:01 lol Joseph @revisualize Jul 26 2017 04:01 :D @EricK425 Not to poke fun... But, yeah.. The internets Eric K @EricK425 Jul 26 2017 04:03 I love the internets Joel Y. @zapcannon99 Jul 26 2017 04:04 But I thought the answer was the library.... Xp Dovydas Stirpeika @Giveback007 Jul 26 2017 04:09 i need to clone an object to cut off the reference JSON.parse(JSON.stringify(x)) is not working i need a simple answer, I am using these objects to store data so I don't need to worry about protoypes blah blah blah just a nice copy this is the error I got: Uncaught TypeError: Converting circular structure to JSON Joel Y. @zapcannon99 Jul 26 2017 04:17 Surendra Karwasra @skkarwasra02 Jul 26 2017 04:58 I made a snake game using javascript. I want to give rewards to user that play game and gain score. To do this i have to post data to a php page. but what if a user post data (without play) to php page with extra score. How to make secure php page to do not accept post request from another page or server. ThePineal @ThePineal Jul 26 2017 05:27 Im trying to do the random quote challenge, I can change the quote, but im having issues randomizing from here $(document).ready(function(){
$("#newQuoteBtn").on("click",function(){$(".quote").html(quote2.quote);
$(".author").html(quote2.author); }); }); fuck $(document).ready(function(){
$("#newQuoteBtn").on("click",function(){$(".quote").html(quote2.quote);
$(".author").html(quote2.author); }); }); is it possible to add a random number function that outputs a variable and replace the quote2 with something liek quote[ranNum] Stanley Su @stanley-su Jul 26 2017 05:31 @ThePineal Yep @ThePineal May I take a look at all of your code? kumquatfelafel @kumquatfelafel Jul 26 2017 05:32 :point_up: @ThePineal for future reference, you can edit your posts by clicking the ... that appears in top right of comment when you hover your mouse over it. (there is a time limit though) Mike @MikeJSchorah Jul 26 2017 06:05 How difficult is it to survive off of freelance work as a newbie? CallMeOrange @EgnaroDev Jul 26 2017 07:19 function disemvowel(str) {return str.replace(/([aeious])/gi, '');} Why didn't it remove s? Well it does but doesn't in codewar.... kumquatfelafel @kumquatfelafel Jul 26 2017 07:20 Rajat @rajataudichya Jul 26 2017 07:20 Guys I have completed a challenge but I believe that there is some other way to do it as well  // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { // Your Code Here myObj.house="Not Found"; return myObj[checkProp]; } // Test your code by modifying these values checkObj("gift"); What other ways can this be done Kelechi Chinaka @ke1echi Jul 26 2017 07:21 whats the () for @MCTwoDigitZero CallMeOrange @EgnaroDev Jul 26 2017 07:21 I don't know... To match letter like a etc.. add [(aeious)] Kelechi Chinaka @ke1echi Jul 26 2017 07:23 /[aeious]/gi would remove any char in the box no matter the case dont think u need the () CallMeOrange @EgnaroDev Jul 26 2017 07:23 really? I tried it but doesn't match any Wow You are right I probably disconsidered [] as ()... looks like this is a waste lol kumquatfelafel @kumquatfelafel Jul 26 2017 07:24 @rajataudichya this is pretty much the way to not do it. CallMeOrange @EgnaroDev Jul 26 2017 07:24 js' function disemvowel(str) { str = str.replace(/([aeiou])/g, ''); var answer = str.split('').filter(function(element){ return element !== 's'; }); return answer.join(''); } disemvowel("This website is for losers LOL!"); function disemvowel(str) {return str.replace(/[aeious]/g, '');} disemvowel("This website is for losers LOL!"); function disemvowel(str) {return str.replace(/[aeious]/g, '');} @kelechy for some reason, it doesn't replace s in codepen... Rajat @rajataudichya Jul 26 2017 07:25 @kumquatfelafel I don't get it CallMeOrange @EgnaroDev Jul 26 2017 07:25 codewar* oh my god, its not supposed to remove s... facepalm kumquatfelafel @kumquatfelafel Jul 26 2017 07:26 @rajataudichya They don't want you to hardcode a response for when checkProp is house. They want you to have a response for properties that the object doesn't have. @MCTwoDigitZero was about to say... "why does it want to remove s if function called disemvowel, you got link?" :p Rajat @rajataudichya Jul 26 2017 07:27 @kumquatfelafel any hints? CallMeOrange @EgnaroDev Jul 26 2017 07:27 function disemvowel(str) {return str.replace(/[aeiou]/gi, '');} @kumquatfelafel yeah Sometime I think s is one of vowel lol someone else did this function disemvowel(str) { var vowels = ['a', 'e', 'i', 'o', 'u']; return str.split('').filter(function(el) { return vowels.indexOf(el.toLowerCase()) == -1; }).join(''); } I like one line :trollface: Surendra Karwasra @skkarwasra02 Jul 26 2017 07:29 I made a snake game using javascript. I want to give rewards to user that play game and gain score. To do this i have to post data to a php page. but what if a user post data (without play) to php page with extra score. How to make secure php page to do not accept post request from another page or server. kumquatfelafel @kumquatfelafel Jul 26 2017 07:29 Challenge instructions... We can use the .hasOwnProperty(propname) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true if the property exists and false if it doesn't (paraphrased slightly) @rajataudichya https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty Kelechi Chinaka @ke1echi Jul 26 2017 07:29 is s a vowel @MCTwoDigitZero CallMeOrange @EgnaroDev Jul 26 2017 07:29 no :/ I thought Darth Skywalker @AdiSkywalker Jul 26 2017 07:30 function disemvowel(str) { var vowels = ['a', 'e', 'i', 'o', 'u']; return str.split('') .filter(c => !vowels.includes(c)) .join(''); } CallMeOrange @EgnaroDev Jul 26 2017 07:31 This is mine function disemvowel(str) {return str.replace(/[aeiou]/gi, '');} Surendra Karwasra @skkarwasra02 Jul 26 2017 07:31 can anyone help CallMeOrange @EgnaroDev Jul 26 2017 07:33 @AdiSkywalker I changed that code a bit function disemvowel(str) { return str.split('').filter(c => !['a', 'e', 'i', 'o', 'u'].includes(c)).join('');} function disemvowel(str) { var vowels = ['a', 'e', 'i', 'o', 'u']; return str.split('') .filter(c => !vowels.includes(c)) .join(''); } Darth Skywalker @AdiSkywalker Jul 26 2017 07:33 @MCTwoDigitZero :+1: You're awesome! :laughing: CallMeOrange @EgnaroDev Jul 26 2017 07:34 Thanks :/, just learned how to code one line Its easier than I thought Still why is Disemvowel Trolls a kyu 7??? Should be kyu 7 hell.. kyu 10 Darth Skywalker @AdiSkywalker Jul 26 2017 07:35 awesomeness does take some work! :laughing: whats a kyu? CallMeOrange @EgnaroDev Jul 26 2017 07:36 Well I think its a level in codewars Darth Skywalker @AdiSkywalker Jul 26 2017 07:36 sounds like how a Hindi person would say "why" I see Markus Kiili @Masd925 Jul 26 2017 07:36 @MCTwoDigitZero Just remember that making one-liners is a sport loosely related to programming. CallMeOrange @EgnaroDev Jul 26 2017 07:37 Coloured belts are worn by kyū ranked practitioners in many martial arts, including judo, karate, Kuk Sool Won and taekwondo. I'm white belt @Masd925 What do you mean by sport loosely? are you saying that its bad idea to code one line? Markus Kiili @Masd925 Jul 26 2017 07:38 @MCTwoDigitZero In general, yes. CallMeOrange @EgnaroDev Jul 26 2017 07:38 Why? Darth Skywalker @AdiSkywalker Jul 26 2017 07:39 Thank god you added belt at the end :D Markus Kiili @Masd925 Jul 26 2017 07:39 @MCTwoDigitZero Clarity of the code is the goal. One-liners are not usually easy to read or understand. CallMeOrange @EgnaroDev Jul 26 2017 07:39 @AdiSkywalker lol @Masd925 Well Yeah I just want to make one line, seems cool.. tho I code it first then make it one-liner Did you mean me? Markus Kiili @Masd925 Jul 26 2017 07:41 @kelechy ? CallMeOrange @EgnaroDev Jul 26 2017 07:41 @Masd925 I think he meant to tag me... Kelechi Chinaka @ke1echi Jul 26 2017 07:42 sorry guys tryna show something to somebody :wave: @Masd925 CallMeOrange @EgnaroDev Jul 26 2017 07:42 Hm.. Didn't you meant to tag me? I was working on a challenge to compare empty array... Well Never mind Kelechi Chinaka @ke1echi Jul 26 2017 07:43 kyu is a like a karate level for kungfu and the likes CallMeOrange @EgnaroDev Jul 26 2017 07:43 yeah Soon... I'll be yellow belt Markus Kiili @Masd925 Jul 26 2017 07:43 @MCTwoDigitZero Yeah, you can learn some techniques by making one-liners. I have a gist on FCC algo one-liners, if you wan't to see what I have stuffed into one line. Kelechi Chinaka @ke1echi Jul 26 2017 07:43 ok..that line needed double check @MCTwoDigitZero CallMeOrange @EgnaroDev Jul 26 2017 07:44 What is it? Markus Kiili @Masd925 Jul 26 2017 07:44 https://gist.github.com/Masd925/8b1a9b1d37c322827dcd CallMeOrange @EgnaroDev Jul 26 2017 07:45 @kelechy are you talking about this? function disemvowel(str) {return str.replace(/[aeiou]/gi, '');} Kelechi Chinaka @ke1echi Jul 26 2017 07:46 no @MCTwoDigitZero CallMeOrange @EgnaroDev Jul 26 2017 07:46 which line? Kelechi Chinaka @ke1echi Jul 26 2017 07:46 did u pass the vowel test @MCTwoDigitZero CallMeOrange @EgnaroDev Jul 26 2017 07:46 Yeah Kelechi Chinaka @ke1echi Jul 26 2017 07:47 nice CallMeOrange @EgnaroDev Jul 26 2017 07:48 @kelechy thanks CamperBot @camperbot Jul 26 2017 07:48 mctwodigitzero sends brownie points to @kelechy :sparkles: :thumbsup: :sparkles: :warning: @kelechy's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account. CallMeOrange @EgnaroDev Jul 26 2017 07:48 Anyway... what line were you talking about? :/ Kelechi Chinaka @ke1echi Jul 26 2017 07:50 not u..was explaining to someone else how do u see CW @MCTwoDigitZero CallMeOrange @EgnaroDev Jul 26 2017 07:51 CW? Like a channel on T.V.? Kelechi Chinaka @ke1echi Jul 26 2017 07:51 codwars CallMeOrange @EgnaroDev Jul 26 2017 07:53 Did you need a link? Kelechi Chinaka @ke1echi Jul 26 2017 07:58 ok iso @iso1048 Jul 26 2017 08:27 Hi. would someone be please able to tell me if the following code (which I passed the Pig latin challenge with) is well written?  function translatePigLatin(str) { var vowels = ["a", "e", "i", "o", "u"]; var strArr; if (vowels.indexOf(str[0]) !== -1){ return str+="way"; } else { strArr= str.split(""); while (vowels.indexOf(strArr[0]) == -1){ strArr.push(strArr.shift()); str = strArr.join("")+"ay"; } } return str; } translatePigLatin("consonant"); kumquatfelafel @kumquatfelafel Jul 26 2017 08:32 @gothamknight There's nothing inherently awful about it. :p If you want some extra practice, you can try solving it using regex as well. You can also try and set something up that could, e.g., translate an entire sentence into pig latin, and/or work regardless of upper/lowercase. Pethaf @Pethaf Jul 26 2017 08:33 I was thinking that he wants to setup a map. And then use an anonymous function. Rajat @rajataudichya Jul 26 2017 08:35 @kumquatfelafel Got it thanks CamperBot @camperbot Jul 26 2017 08:35 rajataudichya sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles: :cookie: 540 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel kumquatfelafel @kumquatfelafel Jul 26 2017 08:35 huh?? Rajat @rajataudichya Jul 26 2017 08:35  // Setup var myObj = { gift: "pony", pet: "kitten", bed: "sleigh" }; function checkObj(checkProp) { // Your Code Here if (myObj.hasOwnProperty(checkProp)){ return myObj[checkProp]; } else { return "Not Found"; } } // Test your code by modifying these values checkObj("gift"); iso @iso1048 Jul 26 2017 08:36 @kumquatfelafel ok as long as it is not bad. I was having trouble with finding relatively effective solutions for the previous intermediate challenges, so just wanted to ensure this code was fine. thanks CamperBot @camperbot Jul 26 2017 08:36 gothamknight sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles: :cookie: 541 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel kumquatfelafel @kumquatfelafel Jul 26 2017 08:36 well... np for ... oh I remember now :laughing: np Rajat @rajataudichya Jul 26 2017 08:36 @kumquatfelafel how can this hasOwnProperty used? in big websites? Blauelf @Blauelf Jul 26 2017 08:37 @gothamknight Good luck with like translatePigLatin("hmm") (not one of the test cases). I'd use a for loop, like  } else { var i; for (i = 1; i < str.length; i++) { if (vowels.indexOf(str[i]) !== -1) { break; } } return str.slice(i) + str.slice(0, i) + "ay"; } No risk of infinite loop. kumquatfelafel @kumquatfelafel Jul 26 2017 08:38 @Blauelf ack. Can't believe I didn't catch that :laughing: @gothamknight @Blauelf absolutely correct. Your current setup only works if there is at least one vowel in the word. shoot. it's 4:50 am. I was on a normal sleep schedule for... about two days haha fauxpas91 @fauxpas91 Jul 26 2017 08:44 Hey guys. Was hoping for a quick sanity check. I have the following code pen. I figure this is the easiest way for people to have a look. https://codepen.io/fauxpas/pen/WEbWXX My issue is that the hide function seems to be running without being called. My intent is that classes with the name .dynamic-content are hidden and only the specific content with the same id as the text in the button should be shown Pethaf @Pethaf Jul 26 2017 08:45 @fauxpas91 It is very bad coding style to have more than one element with the same id in a page. fauxpas91 @fauxpas91 Jul 26 2017 08:46 @Pethaf Sorry can you point out where? As far as I'm aware i don't have any html ID's with the same name or do you mean the js with the var hide being the same name as the function? Pethaf @Pethaf Jul 26 2017 08:53 Oh sorry. I am once again in error. I shouldn't read code before I've had enough coffee. kumquatfelafel @kumquatfelafel Jul 26 2017 08:54 @fauxpas91 I would rename that var hide to something else. You don't want to cause yourself or others reading your code unnecessary confusion. As for hide function running without being called... All elements with "dynamic-content" inherit those properties. dynamic content is set to display:none; in your css, originally, and your hide function sets dynamic content elements to display none. fauxpas91 @fauxpas91 Jul 26 2017 08:55 Hey all. I solved it. Not sure why or how but reading the MDN docs on for each it said "Don't use this with arrays" and I think getElementsByClassName returns an array object Owais Ahmed @owaisehmed Jul 26 2017 08:59 Check if a string (first argument, str) ends with the given target string (second argument, target). This challenge can be solved with the .endsWith() method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead. I need help with this question "Confirm the ending" Not getting it kumquatfelafel @kumquatfelafel Jul 26 2017 09:00 @owaisehmed well, that target string has a certain length, right? Markus Kiili @Masd925 Jul 26 2017 09:00 @fauxpas91 It returns a live HTMLCollection that is an array-like object (not an array). Owais Ahmed @owaisehmed Jul 26 2017 09:00 yeah @kumquatfelafel that's it? kumquatfelafel @kumquatfelafel Jul 26 2017 09:02 @owaisehmed Let's say the target string has a length of 5, and the string whose ending we are checking has a length of 10. Owais Ahmed @owaisehmed Jul 26 2017 09:02 okay kumquatfelafel @kumquatfelafel Jul 26 2017 09:03 How many characters do we need to compare between the first and second string? And which ones? Owais Ahmed @owaisehmed Jul 26 2017 09:04 We just need to check the target string if it exists in the given string or not kumquatfelafel @kumquatfelafel Jul 26 2017 09:05 No. You need to check if the first string ends with the target string. Owais Ahmed @owaisehmed Jul 26 2017 09:05 My bad. kumquatfelafel @kumquatfelafel Jul 26 2017 09:06 For example, suppose I have "Hello World" and "World". I want to check if "Hello World" ends with "World". Owais Ahmed @owaisehmed Jul 26 2017 09:07 Yes then it should return true fauxpas91 @fauxpas91 Jul 26 2017 09:09 @Masd925 As far as I'm aware then all I changed was the for each loop and replaced it with a standard for loop kumquatfelafel @kumquatfelafel Jul 26 2017 09:10 fauxpas91 @fauxpas91 Jul 26 2017 09:14 Hmm I might have stumbled on another reason. My code as it was didn't have all the divs created yet. Now I've changed my code to be one method with takes an argument. If the argument matches a div name then it gets made visible When I had all of them in the function it didn't work and hid everything until I added the div in the html. Even if that bit of code hadn't run yet. So maybe it was due to a runtime error? So much to learn kumquatfelafel @kumquatfelafel Jul 26 2017 09:15 @fauxpas91 these divs had the dynamic-content class as per your definition in css? Blauelf @Blauelf Jul 26 2017 09:15 @kumquatfelafel I really like slice (one character shorter than substr, and uses start and end index) Markus Kiili @Masd925 Jul 26 2017 09:16 @fauxpas91 Yes, for loop works. You should note that nodelists returned from Node.childNodes and the document.querySelectorAll() do have a forEach method. fauxpas91 @fauxpas91 Jul 26 2017 09:19 @kumquatfelafel Yea so <div id="overview" class="dynamic-content"></div> <div id="paypal" class="dynamic-content"></div> etc kumquatfelafel @kumquatfelafel Jul 26 2017 09:20 @fauxpas91 do you want them to start out as hidden? fauxpas91 @fauxpas91 Jul 26 2017 09:23 Hey. Just to reiterate I have it working now. What I've done (might not be the best way) is to set the class dynamic-content to hidder in the css. The javascript on page.ready changes the display of overview to block Then when you click a button it sends an argument to my change function and dynamic-content gets hidden and the div with the same name as the arugment sent is set to block Haven't done the title yet. It's probably best to move the html around a bit. This is my first time trying to do this fauxpas91 @fauxpas91 Jul 26 2017 09:28 @kumquatfelafel @Masd925 thanks CamperBot @camperbot Jul 26 2017 09:28 fauxpas91 sends brownie points to @kumquatfelafel and @masd925 :sparkles: :thumbsup: :sparkles: :cookie: 542 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel :star2: 4346 | @masd925 |http://www.freecodecamp.com/masd925 kumquatfelafel @kumquatfelafel Jul 26 2017 09:35 @Blauelf pshaw. Splice is where it's at! It's still got all the lice, but now with added 'p'. :p function confirmEnding(str,target) { if (str.length < target.length) { return false; } str = str.split(''); str.splice(0, str.length - target.length); return str.join('') === target; } (random folks reading this, it's definitely not the best solution ;) ) Blauelf @Blauelf Jul 26 2017 09:40 Reminds me of my steamroller: function steamrollArray(arr) { var rolled = arr.slice(); var i = 0; while (i < rolled.length) { if (Array.isArray(rolled[i])) { Array.prototype.splice.apply(rolled, [i, 0].concat(rolled.splice(i, 1)[0])); } else { i++; } } return rolled; } kumquatfelafel @kumquatfelafel Jul 26 2017 09:44 interesting. Blauelf @Blauelf Jul 26 2017 10:02 Different than the usual  while (arr.some(Array.isArray)) { arr = Array.prototype.concat.apply([], arr); } return arr; Kelechi Chinaka @ke1echi Jul 26 2017 10:06 :wave: @Blauelf whats your best reference to learning oop in js Markus Kiili @Masd925 Jul 26 2017 10:13 @Blauelf I made another interesting solution to steamRoller. Doesn't use recursion or concat. Just iterates the indices of the array: function steamrollArray(arr) { var result = []; var indexArr = [0]; function getElement(array,indexArray) { return indexArray.reduce(function(acc,curr){ if (acc.hasOwnProperty(curr)) return acc[curr]; },array); } while (indexArr.length>0) { var elem = getElement(arr,indexArr); if (elem===undefined) { indexArr.pop(); indexArr[indexArr.length-1]++; } else { if (Array.isArray(elem)) { indexArr.push(0); } else { result.push(elem); indexArr[indexArr.length-1]++; } } } return result; } Markus Kiili @Masd925 Jul 26 2017 10:20 Could avoid that undefined business, but just presenting the idea. eeflores @eeflores Jul 26 2017 10:22 hey is there an admin in here? Koohyar Movassagh @Koohyar-m Jul 26 2017 10:24 Hi guys, I get stuck so I google for relevant information, 70% of time I end up on stack overflow and get more confused. It's really hard for me to find the relevant info to solve challenges. I read posts saying keep it simple and use right keyword but it doesn’t help. FCC forum has a good post that uses [programming language] + [verb] + [keywords] it helps but still I don’t know what the right keywords are. How do you guys search, any technique and select the right keywords? Long Nguyen @longnt80 Jul 26 2017 10:26 @ConnectCodes where are you on the challenges map? I always put freecodecamp and <<the name of the challenge>> Koohyar Movassagh @Koohyar-m Jul 26 2017 10:30 @longnt80 just started Advanced algorithm scripting. I can easily find the solution for any challenge but I don’t want that. I want to get better at finding relevant resources. Steven @LemonTruth Jul 26 2017 10:32 Anyone know any APIs for the random quote challenge? I'm having trouble finding one Long Nguyen @longnt80 Jul 26 2017 10:33 @ConnectCodes I think what you're looking for is related to the logic relevant to each challenge, right? Ragnorak @Rrak Jul 26 2017 10:34 Long Nguyen @longnt80 Jul 26 2017 10:34 @ConnectCodes if you want to search for that then the chat room is your best bet Koohyar Movassagh @Koohyar-m Jul 26 2017 10:37 @longnt80 I see, it makes sense Steven @LemonTruth Jul 26 2017 10:37 @Rrak oh wow, this is perfect, thanks :) CamperBot @camperbot Jul 26 2017 10:37 lemontruth sends brownie points to @rrak :sparkles: :thumbsup: :sparkles: :warning: @rrak's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account. Blauelf @Blauelf Jul 26 2017 10:45 @Masd925 I think I get what you mean, it's basically the same as recursion, just that you manage your own stack. I am somewhat irritated by that whole hasOwnProperty and undefined stuff. What does it do for you? Here's my own stack-based solution: function steamrollArray(arr) { let stack = [[arr, 0]]; let result = []; while (stack.length > 0) { let [array, index] = stack.pop(); if (index < array.length) { stack.push([array, index + 1]); if (Array.isArray(array[index])) { stack.push([array[index], 0]); } else { result.push(array[index]); } } } return result; } Markus Kiili @Masd925 Jul 26 2017 10:49 @Blauelf I think that is somewhat different. I just changed the array of indices and accessed the array. But the idea is similar. Blauelf @Blauelf Jul 26 2017 10:50 I just kept the sub-array rather than its index, that's probably the main difference. Markus Kiili @Masd925 Jul 26 2017 10:51 Yeah. Rajat @rajataudichya Jul 26 2017 10:54 Can some tell me why [1] and [0] has been used here var ourPets = [ { animalType: "cat", names: [ "Meowzer", "Fluffy", "Kit-Cat" ] }, { animalType: "dog", names: [ "Spot", "Bowser", "Frankie" ] } ]; ourPets[0].names[1]; // "Fluffy" ourPets[1].names[0]; // "Spot" iso @iso1048 Jul 26 2017 10:54 @Blauelf is the following a decent way to do the dna pairing challange? function pairElement(str) { var pairObj = { "G":"C", "C":"G", "A":"T", "T":"A" }; var arr = str.split("").map(function(val){ return [val]; }); for (var i = 0; i <arr.length; i++){ var temp = arr[i][0]; arr[i].push(pairObj[temp]); } return arr; } pairElement("GCG"); Abhinav Mishra @abhinav-m Jul 26 2017 10:55 @rajataudichya that is an array Markus Kiili @Masd925 Jul 26 2017 10:55 function pairElement(str){ var pairs = {A:'T', T: 'A', C: 'G', G: 'C'}; return str.split("").map(function(val){ return [val,pairs[val]]; }); } Abhinav Mishra @abhinav-m Jul 26 2017 10:56 @rajataudichya you are accessing it's indexes with 0 and 1 @rajataudichya which are object's themselves, which has a names property Blauelf @Blauelf Jul 26 2017 10:56 @Masd925 I somehow like push and pop. Reminds me of Tower of Hanoi. Also something easily solved with recursion, a stack, or, in this case, a bit of maths (every second move moves the smallest disc, every fourth move moves the second-to-smallest disc, and so on). Oh, I just realised that a puzzle in "Creeper World 3" is equivalent to Tower of Hanoi. It does not even remotely look the same, as there are totems switched on and off instead of discs on three poles. Abhinav Mishra @abhinav-m Jul 26 2017 10:56 @rajataudichya the names property is also an array , so you access it's index using 0 and 1 Markus Kiili @Masd925 Jul 26 2017 10:57 @gothamknight No need for the loop. limbu @limbu Jul 26 2017 10:57 hi guys i need to add a class(archiveSearchFacetContainerToggleClick) to the archiveSearchFacetContainerToggle div on archiveSearchFacetContainerToggle click iso @iso1048 Jul 26 2017 10:57 @Masd925 wow. thanks. CamperBot @camperbot Jul 26 2017 10:57 gothamknight sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles: :star2: 4347 | @masd925 |http://www.freecodecamp.com/masd925 limbu @limbu Jul 26 2017 10:57 can anyone give me a hand please Abhinav Mishra @abhinav-m Jul 26 2017 10:57 @rajataudichya it is an array of objects @limbu you can use jquery or javascript to add the clas @limbu class* Rajat @rajataudichya Jul 26 2017 10:58 @abhinav-thinktank Thanks bro and if I remember i think its chooses fluffy because in javascript its starts from 0 ? CamperBot @camperbot Jul 26 2017 10:58 rajataudichya sends brownie points to @abhinav-thinktank :sparkles: :thumbsup: :sparkles: :cookie: 426 | @abhinav-thinktank |http://www.freecodecamp.com/abhinav-thinktank Abhinav Mishra @abhinav-m Jul 26 2017 10:58 @rajataudichya yes. array indexes start from 0 Rajat @rajataudichya Jul 26 2017 10:58 just array indexes right? Markus Kiili @Masd925 Jul 26 2017 10:59 @rajataudichya Also should apply to array-like objects. Abhinav Mishra @abhinav-m Jul 26 2017 10:59 @rajataudichya well arrays are objects in javascript with their keys being indexes @rajataudichya Also should apply to array-like objects. Marianissimus @Marianissimus Jul 26 2017 11:00 @limbu try this:$("archiveSearchFacetContainerToggle").on("click", function() {
})
Abhinav Mishra
@abhinav-m
Jul 26 2017 11:00
Can someone explain this
When a static or prototype method is called without an object valued "this", then the "this" value will be undefined inside the called function. Autoboxing will not happen. The behavior will be the same even if we write the code in non-strict mode because all the functions, methods, constructor, getters or setters are executed in strict mode. So if we do not specify this value then the this value will be undefined.
class Animal {
speak() {
return this;
}
static eat() {
return this;
}
}

let obj = new Animal();
obj.speak(); // Animal {}
let speak = obj.speak;
speak(); // undefined

Animal.eat() // class Animal
let eat = Animal.eat;
eat(); // undefined
If we write the above code using traditional function based classes, then autoboxing will happen based on the "this" value for which the function was called.

function Animal() { }

Animal.prototype.speak = function() {
return this;
}

Animal.eat = function() {
return this;
}

let obj = new Animal();
let speak = obj.speak;
speak(); // global object

let eat = Animal.eat;
eat(); // global object
Blauelf
@Blauelf
Jul 26 2017 11:07
@abhinav-thinktank Writing Animal.eat(coconut) is same as Animal.eat.call(Animal, coconut), while eat(coconut) is same as Animal.eat.call(undefined, coconut). The first argument to call is the value passed for this. So in Animal.eat(), this is Animal, while in eat(), this is undefined. Unless you are in non-strict mode, where a non-object this gets auto-boxed to an object. For example, numbers get boxed into Number wrapper class, strings into String, and null or undefined gets autoboxed to the global object (window in a web browser, ordinary global variables are properties of that object, for example undefined refers to the same as window.undefined)
Abhinav Mishra
@abhinav-m
Jul 26 2017 11:09
@Blauelf oh
@Blauelf ok, i understand it better now :)
@Blauelf thanks !
CamperBot
@camperbot
Jul 26 2017 11:09
abhinav-thinktank sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4535 | @blauelf |http://www.freecodecamp.com/blauelf
Abhinav Mishra
@abhinav-m
Jul 26 2017 11:11
I dont understand why the behaviour is different in class / function declaration
Blauelf
@Blauelf
Jul 26 2017 11:11
Autoboxing is one ugliness created for convenience that they are trying to slowly remove. Strict mode was created for creating room for future improvements. I still think strict mode should have been the standard, with optional non-script.

Classes are always treated like in strict mode.

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes#Strict_mode

### Strict mode

The bodies of class declarations and class expressions are executed in strict mode i.e. constructor, static and prototype methods, getter and setter functions are executed in strict mode.

Abhinav Mishra
@abhinav-m
Jul 26 2017 11:15

This line from MDN is the one which is confusing me:

The behavior will be the same even if we write the code in non-strict mode because all the functions, methods, constructor, getters or setters are executed in strict mode.

Is it all functions or

The bodies of class declarations and class expressions are executed in strict mode i.e. constructor, static and prototype methods, getter and setter functions are executed in strict mode.

Blauelf
@Blauelf
Jul 26 2017 11:18
This probably refers only to functions declared within the class body.
Abhinav Mishra
@abhinav-m
Jul 26 2017 11:19
aah ok. that makes much more sense. @Blauelf thanks for all your help :)
CamperBot
@camperbot
Jul 26 2017 11:19
abhinav-thinktank sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:warning: abhinav-thinktank already gave blauelf points
Blauelf
@Blauelf
Jul 26 2017 11:20
I guess they mean the same, just had no clear rules for naming things (or those parts were written at very different points in time, and the naming conventions were not fixed when the first one appeared)
Abhinav Mishra
@abhinav-m
Jul 26 2017 11:22
Aah, your first explanation makes much more sense now :)
Jul 26 2017 11:54
have been off for like 3months, and am thinking of starting afresh again, do i need to register another account?
heroiczero
@heroiczero
Jul 26 2017 11:55
@adepoju-paul if you want to start from the start yes. or you could just use old account and re-do the exercises
Jul 26 2017 11:56
@heroiczero i treid re-doing the execerise but they were already done except i reset the codes for each execerise , what do you think?
heroiczero
@heroiczero
Jul 26 2017 11:58
@adepoju-paul I thought solutions were only saved per session. Maybe I would start another account or delete your account and make it again to start fresh from a clean slate
Jul 26 2017 12:02
@heroiczero can you delete the account so i can start afresh please?
heroiczero
@heroiczero
Jul 26 2017 12:03
Blauelf
@Blauelf
Jul 26 2017 12:03
@adepoju-paul The code you type in is stored in your browser's localStorage. Your last successful submission is available on the server (in your profile). I'm not sure about the "solved" state. If you were ok with the "solved" state reflecting your previous and not current status (I would do it that way), you could still use your own account.
KinderPreet Singh
@kindercappy
Jul 26 2017 12:04
Can anybody help on how do I go about the tic tac toe game with the computer?
Blauelf
@Blauelf
Jul 26 2017 12:05
I've deleted my account at some time, too, but that was because I accidentally had two. Deleted one, and linked the other login method. Now both lead to the same account.
Blauelf
@Blauelf
Jul 26 2017 12:12
I wonder whether somebody created a tic-tac-toe AI that was adapting (so initially one could win, but it would get harder and harder). I once played RTS games that claimed to be adapting, but what they adapted were mostly the factors in the AI cheating (also, no fog-of-war or even map discovery for the AI)
teevik
@teevik
Jul 26 2017 12:15
Is ai one of the requirements for tictactoe?
Abhinav Mishra
@abhinav-m
Jul 26 2017 12:17
@teevik well not technically
@teevik you could simulate some good moves for the computer turn to make it harder for the player :)
Blauelf
@Blauelf
Jul 26 2017 12:17
It doesn't require too much intelligence to make the computer not lose. Two perfect players would result in a draw.
muyani
@muyani
Jul 26 2017 12:17
I am just looking at javascript the first time
to a noob,how can one explain the concept of callbacks
i have never got it
Blauelf
@Blauelf
Jul 26 2017 12:19
Even "If you're about to win, win. If you can avert losing, do that. If the middle is empty, go there. Else go random." is a valid algorithm that might sometimes score a win.
limbu
@limbu
Jul 26 2017 12:20
@Marianissimus thank you mate
CamperBot
@camperbot
Jul 26 2017 12:20
limbu sends brownie points to @marianissimus :sparkles: :thumbsup: :sparkles:
Blauelf
@Blauelf
Jul 26 2017 12:20
@muyani Callbacks are functions you pass to another function, and that function can do anything with the passed function. setTimeout would enqueue the function after a certain time, filter would call it with array elements (plus index and the array, but most callbacks for filter will ignore those extras).
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 12:21
Hey Guys, Can someone spot what I did wrong https://codepen.io/Ronique/pen/XRGrOy?editors=1111
I am not getting the timer value when it is set.
muyani
@muyani
Jul 26 2017 12:24
@Blauelf I get you until where you introduced setTimeout(is this an example?
Blauelf
@Blauelf
Jul 26 2017 12:24
@kindercappy I'd model my game as a state machine, and define valid transitions between the states. Either alternate two humans with their moves, or have the computer take a turn every time the player had one. All of this is pretty event-driven.

@muyani Callbacks can be used in many ways. In

setTimeout(myCallback, 100);

function myCallback would be enqueued for execution after 100ms.

In

var newArray = oldArray.map(myCallback);

the callback would be executed immediately, once per array element, with three arguments, the current array element, its index, and the array.

muyani
@muyani
Jul 26 2017 12:28
@Blauelf i understand,I will follow you to greatness
Blauelf
@Blauelf
Jul 26 2017 12:29
Those were examples for asynchronous and synchronous usage. In both cases, you don't control the calling of the callback function directly.
Abhinav Mishra
@abhinav-m
Jul 26 2017 12:30
@RoniqueRicketts its a scoping problem
@RoniqueRicketts your variables are not defined inside the functions
@RoniqueRicketts the setinterval function to be exact
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 12:30
@abhinav-thinktank Should I put the timer details inside the document.ready()
KinderPreet Singh
@kindercappy
Jul 26 2017 12:31
@Blauelf okay. thanks :)
CamperBot
@camperbot
Jul 26 2017 12:31
kindercappy sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4536 | @blauelf |http://www.freecodecamp.com/blauelf
muyani
@muyani
Jul 26 2017 12:32
how do you control the calling of the callback? @Blauelf
Abhinav Mishra
@abhinav-m
Jul 26 2017 12:32
@RoniqueRicketts define it where you are starting the session
@RoniqueRicketts define your whole setInterval function there
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 12:32

@abhinav-thinktank I am glad you say that because whenever I did this

$("#session").click(function(){ var timerVal =$("#timer").innerHtml;

var allTime = parseInt(timerVal)-1;
var hr = Math.floor(allTime / 60);
var min = allTime % 60;
var sec = 59;
setInterval(countDown, 1000);

function countDown(){
if(min === 0 & sec === 0){
clearInterval(countDown);
breakTimer();
}
else if(sec > 0){
sec--;
$("#timer").html(hr + ":" + min + ":" + sec); } else if(sec === 0){ min -= 1; sec = 59; console.log(hr + ":" + min + ":" + sec); } } function breakTimer(){ console.log("break"); } }); its the same thing Abhinav Mishra @abhinav-m Jul 26 2017 12:34 wait.. clearInterval(countdown) whats this Blauelf @Blauelf Jul 26 2017 12:34 @muyani You don't. It's setTimeout's business to enqueue the function at the right time so it'll get picked in the event loop. You can, however, cancel the planned call writing var handle = setTimeout(myCallback, 100); ... // oh, I did not mean to! clearTimeout(handle); Same with other functions, you don't tell map how to call your function, it just assumes your function can deal with the three arguments. Abhinav Mishra @abhinav-m Jul 26 2017 12:35 ^ @RoniqueRicketts this is the syntax to clear interval you pass the handle, not the function that is one of the mistakes you've made clearInterval(countDown); Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:36 Abhinav Mishra @abhinav-m Jul 26 2017 12:37 scope.clearInterval(intervalID) intervalID... your function is being called multiple times. it's not the interval itself @muyani You don't. It's setTimeout's business to enqueue the function at the right time so it'll get picked in the event loop. You can, however, cancel the planned call writing var handle = setTimeout(myCallback, 100); ... // oh, I did not mean to! clearTimeout(handle); Same with other functions, you don't tell map how to call your function, it just assumes your function can deal with the three arguments. dyon3334 @dyon3334 Jul 26 2017 12:37 javascript:literal objects(literals) vs constructor functions Abhinav Mishra @abhinav-m Jul 26 2017 12:38 var intervalID = scope.setInterval(func, delay[, param1, param2, ...]); var intervalID = scope.setInterval(code, delay); muyani @muyani Jul 26 2017 12:39 @Blauelf thank you so much,Let me ask.Any function can be a callback function huh? CamperBot @camperbot Jul 26 2017 12:39 muyani sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles: :star2: 4537 | @blauelf |http://www.freecodecamp.com/blauelf Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:39 @abhinav-thinktank I am not getting the value of the html document. Ragnorak @Rrak Jul 26 2017 12:40 @RoniqueRicketts You mean you are unable to get a value from a HTML element Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:40 @abhinav-thinktank Stopping the interval is not the problem. The clearInterval actually stops it but my problem is to get the html timer value when it is set. @Rrak Yes. Why can't i get the value when it is set? Abhinav Mishra @abhinav-m Jul 26 2017 12:41 @RoniqueRicketts lol Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:42 @abhinav-thinktank What? Did I say something wrong again??? :worried: Ragnorak @Rrak Jul 26 2017 12:42 try this element.parseInt() to get the value from that element Abhinav Mishra @abhinav-m Jul 26 2017 12:42 nope Blauelf @Blauelf Jul 26 2017 12:42 @muyani As long as it can deal with the way it gets called, sure. For example, Array.isArray tests whether its first argument is an array. It ignores other arguments. So I can use it like arr.some(Array.isArray) to test whether there is any array in my array arr. some uses same three arguments in its calls as map and filter, but Array.isArray ignores the rest. If Array.isArray got confused by those two extra arguments, I'd need to write a wrapper function to be used as a callback. Abhinav Mishra @abhinav-m Jul 26 2017 12:43 i accidentally deleted some of your code in my fork.. nvm Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:45 @Rrak didn't work. Did it work on your end Ragnorak @Rrak Jul 26 2017 12:47 @RoniqueRicketts Send me the snippet where you wrote that code Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:48 @Rrak here //Timer Counter$("#session").click(function(){
var timerVal = $("#timer").parseInt(); var allTime = timerVal-1; var hr = Math.floor(allTime / 60); var min = allTime % 60; var sec = 59; setInterval(countDown, 1000); function countDown(){ if(min === 0 & sec === 0){ scope.clearInterval(countDown); breakTimer(); } else if(sec > 0){ sec--;$("#timer").html(hr + ":" + min + ":" + sec);
}
else if(sec === 0){
min -= 1;
sec = 59;
console.log(hr+":"+min+":"+sec);
}
}
//function breakTimer(){
//  console.log("break");
//}

});
Ragnorak
@Rrak
Jul 26 2017 12:49
Convert that to this
var timerVal = parseInt($("#timer").text()); Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:51 @Rrak Thank you, Your a good nerd. Keep Nerding man. That works. Brb, gonna do my boogie dance. :smile: CamperBot @camperbot Jul 26 2017 12:51 roniquericketts sends brownie points to @rrak :sparkles: :thumbsup: :sparkles: :warning: @rrak's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account. Ragnorak @Rrak Jul 26 2017 12:51 Glad it helped Ronique Ricketts @RoniqueRicketts Jul 26 2017 12:55 @Rrak lol, yeah, Now to continue chopping away to see what else I can fix. Abhinav Mishra @abhinav-m Jul 26 2017 12:58 @Blauelf Note that classes cannot extend regular (non-constructible) objects. If you want to inherit from a regular object, you can instead use Object.setPrototypeOf(): var Animal = { speak() { console.log(this.name + ' makes a noise.'); } }; class Dog { constructor(name) { this.name = name; } } Object.setPrototypeOf(Dog.prototype, Animal);// If you do not do this you will get a TypeError when you invoke speak var d = new Dog('Mitzie'); d.speak(); // Mitzie makes a noise. This isn't working for me It's an example of inheritance using setPrototypeOf Ragnorak @Rrak Jul 26 2017 12:59 @RoniqueRicketts Jump here if you get into trouble Abhinav Mishra @abhinav-m Jul 26 2017 13:00 This message was deleted Ronique Ricketts @RoniqueRicketts Jul 26 2017 13:01 @Rrak I will man. I am forseeing trouble but I won't tell you yet until I've tried and fail. :smiling_imp: Abhinav Mishra @abhinav-m Jul 26 2017 13:03 @Blauelf nvm, figured it out Blauelf @Blauelf Jul 26 2017 13:04 @abhinav-thinktank What was the mistake you made? The code you posted looks valid to me. Huỳnh Trần Khanh @khanh2003 Jul 26 2017 13:05 Abhinav Mishra @abhinav-m Jul 26 2017 13:06 @Blauelf actually the one i posted doesn't seem to work @Blauelf however this is working. @Blauelf :| function Tree(sciName) { this.sciName = sciName; function wood() { console.log("gives wood"); } } //Allowing purpose to be inherited further down the prototype chain Tree.prototype.purpose = function() { console.log(this.sciName + " gives oxygen") } class PalmTree { constructor(sciName) { this.sciName = sciName; } } Object.setPrototypeOf(PalmTree.prototype, Tree); var treeMine = new PalmTree("Palm"); treeMine.purpose(); this gives an error on treeMine.purpose() Blauelf @Blauelf Jul 26 2017 13:07 @abhinav-thinktank The dog example worked flawlessly for me. Abhinav Mishra @abhinav-m Jul 26 2017 13:08 @Blauelf for me too was trying to replicate the same in my code Blauelf @Blauelf Jul 26 2017 13:10 @abhinav-thinktank If you use a constructor, you might want to use an instance for the prototype, like Object.setPrototypeOf(PalmTree.prototype, new Tree()); Abhinav Mishra @abhinav-m Jul 26 2017 13:10 wait what.. how come the animal examples work then because it is an object? @Blauelf this did work, but not sure why Blauelf @Blauelf Jul 26 2017 13:12 It's an object with methods. Tree is a constructor (well, also an object with methods, but not the ones you want) Abhinav Mishra @abhinav-m Jul 26 2017 13:13 Allright. sigh, going through MDN docs is proving a bit painful Huỳnh Trần Khanh @khanh2003 Jul 26 2017 13:14 @abhinav-thinktank Almost everything is an Object in JS except primitive types. Your code doesn't work because Object.setPrototypeOf(PalmTree.prototype, Tree) is roughly equivalent to Object.setPrototypeOf(PalmTree.prototype, {prototype: {purpose: function() { console.log(this.sciName + " gives oxygen") }}}) so treeMine.prototype.purpose() works, and treeMine.purpose() doesn't. Blauelf @Blauelf Jul 26 2017 13:16 @abhinav-thinktank That second example, with a constructor, does not require setPrototypeOf, if you use extends: function Tree(sciName) { this.sciName = sciName; function wood() { console.log("gives wood"); } } //Allowing purpose to be inherited further down the prototype chain Tree.prototype.purpose = function() { console.log(this.sciName + " gives oxygen") } class PalmTree extends Tree { constructor(sciName) { super(sciName); } } var treeMine = new PalmTree("Palm"); treeMine.purpose(); Abhinav Mishra @abhinav-m Jul 26 2017 13:17 @Blauelf yes, in the docs it was mentioned that you can make it work like this too. @Blauelf Note that classes cannot extend regular (non-constructible) objects. If you want to inherit from a regular object, you can instead use Object.setPrototypeOf(): @Blauelf but i guess they have created an object in that dog example, which i am missing in the above case, @khanh2003 thanks for your help ! @Blauelf Ragnorak @Rrak Jul 26 2017 14:24 @RoniqueRicketts Keep up, that's how you will become Good in programming Alex @alexandrupintilei Jul 26 2017 14:44  /* function diffArray(arr1, arr2) { var newArr = []; // Same, same; but different. for(var i = 0; i < arr1.length; i++){ console.log(arr1[i]); if(i < arr1.length ){ return arr2.indexOf(arr1)<0; }; } return newArr; } diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]); */ var arr1 = [1, 2, 3, 5]; var arr2 = [1, 2, 3, 4, 5]; var newArr = arr1.filter(diffArray); function diffArray(el){ return arr2.indexOf(el) < 0; } diffArray(newArr); I want to return newArr,what i do wrong? Ronique Ricketts @RoniqueRicketts Jul 26 2017 14:44 @Rrak Yeah man thanks. I surely will continue. Never give up or backdown CamperBot @camperbot Jul 26 2017 14:44 roniquericketts sends brownie points to @rrak :sparkles: :thumbsup: :sparkles: :cookie: 283 | @rrak |http://www.freecodecamp.com/rrak Stephen James @sjames1958gm Jul 26 2017 14:57 @alexandrupintilei Your uncommented code - the function diffArray is just a filter function. Are you talking about the code at the top? Alex @alexandrupintilei Jul 26 2017 15:09 @sjames1958gm i want to put somehow that filter function inside the comment code Stephen James @sjames1958gm Jul 26 2017 15:11 @alexandrupintilei It can replace the for loop. You will need to call the function that filter calls something else. Dovydas Stirpeika @Giveback007 Jul 26 2017 15:11 ok peeps, I have something special to show off please let me know what you think https://codepen.io/giveback007/full/aybGVb/ I worked hard on this one Stephen James @sjames1958gm Jul 26 2017 15:15 @Giveback007 :+1: Very nice, like all the colors and options. Dovydas Stirpeika @Giveback007 Jul 26 2017 15:15 @sjames1958gm tnx, I've stayed up all night trying to finish this thing. I probably can make the menu look nicer CamperBot @camperbot Jul 26 2017 15:15 giveback007 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles: :star2: 8167 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm Dovydas Stirpeika @Giveback007 Jul 26 2017 15:17 but I think this is where I will stop, otherwise it won't have an end almost 400 lines of js Code 3/4 of it is react Jason Luboff @JLuboff Jul 26 2017 15:19 @Giveback007 Looks good. Whats the purpose of it though? (I know its one of the projects, but I've never understood its purpose) Christopher McCormack @cmccormack Jul 26 2017 15:19 @Giveback007 Excellent job! I love the hue effects! and the fading Dovydas Stirpeika @Giveback007 Jul 26 2017 15:20 @JLuboff it is a mathematicians idea of 'life' @JLuboff that's the shortest explanation Jason Luboff @JLuboff Jul 26 2017 15:20 Got it Dovydas Stirpeika @Giveback007 Jul 26 2017 15:20 @cmccormack tnx :D can't believe it's finally done CamperBot @camperbot Jul 26 2017 15:20 giveback007 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles: :star2: 1059 | @cmccormack |http://www.freecodecamp.com/cmccormack Christopher McCormack @cmccormack Jul 26 2017 15:21 @Giveback007 Are you going to do the dungeon? My recommendation - make it as simple as possible or you're giong to spend WAY to much time on it (like me :() Hemakshi Sachdev @hemakshis Jul 26 2017 15:21 Hey Everyone! Can someone please tell how can we fill our custom shapes (canvas) ? Dovydas Stirpeika @Giveback007 Jul 26 2017 15:21 @cmccormack now I want to see yours Christopher McCormack @cmccormack Jul 26 2017 15:22 my dungeon or game of life? Hemakshi Sachdev @hemakshis Jul 26 2017 15:22 I have made it with lot's of beginPath() and closePath(), etc. etc.. Diego Mayer @Chrono79 Jul 26 2017 15:23 @Giveback007 a suggestion: if the colors mean anything (like age) it would be nice to display that somewhere Dovydas Stirpeika @Giveback007 Jul 26 2017 15:23 @Chrono79 sure, you mean like a key? Christopher McCormack @cmccormack Jul 26 2017 15:23 @hemakshis have you tried .fill()? Dovydas Stirpeika @Giveback007 Jul 26 2017 15:24 @cmccormack yes Christopher McCormack @cmccormack Jul 26 2017 15:24 @Giveback007 yes both? haha Jason Luboff @JLuboff Jul 26 2017 15:25 Christopher McCormack @cmccormack Jul 26 2017 15:25 @Giveback007 here's an old build of the dungeon - I probably should have just finished up at this point but then I redid a bunch of the backend https://mackville.net/react/dungeon/ Dovydas Stirpeika @Giveback007 Jul 26 2017 15:25 I just spied on your game of life, I want to see dungeon Hemakshi Sachdev @hemakshis Jul 26 2017 15:25 @cmccormack No. Actually, I thought it won't work :worried: Christopher McCormack @cmccormack Jul 26 2017 15:25 @JLuboff thanks that's awesome CamperBot @camperbot Jul 26 2017 15:25 cmccormack sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles: :star2: 2103 | @jluboff |http://www.freecodecamp.com/jluboff Christopher McCormack @cmccormack Jul 26 2017 15:25 @hemakshis did you set a fillstyle? Jason Luboff @JLuboff Jul 26 2017 15:26 @cmccormack :+1: I got it from @HeebieGeeBee wherever he may be... :( Hemakshi Sachdev @hemakshis Jul 26 2017 15:26 @cmccormack I also want it in some 3D look Dovydas Stirpeika @Giveback007 Jul 26 2017 15:26 @cmccormack cool, but why do a back end for it? Christopher McCormack @cmccormack Jul 26 2017 15:26 @Giveback007 sorry, I didn't mean backend, just the underlying code Joel Y. @zapcannon99 Jul 26 2017 15:26 @JLuboff Thanks for the cheat sheet! CamperBot @camperbot Jul 26 2017 15:26 zapcannon99 sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles: :star2: 2104 | @jluboff |http://www.freecodecamp.com/jluboff Diego Mayer @Chrono79 Jul 26 2017 15:26 @Giveback007 it could be as simple as a tooltip over the cell or a color bar with a scale, amongst another ideas Jason Luboff @JLuboff Jul 26 2017 15:26 @zapcannon99 :+1: Dovydas Stirpeika @Giveback007 Jul 26 2017 15:28 @Chrono79 thank you for the suggestion, I will have to check with myself if I am not gagging tomorrow from spending too much time on this project. Diego Mayer @Chrono79 Jul 26 2017 15:28 :+1: Hemakshi Sachdev @hemakshis Jul 26 2017 15:28 @cmccormack I tried just now, nothings happening Jason Luboff @JLuboff Jul 26 2017 15:28 I think I'm going to start my Nightlife app today... Christopher McCormack @cmccormack Jul 26 2017 15:29 @hemakshis I only did circles but maybe it will help along with @JLuboff's cheatsheet - https://codepen.io/cmccormack/pen/QveomN Hemakshi Sachdev @hemakshis Jul 26 2017 15:30 @cmccormack Yeah, I've seen that before :wink: Christopher McCormack @cmccormack Jul 26 2017 15:31 oh haha sorry @JLuboff what is that? Find fun things to do in your area? Jason Luboff @JLuboff Jul 26 2017 15:32 @cmccormack Its the second dynamic web app. You're supposed to be able to enter your city, then it returns bars in the area and you can check in. Its kind of lame actually, but should be quicker to create than my voting app Christopher McCormack @cmccormack Jul 26 2017 15:32 @JLuboff that's not lame sounds cool to me :) Joel Y. @zapcannon99 Jul 26 2017 15:33 @JLuboff I think a number of people would use this "lame" app. Hemakshi Sachdev @hemakshis Jul 26 2017 15:33 May I show you my code? Jason Luboff @JLuboff Jul 26 2017 15:33 Eh...I'm not a big drinker...and when I do go out to bar(s) with friends, its always the same 1 or 2 lol And you can check in, but it doesn't show who has checked in Just shows a number lol Christopher McCormack @cmccormack Jul 26 2017 15:33 That's for the server owner to sell to data hoarding companies for :dollar: :dollar: :dollar: @JLuboff you can change the app a bit if you wanted, maybe find movie theaters, ice cream, and coffee shops instead Hemakshi Sachdev @hemakshis Jul 26 2017 15:38 @cmccormack https://codepen.io/hemakshis/full/brdePe/ Please tell, And sorry in advance because the code is a little bit complicated i guess Christopher McCormack @cmccormack Jul 26 2017 15:39 @hemakshis I'll take a look but the canvas project I posted was the only one I've ever done so not sure how much I can help :) Abhinav Mishra @abhinav-m Jul 26 2017 15:39 @hemakshis canvas kyu? shivam gupta @shivamg11000 Jul 26 2017 15:43 what the matter with the canvas, maybe I can help Dovydas Stirpeika @Giveback007 Jul 26 2017 15:43 should I go to sleep now then? Or should I wait till tonight and reset my sleep cycle? Christopher McCormack @cmccormack Jul 26 2017 15:46 @Giveback007 reset man at least some power naps to recharge Dovydas Stirpeika @Giveback007 Jul 26 2017 15:47 @cmccormack blah, I thinks so too, but I've been up for 24hours now Christopher McCormack @cmccormack Jul 26 2017 15:48 get some sleep Dovydas Stirpeika @Giveback007 Jul 26 2017 15:49 I use to be addicted to video games now I'm addicted to this stuff I think it's better no? Christopher McCormack @cmccormack Jul 26 2017 15:50 don't want to burn yourself out though, then you won't want to do it anymore :) Kelechi Chinaka @ke1echi Jul 26 2017 15:53 where is your best bet place to learn oop js Dovydas Stirpeika @Giveback007 Jul 26 2017 15:56 @kelechy you can also go on the beta version of free code camp Kelechi Chinaka @ke1echi Jul 26 2017 15:56 ok @cmccormack Dovydas Stirpeika @Giveback007 Jul 26 2017 15:56 it helped me to understand it Hemakshi Sachdev @hemakshis Jul 26 2017 15:57 @shivamg11000 This is my pen https://codepen.io/hemakshis/full/brdePe/ Kelechi Chinaka @ke1echi Jul 26 2017 15:58 i have done it @Giveback007 i just want to deeper understanding of oop in js..prototypes, inheritance etc Dovydas Stirpeika @Giveback007 Jul 26 2017 15:58 Kelechi Chinaka @ke1echi Jul 26 2017 15:58 cant wait for the beta to go live...any idea when it will be @cmccormack Christopher McCormack @cmccormack Jul 26 2017 15:59 No clue sorry Hemakshi Sachdev @hemakshis Jul 26 2017 15:59 @shivamg11000 If possible suggest something to give it a 3D look Christopher McCormack @cmccormack Jul 26 2017 15:59 I would suggest if you want to use it, use it. The knowledge is the most important part Dovydas Stirpeika @Giveback007 Jul 26 2017 16:01 @cmccormack watch what happens when you start braking the rules of GOL: https://codepen.io/giveback007/pen/prJEdL?editors=0010 Christopher McCormack @cmccormack Jul 26 2017 16:02 what did you do, add randomness after a certain number of gens? almost looks like it's breathing :) Dovydas Stirpeika @Giveback007 Jul 26 2017 16:03 no I just changed some of the if statements there's all kinds of cool things that happen based on what you mess up there was this "brain" that would spread from one spot Kelechi Chinaka @ke1echi Jul 26 2017 16:04 so no point waiting till its live @cmccormack Dovydas Stirpeika @Giveback007 Jul 26 2017 16:04 like a neural network looking thing Christopher McCormack @cmccormack Jul 26 2017 16:04 @kelechy really up to you but I'd say no Jason Luboff @JLuboff Jul 26 2017 16:05 @cmccormack Thats true. Or maybe I'll give the option between Bars and resturants or movies or something Kelechi Chinaka @ke1echi Jul 26 2017 16:05 ok..bcos i was thinking i should wait till beta goes live Christopher McCormack @cmccormack Jul 26 2017 16:06 @kelechy nah don't wait, but if there are bugs or whatever then it's to be expected as it is beta Kelechi Chinaka @ke1echi Jul 26 2017 16:07 thanks @cmccormack CamperBot @camperbot Jul 26 2017 16:07 kelechy sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles: :star2: 1060 | @cmccormack |http://www.freecodecamp.com/cmccormack shivam gupta @shivamg11000 Jul 26 2017 16:13 @hemakshis to give it 3D look I think there's need of webgl or opengl or some library like threejs Dovydas Stirpeika @Giveback007 Jul 26 2017 16:19 Christopher McCormack @cmccormack Jul 26 2017 16:20 neat Hemakshi Sachdev @hemakshis Jul 26 2017 16:20 @shivamg11000 ohh... ohk Yogender @yb1997 Jul 26 2017 16:46 Question for all of you, do you prefer ES7 or TypeScript 2 ? dragonmaiden @dragonmaiden Jul 26 2017 16:49 can anyone help me CENTER THE VIDEO PLESSSS Ayush Mahajan @ay2306 Jul 26 2017 16:55 Is something wrong here? <script type="text/javascript">$('#reso').html('Width: ' + screen.width);
</script>

<div id='reso'></div>
Christopher McCormack
@cmccormack
Jul 26 2017 17:11
@ay2306 did you import jquery?
Joseph
@revisualize
Jul 26 2017 17:11
People still use jQuery?
Christopher McCormack
@cmccormack
Jul 26 2017 17:12
nope it's long run is over
Yogender
@yb1997
Jul 26 2017 17:12
@ay2306 Did you imported jQuery before this script tag ?
Jason Luboff
@JLuboff
Jul 26 2017 17:12
I still do.
Joseph
@revisualize
Jul 26 2017 17:12
I laugh when I see websites with very little "JavaScript" but, they've linked out to jQuery. ... I'm like... So, you made my browser download some HUGE JavaScript file for jQuery just to save 10 lines of code?
Ayush Mahajan
@ay2306
Jul 26 2017 17:13
@cmccormack @yb1997 I did. Thanks but I solved it
CamperBot
@camperbot
Jul 26 2017 17:13
ay2306 sends brownie points to @cmccormack and @yb1997 :sparkles: :thumbsup: :sparkles:
:star2: 1061 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Jul 26 2017 17:13
Now that I'm doing more work in React I don't use jQuery, React and other similar frameworks make you build your site different so you don't really need it
Joseph
@revisualize
Jul 26 2017 17:14
@cmccormack Do you React for work?
Christopher McCormack
@cmccormack
Jul 26 2017 17:14
no
I may soon though, going to build a tool for interacting with our SDWAN Rest API
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:14
How do I make it look a little more realistic??
https://codepen.io/hemakshis/full/brdePe/
Joseph
@revisualize
Jul 26 2017 17:14
I need to research EWS and get calendar data.
Christopher McCormack
@cmccormack
Jul 26 2017 17:15
@hemakshis what's it supposed to be?
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 17:15
Hey guys I have a bug I need some help with https://codepen.io/Ronique/pen/XRGrOy?editors=1111
whenever I try to run the timer It keeps jumping back to 1 between timer. I suspect its a scoping issue but I can't seem to spot it.
Joseph
@revisualize
Jul 26 2017 17:15
@hemakshis Use a graphic.
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:16
@cmccormack Look a little bit more like a real gaming console :sweat_smile:
Yogender
@yb1997
Jul 26 2017 17:16
@hemakshis it looks like a play station controller
What are you trying to achieve ?
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:16
@yb1997 Yes, but I want it to look a little more realistic
Christopher McCormack
@cmccormack
Jul 26 2017 17:16
@RoniqueRicketts you should be clearing your timer if you're changing the time
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:17
@revisualize Can u suggest anything, I tried but could not find anything
Joseph
@revisualize
Jul 26 2017 17:17
Christopher McCormack
@cmccormack
Jul 26 2017 17:18
@hemakshis maybe break it into sections and test out different radial gradients
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 17:18
@cmccormack where is exactly. Look at the code there is a clearInterval(invtervalid)
Christopher McCormack
@cmccormack
Jul 26 2017 17:19
@RoniqueRicketts I'll be honest there is a lot going on in your code and I didn't look through everything - I would recommend you add a lot of console.log statements to see the current values of your variables and do a lot of testing to make sure everything matches what you expect
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:19
@cmccormack It would be really difficult to implement in that way
Christopher McCormack
@cmccormack
Jul 26 2017 17:19
@RoniqueRicketts I only mentioned the clearInterval because many many people don't implement this correctly and they end up with multiple timers running and can't figure out why it's not working properly
@hemakshis ok
Joseph
@revisualize
Jul 26 2017 17:20
@hemakshis Hence the reason I said.. Use a graphic?
Christopher McCormack
@cmccormack
Jul 26 2017 17:21
I don't think it would be that difficult to draw each piece seperately, maybe do the handles, the dpad/buttons, and the analog sticks all as seperate drawings so you can change the fill style
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 17:21
@cmccormack yeah I considered the interval timer but idk why it doesn't clear the first timer . it keeps stacking timers.
Yogender
@yb1997
Jul 26 2017 17:21
@hemakshis are you planning to add buttons on it ?
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:22
@yb1997 Yes. I think after adding the buttons it may look a little better
Christopher McCormack
@cmccormack
Jul 26 2017 17:22
@RoniqueRicketts it looked to me like you only cleared timers when timer reached 0. When you implement a setInterval, the first thing you should consider is how to clear it properly. If you want to clear it each time the timer is changed, you need to add a clearInterval to your time change button event handlers
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:22
Now, I will see after that what I could do about it
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 17:23
@cmccormack ok I will try that then come back to you
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:23
@revisualize I am looking for them. Thanks :)
CamperBot
@camperbot
Jul 26 2017 17:23
hemakshis sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4383 | @revisualize |http://www.freecodecamp.com/revisualize
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:23
@yb1997 Thankyou
CamperBot
@camperbot
Jul 26 2017 17:23
hemakshis sends brownie points to @yb1997 :sparkles: :thumbsup: :sparkles:
Jason Luboff
@JLuboff
Jul 26 2017 17:24
It makes me happy that people use my quote API
Yogender
@yb1997
Jul 26 2017 17:24
add those buttons first so that people like me can play, functionality is more important than design :)
Christopher McCormack
@cmccormack
Jul 26 2017 17:24
@JLuboff then reward them with more quotes!
I could always use a few more for nostalgia's sake :)
Jason Luboff
@JLuboff
Jul 26 2017 17:26
@cmccormack Hmmm...perhaps I will....when I find some time lol. Studying for certifications and working on backend projects and excuse excuse excuse
Christopher McCormack
@cmccormack
Jul 26 2017 17:27
maybe you can add a quote submission for people that want to help :)
Jason Luboff
@JLuboff
Jul 26 2017 17:28
I'm kind of OCD and still have to go and check each quote to make sure the person gave the quote correctly :joy:
Hemakshi Sachdev
@hemakshis
Jul 26 2017 17:28
@yb1997 Yes. :smile:
Christopher McCormack
@cmccormack
Jul 26 2017 17:29
yeah but then you can do it during downtime instead of dedicating time. Maybe they can do a pull request on your json file or something
Rachel
@rachelasawyer
Jul 26 2017 17:29
How do you keep a HTML image hidden until an if statement condition is met?
Jason Luboff
@JLuboff
Jul 26 2017 17:30
@rachelasawyer Add CSS visibility: hidden;
@rachelasawyer Then remove it when the condition is met
Or change it to visible
@cmccormack True. I'll consider it ;)\
Rachel
@rachelasawyer
Jul 26 2017 17:33
@JLuboff Okay cool. Do I then change it to visible as part of the if statement?
Jason Luboff
@JLuboff
Jul 26 2017 17:35

@rachelasawyer Yes. If using jQuery.. you would do something like

$('#imgID').css('visibility', 'visible'); or .imgClass if you're using a class. Not positive how to do it with vanilla JS Rachel @rachelasawyer Jul 26 2017 17:35 @JLuboff Awesome thank you! CamperBot @camperbot Jul 26 2017 17:35 rachelasawyer sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles: :star2: 2105 | @jluboff |http://www.freecodecamp.com/jluboff Jason Luboff @JLuboff Jul 26 2017 17:36 Vanilla JS might be something like document.getElementById('idHere').style.visibility = 'visible'; but...don't quote me on that :D João Porfírio @pixelparker Jul 26 2017 17:38 hey guys. i’m doing a project and im using this menu : https://codyhouse.co/gem/css-mega-site-navigation/ i want to make it a hover menu on desktop instead of being clicked,but im not being able to do that. anyone care to help? on the function that it has to be clickable i already tried to change it to hover, but since jquery needs an handlerin and handlerout to keep the menu open i’m a bit confused with that part Christopher McCormack @cmccormack Jul 26 2017 17:50 @JLuboff i think jQuery you can just do .show() Jason Luboff @JLuboff Jul 26 2017 17:51 @cmccormack You might be right. Usually there is multiple ways to do the same thing :D Thats the nice thing about programming Christopher McCormack @cmccormack Jul 26 2017 17:51 yeah Jason Luboff @JLuboff Jul 26 2017 17:53 @cmccormack Who do you use for image hosting? I was using photobucket for the last year...and they recently stopped allowing hotlinking :angry: I think I could use glitch...but just looking for options Christopher McCormack @cmccormack Jul 26 2017 17:54 just my godaddy server Jason Luboff @JLuboff Jul 26 2017 17:55 Ah.. Christopher McCormack @cmccormack Jul 26 2017 17:56 I got an awesome deal for$12 for one year with plenty of storage and bandwidth so I've been using that
Jason Luboff
@JLuboff
Jul 26 2017 17:57
I used to have a domain with godaddy but let it lapse. I was only using it for VPN to my apartment, but I don't even have the VPN setup anymore
Christopher McCormack
@cmccormack
Jul 26 2017 18:00
I dislike the company but couldn't beat that deal haha
Jason Luboff
@JLuboff
Jul 26 2017 18:04
Ya price wise they're really good
Christopher McCormack
@cmccormack
Jul 26 2017 18:07
Only thing I don't like is they don't have let's encrypt in the cpanel
Jason Luboff
@JLuboff
Jul 26 2017 18:09
Whats that? (let's encrypt)
Christopher McCormack
@cmccormack
Jul 26 2017 18:16
Jason Luboff
@JLuboff
Jul 26 2017 18:16
Ahh..
Christopher McCormack
@cmccormack
Jul 26 2017 18:17
but you have to renew every 90 days unless you can setup an auto-renewal which i've found difficult on godaddy
Jason Luboff
@JLuboff
Jul 26 2017 18:18
I find Godaddy's UI is not great
Christopher McCormack
@cmccormack
Jul 26 2017 18:21
I only use it to upload my cert right now, you can SSH/SCP/SFTP into the server directly if you want which is how I upload my files
Jason Luboff
@JLuboff
Jul 26 2017 18:22
I rarely use it at this point, just for work when needed
What is that? Wf?2kNM?
Christopher McCormack
@cmccormack
Jul 26 2017 18:25
Wfd2kNv?
Jason Luboff
@JLuboff
Jul 26 2017 18:25
I dunno man. I failed. So it gave me another one that I figured out lol
Christopher McCormack
@cmccormack
Jul 26 2017 18:27
Jason Luboff
@JLuboff
Jul 26 2017 18:31
Yup..
Diego Mayer
@Chrono79
Jul 26 2017 18:36
@JLuboff that's why they use recaptcha now ;)
Christopher McCormack
@cmccormack
Jul 26 2017 18:37
Eventually they're going to get rid of it for users they know almost for a fact are real
Jason Luboff
@JLuboff
Jul 26 2017 18:37
@Chrono79 recaptcha is the one where you choose the images?
Christopher McCormack
@cmccormack
Jul 26 2017 18:37
yeah or read off numbers from pictures
Diego Mayer
@Chrono79
Jul 26 2017 18:38
exactly, and they have some other version for the visual impaired people
Christopher McCormack
@cmccormack
Jul 26 2017 18:38
I'd much prefer to use a second factor or something.
Jason Luboff
@JLuboff
Jul 26 2017 18:39
Wooooo! Just got some good news
Diego Mayer
@Chrono79
Jul 26 2017 18:39
:confetti_ball:
Jason Luboff
@JLuboff
Jul 26 2017 18:40
I do believe its time to party!
Christopher McCormack
@cmccormack
Jul 26 2017 18:42
@JLuboff 1 day without a phishing report?
Jason Luboff
@JLuboff
Jul 26 2017 18:44
Getting more :moneybag:
Christopher McCormack
@cmccormack
Jul 26 2017 18:48
congrats! rewarding you for the extra responsibilities?
monkeyfingerz
@monkeyfingerz
Jul 26 2017 18:48
function telephoneCheck(str) {
var numbers = str.replace(/\D/g,"").replace(/ /g,"").replace(/-/g,"") ;
if(numbers.charAt(0) ===1 && numbers.length === 11){
return true;
}else if(numbers.length ===10){
return true;
}else{
return false;
}

}

telephoneCheck("1 (555)-555-5555");
why is this returning false
BrianWilliams28
@BrianWilliams28
Jul 26 2017 18:49
hey guys, I'm working on the search and replace algorithm and here's what I have so far. Could someone give me a hint on what to do next / edit?
function myReplace(str, before, after) {
for (var i = 0; i < str.indexOf(before); i++) {
str[i].replace(before, after);
}
return str;
}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Jason Luboff
@JLuboff
Jul 26 2017 18:49
Overall, ya. I'm taking some easy cert tests right now (All three MTA certs (database, it infastructure, developer)) then going into the hard stuff...going for MCSA SQL server, at which point I'll be taking on a lot more responsibility
Christopher McCormack
@cmccormack
Jul 26 2017 18:50
@monkeyfingerz log your numbers value after you do your replace to see what it stores. Logging to console is the easiest and quickest way to troubleshoot issues like that
@BrianWilliams28 you can't replace sections of a string, you have to build a new string
Diego Mayer
@Chrono79
Jul 26 2017 18:51
@monkeyfingerz charAt returns a string
if(numbers.charAt(0) ===1 && numbers.length === 11){ //this is false
return true;
}else if(numbers.length ===10){ //this is also false
return true;
}else{
return false; // then you return false
}
Christopher McCormack
@cmccormack
Jul 26 2017 18:51
@BrianWilliams28 str[i] will also be a letter, not a word, and you're replacing for every letter
monkeyfingerz
@monkeyfingerz
Jul 26 2017 18:52
@BrianWilliams28 dont loop just replace str with the new string replace creates
Jason Luboff
@JLuboff
Jul 26 2017 18:52
@cmccormack But doing a tiered approach to raises. They gave me an immedate one right now of ~4%. After I pass the first MTA (within the month I'm sure), I'll get another bump of 4%, then after the third MTA (hopefully by the end of the year) I'll get a ~8% bump. Then after MCSA (which, will probably take me a year to year and a half to pass all three tests) I'll get ~14% bump. So..considering I have a little one on the way, I'm super excited
Christopher McCormack
@cmccormack
Jul 26 2017 18:53
@JLuboff that's great man congrats
Jason Luboff
@JLuboff
Jul 26 2017 18:54
@cmccormack Thanks! Feels good man. I have to put in work, but thats okay with me. MCSA SQL will make me very marketable in the future as well
CamperBot
@camperbot
Jul 26 2017 18:54
jluboff sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1062 | @cmccormack |http://www.freecodecamp.com/cmccormack
monkeyfingerz
@monkeyfingerz
Jul 26 2017 18:54
@Chrono79 i don't get why the first if statement doesn't return true
Diego Mayer
@Chrono79
Jul 26 2017 18:54
@monkeyfingerz charAt returns a string, you compare it against a number there
monkeyfingerz
@monkeyfingerz
Jul 26 2017 18:55
DANG! right ok
thanks @Chrono79
CamperBot
@camperbot
Jul 26 2017 18:55
monkeyfingerz sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4500 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jul 26 2017 18:55
:+1:
Jason Luboff
@JLuboff
Jul 26 2017 19:03
@Chrono79 4500, nice
Diego Mayer
@Chrono79
Jul 26 2017 19:04
Croupier, I wanna cash out my tokens please ;)
Jason Luboff
@JLuboff
Jul 26 2017 19:05
@camperbot ?
Diego Mayer
@Chrono79
Jul 26 2017 19:05
I knew it, the house always wins
Joel Y.
@zapcannon99
Jul 26 2017 19:13
@camperbot Where have you gone?
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:13
:wave: i started with the fcc beta
anything not js seems not interesting to me :smile:
how did u guys go through? @JLuboff @Chrono79 ..and any advise for me? :smile:
LAB-XI
@LAB-XI
Jul 26 2017 19:20
function nextInLine(arr, item) {
arr.push(item);
return arr.shift();
}

// Test Setup
var testArr = [5,6,7,8,9];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 1));
console.log("After: " + JSON.stringify(testArr));
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:20
whats the question @LAB-XI
LAB-XI
@LAB-XI
Jul 26 2017 19:22
@kelechy How is 'arr.push(item)' adding to the end of 'testArr'? Why wouldn't it be 'testArr.push(item)?
I have a different array, which array would arr.push(item) push to?
Sorry, *If I had a different array...
Joel Y.
@zapcannon99
Jul 26 2017 19:24
arr is testArr when you use the function nextInLine()
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:25
testArr is just a setup @LAB-XI
LAB-XI
@LAB-XI
Jul 26 2017 19:26
@zapcannon99 Oh I got it. arr is the parameter, testArr is the argument?
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:26
the parameters the function takes are arr, item @LAB-XI
Joel Y.
@zapcannon99
Jul 26 2017 19:26
yeah
LAB-XI
@LAB-XI
Jul 26 2017 19:26
@kelechy @zapcannon99 Cool, I'm there. Thanks both!
CamperBot
@camperbot
Jul 26 2017 19:26
lab-xi sends brownie points to @kelechy and @zapcannon99 :sparkles: :thumbsup: :sparkles:
So you see what arguments/parameters are
LAB-XI
@LAB-XI
Jul 26 2017 19:28
@Chrono79 Yeah I'll go back 10 exercises and go again
Diego Mayer
@Chrono79
Jul 26 2017 19:31
I think that one is actually after the one you're working in
LAB-XI
@LAB-XI
Jul 26 2017 19:33
It's six exercies
*six excers
Diego Mayer
@Chrono79
Jul 26 2017 19:33
No, it's before, maybe they changed the order
LAB-XI
@LAB-XI
Jul 26 2017 19:33
wow I cannot type this evening
Six exercises before!
Marco Galizzi
@Tezenn
Jul 26 2017 19:35
if i jhave an array arr=[1,1,1] and i need to iterate trough it and then check the index it will always return me 0 beause arr.indexOf(arr[i]) even though iterating is 0,1,2 will always give me back 0.. and i need the real index, how can i do? :D
i cannot pass one test of the pairwise challenge with the array [1,1,1]
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:40
https://codepen.io/kelechichinaka/pen/MbGLew pls checkout my tribute page
Joel Y.
@zapcannon99
Jul 26 2017 19:41
Just curious, but what is the highlighting for? @kelechy
@Tezenn although showing the code will help, if you are iterating through with i, isn't i the index?
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:43
which of them @zapcannon99
Joel Y.
@zapcannon99
Jul 26 2017 19:43
@Tezenn Also, arr[i] is a number in your case. You can't really get an index of a number, so it will always return 0
:point_up: For example that.
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:44
oh, just to show some of his important novels @zapcannon99
Joel Y.
@zapcannon99
Jul 26 2017 19:45
Anthills of the Savanna is not.
Ah, okay. If you wanna be consistent, there are a few (like 1 or two) more titles further down. Otherwise, it's a biography. hahaha. Looks good.
Marco Galizzi
@Tezenn
Jul 26 2017 19:46
@zapcannon99 ahah big thanks man i is the index indeed..
CamperBot
@camperbot
Jul 26 2017 19:46
tezenn sends brownie points to @zapcannon99 :sparkles: :thumbsup: :sparkles:
Marco Galizzi
@Tezenn
Jul 26 2017 19:46
and thanks to your tip i now finished all the algorithms
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:47
:+1: @zapcannon99
Joel Y.
@zapcannon99
Jul 26 2017 19:47
Goodies
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:47
LAB-XI
@LAB-XI
Jul 26 2017 19:50
@kelechy Ok minor point but the first paragraph, 'Early Age' looks like it's a slightly weird position?
@kelechy Plus the quote at the end might look better in the center of the page?
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:53
ok @LAB-XI
Veronica Eulenberg
@HappyViki
Jul 26 2017 19:56
Jason Luboff
@JLuboff
Jul 26 2017 19:58
@kelechy I haven't done much on beta, but I went through all of frontend on the regular site. I was fairly familar with html/css prior, so those sections were pretty quick for me. JS took a while
@HappyViki Probably better to post a question..
Veronica Eulenberg
@HappyViki
Jul 26 2017 19:59
I’ve written it here, look at the comments in JS: https://codepen.io/HappyViki/pen/qXBqop
Kelechi Chinaka
@ke1echi
Jul 26 2017 19:59
ok @JLuboff
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:00
@JLuboff the numbers don’t get added, they just get replaced.
Tiago Correia
@tiagocorreiaalmeida
Jul 26 2017 20:01
hello everyone
Christopher McCormack
@cmccormack
Jul 26 2017 20:02
@tiagocorreiaalmeida hiya
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:02
@tiagocorreiaalmeida yo
Tiago Correia
@tiagocorreiaalmeida
Jul 26 2017 20:02
can anyone give a little help on a idea?

im doing the calculator exercise $(button).click(function(){ }); how can I know each key will be pressed? or I can get the content inside the button like Joel Y. @zapcannon99 Jul 26 2017 20:03 id the button Veronica Eulenberg @HappyViki Jul 26 2017 20:03 or do this Joel Y. @zapcannon99 Jul 26 2017 20:03 ex: <button id="buttonID"> Tiago Correia @tiagocorreiaalmeida Jul 26 2017 20:03 tought about the this option confused how I will create it but lets see :D Christopher McCormack @cmccormack Jul 26 2017 20:04 there are also the data- attributes you can use which are pretty useful for this Jason Luboff @JLuboff Jul 26 2017 20:06 @HappyViki if (tracker.length === 0)? Its only ever going to add a number once? Or is it that you remove that element each click.. here: if (clicked === tracker[0]) { tracker.shift(); Ashley Owens @yelhsa Jul 26 2017 20:07 is there any benefit to doing the FCC challenges in a text editor instead of in the window FCC provides? or cons Christopher McCormack @cmccormack Jul 26 2017 20:07 @yelhsa sure, many editors have extensions that can help a lot, like linters and debug tools you can even run the code in the editor if it supports build environments I would recommend VS Code, it's pretty awesome and lots of great extensions Veronica Eulenberg @HappyViki Jul 26 2017 20:11 @JLuboff it’s supposed to remove an element with each click, and then replenish when it reaches 0. Ashley Owens @yelhsa Jul 26 2017 20:12 @cmccormack I am looking into text editors because I have a hard time completing the challenges. The output box doesn't display things it deems to be not part of the challenge it seems. It makes it difficult when I can't really play around with the code. Veronica Eulenberg @HappyViki Jul 26 2017 20:14 @JLuboff isn’t the push supposed to add to arr? It doesn’t look like it is. if (tracker.length === 0) { arr.push(Math.floor(Math.random() * 4)); tracker = arr; console.log("Next level: ", arr, tracker)$("#counter").text(arr.length);
runLights();
}
Christopher McCormack
@cmccormack
Jul 26 2017 20:14
it's good practice to start using an editor anyhow so I support your decision :)
hakimnasir
@hakimnasir
Jul 26 2017 20:15
can someone help me with the npm request package?
Jason Luboff
@JLuboff
Jul 26 2017 20:15
@HappyViki If I'm reading your code corectly... it is pushing to arr. But then when you click the next box, it removes the previous element of the array (tracker). Given, I'm not always the best at reading other peoples code :D
@hakimnasir Whats the question?
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:16
@JLuboff that’s what it’s supposed to do.
Jason Luboff
@JLuboff
Jul 26 2017 20:16
@yelhsa I always liked using https://labs.codecademy.com/#:workspace for FCC challenges, it displays console.log messages and returns
@HappyViki So how would tracker or arr ever have more than one element in it?
hakimnasir
@hakimnasir
Jul 26 2017 20:18
how do you do a codeblock in gitter?
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:18
@JLuboff that’s what it is doing, yes. arr has stuff pushed to it, and then tracker gets stuff removed from it. When tracker === 0, tracker === arr. Am I making more sense? I think I’m just saying the same thing over and over without changing my explination :P
@JLuboff arr never has anything removed from it…or so I would think.
Jason Luboff
@JLuboff
Jul 26 2017 20:19
@hakimnasir I would think you would want a loop? I haven't used the request module before so I'm not sure
@HappyViki arr and tracker reference the same array
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:21
@JLuboff is there any way I could make them their own units?
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:25
@JLuboff now it’s doing this mumbo jumbo https://codepen.io/HappyViki/pen/qXBqop
Jason Luboff
@JLuboff
Jul 26 2017 20:27
@HappyViki Where the dotted line is staying? I'm not sure on that one. And I have to start focusing on work now, but maybe someone else can step in now
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:28
@JLuboff okay. Thanks for the help :)
CamperBot
@camperbot
Jul 26 2017 20:28
happyviki sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2106 | @jluboff |http://www.freecodecamp.com/jluboff
CallMeOrange
@EgnaroDev
Jul 26 2017 20:33
@JLuboff Hey, do you know Factorialize a Number?
Stephen James
@sjames1958gm
Jul 26 2017 20:34
@MCTwoDigitZero You multiply it by every positive integer less than it
CallMeOrange
@EgnaroDev
Jul 26 2017 20:34
I'm working on Large Factorials in codewars
function factorial(n){
for (var i = 1; i <= n; i++){answer*=i}
if (n === 0) {return '1'}
else if (n < 0 || !n) return null;
}
factorial(22);
This is doesn't handle large number but I got the answer
Stephen James
@sjames1958gm
Jul 26 2017 20:35
hakimnasir
@hakimnasir
Jul 26 2017 20:41
@sjames1958gm thank you
CamperBot
@camperbot
Jul 26 2017 20:41
hakimnasir sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8168 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Veronica Eulenberg
@HappyViki
Jul 26 2017 20:44
Can someone help me figure out why the border stays around the box the second and onward rounds?
Only if the boxes are differnt though
If they are the same, then it disappears
I guess this is a different type of simon game :P Try to figure out which button to press!
Maybe there’s something wrong in this part:
  function runLights() {
console.log(arr)
for (var i in arr) {
var lightUp = "#btn" + arr[i];
console.log(lightUp)
$(lightUp).css("border", "dotted black"); setTimeout(function() {$(lightUp).css("border", "none");
}, 1000);
}
}
CallMeOrange
@EgnaroDev
Jul 26 2017 20:52
@sjames1958gm Can you take a look at my code for Large Factorials?
Stephen James
@sjames1958gm
Jul 26 2017 20:57
@MCTwoDigitZero sure
CallMeOrange
@EgnaroDev
Jul 26 2017 20:57
function factorial(n){
var zeroes = '';
for (var i = 1; i <= n; i++){answer*=i; zeroes += '0';}
zeroes = zeroes.slice(0, zeroes.length-1);
if (n === 0) {return '1'}
else if (n < 0 || !n) return null;
else if (n >= 22) return answer.toString().replace(/[^0-9]/g, '')+zeroes;
}
factorial(5);
I'm trying to handle big numbers, for example 22 is 1.124000727777607721e+21
Stephen James
@sjames1958gm
Jul 26 2017 21:01
@MCTwoDigitZero Does javascript number have the precision to hold large factorials and keep all the digits?
CallMeOrange
@EgnaroDev
Jul 26 2017 21:01
with this else if (n >= 22) return answer.toString().replace(/[^0-9]/g, '')+zeroes; I get '1124000727777607721000000000000000000000' but not quite accurate
wait... I forgot to remove 21 there, but probably won't fix the problem
Stephen James
@sjames1958gm
Jul 26 2017 21:03
@MCTwoDigitZero You need to move the decimal point by 21 not add 21 zeros
CallMeOrange
@EgnaroDev
Jul 26 2017 21:05
move . through 21 numbers?
Stephen James
@sjames1958gm
Jul 26 2017 21:05
yes
CallMeOrange
@EgnaroDev
Jul 26 2017 21:05
I see,
Stephen James
@sjames1958gm
Jul 26 2017 21:09
@MCTwoDigitZero Here is a replace that will remove the . and add the correct zeros
"1.124000727777607721e+21".replace(/(\.)([0-9]*)e\+(.*)/, function(m, e1, e2, e3) {
let zeros = "0".repeat(+e3 - e2.length);
return e2 + zeros;
});
Dovydas Stirpeika
@Giveback007
Jul 26 2017 21:21
I was wondering, how did you guys build the dungeon crawler?
DistinctWolf
@DistinctWolf
Jul 26 2017 21:28
How do i send someone to another page when someone clicks on a button in nodejs
Jason Luboff
@JLuboff
Jul 26 2017 21:29
@FlashHero If its the frontend...then same way you would do it normally
@FlashHero If you want that route to redirect, then if you're using express, you can use res.redirect('/page'); inside your callback
iso
@iso1048
Jul 26 2017 21:38
Could I have some thoughts on my code that I passed the missing letters challenge with please?

function fearNotLetter(str) {

var charCodeArr = [];
var missing;

for (var i =0; i <str.length; i++){
charCodeArr.push(str.charCodeAt(i));
}

for (var j = 0; j<charCodeArr.length; j++){
if (charCodeArr[j]+2 == charCodeArr[j+1] ){
missing = charCodeArr[j]+1;
str = String.fromCharCode(missing);
return str;
}
}
return undefined;
}

fearNotLetter("abcdefghjklmno");
DistinctWolf
@DistinctWolf
Jul 26 2017 21:40
@JLuboff how would i do it in frontend
Jason Luboff
@JLuboff
Jul 26 2017 21:41
@FlashHero <a href="/route"> <button> Words</button></a> ...
DistinctWolf
@DistinctWolf
Jul 26 2017 21:42
oh ok thanks @JLuboff
CamperBot
@camperbot
Jul 26 2017 21:42
flashhero sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2107 | @jluboff |http://www.freecodecamp.com/jluboff
Ronique Ricketts
@RoniqueRicketts
Jul 26 2017 21:46
so I wanna toggle between on/off with 2 separate functions using jQuery but they say that .toggle() is depreciated. When I use .toggle() it only remove the target element off the screen. What should I use instead?
Stephen James
@sjames1958gm
Jul 26 2017 21:59
@gothamknight Set missing to the charcode of the first value and then loop starting from the second letter until you get to the end or missing one.
No need to do two loops
@gothamknight
function fearNotLetter(str) {
var e = str.charCodeAt(0) + 1;
for (var i = 1; i < str.length; i++, e++) {
if (e !== str.charCodeAt(i)) {
return String.fromCharCode(e);
}
}
return undefined;
}
CamperBot
@camperbot
Jul 26 2017 22:17
:bulb: to format code use backticks!  more info
korzo
@korzo
Jul 26 2017 22:18
@sfarnsworthkum You can edit post
@sfarnsworthkum Backticks have to be at new line
Sarah F-K
@sfarnsworthkum
Jul 26 2017 22:19
function randomGame() {
var counter = 0;
var number = Math.random;
var timerId = setInterval(function(){
if ( number > .75) {
clearTimeout(timerId);
}
++counter;
}, 1000);

return counter;
}
I'm trying to write a function called randomGame that selects a random number between 0 and 1 every 1000 milliseconds and each time that a random number is picked, add 1 to a counter. If the number is greater than .75, stop the timer and return the number of tries it took before we found a number greater than .75.
my returned counter is always zero, I'm new to timers
also thanks @korzo !
CamperBot
@camperbot
Jul 26 2017 22:21
sfarnsworthkum sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
korzo
@korzo
Jul 26 2017 22:25
@sfarnsworthkum As setInterval is asynchronous, you cant return from function. Instead pass callback function as argument and call this callback as soon as condition is met
Traek Wells
@TraekWells
Jul 26 2017 22:44
Can anyone tell me why I’m getting a return of 0? The input is [-23, 4, -3, 8, -12]
function adjacentElementsProduct(inputArray) {
let largestProduct = 0;
let currentProduct = 0;
for (let i = 0; i < inputArray.length; i++) {
currentProduct = inputArray[i] * (inputArray[i + 1]);
if (currentProduct > largestProduct) {
largestProduct = currentProduct;
currentProduct = 0;
}
}
return largestProduct;
}
I’ve been thinking about this for a while and can’t seem to figure it out. Is the 6th index position a 0? Or does undefined equate to 0?
Sarah F-K
@sfarnsworthkum
Jul 26 2017 22:49
thanks so much @korzo makes much more sense!
CamperBot
@camperbot
Jul 26 2017 22:49
sfarnsworthkum sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:warning: sfarnsworthkum already gave korzo points
korzo
@korzo
Jul 26 2017 22:52
@TraekWells currentProduct un last iteration is NaN
Jason Luboff
@JLuboff
Jul 26 2017 22:55
@TraekWells You always have a negative number, therefore, largestProduct never changes from 0
@TraekWells And the last number is Nan, so you may want to change your for loop declaration to i < inputArray.length - 1
kumquatfelafel
@kumquatfelafel
Jul 26 2017 22:56
:point_up:
Traek Wells
@TraekWells
Jul 26 2017 22:58
@JLuboff ah that makes sense. Thanks.
CamperBot
@camperbot
Jul 26 2017 22:58
traekwells sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2108 | @jluboff |http://www.freecodecamp.com/jluboff
Jason Luboff
@JLuboff
Jul 26 2017 22:59
@TraekWells I'm not sure the end goal, but you may want to initialize largestProduct with -infinity
@TraekWells Or with the first element of your array
kumquatfelafel
@kumquatfelafel
Jul 26 2017 22:59
well... product of first two elements, but yeah.
agreed
Jason Luboff
@JLuboff
Jul 26 2017 23:00
@kumquatfelafel Ah, ya thats true
iso
@iso1048
Jul 26 2017 23:09
@sjames1958gm oh. i did not even know that i could increment two variables when declaring the for loop. thanks.
CamperBot
@camperbot
Jul 26 2017 23:09
gothamknight sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8169 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 26 2017 23:09
@gothamknight yw
LAB-XI
@LAB-XI
Jul 26 2017 23:19
function testElse(val) {
var result = " ";

if (val > 5) {
result = "Bigger than 5";
}

if (val <= 5) {
result = "5 or Smaller";
}

return result;
}

testElse(6);
Can someone tell me why var result = " "; is needed?
Jason Luboff
@JLuboff
Jul 26 2017 23:20
@LAB-XI What if val is not a number, but instead a string? That wouldn't meet either requirement
It could technically be var result; but then in the case above it would return undefined
LAB-XI
@LAB-XI
Jul 26 2017 23:22
@JLuboff Ok I think I understand - if I call testElse, and pass a string as an argument, it should return null, or similar?
Jason Luboff
@JLuboff
Jul 26 2017 23:23
@LAB-XI Currently, it would return " " but if you didn't have var result = " "; and instead had var result; it would return undefined (This is assuming for both cases that you passed in a string instead of a number)
LAB-XI
@LAB-XI
Jul 26 2017 23:23
@JLuboff Ok I understand that - thanks!
CamperBot
@camperbot
Jul 26 2017 23:23
lab-xi sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2109 | @jluboff |http://www.freecodecamp.com/jluboff
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:28
Could someone tell me why this code is broken? It's supposed to add all of the numbers in an array, then return whether that number is odd or even. My code passes every test except for one with an empty array I think
Nick Cleary
@Hijerboa
Jul 26 2017 23:28
For some reason, when I call the twitch API, the first item I call each time I run my program returns a link which looks like https://api.twitch.tv/kraken/channels/undefined. All subsequent calls to the API during that run return an expected result, but for some reason the first one does not. It doesn’t matter what I put in the first slot, I always get this “undefined” URL. Of course I can add a nonsense streamer in the first slot and filter it out from the result, but that’s a work around, not a solution. Can anyone explain to me why this is happening?
https://codepen.io/hijerboa/pen/XgLQpd?editors=0012
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:28

function oddOrEven(array) {

var redArray = array.reduce(function(a,b) {
return a + b
});
if (array.length === 0) {
return "odd"
} else if (redArray % 2 === 0) {
return "even"
} else { return "odd" }

}

function oddOrEven(array) {

var redArray = array.reduce(function(a,b) {
return a + b
});
if (array.length === 0) {
return "odd"
} else if (redArray % 2 === 0) {
return "even"
} else { return "odd" }

}
Could someone tell me why this code is broken? It's supposed to add all of the numbers in an array, then return whether that number is odd or even. My code passes every test except for one with an empty array I think
Nick Cleary
@Hijerboa
Jul 26 2017 23:29
@EricHasegawa It may be possible to have an if statement that returns the correct result if the array is empty, and else do your code from above
Jason Luboff
@JLuboff
Jul 26 2017 23:30
@EricHasegawa You would need to check for an empty array prior to your reduce
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:30
@JLuboff How would I do that?
@Hijerboa I'm not sure what you mean by that
Nick Cleary
@Hijerboa
Jul 26 2017 23:31
Something like this
if (arr.length == 0){
return something;
} else if (arr.length >0 {
}
Jason Luboff
@JLuboff
Jul 26 2017 23:31
@EricHasegawa Just move your if statement above the reduce, and then have an if/else after
Nick Cleary
@Hijerboa
Jul 26 2017 23:31
@EricHasegawa
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:32
@JLuboff That worked, thanks!
CamperBot
@camperbot
Jul 26 2017 23:32
erichasegawa sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2110 | @jluboff |http://www.freecodecamp.com/jluboff
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:33
@Hijerboa Thank you as well
Nick Cleary
@Hijerboa
Jul 26 2017 23:33
@EricHasegawa np mate
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:33
@JLuboff Could you tell me why I had to put the original if statement before the reduce?
@Hijerboa Did you get brownie points for that, it's not showing that you did on my computer
Nick Cleary
@Hijerboa
Jul 26 2017 23:34
@EricHasegawa haha nope idk why
Jason Luboff
@JLuboff
Jul 26 2017 23:34
@EricHasegawa You can't reduce an empty array unless reduce has an starting value
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:34
@JLuboff Oh that makes sense
@Hijerboa Thanks
CamperBot
@camperbot
Jul 26 2017 23:34
erichasegawa sends brownie points to @hijerboa :sparkles: :thumbsup: :sparkles:
Eric Hasegawa
@EricHasegawa
Jul 26 2017 23:34
There we go
Nick Cleary
@Hijerboa
Jul 26 2017 23:34
@EricHasegawa got it :P
Jason Luboff
@JLuboff
Jul 26 2017 23:35
@Hijerboa Ok...if I dissected your code correctly.. You don't feed a streamer in your initial call to getStatus(); but after the first time its called, you call the function again this time using the array and an index that you increment
@Hijerboa Try
\$(document).ready(function() {
getStatus(streamers[0]);
Nick Cleary
@Hijerboa
Jul 26 2017 23:37
@JLuboff that works! thanks mate!
CamperBot
@camperbot
Jul 26 2017 23:37
hijerboa sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2111 | @jluboff |http://www.freecodecamp.com/jluboff
Jason Luboff
@JLuboff
Jul 26 2017 23:37
:+1:
GSGV
@GSGV
Jul 26 2017 23:40
Does anybody have suggestions on other courses you can take or other places to perfect javascript? It's like i understand concepts but i'm having a hard time with formatting the code using FCC
Manish Giri
@Manish-Giri
Jul 26 2017 23:42
@GSGV codeacademy is good, hackreactor prep (free course) has some great exercises for you to practice your skills..
Jason Luboff
@JLuboff
Jul 26 2017 23:42
@Manish-Giri :wave:
GSGV
@GSGV
Jul 26 2017 23:43
Thanks @Manish-Giri codeacademy is so buggy i can't get through it, but i've never heard of hackreactor, i'll check it out!
CamperBot
@camperbot
Jul 26 2017 23:43
gsgv sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6321 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jul 26 2017 23:43
@JLuboff :wave:
Jason Luboff
@JLuboff
Jul 26 2017 23:43
Whats up?
Manish Giri
@Manish-Giri
Jul 26 2017 23:44
@GSGV :+1:
@JLuboff going through the M001 course at mongo uni
ugh it's so slow :angry:
Jason Luboff
@JLuboff
Jul 26 2017 23:44
@Manish-Giri M001 or M101? I did the M101JS, its a good course, but ya can be a bit slow
iso
@iso1048
Jul 26 2017 23:45
"Except for null and undefined, all primitive values have object equivalents that wrap around the primitive values." what does it mean to 'wrap around the primitive values?'
Manish Giri
@Manish-Giri
Jul 26 2017 23:46
@JLuboff um it's probably M101, the one where they have you use compass in week 1
Jason Luboff
@JLuboff
Jul 26 2017 23:47
@Manish-Giri Nah...I didn't use compass
Manish Giri
@Manish-Giri
Jul 26 2017 23:51
@JLuboff another tool?
kumquatfelafel
@kumquatfelafel
Jul 26 2017 23:51

@gothamknight

var obj = {
val: 17
}

For example, this object, obj, "wraps" the primitive value of 17`.

Jason Luboff
@JLuboff
Jul 26 2017 23:53
@Manish-Giri The course I took was specifically using mongo with the nodeJS driver
Manish Giri
@Manish-Giri
Jul 26 2017 23:53
ooh which one was it?
maybe I'll take it oo
@JLuboff
Jason Luboff
@JLuboff
Jul 26 2017 23:53
@Manish-Giri M101JS
Manish Giri
@Manish-Giri
Jul 26 2017 23:54
oh right
ty @JLuboff