These are chat archives for FreeCodeCamp/Help

2nd
Jul 2018
Christopher McCormack
@cmccormack
Jul 02 2018 00:02
@sabin20 did you see it in the sendData method?
glitz20
@glitz20
Jul 02 2018 00:03
no
So my sendData function is
sendData(data) {
        axios.post('http://localhost:4200/items/add/post', data)
            .then(res => this.setState({ items: res.data }))
            .catch(err => console.log(err))
    }
Christopher McCormack
@cmccormack
Jul 02 2018 00:05
you have to put your console above your return
glitz20
@glitz20
Jul 02 2018 00:06
and in my additem file, where the form is present, I have this to handle submit
handleSubmit(event) {
      event.preventDefault();
        this.addItemService.sendData({
            itemname: this.state.itemname,
            category: this.state.category
        })
            .then(data => {
                console.log(data);
            })
      this.props.history.push('/');
    }
Christopher McCormack
@cmccormack
Jul 02 2018 00:07
yeah I see it above, you need to ensure the data is making it each step of the way, logging is a good way to check
glitz20
@glitz20
Jul 02 2018 00:08
so this would be in react right?
Christopher McCormack
@cmccormack
Jul 02 2018 00:09
yes in your sendData method of your ItemService class
glitz20
@glitz20
Jul 02 2018 00:10
sendData(data) {
        axios.post('http://localhost:4200/items/add/post', data)
             console.log(data)
            .then(res => this.setState({ items: res.data }))
            .catch(err => console.log(err))
    }
