These are chat archives for FreeCodeCamp/HelpFrontEnd

15th
Oct 2017
Alexx Martínez
@AlexxMart
Oct 15 2017 00:29
@sjames1958gm I don't know exactly how to terminate filter after the first "true" result
I've trying to do that for a few hours, trying with a loop but it doesn't work
korzo
@korzo
Oct 15 2017 00:34
@AlexxMart Filter is not the best tool for this task.
anyway, if you are going to use it, you need to set flag outside of filter, when function returns true
Alexx Martínez
@AlexxMart
Oct 15 2017 00:40
@korzo the problem is that I can't seem to find a way to stop the iteration when it returns "true" for the first time
korzo
@korzo
Oct 15 2017 00:40
@AlexxMart You can't stop iteration from inside the filter
@AlexxMart Do you want me to post my solution using filter?
Alexx Martínez
@AlexxMart
Oct 15 2017 00:41
@korzo give me a sec, I have an idea
Alexx Martínez
@AlexxMart
Oct 15 2017 01:15
@korzo I went as far as checking the position of the filtered items, the next idea was to take out the empty spaces until the first "false" element was. But I can sense that I'm complicating the code too much and can't still find the correct answer
my code so far @korzo
function dropElements(arr, func) {
  // Drop them elements.
  var f = [];
  for(var i = 0; i < arr.length; i++){
  var v = [arr[i]];
  f.push(v.filter(func));

  }
  return f;
}

dropElements([0, 1, 0, 1], function(n) {return n === 1;});
this returns an array with empty spaces where the filtered items were
I tried using shift instead of filter, but I was unable to return more than the first element that ought to be excluded
korzo
@korzo
Oct 15 2017 01:17
@AlexxMart If you already use for loop, you can return rest of the array, when func returns true for current element
Alexx Martínez
@AlexxMart
Oct 15 2017 01:18
I tried that, let me show you what I had so far @korzo
@korzo never mind, I lost it haha
I really feel guilty because in the last three days I've only completed 8 of these algorithms and I had to ask for a lot of help
korzo
@korzo
Oct 15 2017 01:21
@AlexxMart
function dropElements(arr, func) {
  // Drop them elements.
  var f = [];
  for(var i = 0; i < arr.length; i++){
    if(func(arr[i])) {
       // return rest of the array from current position
    }

  }
  return [];
}

dropElements([0, 1, 0, 1], function(n) {return n === 1;});
korzo
@korzo
Oct 15 2017 01:28
@AlexxMart It's not important how many challenges you completed. What mater is how much you learnt
And it's better to ask then waste a lot of time
K Smith
@klinton24
Oct 15 2017 01:33
Does anyone have a suggestion on how to handle these drop down menus in bootstrap? I have atleast 3 problems with them. First of which , is it doesn't matter which one you click.. they both open the same one. I tried putting them in seperate divs, and that worked in terms of each dropdown menu working, but then, they ended up being vertical to each other, rather than left to right https://codepen.io/ksmith24/pen/VMGqvY?editors=1100
korzo
@korzo
Oct 15 2017 01:38
@klinton24 Why you don't use bootstrap navbar?
K Smith
@klinton24
Oct 15 2017 01:39
Maybe I need to look more into it, I ran into the nav pills somewhere, fell in love with them and to be honest I don't have the strongest understanding of it yet. I only started messing with the drop down menus yesterday;
@klinton24 Anyway, it should work, if you wrap the code in <div class="btn-group">
K Smith
@klinton24
Oct 15 2017 01:48
hmmm it worked but then the wrap made it shorter, is there a way to make the width: of the btn group to go all the way to the right cover of whatever screen? if I put in a certain px, it'll work on 1 screen and not another
korzo
@korzo
Oct 15 2017 01:51
@klinton24 You should wrap each button+ul inside <div class="btn-group">, not whole navigation.
take a look at example from the link above I posted.
But navbar is much better soution for this
K Smith
@klinton24
Oct 15 2017 01:51
okay, thanks @korzo
CamperBot
@camperbot
Oct 15 2017 01:51
klinton24 sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 625 | @korzo |http://www.freecodecamp.com/korzo
MomchilDeus
@MomchilDeus
Oct 15 2017 07:32
@khaduch Can you show me an example of " the nav button frozen to the top of the screen when you scroll up" ?
Any feedback would be appreciated https://codepen.io/MomchilDeus/pen/aLRbRa
Amit Patel
@AmitP88
Oct 15 2017 08:47

