These are chat archives for FreeCodeCamp/HelpJavaScript

3rd
Oct 2017
korzo
@korzo
Oct 03 2017 00:00
@caixeta-paula It's not done yet.
do you know ES6 ?
Lucci Paula
@luccipaula
Oct 03 2017 00:01
@korzo No I don't, are we gonna get into fat arrows or something?
korzo
@korzo
Oct 03 2017 00:01
@caixeta-paula Yes :)
Lucci Paula
@luccipaula
Oct 03 2017 00:01
@korzo I never tried those because I'm afraid I won't remember what they do in the function lol
korzo
@korzo
Oct 03 2017 00:02
@caixeta-paula Arrow functions are easy

@caixeta-paula
You can replace this:

    Object.keys(source).every(function(prop) {
      return obj[prop] == source[prop];
    })

with this

    return Object.keys(source).every(prop => obj[prop] == source[prop]);
Lucci Paula
@luccipaula
Oct 03 2017 00:03
@korzo Also, the algorithm works but the editor is saying "Unreachable return after return"
return collection.filter(function(obj) {
    return Object.keys(source).every(function(prop) {
      return obj[prop] == source[prop];
    });
    return true; // "Unreachable return after return"
  });
korzo
@korzo
Oct 03 2017 00:05
@caixeta-paula Yes, because you return line above.
every return true or false, you don't need another return
Lucci Paula
@luccipaula
Oct 03 2017 00:06
@korzo Ahhh okay. And the arrow just replaces function and initiates the return?
korzo
@korzo
Oct 03 2017 00:06
@caixeta-paula Yes
@caixeta-paula This is syntax for one parameter and direct return
Lucci Paula
@luccipaula
Oct 03 2017 00:07
@korzo Niiiiice
Woah, the algorithm is only a couple of lines now!
korzo
@korzo
Oct 03 2017 00:08
@caixeta-paula You can collapse it to one line now, but it will be hard to read

return collection.filter(obj => Object.keys(source).every(prop => obj[prop] == source[prop]));
Lucci Paula
@luccipaula
Oct 03 2017 00:09
return collection.filter(obj => Object.keys(source).every(prop => obj[prop] == source[prop]));
Haha oh you beat me
@korzo This is much easier to understand now, thank you 🌟 I was starting to think that I'm way too dumb to solve algorithms properly
CamperBot
@camperbot
Oct 03 2017 00:13
caixeta-paula sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 569 | @korzo |http://www.freecodecamp.com/korzo
korzo
@korzo
Oct 03 2017 00:16
@caixeta-paula No :) It needs some practice . And it's always better to ask or look at some code as waste a day on simple challenge
Lucci Paula
@luccipaula
Oct 03 2017 00:17
@korzo You're right, I was just afraid of bothering others for help on something that was supposed to be easy 😅
korzo
@korzo
Oct 03 2017 00:19
@caixeta-paula That's what this chat is for.
Ayush Bahuguna
@relentless-coder
Oct 03 2017 02:58
const isActive = item => item.active
Would this be a pure function in javascript?
so if I provide it a piece of data, {active: true} it will always return true for that piece of data. that would be a pure function thing, right?
Long Nguyen
@longnt80
Oct 03 2017 03:00
@relentless-coder I think so
Ayush Bahuguna
@relentless-coder
Oct 03 2017 03:01
@longnt80 so a pure function is more about, for a piece of data, it would always return the same value without changing the internal state. so unless and until it doesn't change the state of {active: true} it is a pure function. Am I correct?
Long Nguyen
@longnt80
Oct 03 2017 03:02
that's the definition, yes
Ayush Bahuguna
@relentless-coder
Oct 03 2017 03:03
so as long as it doesn't return {active: false} for {active: true} i am good
I mean, it doesn't change that piece of data
Long Nguyen
@longnt80
Oct 03 2017 03:03
that's right
Ayush Bahuguna
@relentless-coder
Oct 03 2017 03:03
It could return a different object {active: false} but the original {active: true} remains the same
explore1
@explore1
Oct 03 2017 03:32
what does "/[\W_]/"mean ?
Fabien SHAN
@X140hu4
Oct 03 2017 03:38
it is a regular expression
Ayush Bahuguna
@relentless-coder
Oct 03 2017 04:53

Say, I have a module, that goes something like

function test(){
  console.log(a)
}

export {test}

and then I import this in another file where I have something like

import {test} from './test'
let a = 2;
test()

would it work?

h1tag
@h1tag
Oct 03 2017 05:19

Any idea why in this challenge, this code:

function add (bookArr, bookName) {
  return bookArr.push(bookName);
}

function remove (bookArr, bookName) {
  if (bookArr.indexOf(bookName) >= 0) {  
    return bookArr.splice(0, 1, bookName);
    }
}

gives me a bookArr.indexOf is not a function err in this statement var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');

Markus Kiili
@Masd925
Oct 03 2017 05:34
@h1tag What is the return value of push method?
return bookArr.push(bookName); <- you use it here.
h1tag
@h1tag
Oct 03 2017 05:36
@Masd925 oh, right :) they put that way in the challenge, so I figured out that I don't have/need to change it
"Both functions should return an array" :)
@Masd925 thank you
CamperBot
@camperbot
Oct 03 2017 05:38
h1tag sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4517 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Oct 03 2017 05:39
@h1tag Array mutator methods generally return something else than the mutated array (some exceptions exist).
h1tag
@h1tag
Oct 03 2017 05:39
:+1:
黎旭
@haolixu
Oct 03 2017 06:21
heelo
Markus Kiili
@Masd925
Oct 03 2017 06:24
@haolixu Yo.
黎旭
@haolixu
Oct 03 2017 06:26
wooo
i am chinese
you are Finland people?
Markus Kiili
@Masd925
Oct 03 2017 06:29
@haolixu Yes.
黎旭
@haolixu
Oct 03 2017 06:33
Are you that night or afternoon?
should i say that good afternoon?because there is afternoon
Markus Kiili
@Masd925
Oct 03 2017 06:38
@haolixu It is morning here.
Conor Murphy
@cmurphy580
Oct 03 2017 07:11
Does anyone know a resource that will show how to do a grab and toss with a horizontal scroll?
Ankur sharma
@ankur1163
Oct 03 2017 07:16
anyone on mac
i am trying to access mongodb folder via cli
i am in applications folder
but i cannot open mongo folder inside it
Dan Couper
@DanCouper
Oct 03 2017 07:18
Whats the error? Permissions?
cmod if so
chmod 775 -R will recursively set permissions on that and it's subfolders if so
Or 777
chmod 777 -R ./myfolder
Ankur sharma
@ankur1163
Oct 03 2017 07:24
@DanCouper
i cannot acces mongo folder inside applications
if i do
cd mongo
nothing happens
it says
Ankurs-MacBook-Air:Applications ankursharma$ cd mongo
-bash: cd: mongo: No such file or directory
I have mongo folder inside applications
@DanCouper
Ahmad Abdolsaheb
@ahmadabdolsaheb
Oct 03 2017 07:31
@ankur1163 is the folder called mongo? can you see it in the file directory using finder?
Ankur sharma
@ankur1163
Oct 03 2017 07:33
yeah its mongo
@ahmadabdolsaheb
tell me can i put this mongo directory anywhere else?
it will run normal, i am thinking to put it in documents
Ahmad Abdolsaheb
@ahmadabdolsaheb
Oct 03 2017 07:35
in windows, I just had it downloads :)
Ankur sharma
@ankur1163
Oct 03 2017 07:38
lol yeah
Claudio Restifo
@Marmiz
Oct 03 2017 07:55
@ankur1163 in your folder directory try a ls -lah and verify that mongo is actually there. According to bash/shell is not
it may just be a missing trailing /
cd yourmongodir/
even tho shell should pick it anyway
Vuk Đuranović
@VukMNE
Oct 03 2017 07:57
I finally did the no repeats challenge, it feels so good
I am back :)
Ankur sharma
@ankur1163
Oct 03 2017 07:58
let me try @Marmiz
I have moved folder to documents
and i can find directory now
Dan Couper
@DanCouper
Oct 03 2017 08:09
Just out of curiosity, why is mongo in Applications, and why are you accessing Applications via the CLI? Doesn't seem a very common thing to do
Ahmad Abdolsaheb
@ahmadabdolsaheb
Oct 03 2017 08:09

for the following structure, I am trying to update the first array item under options to be ["milk", 1]:

{    
  options:[["milk", 0],
           ["chocolate", 0],
           ["others", 0]],
  timestamp:"2017-09-26T14:42:49.359Z"
  title:"shopping list"
  username:"a"
}

this is the mongoose snippet I use which is right out of the documentations.

router.put('/',(req,res) => {
  let {_id, value, option} = req.body;   
  eventModel.findOneAndUpdate(    
    {_id:_id, options: [option, value]},
    { $set: {"options.$": [option, value + 1]}},
      function(err){
      if(err){
          res.status(400).json({ error: err });
      }
      console.log("event updated");
  });    
});

