« first day (3628 days earlier)      last day (1303 days later) » 
00:00 - 15:0015:00 - 00:00

12:42 AM
waiting for ==== and ===== to be added to typescript for equality assignment operators
a ===== b
or maybe a new shorthand a =*5 b
 
1:40 AM
I just saw someone posting about whether they Should or Shouldnt use semicolons....
redditors are just...
sigh
I saw a few "experts" saying "oh its 2020, most programs and IDEs will automatically fix that and automatically fill them in! Its totally okay!"
oh god that just triggers me
like... semicolons are literally like the simplest standard of JS
what are those doofuses thinking
 
huh
so you're saying they should use semicolons?
 
why do you feel so strongly about it?
 
It just annoyed the crap outta me that some so claimed "experts" said it was okay to NOT use them
 
I mean, I use semicolons, but it's not a big deal
It's totally okay to not use them
 
1:42 AM
Because its standard, and depending on where theyre removed, they can actually break expressions
 
That's a little bit silly
 
Some promise functions will easily break if you remove a semicolon
not to mention basic expressions
How is that silly?
I mean tell me
 
It's only standard according to certain style guides
 
would you really risk the stability of a script
from removing semicolons?
 
I really don't think it's that important
It's like tabs vs spaces
 
1:43 AM
facepalm
 
Kotlin is a semicolon-optional language where the status quo is to not use semicolons
 
here let me grab some common answers to this question
> The Good Parts says on two separate occasions that it is a bad idea. The automatic semicolon insertion can hide bugs in your program and creates ambiguity.
Its a bad idea... its standard to use them... ASI hides bugs
This is just super triggering to see newer users actually considering relying on ASI
and removing their semicolons
 
Dude you're really blowing this out of proportion
 
not really, Im just venting because its triggering
 
Consider single vs double quotes
 
1:45 AM
oh fuck here we go
 
A lot of style guides recommend using one quote style unless you have those quotes inside a particular string
 
using single quotes instead of double quotes or the latter
will never cause a "bug"
Removing semicolons however, depending on what youve written, can actually break scripts
 
So you'd do ['This', "isn't", 'a', 'problem']
 
No? Because thats ugly
 
1:47 AM
i dont think you see the difference. A single quote and a double quote are Cosmetic differences
 
Not in that array I just posted
 
a semicolon and no semicolon is basically removing a separator telling what is what
 
That second item will break if you naively replace the double quotes with single quotes
You'd have to escape it
And thus is my point: it makes sense to use one style in all cases except where the code necessitates using another style
 
but why wouldnt you just escape the data within the string
thats basic knowledge
 
Because backslash escaping is ugly
 
1:48 AM
the " and ' conflict within strings
if its ugly... then oh well.
You cant just "remove" semicolons because theyre ugly
 
There are very few cases where automatic semicolons would actually create ambiguity
 
thats like saying "you can remove the 'var' in 'var variableName' because it looks good and works"
 
You're totally missing my point
 
even though its not fully compatible everywhere
 
By a mile
 
1:49 AM
and many scripts are strict
Sure.
 
1 min ago, by forresthopkinsa
And thus is my point: it makes sense to use one style in all cases except where the code necessitates using another style
 
Whatever ya say. Simply saying that you shouldnt remove semicolons even though it poses a risk
 
Very common JS style is "use single quotes unless there's a single quote within the string"
So why not "don't use semicolons unless the end-of-line is ambiguous"
 
I just use backticks in ES6, and if Im in anything older, I just escape anything in the string
backticks ignore both sides
 
You use template literals for everything??
 
1:50 AM
and if Im using a backtick in a string (very uncommon except for discord)
I escape it
 
I haven't seen that before
 
Yes. I do, and if youre going to start some weird speech about how its "more taxing" or some crap? I dont really mind. A few milliseconds do not matter to me, and most of my javascript goes towards a discord bot where my MS ping is random between 10-50 anyways, so anything iterating doesnt really change much
Discord uses backticks for code
 
I'm not starting some speech, I just think it's weird that you use a style that's far more unusual than implicit end-of-lines
And then make such a big deal about semicolons
 
Whats unusual about template literals?

You have the option to replace a string within the template whenever you need it, and you dont have to worry about escaping quotes.
I think its actually quite efficient
 
Unusual doesn't mean inefficient, it means not usual
 