hey guys, running into a weird problem on my project. I'm making a match 3 game and I've got the Swap functionality down (where the user can swap two adjacent cells that they click on). The first time the user swaps two cells, everything works fine. But, when the user tries to swap two cells again (as if it's a 2nd turn), the first cell the user clicked on changes its' image to another one. I don't know what's causing this. How do I fix this? Please, any help will be HIGHLY appreciated! :)

https://codepen.io/AmitP88/pen/pWyaNY?editors=0010

Ashwin
@ashwins93
Oct 15 2017 09:15
@AmitP88 It would be easier to find such bugs by running it in a debugger
Amit Patel
@AmitP88
Oct 15 2017 09:23
@ashwins93 I looked at the dev console for that and got this error:
Uncaught TypeError: Cannot read property 'x' of undefined
at check_adjacentCells (pen.js:156)
at HTMLCanvasElement.<anonymous> (pen.js:203)
But that error is only because when the user clicks on one cell initially, the second cell for the if statements aren't defined (because the user hasn't clicked on a second cell yet). Other than that, I haven't encountered any errors in console that hints to why it's acting the way it is
Ashwin
@ashwins93
Oct 15 2017 09:23
@AmitP88 happens like that in codepen
Amit Patel
@AmitP88
Oct 15 2017 09:24
@ashwins93 I was checking the Chrome dev console actually
Ashwin
@ashwins93
Oct 15 2017 09:27
okay on a totally unrelated note, i see that you are using hard coded values for drawing grid lines even though you have that number in the grid.width variable - its not something related to this bug, but i just saw it
Amit Patel
@AmitP88
Oct 15 2017 09:34
can you show me specifically where? I thought I was using grid.width appropriately in the for loop
Ashwin
@ashwins93
Oct 15 2017 09:38
context.lineTo(800,y); line 83
isn't 800 just the grid.height
Amit Patel
@AmitP88
Oct 15 2017 09:39
ah ok
I'll change it real quick
ok, its' done
Ashwin
@ashwins93
Oct 15 2017 09:40

lines 138 - 143

if (swap_container.length > 2) {
    swap_container.length = 2;
    }     

    var firstCell = swap_container[0];
    var secondCell = swap_container[1];

ideally firstCell and secondCell assignment should be inside the if block, this is why you are getting the error secondCell is undefined because you are trying to assign swap_container[1] without even checking if swap_container has two cells

Amit Patel
@AmitP88
Oct 15 2017 09:43
hmmm, ok, I placed those two variables inside the if block, but now it takes 3 clicks to swap two adj cells (and now it has two of the same errors in console)
Ashwin
@ashwins93
Oct 15 2017 09:45

hmmm, ok, I placed those two variables inside the if block, but now it takes 3 clicks to swap two adj cells (and now it has two of the same errors in console)

i think its because of your IIFE

you are checking for adjacent cells before firstCell and secondCell are assigned their values
ADIL KARMOUZI
@mradil16
Oct 15 2017 09:46
@mradil16
Main.png
guys how can I customize a google map, so it looks like that :
Ashwin
@ashwins93
Oct 15 2017 09:47
(function check_adjacentCells(){
.
.
.
})());
Amit Patel
@AmitP88
Oct 15 2017 09:49
@ashwins93 ok. I've made check_adjacentCells() just a regular function and made the function call after it. But I'm still getting the same errors. How do I fix this?
Ashwin
@ashwins93
Oct 15 2017 09:49
@AmitP88 And i'm not entirely sure why put in an IIFE? You don't have any var declarations inside so as to pollute the function scope in any manner. Is there any other reason to use IIFE?
Amit Patel
@AmitP88
Oct 15 2017 09:50
@ashwins93 to be honest, I did it just so that I wouldn't have to invoke the function after making it. I noticed I was doing that with pretty much all my functions, and I thought it would make more sense to just have them immediately invoke
Ashwin
@ashwins93
Oct 15 2017 09:51