I always get the "event updated" with no errors but the item does not get updated, any help is appreciated. Thank you

Claudio Restifo
@Marmiz
Oct 03 2017 08:16
@ahmadabdolsaheb i think it return the older document by default, you should probably set to return the updated version in options
let me find the documentation
The operation returns the original document before the update:
Ankur sharma
@ankur1163
Oct 03 2017 08:30
@DanCouper i am following tutorial
now i get this error
Ankurs-MacBook-Air:mongo ankursharma$ ls
GNU-AGPL-3.0        README            bin
MPL-2            THIRD-PARTY-NOTICES    data
Ankurs-MacBook-Air:mongo ankursharma$ sudo chown -R `id -un` /data
chown: /data: No such file or directory
Ankurs-MacBook-Air:mongo ankursharma$
Ahmad Abdolsaheb
@ahmadabdolsaheb
Oct 03 2017 09:00

@Marmiz still confused. even when I set it to return the updated data, the document itself returns null

  eventModel.findOneAndUpdate(
    {_id:_id, options: [option, value]},
    { $set: {"options.$": [option, value + 1]}},
    {new: true},
      function(err, doc){
      if(err){
          res.status(400).json({ error: err });
      }
      console.log(doc);
    });
  });

any thing else comes to mind?

Stephen James
@sjames1958gm
Oct 03 2017 10:04
@ankur1163 /data is different than data
/data is from the root
data is relative to the local directory
Pethaf
@Pethaf
Oct 03 2017 12:16
Any react devs here?
Keith
@7KAG7
Oct 03 2017 13:05
hey everyone, im working on my pomodoro clock and my break timer is count up instead of down, any help would be appreciated:
$(document).ready(function(){
   var buzzer = $("#buzzer")[0];
   var count = parseInt($("#num").html());
   var breakTime = parseInt($("#breakNum").html());

  //console.log(count);
  $("#reset").hide();
  $("#start").click(function(){
  var counter= setInterval(timer, 1000);
  count*=60;
  function timer(){
    //hide variable
    $("#start, #minus5Clock, #add5Clock, #minus5Break, #add5Break, #breakNum, #title1, #title2").hide();
    $("#timeType").html("Session Time:");
    count -=1;
    if(count===0){
      buzzer.play();
      clearInterval(counter);
      var startBreak= setInterval(breakTimer,1000);
      $("#num").hide();
    }   
    if(count%60>=10){
       $("#num").html(Math.floor(count/60)+":"+count%60);
       }
       else{
        $("#num").html(Math.floor(count/60)+":"+"0"+count%60);
       }


    function breakTimer(){
    $("#timeType").html("Chill Time: ");
    $("#breakNum").show();
    breakTime*=60;
      $("#timeType").show();
    breakTime -=1;
    if(breakTime===0){
    clearInterval(startBreak);
    buzzer.play();
    $("#reset").show();
    $("#breakNum, #timeType").hide();

    }
    if(breakTime%60>=10){
       $("#breakNum").html(Math.floor(breakTime/60)+":"+breakTime%60);
       }
       else{
       $("#breakNum").html(Math.floor(breakTime/60)+":"+"0"+breakTime%60);
       }
  }
  }

});

$("#reset").click(function(){
    count=5;
    breakTime=5;
    $("#num").html(count);
    $("#breakNum").html(breakTime);
    $("#start, #minus5Clock, #add5Clock, #minus5Break,#add5break,#num, #breakNum, #title1, #title2").show();
    $("#reset, #timeType").hide();  
  });

$("#minus5Clock").click(function(){
  if(count>5){
  count-=5;
  $("#num").html(count);
 }
});
  $("#add5Clock").click(function(){
  count+=5;
  $("#num").html(count);
});
  $("#minus5Break").click(function(){
  if(breakTime>5){
  breakTime-=5;
  $("#breakNum").html(breakTime);
  }
});
  $("#add5Break").click(function(){
  breakTime+=5;
  $("#breakNum").html(breakTime);
  });
});
just1witness
@just1witness
Oct 03 2017 13:16
@dudeguykid You need to decrement your second variable (--var) inside your set interval function.
@dudeguykid What is your second variable anyway?
do you have one?
Keith
@7KAG7
Oct 03 2017 13:17
breakTime
so i basically need to add this: var counter= setInterval(timer, 1000); but replace it with breakTime
just1witness
@just1witness
Oct 03 2017 13:18
@dudeguykid Just place (--breaktime) in your set interval function that should do it. I would try that first at least
@dudeguykid So it will move at the same interval, but decrement instead of increment
Keith
@7KAG7
Oct 03 2017 13:23
@just1witness i think you lost me, what do you mean by set interval
neeeeeeeeeever mind
i got you
ill let you know if that works
just1witness
@just1witness
Oct 03 2017 13:24
@dudeguykid This
var counter= setInterval(timer, 1000);
  count*=60;
  function timer(){
    //hide variable
    $("#start, #minus5Clock, #add5Clock, #minus5Break, #add5Break, #breakNum, #title1, #title2").hide();
    $("#timeType").html("Session Time:");
    count -=1;
Oh, ok lol
Keith
@7KAG7
Oct 03 2017 13:26
sorry every time i test it takes literally a minute
just1witness
@just1witness
Oct 03 2017 13:27
no worries :)
I did mine already, I know how it is
Keith
@7KAG7
Oct 03 2017 13:29
ive been on this one for waaay to long
and im so close to be done
just1witness
@just1witness
Oct 03 2017 13:29
Mine took me weeks to do. I kind went over the top though. I said I wouldn't do that for the tictactoe one, and now I'm doing it again...
Not for simon though!!!!! ;P
Keith
@7KAG7
Oct 03 2017 13:30
although im mentally giving myself a while to finish the last two front end projects
its addicting, i get that
just1witness
@just1witness
Oct 03 2017 13:31
That's a good idea, they are a little mentally taxing.
Keith
@7KAG7
Oct 03 2017 13:31
just1witness
@just1witness
Oct 03 2017 13:31
I just can't stop trying to ridiculous things, like animations and sound effects.
Keith
@7KAG7
Oct 03 2017 13:32
yuuuup
Dhruv Barochiya
@dbarochiya
Oct 03 2017 13:32

var http = require('http');
var bl = require('bl');

var list = [];
var count = 0 ;
var i ;

process.argv.forEach( function(url,index){
if(index>1){
http.get( url , function ( res ){
res.setEncoding('utf8');
res.pipe(bl(function(err,data){
data = data.toString();
count++;
list[count] = data ;

        if(count == 3 ){
            list.forEach( function(ans) { console.log(ans) ; }) ;
        }
    }))
})
}

})

just1witness
@just1witness
Oct 03 2017 13:32
@dudeguykid One thing I'm noticing, is that you should only need on set interval function, and use it for both of your timers.
@dudeguykid Here's mine...I love purple.
timer
Dhruv Barochiya
@dbarochiya
Oct 03 2017 13:33

var http = require('http');
var bl = require('bl');

var list = [];
var count = 0 ;
var i ;

process.argv.forEach( function(url,index){
if(index>1){
http.get( url , function ( res ){
res.setEncoding('utf8');
res.pipe(bl(function(err,data){
data = data.toString();
count++;
list[count] = data ;

        if(count == 3 ){
            list.forEach( function(ans) { console.log(ans) ; }) ;
        }
    }))
})
}

})
/// it's a code for learnyounode - jugglingAsync i'm getting all responses but i don't know how to print them in same order as requests had been made

