These are chat archives for FreeCodeCamp/Help

14th
Mar 2015
Suzanne Atkinson
@AdventureBear
Mar 14 2015 01:31
Let me check , sorry for the delay, dinner break
Suzanne Atkinson
@AdventureBear
Mar 14 2015 01:38
@crosscris @crisberrios here is the routes file it is located in the app folder so the path should be ./apps/routes.js (but adding the extension doesn't help).
I used the scotch.io tutorial to refactor, but in that tutorial they used a different sytnax...with app.get ... instead of the router syntax, so it was difficult for me to figure out what should go where and who should call what
Cristián Berríos
@crisberrios
Mar 14 2015 02:22
as I see, you are using require but the routes.js file doesn't have a module structure
start a new project using yeoman express generator and see how a routes file looks like
Suzanne Atkinson
@AdventureBear
Mar 14 2015 02:23
hmm...OK.
I knew there hat to be some weird things. I sthis good practice ? (even though it's not right?
if I run this command is there a possibliity I will mess something up?
npm install -g yo bower grunt-cli gulp
I think i have gulp running
Blake Johnston
@johnstonbl01
Mar 14 2015 02:26
not sure it's best practice either, but i've got a few route examples on my github site as well, @AdventureBear . they're simple examples, so may be easy to untangle and understand
Suzanne Atkinson
@AdventureBear
Mar 14 2015 02:26
Simple is good. I've mashed together 3 tutorials plus my own ideas
Blake Johnston
@johnstonbl01
Mar 14 2015 02:27
yeah - that's what i did, and wrote a blog post about it as well
Suzanne Atkinson
@AdventureBear
Mar 14 2015 02:27
oh, please share!
Blake Johnston
@johnstonbl01
Mar 14 2015 02:27
johnstonbl.wordpress.com
think it's a few posts back
but if you have questions about any of the route files on git or in that tutorial, let me know
as for your npm command. think you need to have && in between the different things you're installing
so npm install -g yo && bower && grunt-cli && gulp
you probably won't need both grunt & gulp though
unless you just want them ;0
i personally prefer gulp
Suzanne Atkinson
@AdventureBear
Mar 14 2015 02:45
thanks, I'm not seeing the router discussion I don't think. Is it in the beginner MEAN app
Blake Johnston
@johnstonbl01
Mar 14 2015 02:47
yep
that's the tutorial that includes some of the routes
then on my github page (https://github.com/johnstonbl01) the mean_app & loginApp both have routes defined
pm me if you want to discuss or are still having issues finding the file(s)
Suzanne Atkinson
@AdventureBear
Mar 14 2015 02:49
thanks found the files.
Blake Johnston
@johnstonbl01
Mar 14 2015 02:50
yep - just let me know if you have any questions
softeg
@softeg
Mar 14 2015 17:08
@softeg
I need a book to master javascript i begin with eloquant js but not love it i dont khnow why :)
and also a kata execice or small project to master javascript online ?
Suzanne Atkinson
@AdventureBear
Mar 14 2015 18:21
What is your prior experience?
softeg
@softeg
Mar 14 2015 19:11
iam php programmer i use jquery but i need to master js to use framwork like angular, node etc
Ming Zhang
@Scripore
Mar 14 2015 19:13
console.log(4444444444354545454354)
the output is => 4.4444444443545457e+21
how do I get it not to print in scientific notation?
without converting it into a string first
actually, even if I do convert it to a string I still get it in scientific notation
num = 4444444444354545454354
string = num.toString();
console.log(string)
=> 4.4444444443545457e+21
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:40
@softeg have you done the challenges here in FCC yet? There is a great blog post by Douglas Crockford about a sugegsted sequence of reading material. I'll see if I can find it
Eloquent JS is on the list near the top, and i think the next one is "Javascript: The Good Parts".
Nareg Khoshafian
@nkhoshaf
Mar 14 2015 19:41
I'm totally lost at this point not sure what is wrong with my code
Screen Shot 2015-03-14 at 3.38.14 PM.png
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:42
well that's just the console output. what do you want to do with it?
Nareg Khoshafian
@nkhoshaf
Mar 14 2015 19:43
This is from the Bonfire (Sum All Numbers in a Range)...I am able to get all of the numbers in between the two inputs into one array all I have to do is add them together
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:43
@nkhoshaf i didn't take the time to digest your code, but I have a few suggestiosn that will help
first, read this for an approach to your algorithm
second, when you create variables try to make them descriptive, so it's easier for others to read your code, and for you to go back later. (what is x? What is i?) so if you're creating a new array o fitnermediate values, instead of x, call it intermediateArray
also, I know how frustrating it is to KNOW what you want the code to do and you can't figure it out.
your problem may be something really simple. but fir this algorithm, I'd read that blog post I showed, because that will simplify your code as well
Nareg Khoshafian
@nkhoshaf
Mar 14 2015 19:45
@AdventureBear I'm checking out your link now and will def start applying those tips
Yeah all I really need to do is just add all the numbers in the array
that's the only thing not working for some reason
I've looked up a ton of stuff on that but it doesn't seem to work for me
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:47
OK, well if you have an array of numbers, to add them up you would interate through an array, and add each to the building sum.
but what I think the experts here would suggest is to look at functions like map, filter, reduce and foreach for the Array object methods in javascript to do that.
Nareg Khoshafian
@nkhoshaf
Mar 14 2015 19:48
I used both a for loop and reduce method and both are just adding the two inputs together
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:48
also, you can do a few things to help us help you better.
rather than a screen shot of your code
you can put your code here using the markup language as text. use 3 backticks like this: ``` (under the tilde button ~)
hit shift return, paste your code then enter it.
my screen shows some little icons to the right of this input box with help context.
the 2nd thing youc an do is paste a link to code snippets like repl.it, codepen, or jsfiddle among others. So we can click it, try to run your code, make adjust ments adn link it back.
its a bit easier (for me) than looking at code, but anyway, that's the way I have been asking for help (and I need a lot of it)!
Nareg Khoshafian
@nkhoshaf
Mar 14 2015 19:50

function sumAll(arr) {
  var x = 0;
  if(arr[0] < arr[i]){
    for(var i=arr[0]; i<arr[1]-1; i++){
      x = i+1;
      arr.push(x);
    }
    arr.sort();
  }else{
    for(var t=arr[1]; t<arr[0]-1; t++){
      x = t+1;
      arr.push(x);
    }
    arr.sort();
  }
  var count = 0;
  for(var z = 0; z < arr.length; z++){
    count = count + arr[z];
  }
  return count;
}

sumAll([1, 15]);
I was wondering how people did that..thanks!
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:53
sort doesn't do what you think it does
it converts to a strign then sorts
so 1,10, 12, 2, 3, 4
the code above, typo line 3
arr[i] I think you want to be arr1
arr[1]
usea single tick for one line of code like I did there
Nareg Khoshafian
@nkhoshaf
Mar 14 2015 19:55
THAT WAS IT lol
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:56
lol
there you go!
Nareg Khoshafian
@nkhoshaf
Mar 14 2015 19:56
all I had to do was change that...wow thank you so much @AdventureBear
Suzanne Atkinson
@AdventureBear
Mar 14 2015 19:56
I finally HELPED someone!!! Now go do it better. :)
(read the article). :)
happy dance
Julie Myers
@BlueOceanView
Mar 14 2015 19:58
@AdventureBear :clap:
Suzanne Atkinson
@AdventureBear
Mar 14 2015 20:00
@BlueOceanView :+1:
Meta Hirschl
@MetaCoderHirschl
Mar 14 2015 20:52
happy pi day everyone!
Suzanne Atkinson
@AdventureBear
Mar 14 2015 21:02
likewise!
Meta Hirschl
@MetaCoderHirschl
Mar 14 2015 21:39
I know the filter function is one of the important tools....and I'm just not getting it for the symmetric differences...I made one flattened array and then figure, oh just filter out the sames...can anyone take a look:```
function sym(arr) {
  fullArray = arr.slice.apply(arguments);
  var merged = [];
  merged = merged.concat.apply(merged, fullArray);
  console.log(merged);
  var result = merged.filter(function (value, index, array){
    return array.value !== merged[index];});
  return result;
  }



sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]);
Thanks! hope everyone is swimming along on this saturday 3.14.15...smoother than i.
oops this is the link http://repl.it/eAV