I did it like this, but no any change
Christopher McCormack
@cmccormack
Jul 02 2018 00:12
so data is empty?
in your browser console?
glitz20
@glitz20
Jul 02 2018 00:12
yeah
also in express I did smth like
itemRouter.route('/add/post').post(function (req, res) {
    var item = new Item(req.body);
    console.log(req.body)
    item.save()
I get empty bracket in console
Christopher McCormack
@cmccormack
Jul 02 2018 00:13
I don't think you're binding your handleChange properly, fyi
is the output empty or an empty object?
in the browser
glitz20
@glitz20
Jul 02 2018 00:14
lass AddItem extends Component {

  constructor(props) {
      super(props);
      this.state = {
          itemname: '',
          category: ''
      };
      this.addItemService = new ItemService();

      this.handleItemChange = this.handleChange.bind(this);
      this.handleSubmit = this.handleSubmit.bind(this);
    }

    handleChange(event) {
        this.setState({ [event.target.name]: event.target.value });
    }


    handleSubmit(event) {
      event.preventDefault();
        this.addItemService.sendData({
            itemname: this.state.itemname,
            category: this.state.category
        })
            .then(data => {
                console.log(data);
            })
      this.props.history.push('/');
    }

    render() {
      return (
        <div className="container">
              <form onSubmit={this.handleSubmit}>

            <label>
              Add Item:
              <input name='itemname' type="text" onChange={this.handleChange} className="form-control"/>
                  </label><br />
                  <label>
                      Category:
              <input name='category' type="text" onChange={this.handleChange} className="form-control" />
                  </label><br />

            <input type="submit" value="Submit" className="btn btn-primary"/>
          </form>
      </div>
      );
    }
  }
this is the additem class
and this is itemservice
class ItemService {

    sendData(data) {
        axios.post('http://localhost:4200/items/add/post', data)
             console.log(data)
            .then(res => this.setState({ items: res.data }))
            .catch(err => console.log(err))
    }

  updateData(data, id){
    axios.post('http://localhost:4200/items/update/'+id, {
      item: data
    })
    .then(res => this.setState({ items: res.data }))
    .catch(err => console.log(err))
  }

  deleteData(id){
    axios.get('http://localhost:4200/items/delete/'+id)
    .then().catch(err => console.log(err))
  }
}
Christopher McCormack
@cmccormack
Jul 02 2018 00:15
yes you posted it above you don't have to post again, you can modify if you need to
        axios.post('http://localhost:4200/items/add/post', data)
             console.log(data)
When you submit in the browser, are you seeing an empty object in the console ({}), or logging nothing at all?
Also labels don't go around form inputs, they go adjacent, using a for="[input id]" syntax
Christopher McCormack
@cmccormack
Jul 02 2018 00:24
@sabin20 change this.handleItemChange = this.handleChange.bind(this); to this.handleChange = this.handleChange.bind(this); when you get a chance
I just spun up a version of this in codepen and got it to at least send the data to the sendData method, so if you aren't getting that far there is something wrong. Note I don't know what versions you are using so I made it generic
glitz20
@glitz20
Jul 02 2018 00:34
yeah that's a good catch actually,
but the problem is still the same
Christopher McCormack
@cmccormack
Jul 02 2018 00:34
@sabin20 try commenting out this.props.history.push('/'); during testing as well
glitz20
@glitz20
Jul 02 2018 00:36
still no data
Christopher McCormack
@cmccormack
Jul 02 2018 00:36
@sabin20 I'm not sure you know what the problem is yet, take it one step at a time, get to a point where you see the data actually displaying at each step

@cmccormack after that maybe add some middleware after your app.use(bodyParser.json()); in your express app that simply logs the req.body to console.
Something like...

app.use((req, res, next) => { console.log(`Testing Middleware req.body: ${req.body}`); next() })

should be enough to see if you're actually getting the data passed to your app and it's parsing it accurately

yetiwords
@yetiwords
Jul 02 2018 01:10
Hey! I just posted a question to reddit about javascripts that I could use some help with. heres the link https://www.reddit.com/r/javascript/comments/8ven49/learning_loops_hit_a_road_block_though/
its typed up all nice there, so I figured it'd be smart to just drop the reddit link rather than type it out
yetiwords
@yetiwords
Jul 02 2018 01:22
Nevermind! Figured it out!
Ryan Williams
@Ryanwfile
Jul 02 2018 02:13
For the Technical Documentation Project, one user story is When I click on a navbar element, the page should navigate to the corresponding section of the main-doc element (e.g. If I click on a nav-link element that contains the text "Hello world", the page navigates to a section element that has that id and contains the corresponding header. The navigation works exactly like that and every word is exact spelling, tried it with 2 words with underscore as well as all single words but can't pass this test. Any help is greatly appreciated https://codepen.io/Ryanwfile/pen/ZRwjjL
Ryan Williams
@Ryanwfile
Jul 02 2018 02:27
Neverming, it randomly started passing the test after changing nothing
Kyle Holm
@thekholm80
Jul 02 2018 02:27
@Ryanwfile your problem is here: <a class ="nav-link" href =" #Html" rel="internal">Html</a> you have a space before #Html
i removed the space and it passed
Ryan Williams
@Ryanwfile
Jul 02 2018 02:28
@thekholm80 Thanks for the help, I got it
Kyle Holm
@thekholm80
Jul 02 2018 02:28
:+1:
Ryan Williams
@Ryanwfile
Jul 02 2018 02:28
working
Kyle Holm
@thekholm80
Jul 02 2018 02:29
that took me way to long to figure out. i ended up reading their tests to figure out what they're looking for
Claudio Restifo
@Marmiz
Jul 02 2018 02:30
@Ryanwfile :wave: how was the interview? :)
@thekholm80 :wave:
Kyle Holm
@thekholm80
Jul 02 2018 02:30
@Marmiz :wave:
glitz20
@glitz20
Jul 02 2018 02:46
@cmccormack I donot see anything after the log in console
Claudio Restifo
@Marmiz
Jul 02 2018 03:28

@sabin20 I'm curious, why:

.then(res => this.setState({ items: res.data }))

updating the state of ItemService

glitz20
@glitz20
Jul 02 2018 03:34
@Marmiz yeah good point
I have removed that
Claudio Restifo
@Marmiz
Jul 02 2018 03:37
@sabin20 You could make that accepting a callback function that gets passed with it, and execute on then:
.onSomething(this.onSearch(vars), data, cb)

.onSearch({...vars}, data ,cb) {
  axios().then(res => cb(res.data.whatever)
}
glitz20
@glitz20
Jul 02 2018 03:40
sendData(data) {
        axios.post('http://localhost:4200/items/add/post', data)
            .then(function (data) {
                console.log(data);
            })

            .catch(err => console.log(err))
    }
is this good?
@Marmiz
or simply
 sendData(data) {
        axios.post('http://localhost:4200/items/add/post', data)
            .then(console.log(data))
            .catch(err => console.log(err))
    }
Claudio Restifo
@Marmiz
Jul 02 2018 03:45
@sabin20 in the 2nd example data is the data arument
which one you want to log?
glitz20
@glitz20
Jul 02 2018 03:46
data
Claudio Restifo
@Marmiz
Jul 02 2018 03:47
so not the axios response
glitz20
@glitz20
Jul 02 2018 03:47

    handleSubmit(event) {
      event.preventDefault();
        this.addItemService.sendData({
            itemname: this.state.itemname,
            category: this.state.category
        })
            .then(data => {
                console.log(data);
            })
so this is the handle submit
and I want to pass itemname and category as data and post it in database
Claudio Restifo
@Marmiz
Jul 02 2018 03:51

So forget about the promise resolve then for now:

this.addItemService.sendData({
            itemname: this.state.itemname,
            category: this.state.category
        })
 sendData(data) {
  console.log(data) // {itemname: x, category: y}    
}

start with this. And works your way up :)

glitz20
@glitz20
Jul 02 2018 04:17
yeah but I think above one should work too
Claudio Restifo
@Marmiz
Jul 02 2018 04:21

I think should

does it works or not? have you tried it?

glitz20
@glitz20
Jul 02 2018 04:24
No, the whole thing doesnot work as expected
Claudio Restifo
@Marmiz
Jul 02 2018 04:27
so have you tried the simplified version I suggested before?
glitz20
@glitz20
Jul 02 2018 04:28
so should I replace
})
            .then(data => {
                console.log(data);
            })
with
 sendData(data) {
  console.log(data) // {itemname: x, category: y}    
}
Claudio Restifo
@Marmiz
Jul 02 2018 04:30
Do you know what then does?
glitz20
@glitz20
Jul 02 2018 04:32
yeah
glitz20
@glitz20
Jul 02 2018 04:41
I think the problem is with state change
Claudio Restifo
@Marmiz
Jul 02 2018 04:59

@sabin20 before going into the state your app has to:

1 - collect the data and pass to sendData
2 - send data call axios.post  and pass data
3- your server need to read this data
4- do whatever you have to do on the back with this data
5- send back some sort of feedback to the app
6- the app should pick up this feedback
7- do whatever with the feedback

are you telling me that you already have logged and are you sure nothing brakes in this passage?

glitz20
@glitz20
Jul 02 2018 05:03
so this is my additem class
class AddItem extends Component {

  constructor(props) {
      super(props);
      this.state = {
          itemname: '',
          category: ''
      };
      this.addItemService = new ItemService();

      this.handleChange = this.handleChange.bind(this);
      this.handleSubmit = this.handleSubmit.bind(this);
    }

    handleChange(event) {
        this.setState({ [event.target.name]: event.target.value });
    }


    handleSubmit(event) {
      event.preventDefault();
        this.addItemService.sendData({
            itemname: this.state.itemname,
            category: this.state.category
        })


      this.props.history.push('/');
    }

    render() {
      return (
        <div className="container">
              <form onSubmit={this.handleSubmit}>

            <label>
              Add Item:
              <input name='itemname' type="text" onChange={this.handleChange} className="form-control"/>
                  </label><br />
                  <label>
                      Category:
              <input name='category' type="text" onChange={this.handleChange} className="form-control" />
                  </label><br />

            <input type="submit" value="Submit" className="btn btn-primary"/>
          </form>
      </div>
      );
    }
  }
Claudio Restifo
@Marmiz
Jul 02 2018 05:03
:clap: nice.
what about the 7 points above?
glitz20
@glitz20
Jul 02 2018 05:03
and this is itemservice
class ItemService {

    sendData(data) {
        axios.post('http://localhost:4200/items/add/post', data)
            .then(console.log(data))
            .catch(err => console.log(err))
    }

  updateData(data, id){
    axios.post('http://localhost:4200/items/update/'+id, {
      item: data
    })
    .then(res => this.setState({ items: res.data }))
    .catch(err => console.log(err))
  }

  deleteData(id){
    axios.get('http://localhost:4200/items/delete/'+id)
    .then().catch(err => console.log(err))
  }
}
Claudio Restifo
@Marmiz
Jul 02 2018 05:05

this

.then(console.log(data))

are you sure about this?
then

glitz20
@glitz20
Jul 02 2018 05:06
not quite sure
should I put
.then(function (response) {
    console.log(response);
  })
instead??
just like shown in npm doc
axios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });
Claudio Restifo
@Marmiz
Jul 02 2018 05:10

