These are chat archives for FreeCodeCamp/HelpFrontEnd

14th
Aug 2017
Moisés Man
@moigithub
Aug 14 2017 00:15 UTC
u can try with setTimeout or queue methods
https://learn.jquery.com/effects/queue-and-dequeue-explained/ @Tefor
Mike
@MikeJSchorah
Aug 14 2017 00:33 UTC
Does anyone know anything about Call To Action buttons and Inputs?
Austin
@agodfrey8
Aug 14 2017 01:25 UTC
I keep running into CORS problems trying to access APIs through Codepen. I was using crossorigin.me to get around it, but their servers have been down for about a week now. Any suggestions?
Gulsvi
@gulsvi
Aug 14 2017 01:29 UTC
@Tefor Use .promise() to ensure the delay has finished:
  $("#proyect1").delay(2000).promise().done(function() {
    $(this).addClass("animated swing");
  });
  $("#proyect2").delay(3000).promise().done(function() {
    $(this).addClass("animated swing");
  });
Austin
@agodfrey8
Aug 14 2017 01:29 UTC
I tried using CORS Anywhere as well, but now I'm getting 429 errors.
Gulsvi
@gulsvi
Aug 14 2017 01:30 UTC
@agodfrey8 It depends on the API - which one are you trying to use? None of Free Code Camp's recommended APIs require a cross origin proxy.
Austin
@agodfrey8
Aug 14 2017 01:30 UTC
I'm having troubles with the Wikipedia API and the Twitch API.
Gulsvi
@gulsvi
Aug 14 2017 01:31 UTC
With Wikipedia, add &origin=* to your URL. With Twitch, make sure you are using https://wind-bow.glitch.me instead of https://wind-bow.gomix.me
Austin
@agodfrey8
Aug 14 2017 01:32 UTC
@SkyC0der Thank you!
CamperBot
@camperbot
Aug 14 2017 01:32 UTC
agodfrey8 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2383 | @skyc0der |http://www.freecodecamp.com/skyc0der
Austin
@agodfrey8
Aug 14 2017 01:32 UTC
Oh man, I've been banging my head on this problem for awhile now.
Gulsvi
@gulsvi
Aug 14 2017 01:32 UTC
Glad that helped :)
The cross origin proxies can slow things down, go down, or cause random errors. There's usually a way to avoid using them.
@MikeJSchorah I know what CTA butttons are. What's your question?
Austin
@agodfrey8
Aug 14 2017 01:34 UTC
I'll keep that in mind. I'll look up more specific stuff for the API next time. I thought it was just a Codepen issue.
Daniel Ahn
@danii956
Aug 14 2017 03:11 UTC
I have a question... why won't my value of my str[i] change even though the value i'm putting into the str[i] exists?
iso
@iso1048
Aug 14 2017 03:13 UTC
@danii956 strings are immutable....?
Daniel Ahn
@danii956
Aug 14 2017 03:15 UTC
huh.... very interesting
ok thank you @gothamknight
CamperBot
@camperbot
Aug 14 2017 03:15 UTC
danii956 sends brownie points to @gothamknight :sparkles: :thumbsup: :sparkles:
:cookie: 374 | @gothamknight |http://www.freecodecamp.com/gothamknight
Kent Saeteurn
@sansae
Aug 14 2017 03:23 UTC

hi friends, i'm working on a scroll alert and am struggling with it. can anyone please help me?

GOAL:
to alert the user with a message when the user successfully scrolls all the way down to the bottom of the page (i.e. scrollbar touches bottom and cant' go down anyfurther)

ISSUE:
when user scrolls to the bottom of the page, nothing happens

THOUGHTS:
i believe my code is correct, however, what i think is happening is that before the user gets a chance to scroll down to the bottom, my code (my if condition) is executed. my understanding is that javascript code is executed automatically as soon as the page starts loading, UNLESS we do something about it to prevent that. i've searched around and can not figure out how to prevent the js code from loading. i only want to run my code if the condition is met (the condition is that if scrollTop == difference)

PEN: https://codepen.io/kesa/full/prWjvq/
(there is a button that you can even click on to track the value of scrollTop; any help would be greatly appreciated; thank you in advance)

Gulsvi
@gulsvi
Aug 14 2017 03:43 UTC
@sansae You would need to add a scroll event listener so the scrollTop(), window height, and document height can be evaluated every time the user scrolls:
$(window).on('scroll', function() {
  if (Math.round($(window).scrollTop() + $(window).height()) == $(document).height()) {
    // The user has scrolled to the bottom of the page. Run your code here.
  }
});
minor edits to the comment and to use .on() instead of .scroll() -- old habits
Lallo Vigil
@lalov1
Aug 14 2017 03:46 UTC
I'm really close to being finished with the Simon project, but can't figure why they are turning colors at the same time. Could someone help me? https://codepen.io/lalov1/full/MvgvxY/
Kent Saeteurn
@sansae
Aug 14 2017 03:47 UTC
@SkyC0der wow, i didn't know there was an actual scroll event listener; i didn't even think to google that; i seriously need to start googling this ==> "jquery events"
@SkyC0der i'll give your suggestion a try, sky. will report back asap
Gulsvi
@gulsvi
Aug 14 2017 03:48 UTC
It's amazing how many events there are :) https://developer.mozilla.org/en-US/docs/Web/Events
Kent Saeteurn
@sansae
Aug 14 2017 03:50 UTC
@SkyC0der yup; after a quick little search, i found this ==> https://api.jquery.com/category/events/
that's a whole bunch of helpful methods there
will definitely help me when i'm working on future projects
:)
@SkyC0der just that simple line of code and it works! wow...
@SkyC0der as always, thank you sky
CamperBot
@camperbot
Aug 14 2017 03:51 UTC
sansae sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2384 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Aug 14 2017 03:51 UTC
Glad that helped :sparkles:
Tai Jones
@taiJones00
Aug 14 2017 04:20 UTC
What's the hardest JavaScript project out of the first four
heroiczero
@heroiczero
Aug 14 2017 04:21 UTC
@taiJones00 do you mean Advanced Front end? Each one provides different challenges
Tai Jones
@taiJones00
Aug 14 2017 04:22 UTC
The first four starting after the tribute page
heroiczero
@heroiczero
Aug 14 2017 04:24 UTC
@taiJones00 it is not that hard right after the tribute page unless you are talking about APIs
Tai Jones
@taiJones00
Aug 14 2017 04:24 UTC
Yeah those
heroiczero
@heroiczero
Aug 14 2017 04:24 UTC
@taiJones00 the API ones?
Tai Jones
@taiJones00
Aug 14 2017 04:25 UTC
Those 1s
heroiczero
@heroiczero
Aug 14 2017 04:26 UTC
@taiJones00 Which one are you having trouble with? Each one is different formats and you have to research how to retrieve the information
Tai Jones
@taiJones00
Aug 14 2017 04:26 UTC
The Wikipedia one
I assume it involves an array and a for loop somehow
@taiJones00 You could use a loop or forEach to retrieve all the results from your search
Tai Jones
@taiJones00
Aug 14 2017 04:29 UTC
@_@
heroiczero
@heroiczero
Aug 14 2017 04:30 UTC
also remember you need to retrieve the value of the<input>. In addition, for your <form> you need a preventDefault so it does not refresh the page when you press enter
rafaelmonroy
@rafaelmonroy
Aug 14 2017 06:08 UTC

hello I am having trouble getting my program to ignore the special characters, digits and spaces from my string

function palindrome(str) {
var newString = str.replace(/\W\d/gi, "");                                       
if (newString.split("").reverse().join("") == str){
  return true;
  }
 return false;
}
palindrome(“+Eye”);

i tried a few different variations of special expressions but cant seem to get the right one, also couldnt get the .toLowerCase function to execute