@ashwins93 ok. I've made check_adjacentCells() just a regular function and made the function call after it. But I'm still getting the same errors. How do I fix this?

You're still calling check_adjacentCells() before even checking if there are two cells to check for

Amit Patel
@AmitP88
Oct 15 2017 09:51
oh ok
hang on a sec, let me see if I can figure out where to call it then
Ashwin
@ashwins93
Oct 15 2017 09:52

@ashwins93 to be honest, I did it just so that I wouldn't have to invoke the function after making it. I noticed I was doing that with pretty much all my functions, and I thought it would make more sense to just have them immediately invoke

if all you want to do is just execute the statements inside that function immediately, then you can lose the function declaration, it is exactly the same as executing the statements inline

but this doesn't have anything to do with the bug
Amit Patel
@AmitP88
Oct 15 2017 09:53
oh ok
I'll remove the function part, since I didn't have that part before
I just added the function part because I thought it would structure my code better
Ashwin
@ashwins93
Oct 15 2017 09:53
and even the swap function needs to be called only after the user presses 2 icons

I just added the function part because I thought it would structure my code better

that is fine

you can have codes in functional blocks
makes reading the code better
Amit Patel
@AmitP88
Oct 15 2017 09:56
oh ok, I see what you mean
ok, here's what I've done so far:
https://codepen.io/AmitP88/pen/pWyaNY?editors=0010
Ashwin
@ashwins93
Oct 15 2017 10:00

https://codepen.io/AmitP88/pen/pWyaNY?editors=0010

i fixed all the errors it works fine now

sorry i posted the wrong link
wait
omg i messed up by forking the wrong code
Amit Patel
@AmitP88
Oct 15 2017 10:02
lol its ok
Amit Patel
@AmitP88
Oct 15 2017 10:18
@ashwins93 any luck?
Ashwin
@ashwins93
Oct 15 2017 10:18
yep working on it
Amit Patel
@AmitP88
Oct 15 2017 10:18
oh ok lol
Ashwin
@ashwins93
Oct 15 2017 10:18
there is a problem with the img.onload -> that is a callback function
it needs a closure over the variables it uses
i fixed the closure issue
Amit Patel
@AmitP88
Oct 15 2017 10:20
are you referrring to the img.onload functions in draw_firstCell & draw_secondCell functions only?
Ashwin
@ashwins93
Oct 15 2017 10:20
But another issue is that, we are only changing the images visually
in the grid[] array, the images are still in the same position
Amit Patel
@AmitP88
Oct 15 2017 10:20
yeah, that's what I was thinking too
Ashwin
@ashwins93
Oct 15 2017 10:20
the images need to be swapped on the array as well
Amit Patel
@AmitP88
Oct 15 2017 10:21
that's what I was stuck on as well
on how to do that
Ashwin
@ashwins93
Oct 15 2017 10:21
the swap should take place inside the Swap()
Amit Patel
@AmitP88
Oct 15 2017 10:21
I thought it does though?
looks like I still have a lot of JS to learn huh?
Ashwin
@ashwins93
Oct 15 2017 10:25

looks like I still have a lot of JS to learn huh?

You only need to read You Don't Know JS by Kyle Simpson