Do you know what then does?

Have you read some documentation on then?

Are sure what axios post return with the Promise :)
If not keeps reading about it, instead of trying random stuff
glitz20
@glitz20
Jul 02 2018 05:23
yeah I know that asynchronous task returns promise object and promise object has then function which takes success and error handler as a argument
glitz20
@glitz20
Jul 02 2018 05:29
so sendData takes one parameter, data
 sendData(data) {
        axios.post('http://localhost:4200/items/add/post', data)
            .then(function (response) {
                console.log(response);
            })
            .catch(err => console.log(err))
    }
and I want to send two field/properties namely itemname and category
so is this the correct way?
 handleSubmit(event) {
      event.preventDefault();
        this.addItemService.sendData({
            itemname: this.state.itemname,
            category: this.state.category
        })
Claudio Restifo
@Marmiz
Jul 02 2018 05:37
yep :)
glitz20
@glitz20
Jul 02 2018 05:42
also the handleChange is correct, right?
 handleChange(event) {
        this.setState({ [event.target.name]: event.target.value });
    }
for
<label>
              Add Item:
              <input name='itemname' type="text" onChange={this.handleChange} className="form-control"/>
                  </label><br />
                  <label>
                      Category:
              <input name='category' type="text" onChange={this.handleChange} className="form-control" />
                  </label><br />
Claudio Restifo
@Marmiz
Jul 02 2018 05:51
yep :)
(as long as handleChange has this binded to the class context)
Dany Din
@danydin
Jul 02 2018 06:38
hey - the $aArray[0] at the second row is giving the total amount of numbers in the array or just the first number in the array
 ; Loop through the array.
    For $i = 1 To $aArray[0]
        ; Increment the sum by the number in each array element.
        $iArraySum += Number($aArray[$i])
    Next
alpox
@alpox
Jul 02 2018 06:51
@danydin The first number of the array
Dany Din
@danydin
Jul 02 2018 06:52
@alpox so how is it going to iterates through the array?
alpox
@alpox
Jul 02 2018 06:52
@danydin Like this, not at all :)
If you want the length of the array, use count --> count($aArray)
Dany Din
@danydin
Jul 02 2018 06:53
are you sure i found it on wiki :p
the example but it looked wired to me
it's BASIC language
alpox
@alpox
Jul 02 2018 06:54
@danydin Also, arrays start at 0
So $i = 0
Which wiki?
Dany Din
@danydin
Jul 02 2018 06:54
wikipedia for a basic language
alpox
@alpox
Jul 02 2018 06:55
Huh, for a basic language?
Dany Din
@danydin
Jul 02 2018 06:56
yes
alpox
@alpox
Jul 02 2018 06:57
Oh hey I didn't notice the For and Next etc. for some reason. My bad :D forget what I said.
I just got up xD
And thought this is PHP
Dany Din
@danydin
Jul 02 2018 06:58
haha i see no problem.. so what's going on there if you can explain briefly
@alpox
alpox
@alpox
Jul 02 2018 07:01
@danydin I could if i knew what exact language it is. True Basic or Visual Basic?
Dany Din
@danydin
Jul 02 2018 07:03
it's autoit
alpox
@alpox
Jul 02 2018 07:06
@danydin Aha I found the example
Dany Din
@danydin
Jul 02 2018 07:07
:D
funny if it's actually a mistake lol
alpox
@alpox
Jul 02 2018 07:07
If you read it closely you see that the trick is right before that code you sent
Its no mistake
They describe it right below the code actually

The thing is that the array is the return value form the split string. And according to the docs:

Returns an array, by default the first element ($aArray[0]) contains the number of strings returned, the remaining elements ($aArray[1], $aArray[2], etc.) contain the delimited strings.

Dany Din
@danydin
Jul 02 2018 07:08
it's actually not explained here :o
alpox
@alpox
Jul 02 2018 07:08
So the splitstring function just returns an array which holds the number of actual elements found with the splitting - and puts the real elements into the rest of the array
@danydin Hmm you are on another page than me
When you run the above code you will see that $iMax is four and not three as you might have expected. The reason for this is that the developer of the StringSplit function thought it was a good idea to use the first item (item zero) to keep a count of valid items in the array. This makes sense in many situations as you now have an array containing data with an index starting at one. So our sample code can now be rewritten like this.
Dany Din
@danydin
Jul 02 2018 07:11
oh lol fck this is confusing as hell :P
alpox
@alpox
Jul 02 2018 07:11
Do you have to use that language? :D
Dany Din
@danydin
Jul 02 2018 07:12
just to make sure i got it right, they basically made a function that moved all arrays 1 spot forward and left the '0' for the total amount of strings right?
alpox
@alpox
Jul 02 2018 07:13
@danydin Not directly
They made a function that splits a string at a given delimiter
And that one function returns an array in that the elements reside in indices 1+ and the number of elements returned in index 0
So that function does not just take an array and does that with the array :D
Dany Din
@danydin
Jul 02 2018 07:15
yes that's what i was trying to say in an unprofessional way lol
alpox
@alpox
Jul 02 2018 07:15
Alright :D
Dany Din
@danydin
Jul 02 2018 07:15
cool thanks so much! @alpox
learned a lot hah
@alpox by the way what motivates you to help here so much? is it because you enjoy helping and learning at the same? :D
alpox
@alpox
Jul 02 2018 07:24
@danydin Mostly enjoying helping :)
Dany Din
@danydin
Jul 02 2018 07:26
amazing... you must be then really chill and friendly person :)
alpox
@alpox
Jul 02 2018 07:27
I'm trying :D
let ohStr = "Ohhh no";
let ohRegex = /h{3,6}/; // Change this line
let result = ohRegex.test(ohStr);
John
@taloloy18
Jul 02 2018 07:59

div {
width: 70%;
height: 100px;
margin: 50px auto;
transform:scale(1.1);
background: linear-gradient(
53deg,

  #ccfffc,
  #ffcccf
);
  }