just1witness
@just1witness
Oct 03 2017 13:34
I have to go, I'm sorry I won't be able to troubleshoot with you more. Hopefully someone with better knowledge than me comes along . :)
@dudeguykid
Dhruv Barochiya
@dbarochiya
Oct 03 2017 13:35
'code' var http = require('http');
var bl = require('bl');
var list = [];
var count = 0 ;
var i ;
process.argv.forEach( function(url,index){
if(index>1){
http.get( url , function ( res ){
res.setEncoding('utf8');
res.pipe(bl(function(err,data){
data = data.toString();
count++;
list[count] = data ;
if(count == 3 ){
list.forEach( function(ans) { console.log(ans) ; }) ;
}
}))
})
}
})
/// it's a code for learnyounode - jugglingAsync i'm getting all responses but i don't know how to print them in same order as requests had been made
Keith
@7KAG7
Oct 03 2017 13:36
@just1witness i love that the play timer comes first
and yes thats a LOT of purplpe
just1witness
@just1witness
Oct 03 2017 13:37
LOL
@dudeguykid Thanks
CamperBot
@camperbot
Oct 03 2017 13:37
just1witness sends brownie points to @dudeguykid :sparkles: :thumbsup: :sparkles:
:cookie: 356 | @dudeguykid |http://www.freecodecamp.com/dudeguykid
just1witness
@just1witness
Oct 03 2017 13:39
@dudeguykid The work timer actual counts first. I just think in backwards. I am always making things in reverse, lol
Keith
@7KAG7
Oct 03 2017 13:42
hey thanks @just1witness for the help, i have to pretend to do my actual job now instead of working towards one i like
CamperBot
@camperbot
Oct 03 2017 13:42
dudeguykid sends brownie points to @just1witness :sparkles: :thumbsup: :sparkles:
:cookie: 412 | @just1witness |http://www.freecodecamp.com/just1witness
Stephen James
@sjames1958gm
Oct 03 2017 13:47
@Dhruv34788 Use index to store the data list[index] = data
Tai Jones
@taiJones00
Oct 03 2017 14:46
hows the telephone format | telephone format option works for choosing between different telephone formats for the telephone algorithm
Blauelf
@Blauelf
Oct 03 2017 14:53
You mean regular expression alternate matching? string1|string2 would match any of the two things. If you want to have the scope of the | limited, you'd have to use groups, like in I like (cats|dogs)\.
Moisés Man
@moigithub
Oct 03 2017 14:54
| :point_left: means OR
Tai Jones
@taiJones00
Oct 03 2017 14:54
so alteration would be a good solution for choosing between different formats?
in this algorithm?
Mateus Oliveira
@mateusmlo
Oct 03 2017 14:56
hello guys
how do I separate two JSON objects in a variable?
neither , or ; seems to work
Moisés Man
@moigithub
Oct 03 2017 15:01
{} <--- 1 object
{} <-- another object
[ ] <-- an Array
[ { } , { } ] <-- 2 object elements on an array..
arrays elements MUST be separated with commas
Mateus Oliveira
@mateusmlo
Oct 03 2017 15:03
oh wow it passed I was using the wrong symbols and commas
@moigithub thank you!
CamperBot
@camperbot
Oct 03 2017 15:03
mateusmlo sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3650 | @moigithub |http://www.freecodecamp.com/moigithub
Jason Luboff
@JLuboff
Oct 03 2017 15:55
:whale2:
Christopher McCormack
@cmccormack
Oct 03 2017 15:55
@JLuboff that's a big fish!
Jason Luboff
@JLuboff
Oct 03 2017 15:56
Thats a mammal!
Whats the good word?
Christopher McCormack
@cmccormack
Oct 03 2017 15:57
@JLuboff Jelly
i've been trying to get some code working with IE7-IE8 - that's a whole other world of pain...
Jason Luboff
@JLuboff
Oct 03 2017 15:58
I was watching some new show yesterday (Ghosted?) and one guy asked the other if he could get him anything in which he replied "A PB&J, no crust, extra J, no PB" I found it humorous
Lol IE...oh the misery
Markus Kiili
@Masd925
Oct 03 2017 15:58
@cmccormack You stealing mi job?
Christopher McCormack
@cmccormack
Oct 03 2017 15:59
@Masd925 haha probably not, considering I can't seem to get it to work anyhow. There's a bunch of .default code in my bundle and no matter what babel plugins for es3 I install and try to use I can't seem to get it to convert them to ["default"], if that's even the right solution
@JLuboff isn't that just a jelly sandwich? At least toast it and call it toast!
Jason Luboff
@JLuboff
Oct 03 2017 16:02
@cmccormack Lol ya thats why I laughed. Why not just asked for a jelly sammich at that point
Tai Jones
@taiJones00
Oct 03 2017 16:03
var re = /(\d{3})(-)\1\2\d{4}|\1\1\d{4}/;
why does this make telephoneCheck("555-5555") true
555-555-5555
5555555555
these are the only formats I wanted to be true for so far
Christopher McCormack
@cmccormack
Oct 03 2017 16:12
@taiJones00 I believe your or | is only for d{4}|\1 is that your intention?
Tai Jones
@taiJones00
Oct 03 2017 16:13
it's for everything past the |
Christopher McCormack
@cmccormack
Oct 03 2017 16:14
try using parens
Tai Jones
@taiJones00
Oct 03 2017 16:14
still returns true
Christopher McCormack
@cmccormack
Oct 03 2017 16:16
what does
show your code
Tai Jones
@taiJones00
Oct 03 2017 16:17
function telephoneCheck(str) {
  // Good luck!
  //looks like what's in parenthesis is remembered even after | is mentioned
  var re = /(\d{3})(-)\1\2\d{4}|\1\1\d{4}/;
  if (re.exec(str) != null)
    {
      return true;
    }
  else
    {
      return false;
    }
}



telephoneCheck("555-555-5555");
//format | format
Christopher McCormack
@cmccormack
Oct 03 2017 16:20
Sorry my memory is a bit fuzzy about the or, it may split up the whole thing. If it does, then I'm not sure what \1 would match on in the second case
@taiJones00 looks like your second case (after the |) is capturing any grouping of 4 digits
> var re2 = /(\d{3})(-)\1\2\d{4}|\1\1\d{4}/
> re2.test('555')
false
> re2.test('5555')
true
> re2.test('555-5555')
true
> re2.test('555-555')
false
Tai Jones
@taiJones00
Oct 03 2017 16:23
i'm hoping that what's stored in the parenthesis is remembered even after the | is mentioned so I mean \d{3}\d{3}\d{4}
Christopher McCormack
@cmccormack
Oct 03 2017 16:23
don't think it is
besides the logic doesn't make sense even if it did
you want the second condition to match 6 digits then 4 digits?
Tai Jones
@taiJones00
Oct 03 2017 16:25
in the case of 5555555555
Christopher McCormack
@cmccormack
Oct 03 2017 16:25
is that valid?
if so, you'll want to add some (-)? in there somewhere
but like I said earlier I don't think your \1\1 is doing anything in the second condition so try including the (\d{3}) in that condition as well
Moisés Man
@moigithub
Oct 03 2017 16:32
i dont think groups can be used across OR blocks
Marc
@MWBauer
Oct 03 2017 16:38
I'm trying to find a list of the different fonts that can be used without special effort when building an html page
I'm working on my Portfolio and I don't want to use just the same old fonts, ya' know?
piteto
@piteto
Oct 03 2017 16:39
@MWBauer They're called "Web Safe Fonts" https://www.w3schools.com/cssref/css_websafe_fonts.asp
Marc
@MWBauer
Oct 03 2017 16:40
thanks @piteto
CamperBot
@camperbot
Oct 03 2017 16:40
mwbauer sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 184 | @piteto |http://www.freecodecamp.com/piteto
piteto
@piteto
Oct 03 2017 16:40
No problem - there are also web safe colors
Jason Luboff
@JLuboff
Oct 03 2017 16:42
@MWBauer Check out google fonts, thats what I normally use
Marc
@MWBauer
Oct 03 2017 16:42
I can't get any of them to work.
thanks @JLuboff THat's what I was just doing.
CamperBot
@camperbot
Oct 03 2017 16:43
mwbauer sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2212 | @jluboff |http://www.freecodecamp.com/jluboff
Marc
@MWBauer
Oct 03 2017 16:43
I can get the size to wrok.
but I can't get font
I have color...but not font
Christopher McCormack
@cmccormack
Oct 03 2017 16:43
@MWBauer how are you adding them to your css?
Marc
@MWBauer
Oct 03 2017 16:43
I've tried CSS and line
Jason Luboff
@JLuboff
Oct 03 2017 16:43
Make sure you're placing the link to the font in your head (or in codepen in the head section of the settings)
Marc
@MWBauer
Oct 03 2017 16:44
 <style>
    h1 {color: white;}
    h1 {font-family: Aclonica;}
    h1 {font-size: 100px;}
  </style>
  <h1>Marc W. Bauer</h1> <style>
Maybe it' s just been too long but I used to know this.
Christopher McCormack
@cmccormack
Oct 03 2017 16:44
@MWBauer use quotes
look at the example:
p {
    font-family: "Times New Roman", Times, serif;
}
Jason Luboff
@JLuboff
Oct 03 2017 16:45
@MWBauer https://developers.google.com/fonts/docs/getting_started They have further examples here
Christopher McCormack
@cmccormack
Oct 03 2017 16:45
When you select the font in google fonts it tells you how to add it:
font-family: 'Aclonica', sans-serif;
Marc
@MWBauer
Oct 03 2017 16:46
ohj
missed that last part.
Christopher McCormack
@cmccormack
Oct 03 2017 16:46
:)
Marc
@MWBauer
Oct 03 2017 16:46
thanks @cmccormack
CamperBot
@camperbot
Oct 03 2017 16:46
mwbauer sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1225 | @cmccormack |http://www.freecodecamp.com/cmccormack
Marc
@MWBauer
Oct 03 2017 16:51

the other way would be to:

.font-type {
font: "allegro";
}
<h1 class= "font-type">

right?

