Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Simon Cordova
@gbsimon87
@mpmaan The thing is I can't use a number index, I need to find the index by the name value
mpmaan
@mpmaan
let nameToFind = 'GB';
let total = state.teamRoster.length;
for(let i = 0; i < total; i++){
    if(nameToFind === state.teamRoster[i].name){
       let oldAge = state.teamRoster[i].age ;
      state.teamRoster[i].age = oldAge + incrementCount;
      break;
    }
}
try this
once a name is matched , it will update the age and break the loop
Simon Cordova
@gbsimon87
@mpmaan thank you very much I will give that a shot :)
mpmaan
@mpmaan
how do you get name by clicking button?
Simon Cordova
@gbsimon87
It's in React, so I'll be saving the currently clicked player's name in the state
PS: That code worked well ;)
mpmaan
@mpmaan
ok..i don't know react
Simon Cordova
@gbsimon87
All good, this really helped me out, I truly appreciate it
I was overcomplicating it trying to use Object.keys, map, and reduce
mpmaan
@mpmaan
can you tell me where to learn react apart from fcc
i like to use inbuilt functions as few times as possible
Vladislav Ivanov
@developer4eto
@mpmaan you can check the react site - https://reactjs.org/
Simon Cordova
@gbsimon87
@mpmaan the youtube channel academind has some great content to get you started, using ES6 as well
In my opinion, from all the studies I've done, as @developer4eto mentioned, the React docs, and that channel, are some of the best free resources I've found out there
mpmaan
@mpmaan
thanks @developer4eto , @gbsimon87
Vladislav Ivanov
@developer4eto
@mpmaan no problem
Stephen James
@sjames1958gm

@gbsimon87

state = { ..state, teamRoster.map(r => (r.name !== nameToFind ? r : { ...r, age: r.age + incrementCount }))}

If you don;'t want to mutate the existing state

Alexandar B
@ace1122sp
hey guys.. is it considered a bad practice to put an expression in place of object's property value? Which is a better approach? Does it matter?
// Approach A
let obj = {
  totalPoints: someFunction(32)
}

// Approach B
let calculatedValue = someFunction(32);
let obj = {
  totalPoints: calculatedValue
}
Aditya
@ezioda004
@ace1122sp I think Approach A is better because it follow Principle of least privilege and the data is encapsulated so less chance of global conflict.
Stephen James
@sjames1958gm
@ace1122sp I also prefer approach A as you don't have to create a variable that is only used once.
Alexandar B
@ace1122sp
@ezioda004 @sjames1958gm thanks guys.. yeah, i also like A more than B, but I wasn't sure.. :+1:
Rob
@PGFracing
on desktop I’m trying to get the video to the right of the other video http://www.pgfracing.com/newsite.html not sure what’s up
Rob
@PGFracing
how do i get rid of the white space between the left big video and the right videos? www.pgfracing.com/newsite.html ?
mpmaan
@mpmaan
<div class="row"><div class="col-md-6"style="padding-left: 0px; padding-top: 10px; padding-right: 10px;> there is no closing " for the style tag
are you using some framework?
Rob
@PGFracing
mmm I got rid of that should look like this now
<div class="main-container">

        <!-- ROW 1 HEADER -->
        <div class="header-container">
            <div class="row">
                <div class="col-6">
                    <div class="embed-responsive embed-responsive-16by9">
                    <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen></iframe>
                    </div>
                </div>    

                <div class="col-6">
                    <div class="col-6">
                        <div class="embed-responsive embed-responsive-16by9">
                        <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen></iframe>
                        </div>
                    </div>

                    <div class="col-6">
                        <div class="embed-responsive embed-responsive-16by9">
                        <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen></iframe>
                        </div>
                    </div>    

                </div>    


            </div>        
        </div>            
    </div>
mpmaan
@mpmaan
do you want to get rid of space in between or on the right of the last column?
Rob
@PGFracing
okay I got rid of the gap, www.pgfracing.com/newsite.html but not sure why the bottom video isn’t going up to the top row?
mpmaan
@mpmaan
second small video should be on right side of first small video?
Rob
@PGFracing
correct
mpmaan
@mpmaan
try to give a rowin second column which will contain the other two columns for smaller videos
row
       col
       row
              col
              col
something like this if you can understand
Rob
@PGFracing
ya I get that but the row won’t float to the left it will be another row then?
mpmaan
@mpmaan
can you try this?
<div>
    <div class="row">
                    <div class="col-6">
                        <div class="embed-responsive embed-responsive-16by9">
                        <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen=""> 
                               </iframe>
                        </div>
                    </div>

                    <div class="col-6">
                        <div class="embed-responsive embed-responsive-16by9">
                        <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen=""> 
                               </iframe>
                        </div>
                    </div>    

                </div>
</div>
Rob
@PGFracing
that’s just two videos I’m trying to do 3?
mpmaan
@mpmaan
wait a minute
    <div class="header-container">
            <div class="row">
                <div class="col-6">
                    <div class="embed-responsive embed-responsive-16by9">
                    <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen></iframe>
                    </div>
                </div>    

                <div class="col-6" style="margin-left: -40px;">
                    <div class="row">
                    <div class="col-6">
                        <div class="embed-responsive embed-responsive-16by9">
                        <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen></iframe>
                        </div>
                    </div>

                    <div class="col-6">
                        <div class="embed-responsive embed-responsive-16by9">
                        <iframe src="https://www.youtube.com/embed/tHrZW11XAJw" frameborder="0" allow="autoplay; enypted-media" allowfullscreen></iframe>
                        </div>
                    </div>    

                </div>    
            </div>


            </div>        
        </div>
this is complete
i put a row in <div class="col-6" style="margin-left: -40px;">
you just need to adjust margin now
Rob
@PGFracing
nice work there :)
mpmaan
@mpmaan
did it work?
yeah..looking good on website
Rob
@PGFracing
thanks a BILLION @mpmaan