p:hover{
transform:scale(1.1);
}

The size of the div element should scale 1.1 times when the user hovers over it.
Adish Jain
@Adishjain58
Jul 02 2018 07:59
i don't understand why its not working
John
@taloloy18
Jul 02 2018 08:00
Me too, with my challenge
Adish Jain
@Adishjain58
Jul 02 2018 08:01
@taloloy18 use
div { 
    width: 70%;
    height: 100px;
    margin:  50px auto;
    background: linear-gradient(
      53deg,
      #ccfffc,
      #ffcccf
    );
  }
  div:hover{
    transform: scale(1.1);
  }
you have to add hover on div instead of p element
Claudio Restifo
@Marmiz
Jul 02 2018 08:02
@Adishjain58 because the matches are inclusive, so you are matching also the case with 7 h
Adish Jain
@Adishjain58
Jul 02 2018 08:03
@Marmiz so what i have to do?
alpox
@alpox
Jul 02 2018 08:03
@Adishjain58 Your regex can match more than 6 h in a row - because the regex tests if there are 3 to 6 h in a row somewhere in the string. And when there are 7 h, there are still 6 h in a row, just one more too
Adish Jain
@Adishjain58
Jul 02 2018 08:04
@alpox so how can i restrict that?
alpox
@alpox
Jul 02 2018 08:04
@Adishjain58 You know that the h occurs only in the word Oh no here, so you have context. You can use that context to match the boundaries of h
John
@taloloy18
Jul 02 2018 08:05
Done! Thanks @Adishjain58
Adish Jain
@Adishjain58
Jul 02 2018 08:05
@alpox like
let ohRegex = /h{3,6} no/;
@taloloy18 welcome
thanks @alpox
let ohStr = "Ohhh no";
let ohRegex = /Oh{3,6} no/; // Change this line
let result = ohRegex.test(ohStr);
done
alpox
@alpox
Jul 02 2018 08:08
Yup (The no is not needed tho)
Adish Jain
@Adishjain58
Jul 02 2018 08:08
@alpox ok
@alpox but why?
alpox
@alpox
Jul 02 2018 08:09
@Adishjain58 Why no is not needed?
Claudio Restifo
@Marmiz
Jul 02 2018 08:09
because you want only oh with 3-6. Who cares about the no
:)
Adish Jain
@Adishjain58
Jul 02 2018 08:09
@Marmiz ok
thnx @Marmiz
alpox
@alpox
Jul 02 2018 08:09
@Adishjain58 no is not needed because the (empty space) already matches the boundary
Adish Jain
@Adishjain58
Jul 02 2018 08:09
thnx @alpox
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:39
hi @alpox do you know, how could I make text go into a new line inside a json string?
alpox
@alpox
Jul 02 2018 08:45
@diomed In an in-memory string, or are you talking about how it looks in the editor?
@diomed If you mean in-memory, you can use \n (The linefeed/newline character)
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:46
@alpox I am talking how it looks in editor
John
@taloloy18
Jul 02 2018 08:46
The value of the box-shadow property should be set to 25px for offset-x, 10px for offset-y, 0 for blur-radius, 0 for spread-radius, and finally blue for the color.
Ene Catalin
@EneCatalin
Jul 02 2018 08:46
cat
lol
John
@taloloy18
Jul 02 2018 08:46
What's lacking with the code?
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:46
@EneCatalin yes?
Ene Catalin
@EneCatalin
Jul 02 2018 08:46
you pretty much write it like that ?
pretty sure it's all about the {}
it should auto-indent when parsed
when you receive it you receive it as a continuous string anyway
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:48
I mean, can't I break that into lines, FFS?
Ene Catalin
@EneCatalin
Jul 02 2018 08:48
when you parse it ?
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:48
I wanna forse a new line
Ene Catalin
@EneCatalin
Jul 02 2018 08:48
so you receive the JSON or send it ?
if you receive it it's all about the name of the propriety
and where it is in the hierarchy
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:48
O_o
Ene Catalin
@EneCatalin
Jul 02 2018 08:49
do you send or receive the JSON ?
are you using JS ?
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:49
obviously
Ene Catalin
@EneCatalin
Jul 02 2018 08:49
ok so you want to get the values from a key right ?
since it's name value pairs
alpox
@alpox
Jul 02 2018 08:49
@diomed Not possible :) json is just data. If you want it better for your eye, turn on wordWrap in your editor
Ene Catalin
@EneCatalin
Jul 02 2018 08:49
so first you need to know where you can find that key in relation to the root
then you just get that specific value
but you can't see it as key value with newline
only with add-ons can you do that
JSON, much like well...everything, is received as one huge string
read this
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:51
@alpox then what is this \n for, exactly???
Ene Catalin
@EneCatalin
Jul 02 2018 08:51
there's no \n
in JSON
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:52
well FML
Ene Catalin
@EneCatalin
Jul 02 2018 08:52
using \n seems really retarded
you indent based on {}
alpox
@alpox
Jul 02 2018 08:52
@diomed To force a linebreak at that position of the string for the representation of the text when you present it on a page, log it, etc.
Ene Catalin
@EneCatalin
Jul 02 2018 08:52
I don't think you understand what JSON is
alpox
@alpox
Jul 02 2018 08:52
@EneCatalin I think you don't know what he asked
Ene Catalin
@EneCatalin
Jul 02 2018 08:52
very possible :D
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:53
yeah, I quit listening ostrich's advices longt time ago
it's some sort of a loop
of confusion
alpox
@alpox
Jul 02 2018 08:53
I see :/ too bad, he is trying to help
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:54
@alpox so when I put \n in JSON string, shouldn't it go into a new line?!?
Ene Catalin
@EneCatalin
Jul 02 2018 08:54
no
why would it indent ?
alpox
@alpox
Jul 02 2018 08:54
@diomed If you print or show the text on a page, yes. In your editor? No - there you see a \n :D
Ene Catalin
@EneCatalin
Jul 02 2018 08:54
and you're not supposed to randomly show it on a page
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:54
yes, that's what I mean, in html page
Ene Catalin
@EneCatalin
Jul 02 2018 08:55
then yes
May Kittens Devour Your Soul
@diomed
Jul 02 2018 08:55
well, it doesn't. fml
Ene Catalin
@EneCatalin
Jul 02 2018 08:55
show code ?
alpox
@alpox
Jul 02 2018 08:55
@diomed Do you print out the whole json on the page or just the text part? Because that is what would break
Ene Catalin
@EneCatalin
Jul 02 2018 08:55
cat it's like any other string I think
maybe use <br> instead of \n ?
WAIT
it's HTML
so use break
I mean \n is not html for newline
\n and stuff like that is for console/smart languages (like not js :D)
Newline, right there
Ene Catalin
@EneCatalin
Jul 02 2018 08:57
mind = blown
wtf
alpox
@alpox
Jul 02 2018 08:58
@EneCatalin the \n gets replaced with a <br> on insertion through javascript
Ene Catalin
@EneCatalin
Jul 02 2018 08:58
that's surprisingly smart...for js :D
alpox
@alpox
Jul 02 2018 08:58
@diomed Unless you use a weird way to show the text on page?
Like, when you use innerHTML - then it does not replace\n with <br>
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:00
@alpox take a look
on first card

