« first day (4312 days earlier)      last day (621 days later) » 

12:26 AM
!!choose tank or mage
 
tank
 
šŸ‘
 
 
2 hours later…
2:00 AM
Hello :D
 
@Michael Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
 
5 hours later…
6:53 AM
@ChetanShah Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
 
4 hours later…
10:38 AM
If you have a few minutes, here is a tiny "HTML over the wire" library: github.com/josephernest/Swap Comments and criticisms would be super welcome and useful :)
 
@Basj Don't set onclick (and any of the on* properties) because then any consumer of the library will be denied that. Or alternatively, a consumer of the library will set el.onclick = /* whatever */ and wipe out your event handler. Use addEventListener instead.
Don't make your own arbitrary attributes, either. Use data-* attributes which is the standard for custom ones.
 
Thanks @VLAZ for these comments! Feel free to post an issue there if you want to be listed as contributor!
About onclick, sure, but the goal is to prevent the default behaviour and remove any other behaviour anyway, what do you think?
 
for (selector in unloaders) and ` for (m of mutations)` (2 instances) and or (n of m.removedNodes) and for (n of m.addedNodes) and for (selector in loaders) are all missing proper variable declarations, which means those are leaked implicit globals.
Speaking of declarations, you have var but you also have const. Either never use var (preferable) or only use var if you want to be VERY backwards compatible but if so, you'd have to remove any other ES6+ features.
 
@VLAZ A pull-request would be welcome :)
 
11:39 AM
@VLAZ I added variable declaration and strict-mode, thanks! (I'll think about const/let later)
 
 
4 hours later…
3:50 PM
I am learning about JavaScript Set
and at the beginning it's so confusing
What's the different between
// Create a Set
const letters = new Set(["a","b","c"]);

// List all Elements
for (const x of letters.values()) {
	console.log('x', x);
}
and
// Create a Set
const letters = new Set(["a","b","c"]);

// List all Elements
for (const x of letters) {
	console.log('x', x);
}
So, letters.values() and letters?
youtu.be/vfPd6_H7W4Q?t=148 - Vishwas told to use without .values, W3School with .values
 
4:06 PM
What the fucking fuck
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#iterating_sets
// iterate over items in set

for (const item of mySet1) {
for (const item of mySet1.values()) {
Why ?
 
4:33 PM
@MileMijatović Sets are iterables (and thus can be iterated upon directly), while values() returns an iterator (which are also intended to be iterated upon). From the standpoint of for...of, there is no practical difference. P.S. I wouldn't trust anything W3Schools has to say
the distinction becomes important if you (a) want to define custom iteration behavior or (b) use a built-in like Map (where values() obviously return values only while iterating directly uses key-value tuples)
I advise reading up on iteration protocols (iterators and iterables) first as this topic can be a bit confusing - once you get it down, move to what Map and Set do
 
 
5 hours later…
9:27 PM
I dont understand
Its very confusing
 

« first day (4312 days earlier)      last day (621 days later) »