you will like a champion once you are through that series, trust me
Amit Patel
@AmitP88
Oct 15 2017 10:28
@ashwins93 oh yeah, I've heard of that one. So far, all I've read is a little bit of JavaScript & jQuery by Jon Duckett, Eloquent JS, and JS: Novice to Ninja (read most of that - pretty good read). But I'll definitely check out this one too
@ashwins93 I'll compare your code to mine to see what you did differently and learn as much as I can from it
@ashwins93 thanks for your help bro, I really appreciate it! :D
CamperBot
@camperbot
Oct 15 2017 10:29
amitp88 sends brownie points to @ashwins93 :sparkles: :thumbsup: :sparkles:
:cookie: 365 | @ashwins93 |http://www.freecodecamp.com/ashwins93
Ashwin
@ashwins93
Oct 15 2017 10:29
You're welcome @AmitP88
Amit Patel
@AmitP88
Oct 15 2017 10:29
I've been working on this game for the past 6 weeks lol
and even when I get the basic 3 match game done, I still plan to add more elements to it
Ashwin
@ashwins93
Oct 15 2017 10:29

I've been working on this game for the past 6 weeks lol

i really appreciate your persistence

Amit Patel
@AmitP88
Oct 15 2017 10:30
it'll be a fusion between a match 3 game and a class rpg dungeon crawler
thanks :) sometimes I wonder when i'll be ready for an entry level dev job though. I still tend to get stuck often on js tasks
and I still have to build something using ReactJS
Ashwin
@ashwins93
Oct 15 2017 10:31
Keep working on it bro.
and I still have to build something using ReactJS
That is one awesome library
once you learn React, you will realize that this match 3 game would have been a piece of cake with React
Amit Patel
@AmitP88
Oct 15 2017 10:32
yeah, I mean I've learned a little bit of React such as JSX, Components, Rendering, import/export, and starting an app using create-react-app npm
I still have to get my head around props and state though
Ashwin
@ashwins93
Oct 15 2017 10:32
in react our swap function would have been as simple as just
let temp = grid[0]
grid[0] = grid[1]
grid[1] = temp
the unidirectional data flow does all the dirty work
Amit Patel
@AmitP88
Oct 15 2017 10:33
I was wondering that actually when I first started this project, on whether or not I should just use React for this game, but my friend said to get good at JS first before diving into React, since a lot of React stuff uses adv JS concepts
Ashwin
@ashwins93
Oct 15 2017 10:33

I was wondering that actually when I first started this project, on whether or not I should just use React for this game, but my friend said to get good at JS first before diving into React, since a lot of React stuff uses adv JS concepts

yes especially ES6

Amit Patel
@AmitP88
Oct 15 2017 10:33
yeah, I still gotta learn that too
Ashwin
@ashwins93
Oct 15 2017 10:33
Just read the You Don't Know JS series
it has everything you need to know about JS
Amit Patel
@AmitP88
Oct 15 2017 10:33
so far I've just been trying to get good at JS first of all before moving onto those other 2
Ashwin
@ashwins93
Oct 15 2017 10:34
after reading you will be able to learn any framework, any library or make your own libraries
Amit Patel
@AmitP88
Oct 15 2017 10:34
wow O_O
in that case, I'll start reading it right now lol. I'll come back to my game once I get more into it
is the whole book only these 6 sections though? or is there more to it?
Ashwin
@ashwins93
Oct 15 2017 10:38

is the whole book only these 6 sections though? or is there more to it?

only 6 books

but there is a lot of content withing those 6 books
Amit Patel
@AmitP88
Oct 15 2017 10:40
ah ok
I'm trying to see where I can get the free pdf. I dont think the github version is in pdf format
Ashwin
@ashwins93
Oct 15 2017 10:42
You can't get pdf
you need to buy the book for that
O'Reilly
The content is just available as a draft in github
Amit Patel
@AmitP88
Oct 15 2017 10:43
ah ok
Ashwin
@ashwins93
Oct 15 2017 10:43
Clone the git and then you can compile the .md files with pandoc i think
Amit Patel
@AmitP88
Oct 15 2017 10:44
hmmm, I just might buy it actually. It'll be worth the investment
Ashwin
@ashwins93
Oct 15 2017 10:45

hmmm, I just might buy it actually. It'll be worth the investment

Yes it is