1:54 AM
plus they have an appealing color to my eyes within my syntax highlighters
 
I haven't seen it before, therefore it's unusual to me
In my experience, implicit semicolons are more common than template literals everywhere
 
Well I mean, havent you ever wanted to just not have to worry about quotes before?
 
I already don't worry about quotes, they're pretty straightforward
 
I use quotes in a lot of database search / JSON retrieval scripts in my bot and other programs
and having to follow that inverse single and double quote thing is annoying
not to mention I love the look of template literal replacement
 
Okay well whatever floats your boat
 
1:56 AM
Now if Im just writing a random JS app? yeah sure Ill use whatever I type first
 
All I'm saying is that it's more atypical than implicit end-of-lines
 
implicit end of lines? youve said that multiple times
 
Yeah, ASI
 
Holdon... I dont get it. Doesnt javascript read the actual script just like any other basic language serializer?
by ignoring linebreaks and reading everything in a big array or a single line
 
Very few languages ignore line breaks
I don't think I've used one
 
1:58 AM
Well I know there are a lot of languages that specifically rely on line breaks
 
Ehh I think I misspoke
 
But javascript doesnt need them
it relies on a space between keywords and types
 
There's a difference between "needing line breaks" and "reading line breaks"
 
so function name(arg1, arg2) {} might as well be read as function name(arg1,arg2){}
that same concept goes for junkified or minified JS
But what Im trying to say is, if it doesnt work in this way
 
what exactly is your point?
 
1:59 AM
removing a line break would be like:
say you had.....
function functionName() {
 var variableName = 1 + 2;
 var variableName2 = 1 + 2;
}
wouldnt removing the semicolons be like:
function functioName(){var variableName=1+2var variableName2=1+2}
making an invalid expression?
 
No
JS does not strip out line breaks
Minifiers do
But JS does not do that itself
 
Then why does removing semicolons for some specific cases still cause errors and issues
 
The language doesn't know if you want to continue to the next line or not
 
because thats what Im trying to get at, it does still technically cause issues. Whether its common or not, or its for minified code only or not, it still poses some kind of instability to code
 
Which is indeed a really uncommon circumstance
Instability is kind of a dramatic way to put it
 
2:03 AM
Well considering a lot of IDEs and online editors automatically minify code with their own custom minifiers, which ignore linebreaks and missing semicolons
most common users will have issues with it
 
Uhhhhhh
I think you're confused
 
Im not. Minified code usually deletes linebreaks. When you execute said minified code with missing semicolons, itll cause issues with an expression as it reads it literally as both expressions as one.
Or perhaps Im not explaining it well
 
A smart minifier doesn't break code
It doesn't just s/\n//g
 
But I know Ive experienced issues with well formatted code missing semicolons, and being executed in something like firebase causes issues
and others have too
Wait
 
That's super vague and anecdotal
 
2:05 AM
Why are we even arguing about this....
just use semicolons, its standard
and if not, depending on what you use, if you decide not to, it may or may not break
Simple as that?
 
We're arguing because you came in here talking about how stupid Redditors are for even considering not using semicolons, and I'm saying that you're the one who's been misled
Not them
Semicolons are preferable but they're not such a big deal as you make them out to be
 
Well either way.... I just dont see the point in not using them
 
In Kotlin, as I mentioned earlier, it's standard not to use semicolons because code is prettier without them
 
Why are they parseable if its standard
 
Semicolons are just optional
 
2:08 AM
thats what Im curious about
Optional?... strange
 
Same as in JS
 
Something like C#, itll scream hell at me for a single missing semicolon in a basic method with only a single line expression
maybe Im mixing C# and JS
 
In Kotlin's case it's because most of the audience are used to Java
Maybe you are
 
Node.js is the same way as Unity C#... it spams errors for missing semicolons
 
Node will not give you "missing semicolon" errors
 
2:10 AM
But I wont deny the fact that I have gotten errors in the past in vanilla javascript in the browser over a missing semicolon
Well
if it doesnt, I wont bother asking you to explain why
because thatd just drag this on
 
JS will not ever give you a "missing semicolon" error. At worst, it'll misunderstand your meaning, thinking you meant something different than you typed.
 
No, its never a direct "missing semicolon" error
its a typerror or similar, usually with a variable name
and its fixed by applying a semicolon near the location of the error
 
