« first day (3497 days earlier)      last day (1676 days later) » 

00:33
how do i avoid ternary hell in react? is it work making an iife in the middle of the render function?
00:44
more components
interesting that more components are preferred, thanks.
01:08
found my 2nd browser bug yey!
nvm, someone found it before me
nvm, nvm, it was something else. bugs.webkit.org/show_bug.cgi?id=211822
 
2 hours later…
03:33
@JBis Same as it would with an invalid snapshot in jest, you just update it.
 
6 hours later…
09:14
@phenomnomnominal I'll suggest that, right now I think its bypassing the store. So web worker data is connected directly to the view
user12200634
09:57
Does anyone knows whats the naming convention for pages inside pages. What I mean, is there a special name for a page that stays inside another page, like reddit.com/users/john/activity?t=true
user12200634
Notice how john is inside users page. Is it called subpages or subdirectory or ...
user12200634
Found it
user12200634
They are called nested routing
10:29
hi.
How to crop portions of PDF document and save it as image
i do want to select a particular portion from embedded pdf
11:01
Respected members, greetings. I am trying to following the below link for reading the docx file into my div or textarea. stackoverflow.com/questions/46908319/… but it is not allowing me to read .pdf and .txt file. Can anybody help me with it. Would be thankful and grateful.
@hirazzz 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.
11:30
Hi , I want some help in d3.js. I used this command in my code ------                                       var xScale = scaleOrdinal().domain(extent(data,xValue))
  .range([0, innerWidth]); ------- and got first and last value from 'xValue'  on my x-axis -But i want all distinct values on my x-axis .What function in replcaement  of 'extent' can be used?
@aaaaa 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.
I dont understand how this is working:
I mean the condition inside while loop
@jeea Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
let input = "A string with 3 numbers in it... 42 and 88.";
let number = /\b\d+\b/g;
let match;
while (match = number.exec(input)) {
  console.log("Found", match[0], "at", match.index);
}
// → Found 3 at 14
//   Found 42 at 33
//   Found 88 at 40
@jeea Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
11:35
@JamesBot ok
Hi , I want some help in d3.js. I used this command in my code ------                                       var xScale = scaleOrdinal().domain(extent(data,xValue))
  .range([0, innerWidth]);
    and got first and last value from 'xValue'  on my x-axis -But i want all distinct values on my x-axis .What function in replcaement  of 'extent' can be used?