rscales02
@rscales02
Oct 15 2017 10:45
You can definitely find the pdf from a free internet library like libgen.io
not that you shouldn't throw some money that guy's way it is a good series
Amit Patel
@AmitP88
Oct 15 2017 10:48
hmmm ok, i'll check libgen.io first
found the whole series on amazon for $52. not bad
rscales02
@rscales02
Oct 15 2017 10:54
Not bad at all
rscales02
@rscales02
Oct 15 2017 11:10
Screenshot (10).png
can someone help me understand why the code that gives the response looked for does not pass the test?
https://repl.it/MeRN/3 full code here
It is totally functional, when I put in the parameters for the test it is "failing" I get the expected results of the test... :confused:
mukul23
@mukul23
Oct 15 2017 12:03
Hi everyone I have a question about the content on beta fcc
Ashwin
@ashwins93
Oct 15 2017 12:16
@rscales02 You changed the first name and last name
the test is expecting Bob Ross
you shouldn't set the name as Haskell
rscales02
@rscales02
Oct 15 2017 12:18
I reset my code and repasted the code in there... still not working...
Ashwin
@ashwins93
Oct 15 2017 12:19
Remove your calls to setFirstname and setLastName it will go through
rscales02
@rscales02
Oct 15 2017 12:20
That would be nice if it would... it is still not
Ashwin
@ashwins93
Oct 15 2017 12:20
And the Person() function should not return anything (a new object is automatically returned)

var Person = function(firstAndLast) {
    var name = firstAndLast;
    this.getFullName = function() {
      return name;
    };
    this.getLastName = function() {
      name = name.split(" ");
      return name[1];
    };
    this.getFirstName = function() {
      name = name.split(" ");
      return name[0];
    };
    this.setFirstName = function(str) {
      name = name.split(" ");
      name[0] = str;
      name = name.join(" ")
      return name;
    };
    this.setLastName = function(str) {
      name = name.split(" ");
      name[1] = str;
      name = name.join(" ")
      return name;
    };
    this.setFullName = function(str) {
      name = str;
      return name;
    };
    // return name; This is not correct
};

var bob = new Person('Bob Ross');
/*bob.setFirstName("dan");  This is unnecessary
bob.setLastName("johnson")*/
bob.getFullName();
rscales02
@rscales02
Oct 15 2017 12:21

var Person = function(firstAndLast) {
    // Complete the method below and implement the others similarly
   var name = firstAndLast;
    this.getFullName = function() {
      return name;
    };
    this.getLastName = function() {
      name = name.split(" ");
      return name[1];
    };
    this.getFirstName = function() {
      name = name.split(" ");
      return name[0];
    };
    this.setFirstName = function(str) {
      name = name.split(" ");
      name[0] = str;
      name = name.join(" ");
      return name;
    };
    this.setLastName = function(str) {
      name = name.split(" ");
      name[1] = str;
      name = name.join(" ");
      return name;
    };
    this.setFullName = function(str) {
      name = str;
      return name;
    };
};

var bob = new Person('Bob Ross');
bob.getFirstName();
full code on fcc site, this returns "Bob" but still does not pass when the expected return is... "Bob"
Ashwin
@ashwins93
Oct 15 2017 12:22
The final line of your code must be a call to get the fullName
the test is expecting the fullName to be the expected output of the code
rscales02
@rscales02
Oct 15 2017 12:23
bob.getFirstName() should return "Bob". is the test it is failing
as well as bob.getLastName() should return "Ross". and bob.getFullName() should return "Bob Ross". and bob.getFullName() should return "Haskell Ross" after bob.setFirstName("Haskell").
mukul23
@mukul23
Oct 15 2017 12:23
Has everyone has anyone taken the beta fcc for the front end ? How does it compare to the normal fcc?
rscales02
@rscales02
Oct 15 2017 12:24
My last line I am adjusting to the specific test that I am failing
Each of those the output is what is expected as far as my feeble mind can tell
Ashwin
@ashwins93
Oct 15 2017 12:24
Inside your methods, you are manipulating the name variable itself
rscales02
@rscales02
Oct 15 2017 12:25
Yes, to set the name you would need to manipulate the name correct?
Ashwin
@ashwins93
Oct 15 2017 12:26
@rscales02 the problem is you are manipulating even when getting the name
this.getFirstName = function() {
      name = name.split(" ");  ********  name variable is modified now, it is now an array
      return name[0];
    };