I wish I had a good example, but its not very common.
 
So you caught the ambiguous code quickly and your code was never "unstable"
You're right it isn't very common
I'm only arguing about this to point out that you should think twice before taking on such an air of superiority, because you might be the one that's confused
 
2:12 AM
I guess
I dont want you to interpret my words as "superiority"
We were arguing
simple as that
 
Whether or not you intended it, this definitely comes off that way
 
I never pushed superiority over anyone.
I just dislike people who claim to be experts
 
Seems a little hypocritical hah
 
But dont follow a commonly followed standard
 
Well, whatever, you can use whatever code style you want
I'd never omit semicolons in a project of my own
 
2:15 AM
Alright. For the sake of the message.... Find a single chat where I claimed to be a "javascript expert"
:p
 
I hope you understand what I meant but touché
 
||shrug
 
¯\_(ツ)_/¯
 
2:43 AM
when you concatenate immediately called functions, it can annoy, i use it always, just to avoid that cases...
 
3:02 AM
what do you mean? IIFE's?
 
 
1 hour later…
4:30 AM
yes
i have had problems with no-semicolon sometimes, and to not have to discriminate, which is to apply mental ifs, i put it almost everywhere, not as a religion, but yes, everywhere
it is important to have a standard way of coding for oneself, in the end, coding means to put in order
 
 
2 hours later…
6:38 AM
Buenos dias
 
 
2 hours later…
8:17 AM
0
Q: React build taking too long to complete with message "95% emitting CopyPlugin"

Anudeep GIBuild taking too long to complete in my local system. It showing the message "95% emitting CopyPlugin" when I run "npm start" and waits for 7 or 8 hours to complete, even same thing happens when I make code changes if code change is one line or a class name change it again takes a long time to ...

 
@AnudeepGI 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.
 
8:39 AM
cms remove permission --to speak --user whatever
 
 
1 hour later…
9:51 AM
Hi All
im looking to write a query which gets me the record of a collection whose date value of a column is > 24 hours
i have a column, disposed in the collection and it stores ISO date value.
 
why does undefined + null returns NaN , I dont get it +
 
what im trying to do is

disposedDate > CurrentDate by greater than 24 hours
 
@Amundsen typecasting
 
what i tried is using $gt in query
db.getCollection('ledgers').find({disposedDate:{$gt:new Date()}})
 
the + checks the types of both operators, starting with left operand
 
9:54 AM
but it return anything even if it is greater by 1 minute obviously.
 
since undefined is not a pre-defined type, it casts it to a number. Therefore you get a NaN
the null is thereby casted as number as well, which gives you a 0. But that's irrelevant because if there is a NaN, it always gives a NaN AFAIK
 
@KarelG okay but why does undefined + undefined returns also NaN ?
 
Just explained it ^
 
typed it to fast ^^
 
@SamSam 24 hours after or before?
 
9:57 AM
@KarelG thanks
 
I am a quick typer but there is ppl here that can type faster
@SamSam fyi ... are you aware that it gives you a full timestamp?
the databases aren't precise if you apply DATETIME on DATE fields
dependent of the db (I am 100% certain that PostgreSQL, MySQL and MSSQL does it) it picks the loose type, so DATE becomes DATETIME
 
@KarelG yes, i know. Im looking for records where disposedDate is greater than 24 hours.
 
well, add it to your date?
 
when we do disposedDate- currentDate, if the substraction return >24 hours my query should return that record
 
the current query you've used is looking for records after now.
there are various ways. I just set the date correctly instead of doing that math.
(more performance friendly)
 
10:08 AM
db.getCollection('myCollection').aggregate(
[{"$project":{"_id":1,"disposedDate":1,
                  totalHourSpent:{$divide : [{$subtract: ["$disposedDate",new Date()]}, 3600000]}}}])
@KarelG this is my latest query, im close but still the hours thing is not perfect
the value of disposedDate in my DB right now is
ISODate("2020-09-21T15:09:35.673Z")
but the total HOurs is returns me is
"totalHourSpent" : 5.08720694444444
 
 
1 hour later…
11:19 AM
How do I add the class only to buttons that have not been clicked. That is, the button clicked turns blue, the others turn gray, and after 3 seconds, everyone turns blue again.
$("button").click(function() {
                $("button").addClass("bg-grey");
                $(':button').prop('disabled', true);

                setTimeout(function(){
                    $(':button').prop('disabled', false);
                    $("button").removeClass("bg-grey");
                }, 3000);
            });
 
