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
Stephen
@stephepush
unless that already happened. I assume you have to start from scratch? Web Assembly C then Web Assembly python, lol?
This es6 exercise... I dont even think it knows what it's doing:
const source = [1,2,3,4,5,6,7,8,9,10];
function removeFirstTwo(list) {
  "use strict";
  // change code below this line
  arr = list; // change this
  // change code above this line
  return arr;
}
const arr = removeFirstTwo(source);
console.log(arr); // should be [3,4,5,6,7,8,9,10]
console.log(source); // should be [1,2,3,4,5,6,7,8,9,10];
abraham anak agung
@padunk
@stephepush you have to remove first two elements in array without mutating the original array. I think you can use .slice for that
Alexander R Bott
@Abott1222
@stephepush haha I know it is early... I just watched this: https://www.youtube.com/watch?v=ITksU31c1WY
Stephen
@stephepush
@padunk I thought the whole point was to not use slice and to instead use destructuring assingments in lieu of something that slice can easily do
@Abott1222 Haven’t watched the video but I look forward to the day that you can make web pages with python… jeesh
anthonygallina1
@anthonygallina1
:)
Simon Cordova
@gbsimon87
var state = {
    currentPlayer: '',
    teamRoster: [
        { name: 'GB', age: 30, location: 'London'},
        { name: 'Maren', age: 36, location: 'London'},
        { name: 'Daniel', age: 31, location: 'Toronto'},
    ]
}
Hey all, was wondering if anyone could offer some insight, I think I'm on the right track using Object.keys and map, but can't quite achieve it.
I've got an object, which one of the keys is an array of objects.
I need to get into one specific key and change the properties there...
For example, I'd like to click a button in the DOM which will increase age for the name 'GB'
mpmaan
@mpmaan
let oldAge = state.teamRoster[0].age ;
state.teamRoster[0].age = oldAge + incrementCount;
this might work
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?