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
Moisés Man
@moigithub
cuz arr contains same reference to the one being passed.. to make a real copy u need to use spread op
Brad
@bradtaniguchi
I feel stupid :P
mpmaan
@mpmaan
there will always be someone superior than you at a given point of time
Moisés Man
@moigithub
arrays and objects holds "memory location pointer"
soo when u do arr1 = arr2 basicly u copying the memory location instead of its values
Brad
@bradtaniguchi
Yea, but I should figured it out yo XD
like this BS: NaN === NaN // false
Mark
@vinarius
or typeof(NaN) //number
Brad
@bradtaniguchi
I ended-up usingNumber.isNaN(whatImChecking)caught me off guard tho
Aita Kane
@aita-kane
hello can someone help me with my dropdown please. I code the menu and and the container and content of my dropdown, but the problem is when I hover on "Mon panier" , I want the dropdown to be visible . Can someone help me with please ? the codepen link : https://codepen.io/akane96/pen/qKxqWE
richRocksCodeBlocks
@richRocksCodeBlocks
@aita-kane Have you seen this example? https://www.w3schools.com/Css/css_dropdowns.asp
Nate Mallison
@NJM8
@bradtaniguchi NaN === NaN // false makes sense if you think about it as it's something that is not a number, you don't know what it is but it isn't a number
try typeof NaN if you really want to mess with your head
Brad
@bradtaniguchi
My head has been messed with enough already today XD
Nate Mallison
@NJM8
lol
Alexander R Bott
@Abott1222
anyone play with webassembly? Is it worth coding the web in python yet? :P
Stephen
@stephepush
@Abott1222 I think we have to wait for someone to invent that wheel (python via web assembly)
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.