found the cause of my problem, actually my mongo will always be using the UTC time.
that is why this difference
 
11:34 AM
@Tiago what's the logic behind that timneout?
after 3 seconds, you just undoes what you have done before calling setTimeout
 
add/remove another class to reflect the state and done
 
there are data-attributes for that
 
or classes, both r valid
 
12:08 PM
CaaaaRl
 
you must be Lenny?
 
"An entry without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.
Anyone ever seen this error
when trying to send a post with ajax to a sharepoint list
 
12:39 PM
that's an error from SharePoint. Best to not ask it here but in a room dedicated for SharePoint. If there aren't any, visit its SE page. I have worked with it, but I ain't an expert as well
 
 
1 hour later…
2:02 PM
Anybody know of a lib that just does lodash's cloneDeep method?
 
Funny enough, the first answer says lodash is your best bet
 
yeah... it's also huge
but I see this: github.com/pvorb/clone
I read that post before but I missed that reference, might give it a shot
you'd think with redux being everywhere there'd be an easy solution for this one
that isn't an 800lb gorilla, that is
thanks
 
That link contains a 265 line file just to clone an object...
 
must have missed that... long post
where is it?
 
In your link
 
2:10 PM
oh, right
 
265 lines of code just to clone an object is silly.
You're not already using jQuery by any chance?
 
I've read some blog posts about it, apparently there's a lot that can go wrong
I haven't used jQuery in 5 years
 
Sure, a lot could go wrong, but what do you really need it (the clone functionality) for?
 
I tried the JSON stringify / parse method and that failed instantly because of dates
weird date objects?
I'm using moment (at the moment), going to move to something else
I dunno, I just don't want to hit some corner case and find I can't move forward without bringing lodash back in
 
You do realize you can pass a function to JSON.parse?
 
2:13 PM
was reading this yesterday: medium.com/javascript-in-plain-english/…
doesn't work with date objects though
that have timezone info, etc
 
By the way, I'll be in the early-middle learning JS, should I start learning JQUERY now as well, or wait a little longer?
 
@Chanif 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.
 
@Shane Yea, it can.
 
you're talking about the JSON.parse(JSON.stringify(obj)) method, right?
 
@Chanif I'd suggest going for jQuery once you get the basics of native JS
@Shane Yes. Just pass a method to take care of dates
 
2:15 PM
that one crashed the app in a few stores
 
And when to start learning REACT?
 
it might work, but it's not a drop in replacement for cloneDeep
 
app? stores?
 
yeah, redux
everything's pure functions, so I run cloneDeep so I don't have to overthink things when modifying the stores
 
@Chanif When you have the need for it.
 
2:17 PM
thanks. I study alone, so I do not know so much...
 
Still not sure why that'd rule out the json path
 
I dunno, it just failed
@Chanif - take a look around codesandbox.io
it's a good place to rapidly play with different examples... that and codepen.io
better start with codepen actually... codesandbox is for when you start building little mini applications, eg. react
 
var a = { d: new Date(), a: 1 };
var b = JSON.parse(JSON.stringify(a), (key, value) => /^\d{4}-\d{2}-\d{2}/.test(value) ? new Date(value) : value)
console.log(b);
To illustrate the idea of using a reviver function in JSON.parse.
 
huh... never played around with JSON parse...
feel kinda dumb, didn't realize it took more parameters than the string
 
It seems many people don't realize that
 
2:22 PM
yeah... the one does the job most of the time
 
Still, for a deep clone... It's hacky
 
@Shane - Thanks, I'll try.
 
Frankly, I'd rather use lodash or even jQuery, myself, especially considering I usually have jQuery loaded any way
 
yeah... I'd rather just drop a lib in, just not something as big as lodash
 
@Shane lodash is modular
 
2:23 PM
@KarelG Yeah, thought about that too... I might do that
 
Also, library size shouldn't really matter that much. Most users will already have it cached any way
 
I was hoping there was some kind of goto solution out there
even if it's bundled in a create-react-app?
 
Oh, no
 
yeah...
That's the issue is it's just so heavy
 
But maybe that bundler strips out unused code? I know Angular does
 