rscales02
@rscales02
Oct 15 2017 12:27
getFullName just returns name no manipulation
Ashwin
@ashwins93
Oct 15 2017 12:28
see your getFirstName and getLastName methods
rscales02
@rscales02
Oct 15 2017 12:29
bob.getFirstName() should return "Haskell" after bob.setFullName("Haskell Curry") so why does this pass?
cool, thanks @ashwins93
CamperBot
@camperbot
Oct 15 2017 12:30
rscales02 sends brownie points to @ashwins93 :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @ashwins93 |http://www.freecodecamp.com/ashwins93
Ashwin
@ashwins93
Oct 15 2017 12:31
rscales02
@rscales02
Oct 15 2017 12:32
got it, thanks!
Marc
@MWBauer
Oct 15 2017 14:24
MOrning everyone!
Spyrantis Theodoros
@thodorisanta
Oct 15 2017 14:25
how can i make a function call with delay? cause apparently AIturn().delay(4000); doesnt work..
Stephen James
@sjames1958gm
Oct 15 2017 15:42
@thodorisanta setTimeout(AIturn, 4000);
Spyrantis Theodoros
@thodorisanta
Oct 15 2017 15:43
@sjames1958gm do i have to stop it later?
i mean
Stephen James
@sjames1958gm
Oct 15 2017 15:43
setTimeout is one shot - setInterval is continuous
Spyrantis Theodoros
@thodorisanta
Oct 15 2017 15:43
will it run every 4 seconds or is it just as delay
ok
thanks
Niloy513
@Niloy513
Oct 15 2017 17:13
Is anyone here ok with angular with their api calls?
I need some guidence if anyone is able to give it
shilpi verma
@shilpiverma509
Oct 15 2017 17:41

Hi guys, I need some help with this code. I don't know what's going wrong here and I am unable to display anything.
var getQuote= (data)=>{
$(".quote-text").text(data.quote);
if(data.author===""){
data.author="Unknown";
}
$(".author-text").text(-${data.author});
};

var getLocation = (position)=>{
var lat =position.coords.latitude;
var lng = position.coords.longiude;
API_key="AIzaSyAJTiEJQYztstSIC9ItHuo3SdJSIKf2S4c";
const url = https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${lng}&key=${API_key};
return $.getJSON(url,(response)=>{
$('.display-location').text(response.results[3].formatted_address);

 })
 .done(getWeather);
};

 var getWeather= (position)=>{
    var lat =position.coords.latitude;
    var lng = position.coords.longiude;
   var  url= `https://api.darksky.net/forecast/e446c63584e4c1c50e08f61db0ce7efa/${lat},${lon}?callback=?`;
    return $.getJSON(url,(response)=>{
        $('.display-time').text(response.currently.time);
        $('.display-weather').text(respnse.currently.temperature);
    });

};  

$(document).ready(()=>{
$.getJSON(quoteAPI,'data',getQuote);
navigator.geolocation.getCurrentPosition(getLocation);

});