sorry...font-family
Christopher McCormack
@cmccormack
Oct 03 2017 16:51
@MWBauer you can, sure but you may want to make the class name more specific to the font if you do that
Marc
@MWBauer
Oct 03 2017 16:52
srue
Christopher McCormack
@cmccormack
Oct 03 2017 16:52
@MWBauer .font-allegro or whatever would be much easier to understand when looking at your HTML
Marc
@MWBauer
Oct 03 2017 16:52
I have a text-center working in my div, but I can't hardly get anything else working. I keep looking at the old lessons and I'm doing what they say.....I just don't get it.
why isn't it working?
Christopher McCormack
@cmccormack
Oct 03 2017 16:53
text-center is a bootstrap class, are you using bootstrap?
It uses the following CSS:
text-align: center;
oh I see, you have that working :) what isn't working?
Marc
@MWBauer
Oct 03 2017 16:58
I have Bootstrap 4 enabled
Christopher McCormack
@cmccormack
Oct 03 2017 16:59
@MWBauer ok - what is not working? It's pretty standard to run into lots of issues when you first start, it gets easier as you solve each one
Marc
@MWBauer
Oct 03 2017 17:00
https://codepen.io/MBauer/pen/Jrrwbz
See if you can make heads or tails of it. This seems like it should be the easiest thing.....
Christopher McCormack
@cmccormack
Oct 03 2017 17:00
Better for you to describe what isn't working
Hard for us to understand your intent
Marc
@MWBauer
Oct 03 2017 17:00
@cmccormack I've gone through all of the early lessons. I KNEW how to do this. I just don't know why it isn't working now.
Right now I would like to get the Calligrapher font to work.
Jason Luboff
@JLuboff
Oct 03 2017 17:01
@MWBauer For starters...move any CSS into the CSS pane

@MWBauer Second..

Make sure you're placing the link to the font in your head (or in codepen in the head section of the settings)

Your not linking (importing) the font anywhere

You need to read the docs like suggested

@MWBauer https://developers.google.com/fonts/docs/getting_started They have further examples here

Christopher McCormack
@cmccormack
Oct 03 2017 17:02
what is text-font?
Marc
@MWBauer
Oct 03 2017 17:02
I was trying to find a list of the fonts that don't need importing.
Christopher McCormack
@cmccormack
Oct 03 2017 17:03
@MWBauer like @JLuboff said move your css into your css section of codepen. Also you can use multiple properties within one selector:
h1 {
  color: white;
  font-size: 100px;
}
Marc
@MWBauer
Oct 03 2017 17:07
h1 {
 text: center;
 font: Calligrapher;
  color: white;
  size: 100px;
}
Is better?
Christopher McCormack
@cmccormack
Oct 03 2017 17:08
text:center isn't a thing
Jason Luboff
@JLuboff
Oct 03 2017 17:09
And the font name still needs to be in quotes
Christopher McCormack
@cmccormack
Oct 03 2017 17:09
and bootstrap already has text-center
Marc
@MWBauer
Oct 03 2017 17:09
text-align. got it
Moisés Man
@moigithub
Oct 03 2017 17:09
size also need to be fixed
Christopher McCormack
@cmccormack
Oct 03 2017 17:09
@cmccormack here I cloned it for you with some cleanup: https://codepen.io/cmccormack/pen/PJJVXd look at the code as well as the Settings > HTML > Head section
Marc
@MWBauer
Oct 03 2017 17:09
The font is quoted and it's not changing
Christopher McCormack
@cmccormack
Oct 03 2017 17:10
font-family
@MWBauer your closing tags are all off too - you're opening new tags before you close the old ones. Also your <li> tags aren't closed for languages
Kelechi Chinaka
@ke1echi
Oct 03 2017 17:16
can i get -325 to be [-333, -222, -555] with regex?
just1witness
@just1witness
Oct 03 2017 17:20
@kelechy Yes. Use -325.replace(your regex here, -333, -222, -555);
Moisés Man
@moigithub
Oct 03 2017 17:21
pick 3 from first array element
pick 2 from second arr elem
pick 5 from third arr elem
= 325
but since those are 3 separated elements..
probably .toString() then find a pattern
Marc
@MWBauer
Oct 03 2017 17:23
I'm trying to use the allegro font. where do I find if it has serif, etc?
Christopher McCormack
@cmccormack
Oct 03 2017 17:26
@MWBauer Are you importing it from somewhere?
Marc
@MWBauer
Oct 03 2017 17:27
It was on the google font list
do I need to import from google?
Where can I find a list of native fonts?
Jason Luboff
@JLuboff
Oct 03 2017 17:28
@cmccormack See your DM's
Marc
@MWBauer
Oct 03 2017 17:28
Not just safe ones, but fonts that I don't need to import
Christopher McCormack
@cmccormack
Oct 03 2017 17:28
@MWBauer when you select a font in google fonts it has a little floating item at the bottom you can select and it tells you how to import
piteto
@piteto
Oct 03 2017 17:32
@MWBauer I showed you the list earlier - you don't have to import these fonts: https://www.w3schools.com/cssref/css_websafe_fonts.asp
If you want a font that is not listed on that page, you will need to import it.
Marc
@MWBauer
Oct 03 2017 17:32
I ventured into the google fonts link at the bottom.
piteto
@piteto
Oct 03 2017 17:33
get the link to the font, click "Settings", click "CSS" and paste it in. For example with Roboto: https://fonts.googleapis.com/css?family=Roboto
Then in your CSS, use font-family: 'Roboto', sans-serif; wherever you want that font
Alexander Køpke
@alexanderkopke
Oct 03 2017 17:34
domo arigato, mr Roboto. Beep beep!
piteto
@piteto
Oct 03 2017 17:34
What's an example of "sugaring" in JavaScript?
I ran across that term and can't seem to find any references that give examples
Christopher McCormack
@cmccormack
Oct 03 2017 17:35
@piteto Syntactic Sugar?
piteto
@piteto
Oct 03 2017 17:35
I'm sure it's referencing that, but I see "sugaring" and "de-sugaring"
I get the concept of syntactic sugar, I think, like using $.getJSON instead of $.ajax
but can't seem to think of any examples in vanilla js
Christopher McCormack
@cmccormack
Oct 03 2017 17:36
I think that's more of a convenience function actually
piteto
@piteto
Oct 03 2017 17:36
maybe, .map() instead of a for loop with .push()?
Christopher McCormack
@cmccormack
Oct 03 2017 17:36
that's just a method I believe :)
piteto
@piteto
Oct 03 2017 17:37
or fetch() instead of XMLHttpRequest?
or is that just an API? lol
Christopher McCormack
@cmccormack
Oct 03 2017 17:37
I can't think of any for JavaScript but I know Python has stuff like decorators
piteto
@piteto
Oct 03 2017 17:38
I should re-visit python again
Christopher McCormack
@cmccormack
Oct 03 2017 17:38
fetch is a different module
I don't really like fetch very much, could have been so much better than it is
piteto
@piteto
Oct 03 2017 17:39
I guess it's a superset of that functionality with promises built in
Christopher McCormack
@cmccormack
Oct 03 2017 17:40
fetch is fine if you don't want to import anything but I've rarely ever needed to pull something that didn't require parameters and I don't think fetch allows for parameters
piteto
@piteto
Oct 03 2017 17:41
yeah, just headers, cache control I think
Christopher McCormack
@cmccormack
Oct 03 2017 17:41
And most of the time I'm using something that uses jquery as a dependency anyway so might as well use jquerys awesome methods or axios if no jquery
piteto
@piteto
Oct 03 2017 17:42
yeah, a lot of people bash on it, but jQuery definitely has its uses
Markus Kiili
@Masd925
Oct 03 2017 17:43
@piteto Classes?
piteto
@piteto
Oct 03 2017 17:43
my searches for sugaring ended up directing me to dessert places to eat
Christopher McCormack
@cmccormack
Oct 03 2017 17:43
yum!
@alexanderkopke Hi btw!
piteto
@piteto
Oct 03 2017 17:44
@Masd925 That's a great example
Thanks @cmccormack @Masd925
CamperBot
@camperbot
Oct 03 2017 17:44
piteto sends brownie points to @cmccormack and @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 1226 | @cmccormack |http://www.freecodecamp.com/cmccormack
:star2: 4520 | @masd925 |http://www.freecodecamp.com/masd925
Alexander Køpke
@alexanderkopke
Oct 03 2017 17:45
hi!
Marc
@MWBauer
Oct 03 2017 17:46
h1 {
  color: white;
  font-size: 100px;
  font-family: "Impact, Charcoal, sans-serif";
  }
Does that look right on the font?
Moisés Man
@moigithub
Oct 03 2017 17:48
those are 3 separated fonts... dont wrap on a single set of quotes
Take a look if you want. Getting closer.
This is the kind of thing that is difficult for me. But I'm getting it.
piteto
@piteto
Oct 03 2017 17:49

<family-name>
The name of a font family. For example, "Times" and "Helvetica" are font families. Font family names containing whitespace should be quoted.

<generic-name>
Generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent when none of the specified fonts are available. Generic family names are keywords and must not be quoted. A generic font family should be the last item in the list of font family names. The following keywords are defined:

Quotes around custom fonts with spaces, no quotes around generic fonts
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 17:49
hello everyone
Christopher McCormack
@cmccormack
Oct 03 2017 17:49
@tiagocorreiaalmeida heya
Jason Luboff
@JLuboff
Oct 03 2017 17:49
Hello
Moisés Man
@moigithub
Oct 03 2017 17:50
ola
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 17:51
@JLuboff did you created some kind of cron to clean the db of the url shortener service or just let it there?
Jason Luboff
@JLuboff
Oct 03 2017 17:51
@tiagocorreiaalmeida No, not at all
Marc
@MWBauer
Oct 03 2017 17:51
I need to eat and go cut the grass. If I can I'm gonna' work on buttons later.
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 17:53
I really dont know seems like pasting my code here brings the solution to me? :D
Christopher McCormack
@cmccormack
Oct 03 2017 17:54
@MWBauer see ya
Jason Luboff
@JLuboff
Oct 03 2017 17:54
@tiagocorreiaalmeida I did this: app.get(/\/\b\d{4}\b/, function(req, res){ I use a 4 digit random number and thus my route specifically looks for 4 digits (I think...someone helped me iwth it, I suck at regex haha)
@cmccormack Way to check your PM's
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 17:54
I might be wrong but what I have handles unlimited numbers range
just needs to be a number i nstart and 1 in the end
might be wrong tought
Jason Luboff
@JLuboff
Oct 03 2017 17:55
I think you are
(handling unlimited number range that is)
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 17:55
/^(\d+)$/
force the start and end of it to be a number
and says number one or more
I think
im bad withj regex aswell I just use a website called regex 101 xd
@cmccormack can you have an eye on this?
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:03
@JLuboff found out was missing the most important part the / to the routh xd
rout*
Jason Luboff
@JLuboff
Oct 03 2017 18:04
;)
Christopher McCormack
@cmccormack
Oct 03 2017 18:04
@tiagocorreiaalmeida not sure what you're dong but you don't really need it to be a capturing group do you?
@tiagocorreiaalmeida your regex just says the whole string has to be nothing but digits from start to end
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:05
I need after to get it as a header parameter I failed there cause when you write rout you need ot say /something
and I was just saying something
:D
Jason Luboff
@JLuboff
Oct 03 2017 18:10
Oh man...getting so close to finishing my trading app..soooo close
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:12
did you made it about books aswell?
Jason Luboff
@JLuboff
Oct 03 2017 18:12
No, games
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:18
good one
Jason Luboff
@JLuboff
Oct 03 2017 18:18
You can see it in its current iteration here: https://gametrader.glitch.me/
Not all functionality is there yet. And its not using the correct theme
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:20
notify me when yo uget it uploaded with all the changes you have locally looks a good idea tradding game app
Jason Luboff
@JLuboff
Oct 03 2017 18:21
I'll be honest.. I saw someone else did a game trading app instead of book trading and took their idea haha but I've built it all myself and found my own api, etc
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:24
correct me if im wrong when you use .save() on mongoose after on the .then((variable)
doenst the varaible holds the input you set to the db?
maybe im wrong
missing this and 1 more thing got get the url service done
Jason Luboff
@JLuboff
Oct 03 2017 18:24
Not sure. If @moigithub is around, he should though
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:37
@JLuboff can I paste some lines of code and you see if you see any none matchted promise?
Jason Luboff
@JLuboff
Oct 03 2017 18:38
Sure
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:42
ok got this working had some feew issues, only used promises 1 or two times but they are quite good for chaining so I started to use it, well solved so thanks :) , holw long have you been coding?
Jason Luboff
@JLuboff
Oct 03 2017 18:43
I started FCC In May 2016. I had done some website work when I was younger (html/css) and along the way have done little bits and pieces of coding, but never to the point of understanding that I have now (which still isn't great haha)
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:45
do you work or study? if I may ask
Jason Luboff
@JLuboff
Oct 03 2017 18:47
Work full time, study while at work
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:47
related to programming?
Jason Luboff
@JLuboff
Oct 03 2017 18:47
Sort of? I work in IT
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:47
lel same here I would say
:D
Jason Luboff
@JLuboff
Oct 03 2017 18:48
You work in IT
?
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:49
yeah but they kinda make me do designer stuff aswell and I have 0 knowledge about it lel plus video editing and others stuffs that makes no sense at all, had a bit of knowledge about html/css and even php before comming back to it cause this kinda of job is I dont know and always liked to program butseems I was missing the movitation, now got tons of it
Jason Luboff
@JLuboff
Oct 03 2017 18:52
Gotcha. Ya I'm low-man on the totem pole here but a jack of all trades. I'm the helpdesk, new computer setup, deal with inventory, basic/intermediate troubleshooting for network/server stuff, maintain the company intranet and internet pages, etc. Working on getting into SQL to take over that
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:53
I know a bit of sql aswell normal queries using where to get data related from one table to another and that kinda of stuff
I used to use it with php
Jason Luboff
@JLuboff
Oct 03 2017 18:54
Ya I have that basic understanding, but I need to get into more advanced stuff with it. I'm actually taking the MTA: Database test tomorrow but starting next year will be working on MCSA for SQL
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:55
nice, do you intend to keep that job or become more of programmer?
got the url shortener done finally :D
Jason Luboff
@JLuboff
Oct 03 2017 18:56
Goal is to take over the SQL programming position. So I would be the DBA and handle the inhouse built programs (albeit, hopefully move away from their current platform)
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:56
sounds nice hope everythings goes as planned
image.png
is it normal that localhost doesnt turn into a link there right?
Jason Luboff
@JLuboff
Oct 03 2017 18:57
@tiagocorreiaalmeida Thanks
CamperBot
@camperbot
Oct 03 2017 18:57
jluboff sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 376 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:57
probably cause lacks the http protocl and stuff right?
Jason Luboff
@JLuboff
Oct 03 2017 18:57
Ya sounds about right..
Move it to Heroku or Glitch and see what happens (and mlab for the db)
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 18:58
yeah about to do that
in a real world situation I think I would set a datetime associated with the url and everytime a user would make a request I would check all ther records thaat the time passed some limit I would define and clean them
Jason Luboff
@JLuboff
Oct 03 2017 19:00
Why though? What if they keep using it, then all of a sudden.. POOF! Doesn't work anymore
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:00
or have a really bigger db :D
Jason Luboff
@JLuboff
Oct 03 2017 19:08
Meh...the document size is KB...going to take a lot of documents to make it a problem ;)
legendinraze
@legendinraze
Oct 03 2017 19:11
var userData = {
  1: true,
  2: true,
  3: "00QRA10",
  4: "slimer42",
  5: "FFASN9111871-USN16"
};
// Create a new array and add the info from above using just the keys.
userDataArray =  {
  [0, 1, 2, 3, 4,]
};
What's wrong?
We need to transfer the data from the javascript object to the left into an array. Initialize a new array called userDataArray and add all of the data from the object into the array by calling it from the object using the number keys that have been added to the object. When you are done, you should have the same data from the object that has already been written, but in an array, without having to retype each of the variables separately.
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:12
im coping a bit of the info of the fcc info about the working of the url shorener
no idea what to write :D
you are making an object
the idea would be create and empty array
Pieter Stokkink
@forkerino
Oct 03 2017 19:13
@legendinraze there's a key 5 in the object, but not in the array
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:13
and then push the values from the object
userData .1
or this
hey @forkerino !!
Pieter Stokkink
@forkerino
Oct 03 2017 19:14
@tiagocorreiaalmeida good evening!
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:14
how are you ?
Pieter Stokkink
@forkerino
Oct 03 2017 19:16
I'm getting ready to move house. Get the keys tomorrow and been packing lots of stuff. Already tired of it, to be honest
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:16
but feels great for sure :D
Stephen James
@sjames1958gm
Oct 03 2017 19:16
@forkerino I feel you, moved from house to apt. last month and moving from apt. to house next month :(
Pieter Stokkink
@forkerino
Oct 03 2017 19:17
@sjames1958gm ouch, that sucks. I am looking forward to having moved, but the process itself is something I enjoyed in my twenties. Not so much anymore.
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:39
@JLuboff https://fcc-url-shortener-2017.herokuapp.com/ what do you think?
Walid Ashri
@walidashri
Oct 03 2017 19:40
@sjames1958gm Hey
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:51
anyone?
image.png
Christopher McCormack
@cmccormack
Oct 03 2017 19:56
@tiagocorreiaalmeida tried it without -u?
@tiagocorreiaalmeida did you commit?
@tiagocorreiaalmeida says at the top those items are waiting to be committed
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 19:58
yeah the proble mwas that forgot the simpler part
cause had an issue with a repo and then setted up a new one
and forgot that :p
Christopher McCormack
@cmccormack
Oct 03 2017 19:58
heh it happens
I forgot to push the other day and spent a half hour merging conflicts! Don't forget to sync when using multiple machines!
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 20:02
yeah, tbh not the first time I forget to cmmit and lose quite some time trying to figure out what I didw rogn xd
Christopher McCormack
@cmccormack
Oct 03 2017 20:03
add/commit/push is most of what you need to remember :)
Stephen James
@sjames1958gm
Oct 03 2017 20:16
@walidashri Hey, long time no see!
Jason Luboff
@JLuboff
Oct 03 2017 20:17
@tiagocorreiaalmeida Good job, works as intended it appears :+1:
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 20:17
thanks :D
at least now I know how all those things works
Jason Luboff
@JLuboff
Oct 03 2017 20:19
@tiagocorreiaalmeida Here's mine https://surl-jluboff.herokuapp.com/
legendinraze
@legendinraze
Oct 03 2017 20:29
can someone help with method
Ronique Ricketts
@RoniqueRicketts
Oct 03 2017 20:30
what method
legendinraze
@legendinraze
Oct 03 2017 20:30
ar counting = {
  up:function(num1,num2)
  console.log(num1+num2);
};
down:function(num1,num2)
console.log(num1-num2);
a = 100;
b = 1;
Stephen James
@sjames1958gm
Oct 03 2017 20:31
@legendinraze Your function has to have {}
legendinraze
@legendinraze
Oct 03 2017 20:31
not in the video im watching
and it does at the top
Stephen James
@sjames1958gm
Oct 03 2017 20:32
You have to have a { after the parameters and before the function code.
var counting = {
  up:function(num1,num2)
  console.log(num1+num2);
};
Uncaught SyntaxError: Unexpected identifier
legendinraze
@legendinraze
Oct 03 2017 20:34
ok I think I got it
var counting = {
  up:function(num1,num2){
  console.log(num1+num2);
},

down:function(num1,num2){
console.log(num1-num2);
},
};
var a = 100;
var b = 1;
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 20:39
@JLuboff looks great, time for some katas I guess
legendinraze
@legendinraze
Oct 03 2017 20:39
I only have countingObject correct, missing "upMethod"
and "downMethod"
fixed the numbers
Sewwandi Dharmapriya
@SewwandiD
Oct 03 2017 20:43

//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
var first = contacts.hasOwnProperty(firstName);
var second = contacts.hasOwnProperty(prop);

if((first)&&(second)){
  return contact.prop();
}else if(!first){
  return "No such contact";
}

    return "No such property";      

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Hi, I'm struggling with this code, Can someone help me please!
Diego Mayer
@Chrono79
Oct 03 2017 20:48
@SewwandiD contacts is an array
Sewwandi Dharmapriya
@SewwandiD
Oct 03 2017 20:48
yes
Diego Mayer
@Chrono79
Oct 03 2017 20:48
you need to check its elements, so using a loop comes to mind
check again the previous object related challenges
surferpilgrim
@surferpilgrim
Oct 03 2017 20:50
hey is there a binary code for an empty space?
Diego Mayer
@Chrono79
Oct 03 2017 20:50
return contact.prop(); <- this is wrong, contact doesn't exist
and prop is not a function
see how to access an object property using a var
@surferpilgrim explain what you're trying to do
Walid Ashri
@walidashri
Oct 03 2017 20:57
@Chrono79 que tal?
DistinctWolf
@DistinctWolf
Oct 03 2017 20:58
Why is this wrong, the only difference between the expected answer and my algorithm answer is 1 cent
function checkCashRegister(price, cash, cid) {
  var change = cash - price;
  var obj = {
    "ONE HUNDRED": 100.00,
    "TWENTY": 20.00,
    "TEN": 10.00,
    "FIVE": 5.00,
    "ONE": 1.00,
    "QUARTER": 0.25,
    "DIME": 0.10,
    "NICKEL": 0.05,
    "PENNY": 0.01
  };
  var result = [];
  var original=[];
  var holder = [];
  var bills={};
  for (var i = 0; i < cid.length; i++) {
    holder.push(cid[i][1]);
    original.push(cid[i][1]);
    bills[cid[i][0]]=cid[i][1];
  }
  for (var j in obj) {
    while (change >= obj[j]) {
    bills[j]-=obj[j];
   if(bills[j] < 0){
      break;
     }else{
       change -= obj[j];
      result.push(obj[j]);
     }
    }
  }
  for (var z = 0; z < result.length; z++) {
    switch (result[z]) {
      case 0.01:
        holder[0] -= result[z];
        break;
      case 0.05:
        holder[1] -= result[z];
        break;
      case 0.1:
        holder[2] -= result[z];
        break;
      case 0.25:
        holder[3] -= result[z];
        break;
      case 1.0:
        holder[4] -= result[z];
        break;
      case 5.0:
        holder[5] -= result[z];
        break;
      case 10.0:
        holder[6] -= result[z];
        break;
      case 20.0:
        holder[7] -= result[z];
        break;
      case 100.0:
        holder[8] -= result[z];
        break;
      default:
        return "currency not found";
    }
  }
  var final=[];
 for(var a=0;a<original.length;a++){
   if(original[a]!=holder[a]){
     var diff=original[a]- holder[a];
     final.push([cid[a][0],parseFloat(diff.toFixed(2))]);
   }
 }
 return final;
}
checkCashRegister(3.26, 100.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
Sewwandi Dharmapriya
@SewwandiD
Oct 03 2017 20:58
@Chrono79 Thank you so much!
CamperBot
@camperbot
Oct 03 2017 20:58
sewwandid sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4566 | @chrono79 |http://www.freecodecamp.com/chrono79
surferpilgrim
@surferpilgrim
Oct 03 2017 20:58
@Chrono79 replacing binary characters with alphabet characters, just checking if there was a binary character for an empty space,because I tried googling it but it gave me answers for something else
Sewwandi Dharmapriya
@SewwandiD
Oct 03 2017 20:59
I've got through
Diego Mayer
@Chrono79
Oct 03 2017 20:59
:+1:
@walidashri :wave:
Gersho
@Gersho
Oct 03 2017 21:00
@FlashHero floating point maths
Nicholas Losco
@Nicholas11382
Oct 03 2017 21:00
does anyone know how to post to FCC forum?
DistinctWolf
@DistinctWolf
Oct 03 2017 21:01
@Gersho explain please I don't understand what do you mean?
Diego Mayer
@Chrono79
Oct 03 2017 21:01
@FlashHero not all decimal numbers can be represented, so you better work in cents to avoid that problem
cody j Green
@codyjgreen
Oct 03 2017 21:01
how would i go about making this into a function i am just super lost as to how?
var turns = 5;

while (turns > 0) {
  var answer6 = prompt(user + ' Can you guess how old I am? answer with a number between 1 - 50. ');
  console.log(' guess age ');
  if (answer6 < 28) {
    alert( 'too small');
    turns = turns - 1;

  }else if (answer6 > 28 ) {
    alert ('too big!');
    turns = turns - 1;
  }
  else {
    alert ('that is exactly right!');
    userPoints += 1;
    break;
  }
}

alert( user + ' you have ' + userPoints + ' Points! ');
console.log(userPoints + ' Points ');
Gersho
@Gersho
Oct 03 2017 21:02
@FlashHero javascript doesn't handle very well doing maths with decimals, google "javascript floating point errors" to get a detailled idea and possible solutions, since we're talking about money (2 decimals) the best is to work with cents (*100)
surferpilgrim
@surferpilgrim
Oct 03 2017 21:04

Also an unrelated question
does anyone know how to type into the code editor so it won't delete anything
example i try to change this :

var str1=anoherArr.join("");

into this:

var str1=anotherArr.join("");

but when I try to add that t it deletes the next character as I type in a new one
I'd like to be able to add letters in the middle of a line of code without it deleting the next letters,this is a problem I have only in the code editor

Gersho
@Gersho
Oct 03 2017 21:05
@surferpilgrim insert
surferpilgrim
@surferpilgrim
Oct 03 2017 21:05
@Gersho where is than on the keyboard, I have a windows computer
Diego Mayer
@Chrono79
Oct 03 2017 21:06
@surferpilgrim the key that says insert
DistinctWolf
@DistinctWolf
Oct 03 2017 21:06
@Gersho @codyjgreen thanks i'll try to solve it now
CamperBot
@camperbot
Oct 03 2017 21:06
flashhero sends brownie points to @gersho and @codyjgreen :sparkles: :thumbsup: :sparkles:
:cookie: 100 | @codyjgreen |http://www.freecodecamp.com/codyjgreen
:cookie: 501 | @gersho |http://www.freecodecamp.com/gersho
Diego Mayer
@Chrono79
Oct 03 2017 21:06
normally above the 4 directional arrows
Gersho
@Gersho
Oct 03 2017 21:06
in the 2*3 block between the alphabet and the numpad
surferpilgrim
@surferpilgrim
Oct 03 2017 21:06
@Chrono79 is ins short for it?
Diego Mayer
@Chrono79
Oct 03 2017 21:06
yes
press it once and try again
Gersho
@Gersho
Oct 03 2017 21:07
could be anything depending on your country
Diego Mayer
@Chrono79
Oct 03 2017 21:07
or the keyboard maker
but I doubt ins stands for anything else
Gersho
@Gersho
Oct 03 2017 21:07
true
i still don't know what the one between print screen and pause is supposed to do xD
Diego Mayer
@Chrono79
Oct 03 2017 21:09
it was useful in DOS times
Gersho
@Gersho
Oct 03 2017 21:10
and it's still here xD
Diego Mayer
@Chrono79
Oct 03 2017 21:10
if you want to see it in action today, open an excel file, click over one cell, and press scroll lock
now use the arrows
cody j Green
@codyjgreen
Oct 03 2017 21:13
can anyone show me how to make this into a function?
var turns = 5;

while (turns > 0) {
  var answer6 = prompt(user + ' Can you guess how old I am? answer with a number between 1 - 50. ');
  console.log(' guess age ');
  if (answer6 < 28) {
    alert( 'too small');
    turns = turns - 1;

  }else if (answer6 > 28 ) {
    alert ('too big!');
    turns = turns - 1;
  }
  else {
    alert ('that is exactly right!');
    userPoints += 1;
    break;
  }
}

alert( user + ' you have ' + userPoints + ' Points! ');
console.log(userPoints + ' Points ');
Gersho
@Gersho
Oct 03 2017 21:13
apparently it can even be used in a terminal
Diego Mayer
@Chrono79
Oct 03 2017 21:14

@codyjgreen

function yourFunction() {
... //all that code here
}
yourFunction();

Without knowing what do you need, that is a valid answer

cody j Green
@codyjgreen
Oct 03 2017 21:16
@Chrono79 ok, yeah im working on this assignment where we have to conver the questions we made like above to functions to make our code more dry.
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:16
so
cody j Green
@codyjgreen
Oct 03 2017 21:16
Thanks, @Chrono79
CamperBot
@camperbot
Oct 03 2017 21:16
codyjgreen sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4567 | @chrono79 |http://www.freecodecamp.com/chrono79
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:16
make a function, and put your code inside, and when needed, call out that function
so like this
function hello() {
sorry
function hello() {
document.write("hello");
}
THEN CALL OUT THE FUNCTION
hello();
sorry, I didn't see @Chrono79 example
hope that still helps
DistinctWolf
@DistinctWolf
Oct 03 2017 21:18
@Gersho @Chrono79 so, do i have to convert the dollars into cents for example $10 becomes 1000 cents right and cents stay the same
Diego Mayer
@Chrono79
Oct 03 2017 21:18
@FlashHero yes
cody j Green
@codyjgreen
Oct 03 2017 21:19
Ok, cool. no problem yeah man I’m totally into as much explanation as i can get. Thanks @Isaiah1028
CamperBot
@camperbot
Oct 03 2017 21:19
codyjgreen sends brownie points to @isaiah1028 :sparkles: :thumbsup: :sparkles:
:cookie: 122 | @isaiah1028 |http://www.freecodecamp.com/isaiah1028
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:19
@codyjgreen np
A good place you could go for literal interaction with your videos to learn about functions is khan academy
DistinctWolf
@DistinctWolf
Oct 03 2017 21:19
@Chrono79 then, when writing out the actual result, i'll have to convert it back to dollars right?
Diego Mayer
@Chrono79
Oct 03 2017 21:19
exactly
DistinctWolf
@DistinctWolf
Oct 03 2017 21:20
ok @Chrono79 thanks
CamperBot
@camperbot
Oct 03 2017 21:20
flashhero sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4568 | @chrono79 |http://www.freecodecamp.com/chrono79
Gersho
@Gersho
Oct 03 2017 21:20
@FlashHero yes, the idea is that all math will be done with integers, to avoid the floating points errors, and then return to the dollar format to answer
cody j Green
@codyjgreen
Oct 03 2017 21:20
now i know there has to be a better way to write the question in the first place. any advice for how i should structure this question better?
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:21
hm....
just make example
examples, pardon me
but just try to be as descrptive AP, it is hard though because we are online, and we can't verbally say everything, but just be as specific as possible
Gersho
@Gersho
Oct 03 2017 21:22
stay in the chat and look how people ask their stuff and if they are asked additional details or not
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:22
yea
DistinctWolf
@DistinctWolf
Oct 03 2017 21:22
@Gersho ok thanks
CamperBot
@camperbot
Oct 03 2017 21:22
flashhero sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
api offline
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:22
couldn't have said it better @Gersho
Gersho
@Gersho
Oct 03 2017 21:22
you'll learn stuff while reading other people troubles too (and maybe even help !)
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:23
is there a chat for help with ruby
Gersho
@Gersho
Oct 03 2017 21:23
rooms
CamperBot
@camperbot
Oct 03 2017 21:23

freeCodeCamp rooms:

:point_right: Here is a list of our official chat rooms
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:23
I guess, I don't need help, but a better explanation for something
DistinctWolf
@DistinctWolf
Oct 03 2017 21:28
@Gersho @Chrono79 do you guys think that i might have to use the Math.round() because when i actually try to convert it to cents, there's a float point and gives me decimal
Gersho
@Gersho
Oct 03 2017 21:29
yes
Diego Mayer
@Chrono79
Oct 03 2017 21:29
@FlashHero to convert to cents, you have to multiply by 100 (and use Math.round(), yes)
Gersho
@Gersho
Oct 03 2017 21:29
because errors can pop when doing *100 (since it is a float you multiply) so rounding eleminates that
best is to console log the change every step of the way so you can see where it goes wrong
DistinctWolf
@DistinctWolf
Oct 03 2017 21:30
ok
DistinctWolf
@DistinctWolf
Oct 03 2017 21:46
Is there a way to make money by using my coding skills
Considering the fact that I'm in 10th grade
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 21:47
build somewebistes for companys or some cooffe or restaurante around you that doenst hold one
seems hard cause people always told me this but I never had the courage to walk to people and ask them ahaha
Diego Mayer
@Chrono79
Oct 03 2017 21:48
@FlashHero how old are you?
DistinctWolf
@DistinctWolf
Oct 03 2017 21:48
15 years old
Diego Mayer
@Chrono79
Oct 03 2017 21:51
While making some money at that age is a good idea, I would say enjoy the last few years of freedom you have left, but because I don't know your economic situation... I'd say go for it, try doing something easy, fix some small things in already made websites
Isaiah Trembley
@IsaiahCT
Oct 03 2017 21:54
I am 13
boioioioios
DistinctWolf
@DistinctWolf
Oct 03 2017 21:54
@tiagocorreiaalmeida @Chrono79 later this year I might build something for a small business people when I feel more comfortable with backend nodejs, I can manage a basic website with node but I don't feel confident enough in backend
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:15
@Chrono79 around?
function backwardsPrime(start, stop){
var result = [];
  while(start < stop){
    if(isPrime(start)){
      if(start !== Number(start.toString().split("").reverse().join(""))){
        if(isPrime(start.toString().split("").reverse().join(""))){
          result.push(start);
      }
      }
    }
        start ++;
  }
  return result;
}

var isPrime = (num) => {
  num = Number(num);
  for(var i = 2; i < num; i++)
    if(num % i === 0) return false;
  return num !== 1;
}
look at this mess :D
anyway can you see wwhat im missing?
Gersho
@Gersho
Oct 03 2017 22:25
the person coming up with this challenges is messed up xD
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:25
I have some alot more strange than thsi one
and couldnt think of any other idea xd
Expected: '[1095047, 1095209, 1095319, 1095403]', instead got: '[1095047, 1095209, 1095319]'
this is whre it fails
no idea why I dont get the number back
piteto
@piteto
Oct 03 2017 22:25
isPrime should be above your backwardsPrime function
but hmmm.....don't see why it's failing :/
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:28
yeah strange thing tought
it takes 2 long to request
piteto
@piteto
Oct 03 2017 22:28
you can also do math.sqrt(num) in your isPrime() function to make it a little more efficient and combine your if statements.
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:28
4,5sec
will have to rewrite this entirely
piteto
@piteto
Oct 03 2017 22:28
const isPrime = num => {
    if (num < 2) return false;
    for (let i = 2; i < Math.sqrt(num); i++) if (num % i === 0) return false;
    return true;
};
that might run a little faster
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:29
and somehow that passed the test
xd
piteto
@piteto
Oct 03 2017 22:29
lmao
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:29
wait nm
it didnt
arggg
was just runing the samples
sorry false hopes
ahah
now evne fails 3 tests
piteto
@piteto
Oct 03 2017 22:30
start <= stop?
now only two failures
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:31
@piteto
this does it
function backwardsPrime(start, stop){
var result = [];
  while(start <= stop){
    if(isPrime(start)){
      if(start !== Number(start.toString().split("").reverse().join(""))){
        if(isPrime(start.toString().split("").reverse().join(""))){
          result.push(start);
      }
      }
    }
        start ++;
  }
  return result;
}

var isPrime = (num) => {
  num = Number(num);
  for(var i = 2; i < num; i++)
    if(num % i === 0) return false;
  return num !== 1;
}
jesus if were you how would you handle this?such messy thing xd
piteto
@piteto
Oct 03 2017 22:32
I don't know what you're doing different lol, I have it slightly simpler as:
const isPrime = num => {
    if (num < 2) return false;
    for (let i = 2; i < Math.sqrt(num); i++) if (num % i === 0) return false;
    return true;
};

function backwardsPrime(start, stop) {
    const result = [];
    while (start <= stop) {
        let reverseNum = +start.toString().split("").reverse().join("");
        if (isPrime(start) && isPrime(reverseNum) && reverseNum !== start) result.push(start);
        start++;
    }
    return result;
}
but that fails two tests
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:32
change to my is prime func
and good idea next the two ifs
didnt come up with that was so concentrated in the idea of checking values xd
piteto
@piteto
Oct 03 2017 22:33
Expected: '[]', instead got: '[70001]'
all pass except that one ^
Okay, figured it out:
var isPrime = num => {
  if (num < 2) return false;
  for (var i = 2; i < num / 2; i++) if (num % i === 0) return false;
  return true;
};

function backwardsPrime(start, stop) {
  const result = [];
  while (start <= stop) {
    let reverseNum = +start.toString().split("").reverse().join("");
    if (isPrime(start) && isPrime(reverseNum) && reverseNum !== start) result.push(start);
    start++;
  }
  return result;
}
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:37
function backwardsPrime(start, stop){
var result = [];
  while(start <= stop){
  let reverseNumber = start.toString().split("").reverse().join("");
      if(isPrime(start) && isPrime(reverseNumber) && start!==Number(reverseNumber)) result.push(start);
        start ++;
  }
  return result;
}

var isPrime = (num) => {
  num = Number(num);
  for(var i = 2; i < num; i++)
    if(num % i === 0) return false;
  return num !== 1;
}
I updated mine to this
thanks to your idea
piteto
@piteto
Oct 03 2017 22:39
2818ms for mine, now to check the one liner in the solutions lol
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:39
for what I saw there's no one liner solutions xd
4444ms
our solution is quite short tbh
not sure about the others performance still
legendinraze
@legendinraze
Oct 03 2017 22:40
var counting = {
  up:function(num1){
  console.log(num1)
},

down:function(num100){
  console.log(num100)
},
},


 a = 1;
b = 100;
counting.up(a,b)
counting.down(a,b)
piteto
@piteto
Oct 03 2017 22:40
I did (i < num / 2) in the isprime function
legendinraze
@legendinraze
Oct 03 2017 22:41
only got countingObject right.
piteto
@piteto
Oct 03 2017 22:41
still baffled while sqrt didn't work though, hmm
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:42
yeah im always newbiw with this primes thing I always search for some already made function sadly
tbh I avoid it :')
piteto
@piteto
Oct 03 2017 22:44
@legendinraze what answer are you expecting from that?
I think your object needs to be closed:
var counting = {
  up: function(num1) {
    console.log(num1);
  },
  down: function(num100) {
    console.log(num100);
  }
};

a = 1;
b = 100;
counting.up(a, b);
counting.down(a, b);
the b argument never gets used in either of those functions
legendinraze
@legendinraze
Oct 03 2017 22:45
This is my first time working on this so im lost
I'm trying to make it count to 100 from 1
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:47
you need to add or remove numbers depends how you proceed
piteto
@piteto
Oct 03 2017 22:48
yeah, a for loop or while loop is needed to increment a
legendinraze
@legendinraze
Oct 03 2017 22:48
soo
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:53
does this has really to be built on this way?
the easier way to build a counter or countdown
its a straight loop
you can write a function that takes 2 values and loops them inside
legendinraze
@legendinraze
Oct 03 2017 22:53
well that's the lesson
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:54
oh ok didnt knew
mybad
legendinraze
@legendinraze
Oct 03 2017 22:54
it's to get into a school
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:54
can I see the exercise text?
legendinraze
@legendinraze
Oct 03 2017 22:54
my knowledge of javascript is eh. yea
Jason Luboff
@JLuboff
Oct 03 2017 22:54
If you can't create that simple function to get into a school, then it's advisable to study more before applying. Not trying to be rude, but it doesn't seem like you've done any studying
Tiago Correia
@tiagocorreiaalmeida
Oct 03 2017 22:55
can't see it without login can you copy paste or print it?
legendinraze
@legendinraze
Oct 03 2017 22:55
I told the how much I knew of javascript but I was still accepted after I did the first precourse
them*
it's for beginners to pro so im still good it's to showcase how much I know
Jason Luboff
@JLuboff
Oct 03 2017 22:56
Ah. Gotcha.
legendinraze
@legendinraze
Oct 03 2017 22:57
but the latest precourse have been hard
has*

Create a new object variable with two methods contained within. Your object should be called counting and it should include a method called up and a method called down for counting up and counting down:

The up method should take in a single number as an argument and return a number one greater than it.
The down method should take in a single number as an argument and return a number one lower than it.

here @tiagocorreiaalmeida
Jason Luboff
@JLuboff
Oct 03 2017 23:02
@legendinraze
var counting = {
  up: function(num) {
    return ++num;
  },
  down: function(num) {
   return --num;
  }
};

counting.up(1); //returns 2
counting.down(100); //returns 99
Actually, hold on
piteto
@piteto
Oct 03 2017 23:03
num + 1 or num - 1
Jason Luboff
@JLuboff
Oct 03 2017 23:04
@piteto Ya, forgot that ++/-- would alter it after the return
But... actually.. ++num might work
Yup that works
piteto
@piteto
Oct 03 2017 23:04
I always forget about ++num vs num++ :)
legendinraze
@legendinraze
Oct 03 2017 23:05
not for one of the objectives
Jason Luboff
@JLuboff
Oct 03 2017 23:05
There! That above method works
legendinraze
@legendinraze
Oct 03 2017 23:05
downMethod doesnt
nevermind
Jason Luboff
@JLuboff
Oct 03 2017 23:05
@piteto Ya... I never use ++variable always use variable++
piteto
@piteto
Oct 03 2017 23:06
same here
legendinraze
@legendinraze
Oct 03 2017 23:06
Thanks @piteto and @JLuboff
CamperBot
@camperbot
Oct 03 2017 23:06
legendinraze sends brownie points to @piteto and @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 187 | @piteto |http://www.freecodecamp.com/piteto
:star2: 2213 | @jluboff |http://www.freecodecamp.com/jluboff
Diego Mayer
@Chrono79
Oct 03 2017 23:23
@piteto if (isPrime(start) && isPrime(reverseNum) && reverseNum !== start) result.push(start); test reverseNum !== start first, that'll save you some time
and instead of testing for divisors until num /2 test for <=Math.sqrt(num), that'll help too
my solution ran in 370ms like that
Jason Luboff
@JLuboff
Oct 03 2017 23:30
Ughhh
Jason Luboff
@JLuboff
Oct 03 2017 23:36
Sometimes I really hate mongodb...
Lucci Paula
@luccipaula
Oct 03 2017 23:40
Where would I use a regexp to preserve the capitalization in this replace method?
function myReplace(str, before, after) {

  var word = str.split(" ").filter(word => word == before);

  var newStr = str.replace(word, after);

  return newStr;
}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "Leaped");
I have to make it so that "Leaped" becomes "leaped" in the string
Diego Mayer
@Chrono79
Oct 03 2017 23:41
@caixeta-paula and why use regex for that?
Lucci Paula
@luccipaula
Oct 03 2017 23:42
@Chrono79 I thought that's how you change the capitalization of a character
Diego Mayer
@Chrono79
Oct 03 2017 23:42
not always, no
Lucci Paula
@luccipaula
Oct 03 2017 23:42
@Chrono79 What would you recommend?
Diego Mayer
@Chrono79
Oct 03 2017 23:42
you could use slice and create a new string
with the same capitalization of before
isn't word an array there?
I don't think the first argument of replace can be an array, a regular expression or a string yes
Lucci Paula
@luccipaula
Oct 03 2017 23:45
@Chrono79 Oh I didn't notice that mistake, thanks
CamperBot
@camperbot
Oct 03 2017 23:45
caixeta-paula sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4569 | @chrono79 |http://www.freecodecamp.com/chrono79
Lucci Paula
@luccipaula
Oct 03 2017 23:47
@Chrono79 How would slice preserve the capitalization?
Diego Mayer
@Chrono79
Oct 03 2017 23:47
you use slice to dissarm the word between the initial letter and the rest of it
then you convert the initial to either capital or lowercase letter matching the word you havw to replace and arm the word back
Lucci Paula
@luccipaula
Oct 03 2017 23:49
@Chrono79 I would do this for the replacement word?
And then how could I discern the capitalization of the word I must replace?
Moisés Man
@moigithub
Oct 03 2017 23:50
mdn.io/replace
if ( "a".toUpperCase() === "A") then its uppercase/capital being "a" the first char of a word
Lucci Paula
@luccipaula
Oct 03 2017 23:55
@moigithub The word in the given sentence or the replacement word?
Diego Mayer
@Chrono79
Oct 03 2017 23:56
@caixeta-paula the word you have to replace (before)
Moisés Man
@moigithub
Oct 03 2017 23:56

:point_up: 3 de octubre de 2017 18:40

I have to make it so that "Leaped" becomes "leaped" in the string

Diego Mayer
@Chrono79
Oct 03 2017 23:56
there are no weird words like HeLlO in the test set
Lucci Paula
@luccipaula
Oct 03 2017 23:57
Oh wait I don't even need that "word" variable I created, I forgot that I have "before"