Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:38
    @bjorno43 banned @real-action
  • Feb 01 2020 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 2020 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 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
Aditya
@ezioda004
Hes not using class tho but yeah you need new with function constructor
@cmccormack
var obj1 = {
  method1() {
    console.log('method 1');
  }
}

var obj2 = {
  method2() {
   super.method1();
  }
}

Object.setPrototypeOf(obj2, obj1);
obj2.method2(); // method 1
Christopher McCormack
@cmccormack
@ezioda004 I think I remember that from JS the good parts, but I never seem to need to use any of that stuff lol
Aditya
@ezioda004
Lol yeah same, its just good to know that it can be used; for academic purpose :D
Christopher McCormack
@cmccormack
We need something akin to a word-a-day calendar to remind us of the more esoteric parts of programming lol
Aditya
@ezioda004
Thats a cool idea! Like a daily TIL for programming
Christopher McCormack
@cmccormack
ohh that might be a good catalyst for a new blog
Google "weird Javascript ..." every morning and make a post around it with a few examples
Aditya
@ezioda004
Go 1 step further and make a google assistant action "Hey Google, open Today I learned Javascript"
Christopher McCormack
@cmccormack
that would be neat. have a notification sent to mobile for subscribers so they can quickly review
people like more notifications right?
Aditya
@ezioda004
I think so - I for one feel important when I get notified
Christopher McCormack
@cmccormack
@ezioda004 are you also thankful when you get an automated email for your birthday from random companies? :D
Aditya
@ezioda004
@cmccormack Hell yeah; they are the only people who remembers it!
Christopher McCormack
@cmccormack
hahah aw man that's sad
Aditya
@ezioda004
:disappointed_relieved:
Christopher McCormack
@cmccormack
If FCC sold stickers I would send you some on your birthday
but apparently they would take 6 months to get there
Aditya
@ezioda004
Lol no worries, you like free stickers? Check this out
Christopher McCormack
@cmccormack
I CAN GET NPM SOCKS!?!?!
@ezioda004 That's great thank you for sharing
Aditya
@ezioda004
Lmao yeah, but the requirement is hard :/
@cmccormack No problem; I've done the google and alexa one and got the t-shirts! Its pretty easy to do!
Christopher McCormack
@cmccormack
TCzechowski
@TCzechowski
Hey! I've got a function that console.logs me an object with correct "innerHTML" property, but when I want to console.log that property it logs "undefined". Can you tell me why?
<div class="products__container__item">
      <a href="">
        <img src="images/products/jacket-crimson.jpg">
          <p class="products__container__item__price">
            <span class="price">159,90</span></p>
          <p class="products__container__item__model">
            Parka zimowa K&L crimson<br>(KM1519)
          </p>
      </a>
      <button type="button" class="add-to-cart btn btn--important">Add to cart</button>
    </div>
let addToCartButtons = document.getElementsByClassName("add-to-cart");
for (let i = 0; i <addToCartButtons.length; i++) {
  let button = addToCartButtons[i]
  button.addEventListener("click", addToCartClicked)
}

function addToCartClicked(event) {
  let button = event.target;
  let itemPrice = button.parentElement;
  let price = itemPrice.getElementsByClassName("price").innerText;
  console.log(price);
}
Christopher McCormack
@cmccormack
@TCzechowski getElementsByClassName I believe this returns an array-like object, not an element
Adel
@AdelMahjoub
@TCzechowski as @cmccormack mentioned
@TCzechowski try use document.querySelector instead
TCzechowski
@TCzechowski
love ya! <3
Aditya
@ezioda004
If possible, avoid query selector - they are like 99% slower than getElement methods
TCzechowski
@TCzechowski
sooo, how can I do this without using query selector? :)
Aditya
@ezioda004
If its the first selected node then you can do itemPrice.getElementsByClassName("price")[0].innerText
Adel
@AdelMahjoub
only getElementById is faster I think
but I could just run some tests and check
TCzechowski
@TCzechowski
@ezioda004 works like a charm. Thank you!
Christopher McCormack
@cmccormack
They're all going to be very fast in this context, the user would never notice the time difference between any of those selectors
Aditya
@ezioda004
@AdelMahjoub https://www.measurethat.net/Benchmarks/Show/393/0/queryselector-vs-getelementsbyclassname
Albeit not by a lot but my statement was based on this talk I watched yesterday
Adel
@AdelMahjoub
:+1: @cmccormack
well it is not slow; just not as fast, but is incredibly fast
Christopher McCormack
@cmccormack
wow front row looks comfy in that video @ezioda004
Aditya
@ezioda004
@cmccormack Rofl - I found that weird like I get people should be comfy but that felt excessive
Christopher McCormack
@cmccormack
These talks almost never apply to newer coders doing web stuff
but it is good to know
@ezioda004 isn't it like 01:00 there?
Aditya
@ezioda004
@cmccormack Almost, its 12:40
Christopher McCormack
@cmccormack
@ezioda004 ah you're in one of those odd half hour timezones
Aditya
@ezioda004
I could say the same to you :P
Christopher McCormack
@cmccormack
well no, you're GMT+5:30 which is an odd half hour one :) I'm GMT-7:00I believe
TCzechowski
@TCzechowski
@ezioda004 Just curious - For how long have you been coding? you seem to know javascript details in and out :P