Eric Weiss
@eweiss17
Oct 15 2017 18:14
if you have a pen just link that instead, easier
Abhilash Kumar
@apravink
Oct 15 2017 18:29
Hi everyone. I'm about to start the tic tac toe app. Anyone got any pointers for where to start?
Do I just go with setting up a front end and then working on the logic?
shilpi verma
@shilpiverma509
Oct 15 2017 18:31
@eweiss17 Hi , The link to my pen is https://codepen.io/shilpiverma/pen/dVgVpv?editors=1111
Stephen James
@sjames1958gm
Oct 15 2017 18:37
@apravink I would start with the logic first.
Abhilash Kumar
@apravink
Oct 15 2017 18:38
@sjames1958gm Im having a hard time visualising the structure though..where would my logic go?
If im doing this in react, wouldnt my logic be interspersed with my react code?
Stephen James
@sjames1958gm
Oct 15 2017 18:39
@apravink You could pass your click events up to the top (or app layer and have the logic there.).
The initial UI would be clicks into squares and output of X or O into those squares.
@shilpiverma509 you are getting a 400 response to your google request - the response is
{
   "error_message" : "Invalid request. Invalid 'latlng' parameter.",
   "results" : [],
   "status" : "INVALID_REQUEST"
}
Abhilash Kumar
@apravink
Oct 15 2017 18:41
@sjames1958gm that makes sense..ill give a shot
thanks @sjames1958gm
CamperBot
@camperbot
Oct 15 2017 18:41
apravink sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8557 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Oct 15 2017 18:41
@apravink yw
Spyrantis Theodoros
@thodorisanta
Oct 15 2017 18:55
is there a way with jquery to change the content of a p without overwriting a span isnide it?
Ken Haduch
@khaduch
Oct 15 2017 18:58
@MomchilDeus - re :point_up: October 15, 2017 3:32 AM - here is a stackoverflow question that was looking for the same type of element. They have answers, including a jsfiddle example that someone posted, and you can see other discussion in the stackoverflow question/answer...
@thodorisanta - I would say that you can't. Maybe read the text out of the <p> element, save the <span> content, then compose a new string and write it back? Or perhaps come up with a regex that will replace the text after the span. But that might be difficult if there is text before and after the span?
Ivan Ngundela
@ingundela
Oct 15 2017 19:04
Hellow everyone.....I finally have completed developing my Portfolio Website.... for now I have added only 2 projects hosted it in GitHub....may you please visit and give some feedback about the design and the way how I have structured it: https://ingundela.github.io/myportfolio/
Eric Weiss
@eweiss17
Oct 15 2017 19:14
the text in the about me is a lil too small
hard to read
the picture of yourself that stays there as you scroll.... it's cool but isn't practical imo
Resume button goes to linked in, little misleading, maybe put linked in profile instead
and at the bottom, maybe put the technologies you used instead of developed by me
Ivan Ngundela
@ingundela
Oct 15 2017 19:20
@eweiss17 Thank you... I'm using p: font-size: 1.2rem;
CamperBot
@camperbot
Oct 15 2017 19:20
ingundela sends brownie points to @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 597 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Ivan Ngundela
@ingundela
Oct 15 2017 19:21
@eweiss17 Thanks. I'll do the changes as you recommend and see how it looks..
Johnny
@jtan3
Oct 15 2017 21:13
https://codepen.io/jtan3/pen/XgpvoY?editors=1010 can anyone suggest how to display the timer on breakTime after the session countdown? The break timer works since it plays a sound. It just displays 0:00.
Alexx Martínez
@AlexxMart
Oct 15 2017 21:17
I have a question, I am about to complete this challenge, except for a small detail
function truthCheck(collection, pre) {
  // Is everyone being true?
  var s = [];
  for(var i = 0; i < collection.length; i++){
    if(collection[i].hasOwnProperty(pre)){
    s.push(collection[i][pre]);
    } else {
      return false;
    }
  }

  function compare (e){
    return e != "";
  }
  return s.every(compare);
}