damnit I'm doing simple tooltip thingie for a week now. what's wrong with me?
must be depressed :(
alpox
@alpox
Jul 02 2018 09:03
@diomed Put it into a <pre> element --> <pre>{{card.sadržaj}}</pre>
Thats the next variant when not replacing with <br> :D
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:04
isn't that for code only
alpox
@alpox
Jul 02 2018 09:04
Nope, for anything
That has format
Maybe you would have to remove the other styling tho
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:06
welp, that certainly looks different now
like it was for code only :yum:
alpox
@alpox
Jul 02 2018 09:10
Well, its for some formatted blocks of text :D you can style it differently maybe with a class or so - maybe normalizecss also helps - or you just use <br> instead of \n (I usually advice against putting html in text tho
Wait there might be a better method
Let me check
@diomed Just put this in your css (Without the <pre> element in the html):
.card p {
  white-space: pre;
}
It makes html just recognize the newlines like in pre
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:14
@alpox if u look again at my pen, that doesn't seem to help
alpox
@alpox
Jul 02 2018 09:15
@diomed You gotta remove the <pre> element from the html :D
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:17
@alpox ah , now I see what's going on. I guess that'll do.
thank you
alpox
@alpox
Jul 02 2018 09:18
@diomed np :)
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:18
I've never before seen white-space property
alpox
@alpox
Jul 02 2018 09:18
I used it quite sometime for certain stuff
You can as example prevent the text from breaking at all with it
Which is good in certain cases like preventing multiline buttons
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:19
yeah, I noticed :P
alpox
@alpox
Jul 02 2018 09:22
@diomed I just see that pre does prevent text from being wrapped if you don't specify so.
I suggest you use white-space: pre-line; instead - see https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
I never read that docs about white-space so closely :D
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:24
@alpox oh, that one is a winner! exactly what I need! EXCELLENT
alpox
@alpox
Jul 02 2018 09:25
@diomed :thumbsup:
Glad it helps
John
@taloloy18
Jul 02 2018 09:30
https://codepen.io/taloloy18/pen/bKzyKj Help me solve this because it dont work
"0","2018/07/02 7:00 PM","LITE-CEB-CDO","F62A56BD-8C02-4545-AA63-EDCDCC573C3D","MARICEL POTAYRE","0","F","","4D55A71D","TOU","249"
May Kittens Devour Your Soul
@diomed
Jul 02 2018 09:31
O_o
what doesn't work?
alpox
@alpox
Jul 02 2018 09:32
Same quesiton.. what does not work?
John
@taloloy18
Jul 02 2018 09:34
The value of the box-shadow property should be set to 25px for offset-x, 10px for offset-y, 0 for blur-radius, 0 for spread-radius, and finally blue for the color.
alpox
@alpox
Jul 02 2018 09:34
@taloloy18 According to what you said above about what the box-shadow SHOULD be, you have set the blur-radius and the spread-radius to 10px
Instead of 0
For the layout
John
@taloloy18
Jul 02 2018 09:38
It says there that 0 for spread-radius however in my code its 10px?
alpox
@alpox
Jul 02 2018 09:38
Yes
John
@taloloy18
Jul 02 2018 09:49
Done. Thank you sir!! XD
alpox
@alpox
Jul 02 2018 09:55
@taloloy18 np
I have problem to solve this task
can anyone help
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:23
how did u try?
Dajan Bjelanovic
@danbel91
Jul 02 2018 11:23
[type='radio'] {
margin: 10px 0px 15px 0;
}
@diomed can you help
its not working
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:24
@danbel91 that is not your task
Dajan Bjelanovic
@danbel91
Jul 02 2018 11:24
@diomed so how to solve this
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:24
your task is above run tests
it says: Using the type attribute selector, try to give the checkboxes in CatPhotoApp a top margin of 10px and a bottom margin of 15px.
Dajan Bjelanovic
@danbel91
Jul 02 2018 11:25
yes you are right
@diomed but how to add this type attribute as class or id
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:26
you dont add it as class or id
u simply write it in css as it is
Dajan Bjelanovic
@danbel91
Jul 02 2018 11:27
that is the problem I don't know how to solve it
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:27
@danbel91 well, u already have example
just modify that example u already posted
to match your task's requirements
Dajan Bjelanovic
@danbel91
Jul 02 2018 11:28
how to modify brother
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:29

u have this code

[type='radio'] {
    margin: 10px 0px 15px 0;
  }

as example

so that's somehow it should look like
Dajan Bjelanovic
@danbel91
Jul 02 2018 11:29
but when I put like that its not working
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:29
but instead of radio, task tells you to give the checkboxes that
Dajan Bjelanovic
@danbel91
Jul 02 2018 11:30
so what to do
@diomed now its working thank you brother
May Kittens Devour Your Soul
@diomed
Jul 02 2018 11:31
:smiley_cat:
⏣⎈⏣
KingofSPORT
@KingofSPORT
Jul 02 2018 11:58
Hey guys when I can feel that I'm ready to start learning jQuery?
Ene Catalin
@EneCatalin
Jul 02 2018 12:09
stick with JS
it's a lot better than in the past
the better you master it the easier for you long term
Buse
@busekara
Jul 02 2018 12:20
hello
I have a question
can you help me
Ene Catalin
@EneCatalin
Jul 02 2018 12:27
ask
Buse
@busekara
Jul 02 2018 12:34
look
my problem is your a element should be nested within your new p element.
I get this error
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:35
@busekara how did you try?
show your code
Buse
@busekara
Jul 02 2018 12:35
okey

<h2>CatPhotoApp</h2>

<main>

<a href="http://freecatphotoapp.com" target="_blank">cat photos</a>

<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>


<p>View more <a href="www.catphotos.com">cat photos</a>
</p>
</main>

@diomed can you help
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:37
@busekara looking good. try to bring that last p tag to same line, maybe
Buse
@busekara
Jul 02 2018 12:37
My English is not very good
Do you show it in code
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:38
<p>View more <a href="www.catphotos.com">cat photos</a></p>
Buse
@busekara
Jul 02 2018 12:39
what is the difference
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:39
in real world - your code is correct :ballot_box_with_check:
@busekara did you pass now?
Buse
@busekara
Jul 02 2018 12:39
I guess I did not see
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:39
in real world - no difference
Buse
@busekara
Jul 02 2018 12:40
but it gives an error
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:40
ok . send link of your challenge
@EneCatalin ostrich, build me AI for FCC that removes in-editor problems
Buse
@busekara
Jul 02 2018 12:41
okey
I will send
Ene Catalin
@EneCatalin
Jul 02 2018 12:41
mighty ostrich has been summoned ?
Buse
@busekara
Jul 02 2018 12:41
sent in the evening mu
Ene Catalin
@EneCatalin
Jul 02 2018 12:42
if you call me an emu I will actually kill you
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:42
:joy:
she never said emu
Ene Catalin
@EneCatalin
Jul 02 2018 12:42
just making sure
it's a sensitive topic
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:43
why such interspecies negativity?
Ene Catalin
@EneCatalin
Jul 02 2018 12:44
emus are subostrich
they deserve nothing but death
they're impure
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:44
what's with ostriches and emus and llamas and alpacas?
Ene Catalin
@EneCatalin
Jul 02 2018 12:44
llamas and alpacas are ok
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:45
@EneCatalin I mean, I know I guy from discord chat. he's named llama. and he basically shares your politics about alpacas
I mean . . how do you say . his politics about alpacas is analog to yours about emus.
Ene Catalin
@EneCatalin
Jul 02 2018 12:46
as a great philosopher said, some species are simply better
and ostriches are obviously the best
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:46
was that Hitler?
Ene Catalin
@EneCatalin
Jul 02 2018 12:46
who ?
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:47
that great philosopher
Ene Catalin
@EneCatalin
Jul 02 2018 12:47
we don't say that name here cat, mods could read something wrong into it
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:47
I like to live on the edge
(of reason)
Ene Catalin
@EneCatalin
Jul 02 2018 12:47
well, no idea who that guy was but probs not
prob some ostrich philosopher
biggus di...somethingus
can't quite remember
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:49
I think it's bigus dingus
alpox
@alpox
Jul 02 2018 12:49
This discussion gives me cramps
Ene Catalin
@EneCatalin
Jul 02 2018 12:50
that's not normal, go to a doctor ?
we are having a serious discussion about philosophy here
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:51
@alpox hey, you're good with css, right?
are you familiar with bulma?
alpox
@alpox
Jul 02 2018 12:52
I never used bulma, no
@EneCatalin i just came back from the osteopathy for releasing dense muscles. Im starting to get them again here
Ene Catalin
@EneCatalin
Jul 02 2018 12:54
not my fault emus are inferior
it's scientifically proven ostriches are just better
taller, bigger eggs, more beautiful
faster
better at pecking out eyes
every metric is just better
alpox
@alpox
Jul 02 2018 12:55
Well, tell me when the ostriches and emus start programming
Ene Catalin
@EneCatalin
Jul 02 2018 12:55
and llamas spit...a lot
soon, their representative is gonna try something pretty neat soon
(and majestically fail ofc)
sort of like this "Look at you. Sailing through the air majestically. Like an eagle. Piloting a blimp."
alpox
@alpox
Jul 02 2018 12:57
So... Like falling on the nose with style?
Ene Catalin
@EneCatalin
Jul 02 2018 12:57
we refer to it as majestic grace
but yes, like that
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:58
Lana! Lana! Lana! Lana!

Llannaaaaaa!!!!

alpox
@alpox
Jul 02 2018 12:58
Whatever makes you happy :D
May Kittens Devour Your Soul
@diomed
Jul 02 2018 12:58

DANGER ZONE

Ene Catalin
@EneCatalin
Jul 02 2018 12:59
cat is watching archer too much lately ?
alpox
@alpox
Jul 02 2018 13:00
Hey what is my animal
Ene Catalin
@EneCatalin
Jul 02 2018 13:00
the mighty snorlax
alpox
@alpox
Jul 02 2018 13:01
Had to google that.
I like it
May Kittens Devour Your Soul
@diomed
Jul 02 2018 13:02
@alpox why dont u pick if for yourself? I mean, I'm obv a :cat: and he's an ostrich
alpox
@alpox
Jul 02 2018 13:02
@diomed i dont feel like being any animal :D
May Kittens Devour Your Soul
@diomed
Jul 02 2018 13:03
@alpox well u can always remain that flower. whatever that is
Ene Catalin
@EneCatalin
Jul 02 2018 13:04
it's called allergy
May Kittens Devour Your Soul
@diomed
Jul 02 2018 13:04
I'm just right now picturing ostrich smelling flowers, sneezing coz alergic
he heh
Ene Catalin
@EneCatalin
Jul 02 2018 13:05
well, ostrich probs isn't ?
but he never leaves the house so god knows
here is the solution
let repeatNum = "42 42 42";
let reRegex = /(\d+)\s\1\s\1/; // Change this line
let result = reRegex.test(repeatNum);
one case is getting failed and i don't understand how to solve it
FANGWENQING
@cafucfang
Jul 02 2018 13:14
Hi, can anyone help me with this code.I cannot pass run test. where should i put this code.<p>View more<a href="http://freecatphotoapp.com">catphotos</a>
</p>
May Kittens Devour Your Soul
@diomed
Jul 02 2018 13:15
@cafucfang cat photos are 2 words, not 1
have spaces. your sentence must look like this : View more cat photos
FANGWENQING
@cafucfang
Jul 02 2018 13:21
@diomed thank you for your help.I pass it now.
Lance
@texas2010
Jul 02 2018 14:08
@EneCatalin lol "allergy"
Adish Jain
@Adishjain58
Jul 02 2018 15:14
can someone help me with my question
Bjorn van de Peut
@bjorno43
Jul 02 2018 15:28
:wave:
Bjorn van de Peut
@bjorno43
Jul 02 2018 15:38
@Adishjain58 The reason it doesn't work is because you're not specifying the beginning and the end of a string in your regex. You're not specifying that the string has to start with a digit and must end after 3 digits seperated by 2 spaces. So the it will match 1 1 1 1 or test 1 1 1 test 1 just as well
As a little hint:
^ - Specifies the beginning of a string
$ - Specifies the end of a string
Mehdi Amlal
@mehdiamlal
Jul 02 2018 15:41
Hey guys, is a $300 laptop/netbook with Linux installed on it good enough for development?
With 4GB of ram, 500GB of HD and an intel celeron
Bjorn van de Peut
@bjorno43
Jul 02 2018 15:44
@mehdiamlal Development is a broad term here. It completely depends on what kind of development. If you're talking about large systems that need to compiled or stuff that needs to be rendered, then no, that's definitely not good enough. If you're talking about a basic webserver, it's fine. Don't expect it to be very fast though
Also, make sure the processor is at least duo core. Otherwise it's definitely not worth that kind of money
Mehdi Amlal
@mehdiamlal
Jul 02 2018 15:47
I’m talking about a chat app, since I use a desktop pc as my primary machine and I’m going abroad in two weeks, I need something to use (not as a primary machine) while on vacation, to keep coding
m stuck here.. can someone help
Fay Vor
@phavor
Jul 02 2018 15:50
whats the right casing for 'studylyCapVar'
Bjorn van de Peut
@bjorno43
Jul 02 2018 15:51
@mehdiamlal As long as the processor is duo core or better, you're fine. If it's single core, don't buy it. You're going to regret spending that much money on it
Mehdi Amlal
@mehdiamlal
Jul 02 2018 15:52
It’s a quad core 2.2GH, I’ve just checked
Fay Vor
@phavor
Jul 02 2018 15:52
what is the right camelCase for studylyCapVar
Bjorn van de Peut
@bjorno43
Jul 02 2018 15:53
@mehdiamlal Ye that should be fine. That's actually pretty impressive for that price. Even though it's still a Celeron
@phavor camelCase basicly means that each word (or part of a word) starts with a capital letter, except the first word. Like eleBtnClassName for example.
Mehdi Amlal
@mehdiamlal
Jul 02 2018 15:59
@bjorno43 i think it’s a new Chinese firm, they sell amazing products for an incredibly low price
Bjorn van de Peut
@bjorno43
Jul 02 2018 15:59
Another important part of it is that you use meaningfull names as variables. So var a = document.getElementsByTageName('div') makes no sense. No one understands what a contains. Instead you'd use something like var elesDiv
@mehdiamlal Hmm. I suggest you be carefull though. Especially when dealing with Chinese firms. I always keep this phrase in mind when buying something online: "If it sounds too good to be true, it usually is"
Like if you actually get what you pay for, it's most likely a refurbished laptop and not a new one
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:04
¯_(ツ)_/¯
Kyle Holm
@thekholm80
Jul 02 2018 16:04
if i had a budget of $300 i'd look for a used laptop. you can get a much better machine that way
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:05
I understand nothing
like, does var even exist
isn't var now let
or whaaaaaaaat?!?
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:05
An uncle of mine also felt for such scam. He installed Wish store app on his phone and bought a TB USB drive for 20 dollar. I told him it was impossible to get that for such a low price. He said no, look. And it showed 1TB when plugged in. Had to explain him that they messed around with the firmware on it. Scanned the USB drive and it was just a 16GB stick :P
Kyle Holm
@thekholm80
Jul 02 2018 16:06
@diomed if only there were some kind of place where you could learn all about that
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:06
where is this magical place? tell me. tell me
Kyle Holm
@thekholm80
Jul 02 2018 16:06
@diomed here
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:07
damn, I fell right through it
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:08
Ok removed that one before anyone actually followes that advise.. ghehe
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:08
@bjorno43 I tried that once, but it was boring. all the good stuff was already deleted or seized by the FBI
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:08
@diomed You just don't know where to look :laughing:
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:08
clearly.
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:08
Hahaha
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:09
this guy made a pretty cool menu
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:09
Last time it was checked, the Darkweb was still estimated to be 9 times as large as the "normal" internet. So there's plenty stuff hidden there, ghehe
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:11
yeah, but send me some good links, would u
coz all communities with good links I know of are banned on reddit or anywhere
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:12
I can't. It would imply that I know about them xD
Nah I'm just messing with you. I honestly only visited it a few times when it was all over the news. I've seen things that made me reach for some bleach to wash my eyes out. Never went back again
Fay Vor
@phavor
Jul 02 2018 16:13
@bjorno43 I've tried that on studlyCapVar and yet it wouldn't pass
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:15
@phavor It's probably studyLyCapVar. Not sure. Those words dont make much sense to me
Fay Vor
@phavor
Jul 02 2018 16:17
@bjorno43 Same here
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:17
@diomed A good place to start is usually The Hidden Wiki. Finding a working link for that will be a challenge though
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:18
world is a funny place
Kyle Holm
@thekholm80
Jul 02 2018 16:19
@diomed in his defense, dressing yourself is very hard
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:19
@bjorno43 I went to some index, and all sites were dead. anyway police would probably catch me so better safe than sorry. I'll get all my links from lighter web
he just probably didn't drink his magic potion yet
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:23
@diomed True. I mean, staying hidden from the police aint that hard. As long as you're not stupid :P But honestly, unless you're interested in buying drugs, weapons or worse.. there's not that much to worrie about. Only stuff that interested me were some funny "wiki leaks" sites.
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:24
I'm interested only in getting bitcoin for free
:smiling_imp:
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:25
lol
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:26
oh man, hire a hitman . com is blank
now I'm disappointed. there goes my plan
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:28
Ghehe I know one of those websites like looked like they were completely pointless
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:28
must go on deep web to buy myself domain for site hosted on your server
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:29
Like patatje.net used to simply display an image. Nothing else. Only "insiders" knew there was a hidden illegal forum behind it where you could download everything completely free :P
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:30
everything what?
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:31
software, games, movies, stuff like that
It's no longer there though. After Usenet became popular it shut down
diomed @diomed yawns
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:33
I thought there's something better.
like, I would totally download a car
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:34
lol
I've seen Ready player one a few days ago. Can't wait for it to become reality. Too bad that probably won't happen within my lifetime :P
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:39
so it's that good, huh?
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:39
It's a pretty good movie, ye
Kyle Holm
@thekholm80
Jul 02 2018 16:42
i loved that movie
i should read the book
May Kittens Devour Your Soul
@diomed
Jul 02 2018 16:53
just heard the news: last season of GOT shall be heavy on peaceful diplomacy and light on violence
Bjorn van de Peut
@bjorno43
Jul 02 2018 16:57
In other words: More sex :laughing:
Ene Catalin
@EneCatalin
Jul 02 2018 17:03
so GOT just got trashed
westworld it is
May Kittens Devour Your Soul
@diomed
Jul 02 2018 17:07
@EneCatalin I expected more of rebelion :trollface:
Aditya
@ezioda004
Jul 02 2018 17:14
doesnt look like anything to me
Ramon Cardenas
@Ramoncarden
Jul 02 2018 17:15
General question here. I've reached the section for the responsive web design projects and I'm developing on my machine instead of using codepen. Im kinda new to git so wanted to know if its best practice to make a new repo for every project of if i should make a big repo, lets say FCC, and then add all my projects there? Does it matter? Thanks in advance
May Kittens Devour Your Soul
@diomed
Jul 02 2018 17:16
doesn't matter
either way is fine
Christopher McCormack
@cmccormack
Jul 02 2018 17:16
@Ramoncarden up to you, but for small projects I put mine in a single FCC monorepo
May Kittens Devour Your Soul
@diomed
Jul 02 2018 17:16
just link to them properly
Ramon Cardenas
@Ramoncarden
Jul 02 2018 17:23
@cmccormack thanks. just checking to see what was best practice. I was leaning to making a different repo for each project
@diomed was just gonna use the github pages option to link them. Thank you
yetiwords
@yetiwords
Jul 02 2018 22:27
hey I need help. I just started learning arrow functions, so this problem is a throwing me for a loop. (pun intended)
"Inside the formalGreeting function use the built in .map method to map over the array called names and return a new array with "Hello, " appended to the beginning of each name. Make sure to use the arrow function combined with the map method. "

var names = "TBD";

var formalGreeting = ( array ) => {

return array.map ( ( a ) => { a = "Hello, " + a } ) ;

};

Christopher McCormack
@cmccormack
Jul 02 2018 22:29
@yetiwords if you use curly braces as your return from your arrow function, you have to add a return syntax. Also, you don't assign to the value in map, you just return the new value
yetiwords
@yetiwords
Jul 02 2018 22:29

So, var names = "TBD";

var formalGreeting = ( array ) => {

return array.map ( ( a ) => { return a = "Hello, " + a } ) ;

};?

Christopher McCormack
@cmccormack
Jul 02 2018 22:29
You're basically iterating over an array, and using the existing value (a, in your case) doing something with a and returning it to the same position in a brand new array that map returns
@yetiwords don't return an assignment statement
just return "Hello, " + a
Also, in an arrow function, if you use parenthesis instead of curly braces you don't need to add return
Daniel Simeonov
@dbsimeonov
Jul 02 2018 22:38
Guys can you explain me as simple as possible what Event Delegation and Event Bubbling means, as I'm preparing for interview and what I found on google is kind of complicated to put it in sentences.
Christopher McCormack
@cmccormack
Jul 02 2018 22:45
@dbsimeonov this example seems pretty good. I would recommend reading it closely and doing a lot of tests of your own in a test project
yetiwords
@yetiwords
Jul 02 2018 22:58
@cmccormack Thank you for explaining all of that. I think I understand, the one thing I'm confused about is that if I remove the 'a' as a parameter than I can't use "return 'hello, ' a" <<<<<<

var names = "TBD";

var formalGreeting = (array) => {
return array.map((a) => {return "Hello, "+ a});
};

Christopher McCormack
@cmccormack
Jul 02 2018 22:58
@yetiwords that looks fine
Daniel Simeonov
@dbsimeonov
Jul 02 2018 23:00
Thanks man!
yetiwords
@yetiwords
Jul 02 2018 23:04
figured it out!

var names = "TBD";

var formalGreeting = () => {
return names.map((a) => {return "Hello, "+ a});
};

Christopher McCormack
@cmccormack
Jul 02 2018 23:04
@yetiwords you can also do
const formalGreeting = array => array.map((a) => "Hello, "+ a)
yetiwords
@yetiwords
Jul 02 2018 23:05
I removed the array parameter and array from the .map
Christopher McCormack
@cmccormack
Jul 02 2018 23:05
ah yeah I didn't look at that code wasn't sure what names was for
probably better to still use a parameter and pass names to formalGreeting though
yetiwords
@yetiwords
Jul 02 2018 23:06
Same! haha, I guess it's the new array they want the values assigned to
Christopher McCormack
@cmccormack
Jul 02 2018 23:06
array would have to be an array though
yetiwords
@yetiwords
Jul 02 2018 23:06
Some of these code practice tests are really strict.
Christopher McCormack
@cmccormack
Jul 02 2018 23:07
@yetiwords did that actually work? I don't think strings have a map method
oh names was your test and it should have been an array :)
duh
yetiwords
@yetiwords
Jul 02 2018 23:18
haha, I totally missed that too. Thanks for your help!!!
chances are that Ill be back with more questions
yetiwords
@yetiwords
Jul 02 2018 23:41

back again. I've never used or been introduced to reduce methods, I just read up on them right now.

Inside the productOfArray function use the built in reduce method to loop over the array called numbers and return the product of all the numbers in the array. Make sure to use the arrow function combined with the reduce method.
heres my code

var numbers = "TBD";

var productOfArray = () => {
return numbers.reduce((total, current) => {
return total + current;
});
};