hi is anybody has any idea about (this question )[stackoverflow.com/questions/61773578/…
@HusseinOjaghi 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.
https://chat.stackoverflow.com/transcript/message/49365071#49365071

I guess it is returning null if it does not find the pattern
Why out of while loop lastIndex property of regex object go reset to zero??
let input = "A string with 3 numbers in it... 42 and 88.";
let number = /\b\d+\b/g;
let match;
while (match = number.exec(input)) {
  console.log("Found", match[0], "at", match.index);
  console.log(number.lastIndex);
}
console.log("out of while lastIndex:", number.lastIndex); // why is this showing lastIndex as 0???
// → Found 3 at 14
//   15
//   Found 42 at 33
//   35
//   Found 88 at 40
//   42
//   out of while lastIndex: 0
12:22
is there any react developer?
@bounty 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.
if there, can you please take a look at this link --> stackoverflow.com/questions/61773256/…
12:33
@jeea I'm guessing here it's because the regex.exec moves the pointer for lastIndex but when it finishes (number.exec(input) returns null) it resets to the beginning.
Is it Javascript or JavaScript?
13:02
The latter
JakartaScript
CeeSharpScript
Latest EcmaScript standard has so many of C#'s features, it might as well be called that
shouldnt we call all languages just baby kotlins?
That sounds cute actually, like Baby Yoda
We need a cute plush toy to go with it
13:21
@VLAZ I think that is the case!!!
13:37
@phenomnomnominal K. Thx.
@Alex CeeSharpRun?
Writing VS Code extensions is super weird
13:53
@Michael Nice! And its acronym (CSR) won't confuse folks (CSS)
14:40
Morn y'all
Hello
15:04
I'm doing a project for school. If anyone knows of any JavaScript API's that provide any useful information on the user that would be great. Obviously, you can get user agent string, but i am also looking for less obvious api's like the media stream api which tells a website how many cameras and mic's are connected to the computer (even before requesting permission).
user11867329
Anyone who understand stocks dividends by any chance?
A bit. Whats up?
user11867329
Dividends percentage, I assume are yearly-based.
user11867329
But they are paid quarterly
user11867329
So, is it ROUGHLY 1/4th of the yearly dividend that are paid by then end of the quarter?

What if I buy stocks a week before the end of the fiscal quarter?
I assume they calculate the amounts of the quarterly dividend percentage you received based on the time you've held the stock (if not a full quarter)?
user11867329
15:08
Or is it case-by-case
user11867329
where if you buy X date, you will received dividends after 3 months (I doubt thats the case but who knows)
@OakDev Yes. Usually referred to as the dividend yield, it's the percentage of the current price of stock paid in dividends.
user11867329
Yes, that I know.
user11867329
Everysingle thing I asked still applies
@OakDev Depends on company. Most are paid quarterly. But some maybe more or less often.
user11867329
15:10
But they are paid all at once?
user11867329
So if I buy the stocks a week before end of quarter
user11867329
I can just cash the dividends and sell? Wouldnt make sense.
Yes. I don't think they check when you invested.
@OakDev No. The end of the quarter is when earnings come out. So you maybe get 2% in dividends but then loose 10% because the stock drops.
> The ex-dividend date for stocks is usually set one business day before the record date. If you purchase a stock on its ex-dividend date or after, you will not receive the next dividend payment. Instead, the seller gets the dividend. If you purchase before the ex-dividend date, you get the dividend.
user11867329
Or in a more optimistic scenario
so you'd be fine if you bought a week before
user11867329
15:13
You cash 1.65% dividends, instantly, and the earnings are promising and the stock plummets +20%
user11867329
Just seems like a waaaay too easy hack
plummets "+20%"?
user11867329
Sorry, wrong words, english
user11867329
Plummeting = downwards, right?
Yes.
user11867329
15:13
I meant upwards
user11867329
Jumps up 20%
Gotchta
Well then that is called a good investment.
user11867329
I'll double check that information
Thats why stocks volumes are so high before earnings days. Everyone is looking to cash in on the possibility of good earnings.
(Volumes are how many transactions aka buying and selling is occurring)
or they are trying to dump because they think that earnings are going to be bad
hey peeps, I'm using react. Right now I'm testing in local so my URL is something like localhost:8000/foo/bar/. Now, I want to link to localhost:8000/foo/abc/xyz. However, the URL for the homepage will be different depending on whether it's local or test env. What is the best and reliable way to create URLs in these situations?
15:22
config file with a base path?
Is there a function to get the base path?
Well it depends what you are trying to do. If you want to be relative to whatever the current page is client side, then you can use window.location.href or something. But if you need react to serve things at a certain path server side, then i would suggest a config file or environment variable.
I just want to create a Hyperlink.
Don't want to Route
Ok, is everything at a different path or just homepage?
Only the homepage.
so it'll be like te986.companyname.com/foo/abc/xyz.
15:29
Ok I would use process.env.NODE_ENV
href={process.env.NODE_ENV === "production" ? "produrl" : "devurl"}
aah but that would entail me defining the produrl and the devurl right
yes
Otherwise you can use window.location.href
but i think that is more risky
process.env.PUBLIC_URL
i think this one will work
well you can use any env var but since it is based on dev or prod i would use other one
but yeah that works too
how would NODE_ENV know whether its dev or prod though
15:38
its automatic in some configs, or you set it yourself
aah I dont think my react supports process.env.PUBLIC_URL, console.log(process.env.PUBLIC_URL) is coming as undefined
have you set it?
you must set it
oh sorry
then it's similar to using NODE_ENV
yes
Would any more-experienced devs here be willing to take a quick look at some JS I'm trying to get to work? I'm trying to pass some parameters to a backend function in order to receive a JSON response and it's not working; I'm lost.
15:51
@LordTaylor 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.
JS

Vue.component('getdata', {
    data: function () {
        return {
        };
    },
    mounted: function () {
        var result = this;
        var dataVar = {
        Groups: '',
        StartDate: '',
        EndDate: '',
        UserId: '',
        SomeId: '',
        hasIt: false
    }
        fetch('/Controller/GetData', {
            method: 'POST',
            headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
            body: JSON.stringify(dataVar)
        })
@LordTaylor Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
If someone could tell me what I am doing wrong there, I'd greatly appreciate it.
JS is at the top and the C# function I'm trying to reach is below it.
 
1 hour later…
17:15
posted on May 13, 2020 by Srinivas Sista

The beta channel has been updated to 83.0.4103.56 for Mac, Linux and Windows A full list of changes in this build is available in the log. Interested in switching release channels?  Find out how here. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Srinivas Sista Google Ch

17:43
I'd like to verify my approach is correct. I have gulp set up to do some build tasks. In my package.json I added "gulp": "gulp" to the scripts section, so I can then call npm run-script gulp MyTask directly and use the projects's gulp installation instead of installing it globally.
Does this make sense? Is there a better accepted way to go about this?
sounds good to me
i think global installations should be illegal
I'm also especially wary of them.
If I get a new project and it's using a different version of gulp, it could lead to clashes.
do note, that if gulp isn't installed in project but is installed globally it will use the global one iirc
It's installed in the project - it's a dev dependancy.
I just wanted to make sure this is a normal way to use the project's installation.
My first idea was to call it explicitly from the command line - ./node_modules/gulp/bin/gulp.js MyTask but it doesn't seem to like it. I think it ignores the gulpconfig and I have to supply it as a parameter with --config but I just decided a script might be easier and it works so far.
18:31
lmao
if you hover over font-awesome's hamburger button it turns into an actual hamburger
i need to change all my sites thats beautiful
18:44
Hamburger menus are old fashioned. Get with the times and use pizza menus.
19:20
I'm not the brightest person
Just a quick and easy simple question
element.forEach(function(button) {}
for loop ect inside of that
playing games shoudln't be done with keyboards that can be dstroyed I now learned.
is there a way to select every single element
Define "select"?
@LeeSugden Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
19:24
apolgies JamesBot however on a mac it isnt working for some reason
    navLink.forEach(function(button2) {
    button2.addEventListener('click', function() {
    //toggle active
    for(let i = 0; i < navLink.length; i++){
        if(this.id === navLink[i].id){
            // contains active anywhere remove it
            if ( this.id === toggleImg[i].id ) {
                //remove from all
                navLink.classList.remove("active"); //doesnt currently work
            }
        }
    }
    });
});
did that work?
@paul23 I want to remove it from all of the navLink classes but i need it in a for loop because then im going to select the specifc button and add changes to that one
When removing from a list always make sure you iterate from end to start.
Consider the list: [1, 2, 3, 4, 5], if we remove all items from the list like:
so if implemented [1,2,3,4,5] instead of [i] would that work?
for (let i = 0; i < thelist.length; i++) {
    thelist.splice(i,1);
}
Consider what happens each iteration:
0: [1, 2, 3, 4, 5] -- index is at "0" theList[0] = 1
1: [2, 3, 4, 5] -- index is at "1"  theList[1] = 3(!)
2: [3, 4, 5] -- index is at "2" theList[2] = 5(!)
3: [4, 5] -- index is at "3" theList[3] = ??? Error
You'll first of all wish to loop from top to bottom:
for (let i = theList.length-1; i>= 0; i--) {
    theList.splice(i, 1);
}
0: [1, 2, 3, 4, 5] -- index is at "4" theList[4] = 5
1: [1, 2, 3, 4] -- index is at "3"  theList[3] = 4
2: [1, 2, 3] -- index is at "2" theList[2] = 3
3: [1, 2] -- index is at "1" theList[1] = 2
4: [1] -- index is at "0" theList[0] = 1
5: [] -- stopiteration
Im struggling to comprehend you, Imagine a loop of 4 divs .a .b .c .d, .a always starts with a class of .active however I want to add .active to say .c and remove any cases of .active in the remaining classes.
oh wait, you're not removing the divs themselves with remove?
19:35
no .a .b .c .d are constant however .active moves between .a .b .c .d for example
start off .a .active click .b this should then be .b .active and .a .active should just be .a
    if(this.id === navLink[i].id){
        // contains active anywhere remove it
That if statement is (probably, depending on context libraries for which I don't have time to check) not doing what you state it does.
@paul23 uh oh lol
it is "if the button pressed is actually the navigation linki we're iterating over".
Now I'm unsure if this will even work, since it looks like you're not using strict mode and hence this is a problem of itself.. But you should change the inner loop contents to something like:
if (this.id === navLink[i].id) {
    navLink[i].classList.add("active");
} else {
    navLink[i].classList.remove("active");
}
Possibly caching the this outside the event callback:
i want it to do that navLink[0,1,2,3].classList.remove("active");
navLink.forEach(function(button2) {
    const thisNavLink = this;
    button2.addEventListener('click', function() {
    //toggle active
    for(let i = 0; i < navLink.length; i++){
        if (thisNavLink.id === navLink[i].id) {
            navLink[i].classList.add("active");
        } else {
            navLink[i].classList.remove("active");
        }
    }
    });
});
19:47
hi there
Really sad my ctrl key broke in two :(
|| backup
Backup Created
i'm fixing james, does anyone remember any issues?
@paul23 it seems you...lost control.
I'll see myself out.
19:49
XD
Took me longer than I'd like to admit to get that one
hi friends.
Hello
20:10
|| sudo restart
My life has come to end. I hope to be revived soon.
@JamesBot go inside a cave and emerge in three days time.
||> return await Promise.resolve(3)
@JBis "TypeError: Promise.resovle is not a function" Logged: `` Took: 0ms
It has worked in the past.
20:11
@JBis 3 Logged: `` Took: 0ms
i just can't spell
||> undefined; Array(100000000).fill(10).map(num => Math.pow(num,2))
uh oh
|| status
I am currently alive!
Is that array just too big?
||> Array(5).fill(10).map(x => Math.pow(x, 2))
@VLAZ [100,100,100,100,100] Logged: `` Took: 0ms
@VLAZ [100,100,100,100,100] Logged: `` Took: 0ms
Hmm, twice?
||>Array(50).fill(10).map(x => Math.pow(x, 2))
20:14
@VLAZ [100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100] Logged: `` Took: 1ms
||> undefined; Array(100000).fill(10).map(num => Math.pow(num,2))
@JBis [100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100 Logged: `` Took: 16ms
there we go
||> undefined; Array(5).fill(10).map(x => Math.pow(x, 2))
@VLAZ [100,100,100,100,100] Logged: `` Took: 0ms
20:15
||> typeof jQuery
@VLAZ "undefined" Logged: `` Took: 0ms
||> {}+[]
@VLAZ 0 Logged: `` Took: 0ms
||> {}
@VLAZ {} Logged: `` Took: 0ms
20:30
Hmm, should have been just nothing
Seems V8 has changed how it interprets this. Again.
uh anyone know how to overwrite grid-auto-columns for a specific column?
IE: I have a variable amount of columns, each which I wish to have max-content as width. Except column 2, which will always be there, and needs to eat all remaining space
@VLAZ why?
{} is an empty block. You can see that in {}+[] - the result is zero, because the interpreter reads "open code block" -> "close code block" (so, no-op) -> "plus" (no left side operand, so it's a unary plus) -> "empty array". Thus the expression it evaluates is just +[] - it converts the empty array to a number by calling .length on it and thus the result is zero
If we use brackets, we can force the interpreter to evaluate {} as an empty object instead:
||> ({}+[])
@VLAZ "[object Object]" Logged: `` Took: 0ms
||>({})
20:37
@JBis {} Logged: `` Took: 0ms
||> {

}
@JBis {} Logged: `` Took: 0ms
interesting
now it performs "addition" and due to abstract type conversion rules, it converts both operands to strings. For the empty object that results in the string "[object Object]" and for the empty array that's the same as calling .join() on it. An empty array produces an empty string, so you just get the string value of the object
Try that in the Firefox console, and you'd see undefined
Chrome used to interpret {}+[] as if you had ({}+[]) but it seems it has stopped now. Except if you just have an empty object, in which case it evaluates it as if ({})
Well, not Chrome - I assume you use a V8 REPL for the bot
So, it's really V8 itself.
21:03
@OwenVersteeg Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
@OwenVersteeg 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.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
@OwenVersteeg Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
@OwenVersteeg Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
OK, clearly I am too dumb to properly format my code. I tried backticks around it and four spaces indentation, neither made the bot happy...
did you try ctrl +k?
const newData = {};
data.map((e) => {
     newData[e.utc_time] = e.data_value;
});
const newData = data.reduce((obj, datapoint) => ({ ...obj, [datapoint.utc_time]: datapoint.data_value }), {});
Yep, that seemed to put in four spaces but somehow it didn't format as code?
Ah, thanks!
So whats your question?
Anyway, I wanted to rewrite the top in a "better" way because apparently using map like that is bad. So I tried to write it in the "functional" way (the bottom snippet you pasted) but that's horrifyingly slow
Does anyone have an idea for how to rewrite it in a way that's fast and functional?
21:09
functional will rarely be as fast as nonfunctional but lets see what we can do
Thanks! Yeah, according to the airbnb style guide the "right" way to do stuff like this is functionally
i see two main options
const newData = {};
data.forEach((e) => {
     newData[e.utc_time] = e.data_value;
});
which isn't terrible and probably the most efficient
otherwise, you can do this
Object.fromEntries(data.map((e) => [e.utc_time,e.data_value]));
@JBis "ReferenceError: data is not defined" Logged: `` Took: 0ms
|| mdn Object from entries
21:12
more info ^
Oh fancy! Nice, thanks!
The foreach is O(n) and the fromEntries is probably about O(2n)
Huh so for some reason the fromEntries seemed to run perceptually faster
I wonder if there's some funky optimization being done deep in v8 or something
than the foreach?
Yeah
I'll time it
21:15
|| shrug
¯\_(ツ)_/¯
it must be optimized
that benchmark says that foreach is faster
Ok I guess it's just something funky with my specific use case cause when I benchmarked the two on their own the fromEntries was consistently ~30% faster
Thanks!
np
So why is the reduce so slow? At first glance I thought it'd just be O(n) but I guess the object spread is forcing it to be something much worse?
cause with 12,000 items it's somewhere around 30 seconds vs. 11 milliseconds for both the forEach and the fromEntries
21:25
hmm
const newData = data.reduce((obj, datapoint) => {
   obj[datapoint.utc_time] = datapoint.data_value;
   return obj;
}), {});
try that, should be slightly faster than the entries method
but slower than foreach
Funny enough that seems to be the fastest of them all
Object spread iterates the object
So it's O(n) itself
I guess it's the object spread being slow?
Aha!
oh wait theres an error there
So it made my reduce with the spread O(n^2) then?
21:29
const newData = data.reduce((obj, datapoint) => {
   obj[datapoint.utc_time] = datapoint.data_value;
   return obj;
}, {});
try that
@JBis Yeah I fixed it when I put it in
based on the testing site, it went foreach, reduce, fromEntries
Yeah I just ran it a bunch more and that's exactly what I got
So is there a nice alternative to the object spread (for that kind of neat one-liner stuff) that's not super slow?
Or a way to make the object spread not slow?
Cause that's kind of disappointing, I liked the elegance of the ...
delete the spaces
const newData = data.reduce((obj, datapoint) => { obj[datapoint.utc_time] = datapoint.data_value; return obj; }, {});
boom, one line
hahah, true
21:32
personally i try to avoid reduce
i think alternatives are more readable
Huh
I'd just switched to the airbnb style guide and they really hate loops and foreach so I had been switching a lot of stuff to reduce
But I guess there's a third option of stuff like Object.fromEntries?
the airbnb guide's problem with for...of loops steps from how heavy it is to polyfill/transpile
if that isn't a problem for you then override the rule
that particular rule is very controversial
I thought they also didn't like for...in for another reason
Pretty sure it's the same reason
regenerator-runtime or something like that
3 mins ago, by forresthopkinsa
the airbnb guide's problem with for...of loops steps from how heavy it is to polyfill/transpile
^ stems*
I seem to remember their problem with for..in is something to do with inherited properties
21:39
posted on May 13, 2020 by Cindy Bayless

The Beta channel is being updated to 83.0.4103.50 (Platform version: 13020.44.0) for most Chrome OS devices. This build contains a number of bug fixes and security updates. Most systems will be receiving updates over the next several days. If you find new issues, please let us know by visiting our forum or filing a bug. Interested in switching channels? Find out how. You can submit fee

and they want you to call hasOwnProperty over everything
oh, right, that is an issue, but they're right about that most of the time
@forresthopkinsa but they are ok with forEach loops right? Also when would you need to polyfill for...of or for...in?
you don't want to be iterating over prototype elements
IE I guess?
The problem isn't that you have to transpile it, the problem is that you need to add a really heavy runtime to your app when you do
but how often do you actually end up iterating over prototype elements? The built in stuff in Object.prototype isn't enumerable
21:42
There's a Github issue somewhere with like a 500-comment argument about this
So you'd only do that if you're for..in -ing over something from a library or something
Hahahahahahahah I had a feeling
Well I do think the dangers of for...in are legit
you mean about prototypes? or is there something else if you don't transpile?
When a library does override an object's prototype -- which is common enough -- you typically don't know they did it
fucking ie
21:44
No I think the transpile thing is stupid and I disagree with airbnb about that one
I'm talking about prototype iteration
Yeah
Idk I guess I've just never run into a library I use that added a prototype to something I was iterating over
those only i like about regular for loops is that you can use await without worrying about stuff
I haven't had that problem either but it's common enough to be a well-known footgun
@JBis Right, that was the bulk of the aforementioned argument
Trying to use reduce with promises is a major PITA
related
5
Q: How to use Array.prototype.some() with an async function?

JBisI am trying to do the following: command.permissions.some(async permissionsKey => { switch (permissionsKey) { case "all": { return true; } case "OWNER": { return await msg.roomContext.isRoomOwnerId(msg.getStaticUserUID()...

Unfortunate that the answer to that question is so long
Ideally it would be like one line
21:47
ideally there would be a second arg
if set, it would return a promise that resolves when its done
(at least for forEach and stuff)
I think there's a draft for just having async variations of the iterable functions
some issue can't be solved because promises can't be canceled
@forresthopkinsa +1 to that
I've implemented a few such async variations myself
you run into it a lot
I started a really long-running test for my current task at work before I went to bed last night and this morning the results had been deleted because our staging deployments run on GKE preemptible nodes
So the VMs were terminated and the database wiped and I have to re-run the thing
oof
What type of tests take that long?
Video transcoding stuff
vp9 encoding takes a ridiculously long time
21:54
ah
@agentprovocateur Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
I was trying to make a change to our pipeline that would speed up the process but I didn't know if it would cause a/v sync issues
James that was faster than 25s
time is relative
james is just traveling the speed of light
21:57
oh shoot I didn't factor that in
i cant figure out the formatting LOL
if(something){
object1['animals'] = results[i1];
}
If(something else){
object1['cars'] = results[i1];
}

$.each( object1['animals'], function(index,record){
record.key2 = "A";
});
$.each( object1['cars'], function(index,record){
record.key2 = "B";
});
lol thanks.
hit Ctrl+K before sending
yeah so, i'm just trying to split up the results into separate objects and then loop through the objects to set additional key values
but a lot of the animal set has key2 = "B"
i dont understand why...
am I expecting something incorrectly or is something else messing up the code?
22:04
@agentprovocateur are you on a mac?
@OwenVersteeg are you on a mac?
22:22
23:07
Any good Zoom meetups for JavaScript?

« first day (3497 days earlier)      last day (1676 days later) »