truthCheck([{"single": "double"}, {"single": undefined}], "single") ;
the name of the challenge is "Everything Be True"
and I need to check if the resulting array "s" has either: NaN, undefined, false, or ""
but I can't add more than one argument to my compare function
and I tried with a loop but it messes the code if I try that method
Moisés Man
@moigithub
Oct 15 2017 21:24
logical operators @AlexxMart
Alexx Martínez
@AlexxMart
Oct 15 2017 21:26
@moigithub how so? I tried using logical operators with the prototype ".every()", also inside of the compare function and it doesn't seem to be working
Moisés Man
@moigithub
Oct 15 2017 21:27
e !== 1 && e !==2 && e!== 3
e is NOT 1 AND is not 2 and its not 3
Alexx Martínez
@AlexxMart
Oct 15 2017 21:34
nice! Thanks @moigithub
CamperBot
@camperbot
Oct 15 2017 21:34
alexxmart sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3673 | @moigithub |http://www.freecodecamp.com/moigithub
Alexx Martínez
@AlexxMart
Oct 15 2017 21:34
I did the same thing using || instead of &&
I have no clue why haha
Stephen James
@sjames1958gm
Oct 15 2017 21:50
@jtan3 You aren't updating the elements in the clock - the one with .sessionTimer class
@jtan3 $(".sessionClock").html(Math.floor(breakTime/60) + ":" + breakTime % 60);
Johnny
@jtan3
Oct 15 2017 21:52
@sjames1958gm is that line 141?
Stephen James
@sjames1958gm
Oct 15 2017 21:52
@jtan3 yes
You could rename that class to simply clock and use for both session and break
Johnny
@jtan3
Oct 15 2017 21:54
@sjames1958gm thanks
CamperBot
@camperbot
Oct 15 2017 21:54
jtan3 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8558 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Johnny
@jtan3
Oct 15 2017 21:56
@sjames1958gm weird i thought i changed the class name before i linked the page
Spyrantis Theodoros
@thodorisanta
Oct 15 2017 21:57
okay can you explain something for me then. in my code. i use clearTimeout 2 times IN DIFFERENT PLACES. one like clearTimeout and one clearTimeOut . if delete the second one which according to what you claim (and what is right) my code doesnt work as i want it to, same thing happens if i use it like this "clearTimeout " but if i write it with a capital "o" (O) it works!! HOW? :P
ADIL KARMOUZI
@mradil16
Oct 15 2017 22:55

Guys . I couldn't PUSH my files to GITHUB . this message shows up :

fatal: unable to access 'https://github.com/mradil16/ideaDate.git fetch = +refs/heads/*:refs/remotes/origin/*/': The requested URL returned error: 400

HOW TO FIX IT ??

Stephen James
@sjames1958gm
Oct 15 2017 22:58
@mradil16 What do you get from
git remote -v
ADIL KARMOUZI
@mradil16
Oct 15 2017 23:00
origin  git@github.com:mradil16/ideaDate.git     fetch = +refs/heads/*:refs/remotes/origin/* (fetch)
origin  git@github.com:mradil16/ideaDate.git     fetch = +refs/heads/*:refs/remotes/origin/* (push)
@sjames1958gm
Stephen James
@sjames1958gm
Oct 15 2017 23:03
I have never seen that stuff between .git and (fetch)
This is what I usually see
git remote -v
origin  git@github.com:sjames1958gm/range.git (fetch)
origin  git@github.com:sjames1958gm/range.git (push)
ADIL KARMOUZI
@mradil16
Oct 15 2017 23:17
what can I do ? so I can push files to github @sjames1958gm
Stephen James
@sjames1958gm
Oct 15 2017 23:18
Are you doing
git push origin master
ADIL KARMOUZI
@mradil16
Oct 15 2017 23:20
yes it shows this message :
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
information inside config file :
[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
        [remote "origin"]
        url = git@github.com:mradil16/ideaDate.git 
        fetch = +refs/heads/*:refs/remotes/origin/*
@sjames1958gm
Stephen James
@sjames1958gm
Oct 15 2017 23:26
Mine looks similar, wonder if there is something where it thinks those url = and fetch = lines are one the same line??
You could try removing .git directory and doing git init and git add again.
Not sure
@thodorisanta
It looks like you call AIturn from your player click handler - after you have cleared the timer in newRound
I think the reason it works when you have clearTimeOut is that it throws an error and you don't get that call to AIturn
Spyrantis Theodoros
@thodorisanta
Oct 15 2017 23:32
@sjames1958gm how can i fix that though?
Stephen James
@sjames1958gm
Oct 15 2017 23:35
@thodorisanta You could return a value from checkForWin and if it is true don't call AIturn