2:25 PM
no idea... possibly
@Chanif -np man... I think you'll like codepen, it's a fun place to play around and let you tweak something that's already working
you can learn pretty fast in there if you're getting started
 
codewars.com also has some fun problems to tackle
Although some are more gimmicky
 
@Shane What is the difference between them?
 
codepen and codesandbox?
 
yeah
 
codepen is more for standard javascript, meaning you load JQuery to the page and use it that way
codesandbox is more for making apps, where you import modules and "compile" them into a large javascript file... don't worry about that yet
start with the basics
watch this... youtube.com/watch?v=FKTxC9pl-WM it's good advice on how to learn
If you take that advice, it will change your career forever
big thing to say, but it's true
 
2:39 PM
Is it better (for me, right now) than a code editor? and what advice do you mean?
 
Your mindset is important... you don't want to move too slow or too fast
too fast, you get tired and overwhelmed quickly... too slow and you end up rigid
so the idea... when you want to learn something, is to take something that you can accomplish, but not well and do it a bunch of times until you don't have to think about it at all
something like array.map or array.reduce and just do it 30 times in different ways
but do it fast
and you train your muscle memory... THEN move onto something that uses them and repeat
 
The basics is always not to use a window inside the browser
 
eventually you can move onto the harder stuff because the beginner stuff is now second nature... that's how you know you're ready
The basics are wherever you start
The video starts with everyone has an opinion on what you "have to know" to call yourself a dev... but it's really about the process of learning
 
Using a browser window will learn you the intracities of that window - while ides are often much clearer in "this is code and this is IDE specific".
 
@paul23 I think it's important to move to an IDE / text editor soon, but I think starting there robs you of that instant feedback that's so critical in the beginning
 
2:46 PM
My level is to build basic and responsive things, I currently practice more on “programming thinking”, and less on learning the more advanced topics.
(Although I learn a lot in the process! Mostly features and options of the language, like getting user screen width, and more)
Is it right to do so?
 
that's a great starting place, yeah
there are lots of great starting places
 
I'm not sure about that; having started in java and later c family..
 
"good" is better than perfect because it moves
 
never experienced that as problem, rather had troubles when tutorials recommended "tools" which made life easier.. And ended up being magical trees which hide the logic.
 
well, javascript is well rooted in browser technology and the basics are pretty ubiquitous these days
 
2:47 PM
it is not for a starter
:P
 
@KarelG - if you can break it down into atomic concerns then it really doesn't matter
 
I'm a little entangled in the logic of what I'm building, I think I need to practice it some more - before learning. and I use a lot of browser developer tools
 
@Chanif the most important thing is to not learn too many concepts simultaneously
 
Do you have any advice, how to practice logic and programmatic thinking? (I study alone)
 
Really, guys... Don't just go faffing about in an editor
 
2:50 PM
"just do it"?
 
Look for an (online) course
Heck, get a book
 
I agree with @Cerbrus that's good advice
 
Follow the lessons in there
 
There's not much to "programmatic thinking" other than engineering mentallity.
 
if you don't have something specific you want to learn... a book or course is ideal...
 
2:52 PM
Which basically boils down to just start chipping of the problem at hand until you understand it and can trivially bring a solution together.
 
I study client side development, the basics I know well, but less know how to integrate everything.
 
@paul23 on the clock, sure... if the goal is learning though... I think you have to break it into pieces and master them individually before putting them together
 
Mostly JS
 
practice makes permanent
 
That kinda sound like the kind of thing you learn on the job
 
2:55 PM
Thanks, what you wrote is really helpful. (Especially when I do not have feedback from a teacher)
 
@Chanif Well then you'd have to study. "how to integrate" isn't something you can really learn at home. You learn those things by looking and discussing things with others.
 
Looking at someone else's code can it help?
 
sometimes
 
Depends on the code
 
@Cerbrus amen
 
2:57 PM
IF its commented or marked up yes
 
Shifting a bit... I think I'm with @Cerbrus - see if you can find an online course on getting started
 
^
 
once you know what's out there... then pick a direction you think are more interested in
 
also depends on how you look at said code. it's easy to take working code, read it, and understand it... but... that doesn't really give you the same experience as figuring it out on your own
I find it far more useful to look at not working code and fix it.
 
I think it's not for my level yet.
 
00:00 - 15:0015:00 - 00:00

« first day (3628 days earlier)      last day (1303 days later) »