Johnny
@jtan3
Aug 14 2017 06:10 UTC
@rafaelmonroy .toLowerCase() is a string method. You should do it before making your string into an array.
Markus Kiili
@Masd925
Aug 14 2017 06:10 UTC
@rafaelmonroy \W doesn't target underscore. If you add W and _ using [ ], it will work.
rafaelmonroy
@rafaelmonroy
Aug 14 2017 06:13 UTC
@jtan3 i should add .toLowerCase() to my newString before splitting, reversing and joining back up? ?
@Masd925 how would that syntax look? str.replace(/[\W,_]\d/gi, “”)?
Markus Kiili
@Masd925
Aug 14 2017 06:15 UTC
@rafaelmonroy You should replace and lowercase. Then compare that string with the reversed one. /[\W_]/g would do it.
rafaelmonroy
@rafaelmonroy
Aug 14 2017 06:22 UTC
@Masd925 thanks man, that really helped.
CamperBot
@camperbot
Aug 14 2017 06:22 UTC
rafaelmonroy sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4404 | @masd925 |http://www.freecodecamp.com/masd925
rafaelmonroy
@rafaelmonroy
Aug 14 2017 06:23 UTC
there is no need for “,” when adding inside []?
Markus Kiili
@Masd925
Aug 14 2017 06:24 UTC
@rafaelmonroy No.
Rabin Shrestha
@jyapujuju
Aug 14 2017 09:39 UTC
function uniteUnique(arr) {
  arr.reduce(function (a, b){


    return a.concat(b);
  });
  return arr;
}
```
TypeError: a.concat is not a function
??
Long Nguyen
@longnt80
Aug 14 2017 09:41 UTC
@jyapujuju concat() is a method of array, and a is not array
Markus Kiili
@Masd925
Aug 14 2017 09:46 UTC
@jyapujuju The only parameter arr only catches the first passed argument.
You need to use the arguments object for all the arguments.
Alexander Domikov
@AlexanderDom
Aug 14 2017 09:47 UTC
i think it's MDN exemple for reduce() that somehow misslead him https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
Rabin Shrestha
@jyapujuju
Aug 14 2017 09:47 UTC
@AlexanderDom true
Alexander Domikov
@AlexanderDom
Aug 14 2017 09:48 UTC
:)
it's because they have an Array inside an Array, so concat() works
Rabin Shrestha
@jyapujuju
Aug 14 2017 09:49 UTC
@longnt80 @Masd925 what shoudl i do?
Markus Kiili
@Masd925
Aug 14 2017 09:50 UTC
@jyapujuju Read up on arguments object.
Rabin Shrestha
@jyapujuju
Aug 14 2017 09:50 UTC
@Masd925 they are array
Long Nguyen
@longnt80
Aug 14 2017 09:51 UTC
@jyapujuju which challenge is this?
Markus Kiili
@Masd925
Aug 14 2017 09:51 UTC
@jyapujuju It is an array-like object. You can turn it into a real array if you like to use array methods on it.
Rabin Shrestha
@jyapujuju
Aug 14 2017 09:51 UTC
@longnt80 sorted union (intermediate algo)
Markus Kiili
@Masd925
Aug 14 2017 09:51 UTC
Array-like means it has .length and [i] access.
Jim Tryon
@jimtryon
Aug 14 2017 09:52 UTC
If I managed a wordpress site, helped to set up the hosting, install the theme, keep plugins updated, and did general maintenance of the website, does that make me a web developer or web administrator?
Alexander Domikov
@AlexanderDom
Aug 14 2017 09:53 UTC
if you do only maintenance you're administrator if you change some code, in my point of view you can call you developer ;)
Rabin Shrestha
@jyapujuju
Aug 14 2017 09:54 UTC
@Masd925 yes
Alexander Domikov
@AlexanderDom
Aug 14 2017 09:54 UTC
you can call you developer since your first "hello world" or whatever text
Rabin Shrestha
@jyapujuju
Aug 14 2017 09:54 UTC
https://www.freecodecamp.org/challenges/sorted-union @Masd925 @longnt80 @AlexanderDom
Markus Kiili
@Masd925
Aug 14 2017 09:55 UTC
@jyapujuju You can do var args = Array.prototype.slice.call(arguments); and then use reduce on args. It turns arguments object into an array.
Alexander Domikov
@AlexanderDom
Aug 14 2017 09:55 UTC
yes, already looking at it @jyapujuju
Long Nguyen
@longnt80
Aug 14 2017 09:55 UTC
@jyapujuju here https://repl.it/J9zr/19
@jyapujuju if you take a look, arr is only the first array so a and b is not array
mbsyaswanth
@mbsyaswanth
Aug 14 2017 09:55 UTC
Jim Tryon
@jimtryon
Aug 14 2017 09:55 UTC
thanks @AlexanderDom
CamperBot
@camperbot
Aug 14 2017 09:55 UTC
:cookie: 442 | @alexanderdom |http://www.freecodecamp.com/alexanderdom
jimtryon sends brownie points to @alexanderdom :sparkles: :thumbsup: :sparkles:
mbsyaswanth
@mbsyaswanth
Aug 14 2017 09:55 UTC
my first css,html project!
Alexander Domikov
@AlexanderDom
Aug 14 2017 09:58 UTC
@mbsyaswanth nice calculator, you forgot to add a <title> to your page and <meta charset="utf-8" />
Long Nguyen
@longnt80
Aug 14 2017 09:58 UTC
@jyapujuju to get all the arrays in arr, you need to use the object: arguments like @Masd925 said
Alexander Domikov
@AlexanderDom
Aug 14 2017 09:58 UTC
arguments are linked in helpfull links of exercice
@jyapujuju in this link , they show you the method to turn arguments to an array
then you can use that array with reduce()
mbsyaswanth
@mbsyaswanth
Aug 14 2017 10:05 UTC
whats the use of <meta charset="utf-8" /> , thanks u for remembering me. @AlexanderDom
CamperBot
@camperbot
Aug 14 2017 10:05 UTC
mbsyaswanth sends brownie points to @alexanderdom :sparkles: :thumbsup: :sparkles:
:cookie: 443 | @alexanderdom |http://www.freecodecamp.com/alexanderdom
Long Nguyen
@longnt80
Aug 14 2017 10:11 UTC
@Masd925 what's wrong with this: https://repl.it/J9zr/22
Markus Kiili
@Masd925
Aug 14 2017 10:13 UTC
@longnt80 Arrow functions don't have their own arguments object.
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:13 UTC
@longnt80 @AlexanderDom @Masd925

function uniteUnique(arr) {
  arr = Array.prototype.slice.call(arguments);
  arr.reduce(function (a, b){
    arr = a.concat(b);
  });
  return arr;
}
still a is undefined
Long Nguyen
@longnt80
Aug 14 2017 10:14 UTC
@Masd925 so I can't use arrow function with arguments? have to use the normal way?
Markus Kiili
@Masd925
Aug 14 2017 10:14 UTC
@jyapujuju Reduce returns a new array that you don't use.
@longnt80 I think you should get the arguments with some new syntax like spread or rest.
Long Nguyen
@longnt80
Aug 14 2017 10:16 UTC
@Masd925 ah, let me see
Markus Kiili
@Masd925
Aug 14 2017 10:16 UTC
@jyapujuju return a.concat(b); inside the reduce callback.
Long Nguyen
@longnt80
Aug 14 2017 10:19 UTC
@Masd925 thanks, the new syntax is very nice!
CamperBot
@camperbot
Aug 14 2017 10:19 UTC
longnt80 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4409 | @masd925 |http://www.freecodecamp.com/masd925
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:27 UTC
@Masd925 return a.concat(b); gives me nothing
Markus Kiili
@Masd925
Aug 14 2017 10:27 UTC
@jyapujuju Post the whole code please.
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:29 UTC

function uniteUnique(arr) {
  arr = Array.prototype.slice.call(arguments);
  arr.reduce(function (a, b){
    return a.concat(b);
  });
//   return arr;
}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
Long Nguyen
@longnt80
Aug 14 2017 10:29 UTC

@jyapujuju this:

arr.reduce(function (a, b){
    return a.concat(b);
  });

doesn't change arr
you need to assign the result to another variable , then

return that variable
Markus Kiili
@Masd925
Aug 14 2017 10:30 UTC
@jyapujuju You are not using the reduce return value (the new array).
Long Nguyen
@longnt80
Aug 14 2017 10:35 UTC

@jyapujuju

The reduce() method reduces the array to a single value.

But it doesn't change the array. In this case, it doesn't change arr. arr is still [ [ 1, 3, 2 ], [ 5, 2, 1, 4 ], [ 2, 1 ] ]
You need to assign that value to another variable.

Rabin Shrestha
@jyapujuju
Aug 14 2017 10:35 UTC
@Masd925

function uniteUnique(arr) {
  arr = Array.prototype.slice.call(arguments);
  arr.reduce(function (a, b){
    var narr = a.concat(b);
    return narr;
  });
//   return arr;
}
Long Nguyen
@longnt80
Aug 14 2017 10:36 UTC
@jyapujuju more like:
var narr = arr.reduce(function (a, b){
    return a.concat(b);
  });
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:38 UTC
@Masd925 no effect
Long Nguyen
@longnt80
Aug 14 2017 10:38 UTC
@jyapujuju what's your current code?
Markus Kiili
@Masd925
Aug 14 2017 10:39 UTC
@jyapujuju return arr.reduce(..);
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:39 UTC

function uniteUnique(arr) {
  arr = Array.prototype.slice.call(arguments);
  var arg_arr = arr.reduce(function (a, b){
    return a.concat(b);
  });
//   return arr;
}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
Long Nguyen
@longnt80
Aug 14 2017 10:39 UTC
@jyapujuju you need to return the final result
return arg_arr
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:41 UTC
@longnt80 can you explain me :)
Long Nguyen
@longnt80
Aug 14 2017 10:41 UTC
arr = Array.prototype.slice.call(arguments);
  var arg_arr = arr.reduce(function (a, b){
    return a.concat(b);
  });
  return arg_arr;
}
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:41 UTC
what is happening when i not put return in a.concat(b)
ya i got that
:)
@longnt80
Long Nguyen
@longnt80
Aug 14 2017 10:42 UTC
@jyapujuju then your reduce() won't have any value
@jyapujuju each function have a return
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:42 UTC
@longnt80 i got nice array . but i want to know the flow... can you do that for me ?
Long Nguyen
@longnt80
Aug 14 2017 10:43 UTC
what do you mean the flow?
Rabin Shrestha
@jyapujuju
Aug 14 2017 10:44 UTC
working mechanism i think
hehe
Long Nguyen
@longnt80
Aug 14 2017 10:45 UTC
@jyapujuju the logic to solve the challenge?
@jyapujuju return a.concat(b); is for this function function (a, b)
return arg_arr; is for this function function uniteUnique(arr)
Matthew Sinkgraven
@s0nic12
Aug 14 2017 11:14 UTC
Hi guys, I just finished my simon game. Any feedback is much appreciated! https://s0nic12.github.io/simon/
Long Nguyen
@longnt80
Aug 14 2017 11:15 UTC
@s0nic12 what's the last button?
@s0nic12 I can click the button while the game goes through the steps
Matthew Sinkgraven
@s0nic12
Aug 14 2017 11:18 UTC
@longnt80 Last replays the last sequence again
@longnt80 if you click the button while the game is playing the sequence it will not do anything
even though it does light up
Long Nguyen
@longnt80
Aug 14 2017 11:19 UTC
@s0nic12 I think you should disable it so that user cannot click while the game is playing
for example, I clicked the last button very fast multiple times and that make the game played the sequence multiple times which can be very confusing
Matthew Sinkgraven
@s0nic12
Aug 14 2017 11:21 UTC
@longnt80 dont click it multiple times then :p
Long Nguyen
@longnt80
Aug 14 2017 11:21 UTC
@s0nic12 yeah, I know :D
just my suggestion
Matthew Sinkgraven
@s0nic12
Aug 14 2017 11:22 UTC
@longnt80 Only joking, thanks for the feedback
CamperBot
@camperbot
Aug 14 2017 11:22 UTC
s0nic12 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 496 | @longnt80 |http://www.freecodecamp.com/longnt80
Matthew Sinkgraven
@s0nic12
Aug 14 2017 11:22 UTC
:)
Long Nguyen
@longnt80
Aug 14 2017 11:23 UTC
@s0nic12 np
@s0nic12 let say I make it to step 4, now I try to click 4 buttons very quick and make the wrong move, now everything will goes crazy!
Karol Buda
@karolbuda
Aug 14 2017 12:03 UTC
Hi everyone! I am currently on my last front-end project (Simon game), and I'm struggling with using the z-index to put an element over another while being positioned relative to it. My pen is here: https://codepen.io/karolbuda/pen/xLXxrO
Anna
@AnnaVih
Aug 14 2017 12:04 UTC
hello!
i need some help guys!I want to remove hash from url after page scroll
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:07 UTC
why Anna ? its a normal anchor link behavior
korzo
@korzo
Aug 14 2017 12:08 UTC
@AnnaVih From the browser url or from the url in variable?
Anna
@AnnaVih
Aug 14 2017 12:09 UTC
from browser url
or use location.hash
@AnnaVih but latter may scroll you page upwards
Anna
@AnnaVih
Aug 14 2017 12:15 UTC
@korzo i can not get it=(
korzo
@korzo
Aug 14 2017 12:19 UTC

@AnnaVih Then use pushState

history.pushState(null, null, 'your new url');

it will not jump nor refresh page

Matthew Sinkgraven
@s0nic12
Aug 14 2017 12:21 UTC
@longnt80 Controls are now locked during sequence playback :)
Long Nguyen
@longnt80
Aug 14 2017 12:33 UTC
@karolbuda you don't need z-index
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:35 UTC
@karolbuda which element is problematic ?
Karol Buda
@karolbuda
Aug 14 2017 12:36 UTC
@longnt80 @AlexanderDom here is what it looks like now and it seems to be working. Not fully responsive yet but i'll fix that with media queries! https://codepen.io/karolbuda/full/xLXxrO
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:37 UTC
problem was .white element ?
Long Nguyen
@longnt80
Aug 14 2017 12:37 UTC
@karolbuda my suggestion is to make the w3-container a fixed width
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:39 UTC
yes, it can help, and then each child need to take 50% of parents width
Karol Buda
@karolbuda
Aug 14 2017 12:39 UTC
@AlexanderDom Yes, after setting it to absolute with z-index 1 it seems okay
@longnt80 would that be more beneficial than the current solution?
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:39 UTC
for me even without z-index it's beyond others
Long Nguyen
@longnt80
Aug 14 2017 12:40 UTC
@karolbuda here's the code I'd put on .white
.white {
    z-index: 1;
    width: 20rem;
    padding: 0rem 0rem 6rem 0rem;
    position: absolute;
    top: 50%;
    border: solid black 1px;
    left: 50%;
    transform: translate(-50%,-50%);
}
Karol Buda
@karolbuda
Aug 14 2017 12:41 UTC
@longnt80 After using that, the white element seems to stay fixed when resizing the window
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:41 UTC
margin: auto don't gonna do a thing just remove .w3-panel style, margin: 0 is enough
with @longnt80 style,your element always gonna be in center of his parent
vertically and horizontally
Long Nguyen
@longnt80
Aug 14 2017 12:42 UTC
@karolbuda is that not what you want?
Karol Buda
@karolbuda
Aug 14 2017 12:43 UTC
@longnt80 I need it to be at the center of those 4 boxes, not necessarily in the center of the screen
@AlexanderDom okay, let me try that!
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:43 UTC
other little point, dont need of units for 0 values, i mean 0 or 0rem it's same for browser
Long Nguyen
@longnt80
Aug 14 2017 12:43 UTC
@karolbuda put position: relative; on .w3-container
then it'll be at the center of 4 boxes
Karol Buda
@karolbuda
Aug 14 2017 12:45 UTC
@AlexanderDom @longnt80 perfect, works even better! Thank you for the help!
CamperBot
@camperbot
Aug 14 2017 12:45 UTC
karolbuda sends brownie points to @alexanderdom and @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 497 | @longnt80 |http://www.freecodecamp.com/longnt80
:cookie: 444 | @alexanderdom |http://www.freecodecamp.com/alexanderdom
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:46 UTC
it's @longnt80 who made almost all help :), i've said little advices
Long Nguyen
@longnt80
Aug 14 2017 12:46 UTC
@karolbuda what if you view it on mobile?
Karol Buda
@karolbuda
Aug 14 2017 12:47 UTC
@longnt80 it is still working, but now I need to work on a way to scale the .white element relative to the boxes
right now its too large
Long Nguyen
@longnt80
Aug 14 2017 12:48 UTC
@karolbuda I think you should use em
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:48 UTC
you can add border-top-YOURSIDE-radius: 100% where side are left, right, and border-bottom-YOURSIDE-radius: 100% if you want a perfect circle style
you can style in % for width and use min-width with em
Long Nguyen
@longnt80
Aug 14 2017 12:49 UTC
Capture.JPG
this is what it looks like on mobile though, not sure you want that
Karol Buda
@karolbuda
Aug 14 2017 12:52 UTC
@longnt80 Definitely not, updating the media queries so everything in white resizes. If you look at the bottom of the css I had them there but commented out
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:52 UTC
    width: 50%;
    max-width: 20rem;
works for certain point but you have a very big paddings (by the way padding: 8rem ;) )
Long Nguyen
@longnt80
Aug 14 2017 12:52 UTC
@karolbuda ok
Alexander Domikov
@AlexanderDom
Aug 14 2017 12:53 UTC
@karolbuda you can use em for media-query too instead of pixels
jastuccio
@jastuccio
Aug 14 2017 13:26 UTC
Good morning room, I am having trouble calling a JS function in my HTML file. I can see the result in the console, but not on the page. SPOILER ALERT my pen contains the answer to smallest-common-multiple from the intermediate algorthim challenges https://codepen.io/jastuccio/pen/broROz?editors=1111
Markus Kiili
@Masd925
Aug 14 2017 13:34 UTC
@jastuccio It is possible that you are trying to change dom before the page is ready. Try putting the script at the end of body, or inside window load event handler.
for example window.addEventListener("load",function(){CODE HERE});
jastuccio
@jastuccio
Aug 14 2017 13:41 UTC
@Masd925 Thank you! addEventListener worked :D
Markus Kiili
@Masd925
Aug 14 2017 13:46 UTC
@jastuccio :+1:
Anna
@AnnaVih
Aug 14 2017 14:18 UTC
@korzo it does not work(
Jorge
@flawedLogic506
Aug 14 2017 14:24 UTC
hey whats happening guys
Daniil Kuznetsov
@DanUnited
Aug 14 2017 14:33 UTC
Hello guys :3
Markus Kiili
@Masd925
Aug 14 2017 14:34 UTC
@DanUnited Yo.
Daniil Kuznetsov
@DanUnited
Aug 14 2017 14:35 UTC
I have one question for your advice alt
how can i build green block in CSS ?
i think to do white triangle >>
Daniel Feldman
@Feldbot
Aug 14 2017 14:37 UTC
Hi, can someone help me figure out the "Profile Lookup" exercise? I'm stuck on why the first part of my code isn't finding a match in the array object.

//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
  for (var i = 0; i < contacts.length; i++) {
    for (var j = 0; j < contacts.length[i]; j++) {
      if (contacts.firstName[i][j] == firstName) {
        return "a match";
      } 
    }    
  }
      return "No such contact";

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Markus Kiili
@Masd925
Aug 14 2017 14:40 UTC
@Feldbot Array elements there are objects, so you cannot loop the properties with a for loop, and there is also no need for a second loop.
So the first loop is enough.
Daniel Feldman
@Feldbot
Aug 14 2017 14:42 UTC
@Masd925 The "get a hint" page recommends using a for loop...
Markus Kiili
@Masd925
Aug 14 2017 14:42 UTC
@Feldbot One for loop is fine, but you don't need to loop the object contacts[i]. You can just access it.
Daniel Feldman
@Feldbot
Aug 14 2017 14:44 UTC
@Masd925 I just tried this and it still isn't finding the name...
function lookUpProfile(firstName, prop){
// Only change code below this line
  for (var i = 0; i < contacts.length; i++) {
      if (contacts.firstName == firstName) {
        return "a match";
      } 
    }    
      return "No such contact";
Markus Kiili
@Masd925
Aug 14 2017 14:45 UTC
@Feldbot contacts is an array. It doesn't have firstName property key.
You need to target the looped object.
Daniel Feldman
@Feldbot
Aug 14 2017 14:47 UTC
@Masd925 I'm confused there. In the array it has several firstName properties, no?
Markus Kiili
@Masd925
Aug 14 2017 14:47 UTC
@Feldbot Inside the loop block contacts[i] is the looped object. You need to test it.
Daniel Feldman
@Feldbot
Aug 14 2017 14:48 UTC
@Masd925 Got it. Thanks for the help Markus. Back to the drawing board...
CamperBot
@camperbot
Aug 14 2017 14:48 UTC
feldbot sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4412 | @masd925 |http://www.freecodecamp.com/masd925
Peter Steele
@PeterHSteele
Aug 14 2017 14:49 UTC
@DanUnited you can make that with three nested divs. Check out this codepen, i colored the white triangle red so you can see it. you can play around with the borders on the triangle to get the exact shape you want
Daniil Kuznetsov
@DanUnited
Aug 14 2017 14:54 UTC
@PeterHSteele bad way i resolved that task with 1 block :D
i just add green triangle with negative left attribute to :before element
i got green div with transparent
Trommelochse
@Trommelochse
Aug 14 2017 14:59 UTC
@Feldbot look at this pen
you are tryingto compare contacts.firstName to something
however, contacts is an array and doesn't have named properties
Tchr. Joe Gachau
@tchrjoegachau
Aug 14 2017 15:01 UTC
Hi, how do i put a header and a footer to a page in css
Trommelochse
@Trommelochse
Aug 14 2017 15:02 UTC
@tchrjoegachau pure CSS won't do it... you first need some HTML, which you can then style with CSS to your liking
Tchr. Joe Gachau
@tchrjoegachau
Aug 14 2017 15:06 UTC
Thanks @Trommelochse . I will try it out.
CamperBot
@camperbot
Aug 14 2017 15:06 UTC
tchrjoegachau sends brownie points to @trommelochse :sparkles: :thumbsup: :sparkles:
:cookie: 310 | @trommelochse |http://www.freecodecamp.com/trommelochse
Daniel Feldman
@Feldbot
Aug 14 2017 15:09 UTC
@Trommelochse I'm starting to get it... Incidentally, do you typically throw the code into CodePen to test? How do I get the JS to run on CodePen? That is something I'm noticing on the fCC exercises if I bring up the browser console I'm not able to use that to test objects very well.
Trommelochse
@Trommelochse
Aug 14 2017 15:12 UTC
I usually write code in Atom, but codepen is nice to test small snippets
it also has a built in console
on the very bottom, left, small button, says console
however, the built in console doesn't show error messages or complains when you want to display large logs
so, you might still need the browser console every now and then
Daniel Feldman
@Feldbot
Aug 14 2017 15:14 UTC
@Trommelochse I see that in codepen, but how do you get the code to run? If I call "lookUpProfile("Akira", "likes");" in the codepen console it says it's undefined.
Trommelochse
@Trommelochse
Aug 14 2017 15:16 UTC
console.log(lookUpProfile("Akira", "likes"))
also make sure that your function actually returns something
if your function doesn't return a value, there's nothing to log for the console
(check how I did it in my pen that I sent earlier)
Liam Docherty
@ldocherty1
Aug 14 2017 15:18 UTC
I'm trying to locate a JPG file from computer to insert into my webpage. Here is my code which I used within CSS but the image doesn't appear to successfully load.
    background-image: url('assets/background1.jpg');
Trommelochse
@Trommelochse
Aug 14 2017 15:21 UTC
@ldocherty1 not sure about it, but you could try background-image: url('./assets/background1.jpg');
Daniel Feldman
@Feldbot
Aug 14 2017 15:21 UTC
@Trommelochse Your codepen doesn't return "a match" with matching input... Should it?
Liam Docherty
@ldocherty1
Aug 14 2017 15:22 UTC
@Trommelochse No luck
Trommelochse
@Trommelochse
Aug 14 2017 15:22 UTC
it actually returns the value of the property that I am checking
@ldocherty1 then you should probably go for the absolute path like this
background-image: url('file:///C:/Users/userid/desktop/assets/yourimage.jpg');
@Feldbot it actually returns the value of the property that I am checking
Liam Docherty
@ldocherty1
Aug 14 2017 15:24 UTC
@Trommelochse Ok I will try this thanks. Is this the file path for windows? will it still work on a Mac?
CamperBot
@camperbot
Aug 14 2017 15:24 UTC
ldocherty1 sends brownie points to @trommelochse :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @trommelochse |http://www.freecodecamp.com/trommelochse
Trommelochse
@Trommelochse
Aug 14 2017 15:24 UTC
I am checking for Akira's likes, so it returns an array of things that Akira likes
Daniel Feldman
@Feldbot
Aug 14 2017 15:26 UTC
@Trommelochse When I enter
console.log(lookUpProfile("Akira", "likes"));
it is coming back undefined on your codepen. Am I doing something wrong there?
Trommelochse
@Trommelochse
Aug 14 2017 15:34 UTC
you haveto put it inside your Javascript
Rabin Shrestha
@jyapujuju
Aug 14 2017 15:38 UTC
function uniteUnique(arr) {
  var newarr=[];
  arr = Array.prototype.slice.call(arguments);
  var arg_arr = arr.reduce(function (a, b){
    return a.concat(b);
  });
  for (var i = 0; i < arg_arr.length; i++){
    for (var j = 0; j < arg_arr.length; i++){
      if(arg_var[i] == arg_var[j])
       newarr = delete arg_var[j];
    }
  }
  return newarr;
}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
arg_var undefined??
Daniel Feldman
@Feldbot
Aug 14 2017 15:38 UTC
@Trommelochse I thought you changed my code to working code in your codepen. I now see I need to edit that.
Trommelochse
@Trommelochse
Aug 14 2017 15:39 UTC
hehe
Ken Haduch
@khaduch
Aug 14 2017 15:39 UTC
@jyapujuju - it doesn't look like you have an arg_var created anywhere, but you are using it as an array? Maybe you want arg_arr?
Ken Haduch
@khaduch
Aug 14 2017 15:53 UTC
@Feldbot - jsbin.com is a nice site for testing code, they have panels for HTML, CSS, Javascript, output, the console, and you can just run a JS function there by calling it. Nice site for doing testing and sharing code, etc. (Just going back and looking through the most recent posts here)
Rabin Shrestha
@jyapujuju
Aug 14 2017 15:54 UTC
@khaduch its in 4th line
)
:)
Ken Haduch
@khaduch
Aug 14 2017 15:55 UTC
@jyapujuju - arg_arr is there, arg_var is not? In other words, you have a var arg_arr but have never made var arg_var and initialized it to anything?
Daniel Feldman
@Feldbot
Aug 14 2017 15:55 UTC
@Trommelochse I'm still looking at your codepen (with the working code now), and don't understand how the logic is delivering the result. Should I save that pen to show you where I am at ? I understand that it is matching on the name, but I don't see why simply adding return contact[prop] automatically matches and returns the second argument's value.
aisnotb
@aisnotb
Aug 14 2017 15:56 UTC
Anyone knows how to make a div disappear but the text on it not ?
Ken Haduch
@khaduch
Aug 14 2017 15:58 UTC
@aisnotb - you can set a div to have the CSS display: none; and that will hide the div, the contents should still be there if you set it to a different display mode? Not sure if that's exactly what you are asking for...
Trommelochse
@Trommelochse
Aug 14 2017 15:59 UTC
@Feldbot contact is an object with certain properties
aisnotb
@aisnotb
Aug 14 2017 15:59 UTC
@khaduch Hi, thanks for your reply, this is what i mean
CamperBot
@camperbot
Aug 14 2017 15:59 UTC
aisnotb sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
Robert Marić
@Mariciano95
Aug 14 2017 15:59 UTC
Can anyone help with flexbox in my React Native app? I just want to clear two buttons? D:
CamperBot
@camperbot
Aug 14 2017 15:59 UTC
:star2: 3200 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Aug 14 2017 15:59 UTC
@aisnotb :+1:
Trommelochse
@Trommelochse
Aug 14 2017 16:00 UTC
and you have a string variable prop passed into your function
let's say prop = 'lastName'
Ken Haduch
@khaduch
Aug 14 2017 16:01 UTC
@Mariciano95 - I'm not a react expert (just a learner) but if you post a link to your code I'll try to help, or someone else will.
Trommelochse
@Trommelochse
Aug 14 2017 16:02 UTC
to access the lastName property of a contact I can say: contact.lastName
but since we don't know which property is passed in, we have to access the property like this contact[prop]
Rabin Shrestha
@jyapujuju
Aug 14 2017 16:02 UTC
@khaduch thanks
CamperBot
@camperbot
Aug 14 2017 16:02 UTC
jyapujuju sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3201 | @khaduch |http://www.freecodecamp.com/khaduch
Robert Marić
@Mariciano95
Aug 14 2017 16:02 UTC
@khaduch Is it ok if I just link you the emulator I am using
Trommelochse
@Trommelochse
Aug 14 2017 16:03 UTC
and if our value prop matches any property of the contact object, we will get the value of that property, or undefined otherwise
Rabin Shrestha
@jyapujuju
Aug 14 2017 16:04 UTC
function uniteUnique(arr) {
  var newarr=[];
  arr = Array.prototype.slice.call(arguments);
  var arg_arr = arr.reduce(function (a, b){
    return a.concat(b);
  });
  for (var i = 0; i < arg_arr.length; i++){
    for (var j = 0; j < arg_arr.length; i++){
      if(arg_arr[j] === arg_arr[i])
       newarr = delete arg_arr[j];
    }
  }
  return newarr;
}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
Trommelochse
@Trommelochse
Aug 14 2017 16:04 UTC
it's a bit awkward to explain, but quite simple, once you understood it :)
Rabin Shrestha
@jyapujuju
Aug 14 2017 16:04 UTC
why it syas potential infinite loop
Robert Marić
@Mariciano95
Aug 14 2017 16:05 UTC
@khaduch https://snack.expo.io/BJRWzSyuW if you wanna look at it I just want to Like and Dislike to be levled horizontally
Ken Haduch
@khaduch
Aug 14 2017 16:31 UTC
@Mariciano95 - I've never used this site - how do I run the app, or is there some other trick to it? Do I have to download some other app?
Ken Haduch
@khaduch
Aug 14 2017 16:50 UTC

@jyapujuju - you are modifying arg_arr within the loop, which makes it uncertain as to the effects on the for loop execution. If you are increasing the size of the array as you loop through it, there might never be an end. I don't know if they analyze whether or not you are increasing or decreasing the size, but it is not a good idea to do this regardless.

One comment on using delete as you are doing - it will return a value of true or false according to this documentation so you won't be getting an array of values from the original array. I would offer that you are doing down a path that is not a good solution. What you could potentially do is keep a newarr, and as you find values that are not contained within it (check the documentation for the .indexOf() array method) you can .push() a new value into it.

Ken Haduch
@khaduch
Aug 14 2017 17:29 UTC
@Mariciano95 - I'm having trouble getting into this "Expo" and how to edit things to try them. I'm just curious about whether or not you have to have display: flex in your CSS style? I think that this is how you enable the flex mode of displaying things? I'm not sure if there is a different mode of accessing it using React - as I said, this is new to me and I haven't worked with defining styles within React up to this point.
Daniel Feldman
@Feldbot
Aug 14 2017 17:34 UTC
@Trommelochse I just wanted to say thanks for the help. I had to look at the solution on this one. I never would have remembered to use hasOwnProperty or would have understood the nested if statement structure at this point in my learning. Good to struggle through it though. Thanks again :-)
CamperBot
@camperbot
Aug 14 2017 17:34 UTC
feldbot sends brownie points to @trommelochse :sparkles: :thumbsup: :sparkles:
:cookie: 312 | @trommelochse |http://www.freecodecamp.com/trommelochse
Robert Marić
@Mariciano95
Aug 14 2017 17:41 UTC
@khaduch I think I didn't put it
@khaduch It dosne't matter I am just happy it works, I just wanted to make it look nicer. But the code side everything works. The problem this is my these are my first touches with flexbox...
Ken Haduch
@khaduch
Aug 14 2017 17:55 UTC
@Mariciano95 - if you want to have a "fun" interesting overview of flexbox, try this site: http://flexboxfroggy.com/ - a game-like overview of flexbox features...
Robert Marić
@Mariciano95
Aug 14 2017 17:56 UTC
@khaduch Thanks
CamperBot
@camperbot
Aug 14 2017 17:56 UTC
mariciano95 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3202 | @khaduch |http://www.freecodecamp.com/khaduch
Thayyeb salim
@Thayyebsalim
Aug 14 2017 18:00 UTC
Is it a funnier version of http://www.flexboxdefense.com/ ?
Gaurav
@gauravmagan
Aug 14 2017 18:13 UTC
is there any build process to configure with
to start the application
@khaduch
right now im pulling up to the local with the full path
is there any package to download
wrapbootstrap template run in local?
how to set this up
do i need to use tools like gulp
to reload with a command
cameron nicklaus
@camnicklaus
Aug 14 2017 18:43 UTC
anyone interested in helping me out with a page-loading/javascript-check issue?
Ken Haduch
@khaduch
Aug 14 2017 18:51 UTC
@camnicklaus - do you have a page URL that you can post?
Trommelochse
@Trommelochse
Aug 14 2017 18:52 UTC
@camnicklaus always happy if I can help, not sure if I can, though. What's the issue?
cameron nicklaus
@camnicklaus
Aug 14 2017 18:56 UTC
@khaduch @Trommelochse unfortunately I don't, I'm a subcontractor for one guy on a team and don't have much access to the dev environment. The basic issue it this though:
I’ve written a dropdown menu/filter that has both a native html form component and a custom component. I use a script to add a class to the native form that hides it... essentially checking if javascript is enabled and showing my custom component if it is. the issue is that the native widget displays until the script fires and replaces it with my custom one..I wonder if I can avoid that
the script is this: window.addEventListener("load", function() { const dropdownMenu = document.querySelectorAll('.dropdown-wrapper'); dropdownMenu.forEach(function(menu) { menu.classList.remove('js-disabled'); menu.classList.add('js-enabled'); }); });
.dropdown-wrapper.js-enabled select, .dropdown-wrapper.js-disabled .select {
position: absolute;
left: -9999em;
overflow: hidden;
}
Daniel Feldman
@Feldbot
Aug 14 2017 18:57 UTC
@khaduch Thanks for the recommend on js fiddle. Do you like that better than codepen?
CamperBot
@camperbot
Aug 14 2017 18:57 UTC
feldbot sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3203 | @khaduch |http://www.freecodecamp.com/khaduch
Trommelochse
@Trommelochse
Aug 14 2017 19:02 UTC
@camnicklaus not my strongest suit, but what about a <noscript> tag?
Ken Haduch
@khaduch
Aug 14 2017 19:06 UTC
@Feldbot Did I recommend jsfiddle? Or was it jsbin.com? I use both, but I don't think that I prefer them to CodePen because CodePen has a lot of nice features that are useful. I like JSbin and jsfiddle for more "lightweight" things where I'm not including a lot of libraries, just trying some simple CSS / HTML / JS "fiddling". The nice thing about CodePen is that it's easier to put a link for the fullscreen version so that if you were sharing it with others you wouldn't have all of the nuts-and-bolts exposed to someone who would just want to see functionality.
Trommelochse
@Trommelochse
Aug 14 2017 19:06 UTC
CodePen is my favorite
Amit Patel
@AmitP88
Aug 14 2017 19:07 UTC
hey guys, I've been reading up on React for the past few days and I'm starting to get my feet wet by trying it out on CodePen. However, I'm running into some problems on how to get it to work on my pen. https://codepen.io/AmitP88/pen/eEGKZM?editors=1010 I've installed Babel, React, and ReactDOM cdns on my pen via Settings. I don't know what I'm doing wrong. I checked the console for errors and I'm getting 'uncaught ref error: require is not defined' on JS line 3. I don't know why I'm getting this because I haven't written the word require anywhere in my code. What am I missing?
error.png
Daniel Feldman
@Feldbot
Aug 14 2017 19:08 UTC
@khaduch I thought I saw you mention that this morning. Sounds like you do at any rate ;-) I'll check out jsbin, I haven't seen that yet.
Ken Haduch
@khaduch
Aug 14 2017 19:08 UTC
@Feldbot - I could have been thinking jsbin and jsfiddle came out instead... old age has its costs... ;)
Trommelochse
@Trommelochse
Aug 14 2017 19:10 UTC
@AmitP88 you don't need to import react and react-dom manually
because you did already in you JS settings
Ken Haduch
@khaduch
Aug 14 2017 19:10 UTC
@AmitP88 - I've struggled with this going through the react lessons that were on the beta site. I'm not sure that there is something that you have to have node.js configured to do? I'd be interested to know...
Trommelochse
@Trommelochse
Aug 14 2017 19:10 UTC
remove the first 2 lines
Amit Patel
@AmitP88
Aug 14 2017 19:10 UTC
@Trommelochse oh ok, I thought of that, but I wasn't sure
Trommelochse
@Trommelochse
Aug 14 2017 19:11 UTC
and things will be working exactly as expected
Amit Patel
@AmitP88
Aug 14 2017 19:11 UTC
@Trommelochse it did, thanks bro :)
CamperBot
@camperbot
Aug 14 2017 19:11 UTC
amitp88 sends brownie points to @trommelochse :sparkles: :thumbsup: :sparkles:
:cookie: 313 | @trommelochse |http://www.freecodecamp.com/trommelochse
Trommelochse
@Trommelochse
Aug 14 2017 19:11 UTC
np, always happy to help
Amit Patel
@AmitP88
Aug 14 2017 19:12 UTC
@khaduch for sure. I've thought about doing the tutorial projects on various sites, but I figure best way for me to learn is to just dive in, play around with it, then start making my own apps
doing tutorial projects gets stale after a while
cameron nicklaus
@camnicklaus
Aug 14 2017 19:14 UTC
@Trommelochse right on. thanks
CamperBot
@camperbot
Aug 14 2017 19:14 UTC
camnicklaus sends brownie points to @trommelochse :sparkles: :thumbsup: :sparkles:
:cookie: 314 | @trommelochse |http://www.freecodecamp.com/trommelochse
Trommelochse
@Trommelochse
Aug 14 2017 19:18 UTC
@camnicklaus amazing, glad it worked
Roxroy
@roxroy
Aug 14 2017 19:29 UTC
Hey guys, finally gave this learning site a go, www.flexboxdefense.com to better understand the flexbox commands. You align your tower defense using CSS. I learnt quite a bit while playing the game. Lots of fun. Try to go to the end and beat the game.
Gaurav
@gauravmagan
Aug 14 2017 19:37 UTC
do we have a ny generators guys to load the app
from the local
fire on the browser
BrianWilliams28
@BrianWilliams28
Aug 14 2017 19:39 UTC
can someone give me a hint on what i should do here? i'm stuck on how to solve this algorithm.
/* Find the missing letter in the passed letter range and return it.

If all letters are present in the range, return undefined. */
function fearNotLetter(str) {
  var missingLetter = '';
  var alpha = 'abcdefghijklmnopqrstuvwxyz';

  for (var i = 0; i < str.length; i++) {
// i = 0, 1, 2 ,3...
// str[i] = a, b, c, d...
    var index = str.charCodeAt(i);
    // returns UTF16 Code: 97, 98, 99, 101...


  }

  return missingLetter;
}

fearNotLetter("abce");
// needs to return "d"
// fearNotLetter("bcd") should return undefined.
Peter Steele
@PeterHSteele
Aug 14 2017 19:43 UTC
@BrianWilliams28 you've got the right idea by using charCodeAt(). Think of a mathematical way to determine if there's a gap of more than one letter
like, you know the difference between character codes for consecutive letters is always 1. So if the difference is more than one...
BrianWilliams28
@BrianWilliams28
Aug 14 2017 19:45 UTC
@PeterHSteele
 if (str[i].charCodeAt() > str[i].charCodeAt() + 1)

  }
something like that?
lol
wait im dunmb
this would be better
function fearNotLetter(str) {
  var missingLetter = '';
  var alpha = 'abcdefghijklmnopqrstuvwxyz';

  for (var i = 0; i < str.length; i++) {
// i = 0, 1, 2 ,3...
// str[i] = a, b, c, d...
    var index = str.charCodeAt(i);
    // returns UTF16 Code: 97, 98, 99, 101...
if (str[i] > index + 1) {
  // do something in here lol
}

  }

  return missingLetter;
}

fearNotLetter("abce");
wait no
Peter Steele
@PeterHSteele
Aug 14 2017 19:50 UTC
@BrianWilliams28
if (str[i].charCodeAt()-str[i-1].charCodeAt()>1)
you want to check if the difference between the character codes is greater than 1, if so u know there's a missing letter

sry my bad

if (str.charCodeAt(i)-str.charCodeAt(i-1)>1)

that's it

BrianWilliams28
@BrianWilliams28
Aug 14 2017 19:53 UTC
that makes sense
here's what i wrote for the next part, doesn't seem to work though.
if (str[i].charCodeAt() - str.charCodeAt(i - 1) > 1) {
  missingLetter = str.fromCharCode(index - 1);
  console.log(missingLetter);
}
Peter Steele
@PeterHSteele
Aug 14 2017 20:00 UTC
get rid of the [i] in your if statement, it's str.charCodeAt(i)
also missingLetter = String.fromCharCode(str.charCodeAt(i )-1);
BrianWilliams28
@BrianWilliams28
Aug 14 2017 20:10 UTC
wait why did you write String.fromCharCode instead of str.fromCharCode ?
Stephen Passero
@stephenpassero
Aug 14 2017 20:11 UTC
@/all I'm on the Simon Game challenge. How would I make my code wait until I click before flashing the colors again?
BrianWilliams28
@BrianWilliams28
Aug 14 2017 20:13 UTC
@PeterHSteele disregard that last question Peter, i didn't notice the syntax of that method. thanks for your help!
CamperBot
@camperbot
Aug 14 2017 20:13 UTC
brianwilliams28 sends brownie points to @peterhsteele :sparkles: :thumbsup: :sparkles:
:cookie: 317 | @peterhsteele |http://www.freecodecamp.com/peterhsteele
Gulsvi
@gulsvi
Aug 14 2017 20:27 UTC
@stephenpassero Use setTimeout(), a Promise(), or if you are using jQuery, .queue() is also an option. Most people use setTimeout()
(also, you might not want to tag 15,443 people in here with @all :))
Trommelochse
@Trommelochse
Aug 14 2017 20:31 UTC
:D :D
Daniel Feldman
@Feldbot
Aug 14 2017 20:41 UTC
Hi, trying to understand some code on Make object properties private.
My code passes, but I'm not hitting the specified requirements. Setting parameters seems to work, but then when getting, I'm not getting what I set. Any thoughts?
var Bike = function() {

  // Only change code below this line.

  // private variable
  var gear; 

  // public methods
  this.setGear = function (change) {
    gear = change;
  };

  this.getGear = function () {
    return gear;
  };
};

var myBike = new Bike();
myBike.getGear();
Ken Haduch
@khaduch
Aug 14 2017 20:46 UTC
@Feldbot - either you have to initialize the gear variable when you create it (in order to get something back immediately after creating the object) or you have to do a myBike.setGear(4) for example, before you do a getGear() - otherwise, I'm not sure what you are having a problem with? That''s the one thing that I can see with the code that you posted that might be causing a problem? Are you failing any particular test? And which one(s) if you are?
Daniel Feldman
@Feldbot
Aug 14 2017 20:51 UTC
@khaduch If I initialize var gear = 5; then call myBike.setGear(10) then call myBike.getGear() it returns 5 instead of 10. Shouldn't I get back what I set in this exercise?
The requirements say "myBike.getGear() should return 4 after calling myBike.setGear(4)." but when I do this it keeps returning the supposedly private variable.
Ken Haduch
@khaduch
Aug 14 2017 20:55 UTC
@Feldbot - the private variable is what should get the value that you are passing to myBike.setGear() - and that should be returned? I have essentially the same code, the only think that I have is that I named the argument to the setGear function "newGear" instead of "change" - but that shouldn't be causing a problem. I'm going to copy your code into my challenge and try to run it?
@Feldbot - it seems to work fine when I run the tests? So I think that it's correct. Unfortunately I have to zip for now - maybe someone else will have some insight?
Daniel Feldman
@Feldbot
Aug 14 2017 20:58 UTC
@khaduch Thanks Ken. Mine passes tests but I don't know why. Maybe I am misinterpreting the requirements.
Gulsvi
@gulsvi
Aug 14 2017 21:03 UTC
@Feldbot Your code should return 10 if you do myBike.setGear(10) regardless of what you have set gear equal to inside the object.
var Bike = function() {
  var gear = 5;

  this.setGear = function(change) {
    gear = change;
  };

  this.getGear = function() {
    return gear;
  };
};

var myBike = new Bike();
myBike.setGear(10);
myBike.getGear(); // returns 10
I guess I should ask - how are you determining the return value from myBike.getGear()?
Chris
@bestintown23
Aug 14 2017 21:07 UTC
Hello is there any ideas on why my nav options are not in the center? https://codepen.io/bestintown23/pen/wqrPvy
Daniel Feldman
@Feldbot
Aug 14 2017 21:10 UTC
@SkyC0der I'm first running the setGear(10), then looking at the in-app console. Then it passes all tests. Then I'm going back to it and calling getGear(); expecting to see 10, but it returns 5 in the in-app console.
Gulsvi
@gulsvi
Aug 14 2017 21:12 UTC
@Feldbot Ahhh, that makes sense. The console in the Free Code Camp challenges isn't a true console - that probably explains what's going on. Try it out here instead: https://s.codepen.io/anon/pen/vJezrb?editors=0012, or on a site like https://repl.it. Lots of people do their JS challenges there because of this issue.
The codepen link I gave you ^^ has your code in it already
Daniel Feldman
@Feldbot
Aug 14 2017 21:18 UTC
@SkyC0der Thanks. I've had some issues already trying to use the inspector/console with the challenges and not understanding what is being evaluated. Maybe I'll try throwing it in a pen first to 'debug'. I appreciate the help!
CamperBot
@camperbot
Aug 14 2017 21:18 UTC
feldbot sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2387 | @skyc0der |http://www.freecodecamp.com/skyc0der
iso
@iso1048
Aug 14 2017 21:18 UTC
@SkyC0der hey bro could I get some help with the 'sum all primes' challenge?
@SkyC0der also, how is it going?
Gulsvi
@gulsvi
Aug 14 2017 21:19 UTC
@Feldbot No problem. Codepen and Repl.it are a great help for those challenges!
@gothamknight Doing okay, you? Sure, I can help with the sum all primes. What's up?
iso
@iso1048
Aug 14 2017 21:22 UTC

@SkyC0der good. yeah doing fine.


function sumPrimes(num) {

  var arr=[];

  for (var i = 2; i <=num; i++){
    if (i%2 !==0){
      arr.push(i);
    }
  }
  arr.unshift(2);
  for (var j = 1; j<arr.length; j++){
    for (var q = 2; q <=arr[arr.length-1]/arr[j]; q++){
      if (arr.indexOf(arr[j]*q) !== -1){
        var x = arr.indexOf(arr[j]*q);
        arr[x] = 0;
      }
    }
  }
  arr = arr.filter(function(item){return item !==0;}).reduce(function(a,b){return a+b;});
  return arr;
}

sumPrimes(10);

that is my code. I can pass the tests when 10 is passed into the function, but not when 977 is passed into the function. When 977 is passed into the function, the console says "potential infinite loop" for this line
for (var q = 2; q <=arr[arr.length-1]/arr[j]; q++){.
So i tried replacing arr[arr.length-1]/arr[j] with smaller numbers and it seems to work, but not with larger numbers. What is up with that?

(i realise it is probably not an ideal approach but.... yeah)
Gulsvi
@gulsvi
Aug 14 2017 21:23 UTC
without code comments or descriptive variables names, I'll have to study your code in the console. brb
I assume arr is an array of prime numbers?
presumably if arr is all primes, you just reduce that
no need for multiple for loops
Daniel Feldman
@Feldbot
Aug 14 2017 21:25 UTC
@SkyC0der How would I know when to try the challenges out in those apps vs. fCC? I'm not experienced enough to know what is going on yet mostly, and am just trusting the built-in fCC challenge evaluation.
Gulsvi
@gulsvi
Aug 14 2017 21:26 UTC
@Feldbot If you ever feel the need to console.log() something to get more info about your code, don't use the FCC console.
It'll become clearer as the algorithms get more involved
Daniel Feldman
@Feldbot
Aug 14 2017 21:27 UTC
@SkyC0der Thanks, good tip. And thanks for the encouragement, I can definitely use that!
CamperBot
@camperbot
Aug 14 2017 21:27 UTC
feldbot sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:warning: feldbot already gave skyc0der points
Gulsvi
@gulsvi
Aug 14 2017 21:31 UTC
@gothamknight I give up :) not sure what you're trying to do with your two for loops
Can someone tell me what other resources you use to solve the algorithm challenges?
Gulsvi
@gulsvi
Aug 14 2017 21:32 UTC
It looks like arr is an array of odd numbers less than or equal to num and then you add a 2 to the beginning of that array @gothamknight
iso
@iso1048
Aug 14 2017 21:32 UTC
@SkyC0der haha that isn't like you. yep that is right
Gulsvi
@gulsvi
Aug 14 2017 21:32 UTC
How are you figuring out the prime numbers?
I don't see how this formula does it?
    for (var q = 2; q <= arr[arr.length-1]/arr[j]; q++){
      if (arr.indexOf(arr[j]*q) !== -1){
        var x = arr.indexOf(arr[j]*q);
        arr[x] = 0;
      }
    }
I think you need a different approach - try to make an array of all prime numbers first. There's the sieve of eratosthenes: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Pseudocode
then all you have to do is sum all numbers in that array with reduce
iso
@iso1048
Aug 14 2017 21:37 UTC
@SkyC0der the for loop with j loops through each element of the array. the for loop with q is a factor which is multiplied to the element of the array (j). q is less than the last number in the array divided by the the selected element of the array (j). so if j = 1, and q = 2, then the if statement would be testing arr.indexOf(3*2). Since 6 is in the array, it is replaced with 0. Then q increases to 3, so now arr.indexOf(3*3) is being tested, since 9 is in the array, it is replaced with 0....and so on.
Those for-loops are an attempt at making an array of prime numbers ahah
Gulsvi
@gulsvi
Aug 14 2017 21:39 UTC
@gothamknight I'd have to think some more about what cases cause that to fail
One approach to determining if a number is prime is to divide that number by every number less than it. If you don't get a remainder for any of those divisions, it is not prime.
iso
@iso1048
Aug 14 2017 21:41 UTC
@SkyC0der yeah i tried doing it that way but was not able to. Ill try it that way again. It is not the mathematics principles that are getting me stuck...
Gulsvi
@gulsvi
Aug 14 2017 21:41 UTC
Writing a simple function to determine if a number is / is not prime is a common interview question :) and a good approach to solving this problem. Then you can just do if if(isPrime(i)) arr.push(i)
The sieve of eratosthenes would be the more efficient approach though - and worth studying IMO
@gothamknight Happy to help you get that for loop working
iso
@iso1048
Aug 14 2017 21:44 UTC
@SkyC0der I did base that approach on The sieve of eratosthenes...
@SkyC0der i just dont really get why it works with smaller numbers but not larger numbers
Gulsvi
@gulsvi
Aug 14 2017 21:45 UTC
@gothamknight What I would do to understand it better is find the smallest number where it fails - figure out what numbers went into that computation
iso
@iso1048
Aug 14 2017 21:46 UTC
@SkyC0der i would have to know the answer of the sum of the primes to know where it fails, so I might as well try a different approach that works, then come back and see where my code failed. Thanks for the help as always bro
CamperBot
@camperbot
Aug 14 2017 21:46 UTC
gothamknight sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2388 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Aug 14 2017 21:47 UTC
@gothamknight Something isn't right about that implementation though - your code crashes my browser when I try to do sumPrimes(977)
iso
@iso1048
Aug 14 2017 21:47 UTC
@SkyC0der so two for loops and .reduce should get the job done?
Gulsvi
@gulsvi
Aug 14 2017 21:47 UTC
@gothamknight One for loop and a .reduce
nvm, yeah, another for loop to test if it is prime
iso
@iso1048
Aug 14 2017 21:49 UTC
@SkyC0der shit. ill take a look at it again. right now, time for a boring lecture, where the lecturer pronounces 'apoptosis' as apotosis - very annoying.
juni
@junipberry
Aug 14 2017 21:49 UTC
hey sky
Gulsvi
@gulsvi
Aug 14 2017 21:49 UTC
lol
Have fun @gothamknight
Hello @junipberry
juni
@junipberry
Aug 14 2017 21:50 UTC
Hii :D Can you take a look at my code
Gulsvi
@gulsvi
Aug 14 2017 21:50 UTC
Sure
juni
@junipberry
Aug 14 2017 21:50 UTC
function isEven(num) {
if (Math.abs(num % 2) == 1);
  return true;
}
Gulsvi
@gulsvi
Aug 14 2017 21:52 UTC
@junipberry your if statement is broken
if (condition) doSomething
you have if (condition);
Alexander Domikov
@AlexanderDom
Aug 14 2017 21:54 UTC
This message was deleted
juni
@junipberry
Aug 14 2017 21:55 UTC
oh right, ty~
ty @SkyC0der
silly mistake on my part
Gulsvi
@gulsvi
Aug 14 2017 21:56 UTC
No problem, also, it's an anti-pattern to return true or false after a comparison - just return the comparison and you'll get either true or false
juni
@junipberry
Aug 14 2017 21:57 UTC
ah, so itll be done in one line
got it, ty~
Gulsvi
@gulsvi
Aug 14 2017 21:57 UTC
Correct
Kind of like:
function isLessThanFive(num) {
  return (num < 5); // will return true if less than five, else false
}
juni
@junipberry
Aug 14 2017 21:58 UTC
got it, keeping it clean and simple :)
Gulsvi
@gulsvi
Aug 14 2017 21:58 UTC
Yep! :)
juni
@junipberry
Aug 14 2017 21:59 UTC
sky, can you take a look at 2 more I did? I’m not sure if its my prob or a bug. I just dont see why its wrong
Gulsvi
@gulsvi
Aug 14 2017 21:59 UTC
Sure
juni
@junipberry
Aug 14 2017 22:00 UTC
ty, this is straighforward enough but don’t know why its not passing:
function isOldEnoughToDrive(age) {
  if (age >= 16) {
    console.log(true);
  } else {
    console.log(false);
  }
  return Boolean(age);
}
or this works too, right:
function isOldEnoughToDrive(age) {
  if (age >= 16) {
  return Boolean(age);
}}
Gulsvi
@gulsvi
Aug 14 2017 22:02 UTC
@junipberry Does that challenge require you to use Boolean()
Because you could just do:
function isOldEnoughToDrive(age) {
  return age >= 16;
}
juni
@junipberry
Aug 14 2017 22:03 UTC
not really, just to find out whether its true or false
Gulsvi
@gulsvi
Aug 14 2017 22:03 UTC
Okay, yeah, it's the same as that isLessThanFive example I put above, only you're checking if it is greater than or equal to 16
(so many typos lol)
juni
@junipberry
Aug 14 2017 22:04 UTC
ahh haha
ok ty~~
and this one :
function getFullName(firstName, lastName) {
  return ('firstName lastName');
}
Gulsvi
@gulsvi
Aug 14 2017 22:08 UTC
^^ I think you can figure this one out :)
firstName and lastName are going to act like variables
so, to make a string with variables in it - we put quotes around the text and plus signs before and after the variables
Like in the Word Blanks challenge: https://www.freecodecamp.org/challenges/word-blanks
juni
@junipberry
Aug 14 2017 22:10 UTC
I’ve tried concating it like so:
function getFullName(firstName, lastName) {
  return ('firstName' + 'lastName');
}
Gulsvi
@gulsvi
Aug 14 2017 22:10 UTC
That results in a string like: firstNamelastName
juni
@junipberry
Aug 14 2017 22:10 UTC
ahhhhhh
got it
Gulsvi
@gulsvi
Aug 14 2017 22:11 UTC
:+1: :sparkles:
juni
@junipberry
Aug 14 2017 22:12 UTC
actually no, the inclusion of whitespace after firstName is not fixing it :(
Gulsvi
@gulsvi
Aug 14 2017 22:12 UTC
What does your code look like now?
juni
@junipberry
Aug 14 2017 22:13 UTC
function getFullName(firstName, lastName) {
  return ('firstName ' + 'lastName');
}
Gulsvi
@gulsvi
Aug 14 2017 22:14 UTC
Okay, that gives you a string like: firstName lastName
You need to use firstName and lastName as a variable, not a string
juni
@junipberry
Aug 14 2017 22:19 UTC
function getFullName(firstName, lastName) {
  return ( '+firstName +lastName+' );
}
Gulsvi
@gulsvi
Aug 14 2017 22:21 UTC
@junipberry Everything between the quotes will be a string
That function returns: +firstName +lastName+
var ourName = "Free Code Camp";
return "Hello, our name is " + ourName + ", how are you?";
^^ that returns Hello, our name is Free Code Camp, how are you?
juni
@junipberry
Aug 14 2017 22:28 UTC
oh, I wanted to concat the ‘ to the name so it shows up so i get ie: ‘James Smith'
Gulsvi
@gulsvi
Aug 14 2017 22:30 UTC
var ourName = "Free Code Camp";
return "Hello, our name is '" + ourName + "', how are you?";
^^ That returns Hello, our name is 'Free Code Camp', how are you?
with the single quotes added to the name
@junipberry Practice changing the string here to see how it changes: https://s.codepen.io/anon/pen/BdwqOR?editors=0012
juni
@junipberry
Aug 14 2017 22:35 UTC
so, I need to include ‘ ‘ inside a string “ “ for it to show up, like:
function getFullName(firstName, lastName) {
  return ("'"+firstName +lastName+"'");
}
Eric Weiss
@eweiss17
Aug 14 2017 22:36 UTC
huh, you want quotation marks to be outputted?
Can someone tell me how to get rid of the overlap between the contact and projects pages?
juni
@junipberry
Aug 14 2017 22:40 UTC
doh
only the whitespace was a string, so I had to show it like so
ty @SkyC0der
Eric Weiss
@eweiss17
Aug 14 2017 22:42 UTC
@EricHasegawa you have a lot of things commented out. your html is hard to view
Also the spacing.... try to avoid <br> in html code if you can
Gulsvi
@gulsvi
Aug 14 2017 22:43 UTC
@EricHasegawa To remove the overlap, your projects page needs another closing </div>
And I agree, get rid of all those br tags - use margin-top/bottom instead. <br> is for poems, addresses, etc. where a line break is needed.
Glad you got it figured out @junipberry
Eric Hasegawa
@EricHasegawa
Aug 14 2017 22:46 UTC
@SkyC0der @eweiss17 Yeah I know this is an old project it's a huge mess, I'll make a new portfolio page once I start getting more experienced
juni
@junipberry
Aug 14 2017 22:47 UTC
ty for bearing w me @SkyC0der
Eric Hasegawa
@EricHasegawa
Aug 14 2017 22:47 UTC
@SkyC0der @eweiss17 Thanks!
CamperBot
@camperbot
Aug 14 2017 22:47 UTC
erichasegawa sends brownie points to @skyc0der and @eweiss17 :sparkles: :thumbsup: :sparkles:
:star2: 2389 | @skyc0der |http://www.freecodecamp.com/skyc0der
:cookie: 592 | @eweiss17 |http://www.freecodecamp.com/eweiss17
Gulsvi
@gulsvi
Aug 14 2017 22:48 UTC
Likewise :p
Eric Weiss
@eweiss17
Aug 14 2017 22:49 UTC
I'm doing react.js on codecademy right now..... I'v discovered that react native is it's own react framework compared to just incorporating react in an app
right now it's just going over JSX, is jsx really used a crap ton in react?
Gulsvi
@gulsvi
Aug 14 2017 22:50 UTC
Yeah, jsx is very common in react
Maybe you can use regular react in an electron app?
Makes it semi-native anyway lol
Eric Weiss
@eweiss17
Aug 14 2017 22:54 UTC
what do you mean by native
Gulsvi
@gulsvi
Aug 14 2017 22:54 UTC
Not in your web browser
like a standalone application
Eric Weiss
@eweiss17
Aug 14 2017 22:55 UTC
i was using the word app very loosely, as just any project
is react almost exclusivly used in react native? Should i just focus on learnign that?
Gulsvi
@gulsvi
Aug 14 2017 22:55 UTC
Do you want to build native applications or web applications?
Eric Weiss
@eweiss17
Aug 14 2017 22:56 UTC
my objective was just to recreate my portfolio using react
Gulsvi
@gulsvi
Aug 14 2017 22:57 UTC
Yeah, then just learn React
React Native is for making native apps - don't need a URL to open them
Eric Weiss
@eweiss17
Aug 14 2017 22:58 UTC
So if you were creating a phone app or something ?
Gulsvi
@gulsvi
Aug 14 2017 22:58 UTC
Exactly
Eric Weiss
@eweiss17
Aug 14 2017 22:58 UTC
Okay cool, thanks for the info @SkyC0der
CamperBot
@camperbot
Aug 14 2017 22:58 UTC
eweiss17 sends brownie points to @skyc0der :sparkles: :thumbsup: :sparkles:
:star2: 2390 | @skyc0der |http://www.freecodecamp.com/skyc0der
Gulsvi
@gulsvi
Aug 14 2017 22:58 UTC
It would be indistinguishable from an android app built with Java or a iOS app built with Objective-C
Just another icon on your home screen :)
Eric Weiss
@eweiss17
Aug 14 2017 22:59 UTC
I think i will be creating a andoid app via android studio in the coming months
for a school project
@SkyC0der last question about react (for now) . More or less HTML mark up compared to adding via JSX?
if you catch what i am trying to ask....
Gulsvi
@gulsvi
Aug 14 2017 23:06 UTC
@eweiss17 sorry, stepped away. Yeah, JSX is HTML markup in your JavaScript.
Requires the babel preprocessor if you use it in codepen
iso
@iso1048
Aug 14 2017 23:07 UTC
@SkyC0der bro...
Gulsvi
@gulsvi
Aug 14 2017 23:08 UTC
bruh....
Get those primes?
iso
@iso1048
Aug 14 2017 23:08 UTC
  var arr=[];
  var isPrime = true;

  for (var i = 3; i<=num; i++){
    for (var j=2; j<Math.round(Math.sqrt(i)); i++){
      if (i%j == 0) {
        isPrime = false;
      }
    }
    if (isPrime){
      arr.push(i);
    }
  }
how is if (i%j == 0) a potential infinite loop?
Eric Weiss
@eweiss17
Aug 14 2017 23:08 UTC
the question was should my html page be large or should my react be large? Only use react when it will make a difference or all the time?
iso
@iso1048
Aug 14 2017 23:09 UTC
it's not even a loop.
Gulsvi
@gulsvi
Aug 14 2017 23:09 UTC
Looks like a syntax error from here
Eric Weiss
@eweiss17
Aug 14 2017 23:09 UTC
why do you have i++ in that second for loop
iso
@iso1048
Aug 14 2017 23:09 UTC
oh shit.
Gulsvi
@gulsvi
Aug 14 2017 23:09 UTC
@eweiss17 The React apps I've seen have one line of HTML. The rest is all JS
iso
@iso1048
Aug 14 2017 23:10 UTC
@eweiss17 thank you
Eric Weiss
@eweiss17
Aug 14 2017 23:10 UTC
is that what is the standard?
Gulsvi
@gulsvi
Aug 14 2017 23:10 UTC
I believe so, but I'm no expert at React - only did that one course and browsed around looking at code on codepen
Trommelochse
@Trommelochse
Aug 14 2017 23:15 UTC
@eweiss17 I've been digging into React a lot recently, it's MUCH FUN, can be confusing though
And Sky way right, If you write an app purely in react there's barely any real HTML involved, however, you will find yourself writing a lot of JSX that feels like HTML and converts into HTML while rendering
This week, I will release a Blog on creating a Full Stack Blog using React,Express and MongoDB
once you get into React, it's quite convenient
my FCC Leaderboard took me 2 hours and has quite clean&lean code:
Trommelochse
@Trommelochse
Aug 14 2017 23:22 UTC
(please ignore the ugly thing I am doing with the axios promise during componentDidMount() )
Gulsvi
@gulsvi
Aug 14 2017 23:50 UTC
@Trommelochse Very nice! I like seeing how everyone makes that app. My only question is why axios instead of fetch, but I'll ignore that for now ;)
Trommelochse
@Trommelochse
Aug 14 2017 23:52 UTC
@SkyC0der no reason for axios over fetch... I sat at home, was slightly tipsy and wanted to do create something quickly, so I just picked what I was used to
however, I am not using correctly there
I make another async request within the resolved promise instead of bundling them....
no biggie for that projeect, but should fix it nevertheless, since otherwise it's quite ok
btw, do you know what you highest 'last 30 days' score was?