« first day (3989 days earlier)      last day (942 days later) » 

user14913615
4:04 AM
hii
 
@Aakash1282 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.
 
 
1 hour later…
5:17 AM
Any idea how to control this excess space in highgharts? i.stack.imgur.com/fr19t.png
Tried spacing, margin, minpadding, maxpadding, min, max, endOnTick, startOnTick, etc and none seems help
The labels on the right is yAxis with custom tickPositions
 
 
3 hours later…
8:30 AM
hmm what is the best unit is css to have two divs "about" a space distance apart?
Should that be based on "em" "ex" or "ch"?
 
9:12 AM
what's ch?
 
A distance unit
width of "0"
 
10:01 AM
@paul23 Horizontally or vertically? Because "ex" is the height of the font. Doesn't make much sense to use it for horizontal spacing. And vice versa, I don't think using "em" for vertical spacing makes much sense.
If you mean horizontal, I'd lean towards "em". Because I use it the most, to be honest.
 
like <div>label:</div><div>value</div>
 
Probably 1em, in that case. Or whatever multiplier you want, e.g. 1.5em if that's more up your alley. But I'd personally use "em". Not sure how I'd determine if that's "better" than "ch" or not, however.
 
10:50 AM
1 em seems so wide though :P
like completely not natural for a space character
 
 
1 hour later…
11:51 AM
Hmm it's sad that javascript doesn't have the notion of views of data (array) like python has
 
Like DataView?
I don't remember anything like (data) views in python either.
 
12:07 PM
Like: list[2:4] makes a slice/dataview of only elements 2,3 and 4.
Or list[::2] has all even elements.
The big idea being that they efficient to create, almost a zero cost operation even for huge lists. As they don't copy the data but rather create a view for iteration.
 
12:27 PM
well, JS has slices, thought efficiency is probably an implementation detail of the executing engine
 
@makadev actually it's fundamentally different. As the specification states (and it is often used) that it should make a copy of the list. While slice in python makes no copy (as feature) but only view of the same data.
 
slice is slice
 
yes but is it a slice of the data or a slice of the view of the data - that is a difference in choice that makes python so fast
 
what about mutability?
 
??
in python indeed modifying data through a slice/view modifies the underlying source - but that's what you use it for.
 
12:43 PM
so it's syntactic sugar, not python being faster ;)
 
no
A view is how you see an array, you operate on the view that is what a list is.
saying that is syntactic sugar is saying that any language is syntactic sugar on assembly
In python the underlying data has completely separate from how you look at collections (lists, dictionaries, sets etc).. Notice it talks about lists not arrays..
 
hm?
what I mean is, you could also implement that behaviour without much problems in JS
 
1:04 PM
oh you can? I haven't see any implementation near the speed of python when handling large arrays (akin to 1k-2k elements)
in python the slicing and iterating is handled deep inside the interpreter and highly optimized code.
a slice is a native python object
 
1:17 PM
If you are talking of arbitrary data/memory manipulation and (chained) slices.. that might be. But DataViews (or Views) are just a concept for mapping Data/DataAccess hence you can pretty much always do something similar with simplest arithmetic.
It's just much easier to use
 
Probably the closest you can have in JS is to have something like goThrough(someIndexes, data, callback) or something similar. Assuming you have some smart code that parses someIndex expressions perhaps you can pass 2-12 or :2 and similar.
Not really the same thing, though.
Well, there is an ArrayBufferView but it's for the typed arrays. Also not quite the same thing.
|| mdn ArrayBufferView
 
|| mdn DataView
 
That one, too
 
1:44 PM
Wooo! Just got my first bounty
 
 
2:01 PM
Is there a similar less than or equal to value for the moment .isBefore /// . isSame or would
if (moment(today).isBefore(moment(dueDate)) || moment(today).isSame(moment(dueDate))){alert("Task completed on time!");}
suffice
 
moment.isSameOrBefore
Though coming from physics it kind of feels iffy to have a "same date", should be "is in range"
Also make sure you have read momentjs.com/docs/#/-project-status
 
2:16 PM
🚽
 
I now kind of wonder what the most downloaded npm package is
 
success: function(data, status, xhr) {
                var completionString = '';
                var today = moment();

                if(moment(today).isSameOrBefore(moment(item.DueDate))){
                    completionString = 'on schedule';
                } else {
                    completionString = 'behind schedule';
                }
                console.log(completionString);
                alert("You have completed the following task: " + item.Title + ", " + completionString + ".\nBe on the lookout for a confirmation email.");
 
npmjs.com/package/npm is probably pretty high on the list
 
Before I added the two variables and the condition, the alert worked fine. Now I do not get an alert but the call works.
Or do I need to put the alert inside of each condition?
 
2:22 PM
@KevinB doubtful, express has 4 times as many downloads for example.. As has momentjs
 
and at that poitn you just follow the dependencies
 
Nvm figured the alert out
if today = 9/17/2021 & dueDate = 9/17/2021
why does moment(today).isSameOrBefore(moment(dueDate)) return false?
 
uhhh how do you create the moments?
 
how do you create today and duedate
 
var today = moment()
and dueDate is actually item.dueDate apart of the item I am posting
 
2:31 PM
yes but then how do you create item.dueDate()
 
surely they have different times then?
 
It is created in a SP List
 
Well just debug it, by adding something like:
 
tried moment().startOf(today).isSameOrBefore(moment(dueDate))
and that still returns false
 
console.log("today: ", today.format(x));
console.log("dueDate: ", item.DueDate.format(x));
before the if statement
format(x) prints the full unix timestamp in milliseconds
 
2:38 PM
just tried that. "x is not defined"
 
uh .format('x') my bad
x being a string literal
 
console.log("today: ", moment(today.format(x)));
console.log("dueDate: ", moment(item.DueDate.format(x)));
logs nothing either
it logs today, but not dueDate
This condition works, but I am not sure if it is syntactically correct
(moment().startOf(today).isSameOrBefore(moment().endOf(dueDate))
 
3:03 PM
@paul23 This page claims it's Lodash. It's dated as August 2019 gist.github.com/anvaka/8e8fa57c7ee1350e3491
That's most depended upon, though. Not most downloaded.
 
Yea I found that earlier, made me hence wonder what is actually downloaded the most
 
I guess it depends on how you want to count the download, too. A one CI might be doing 100 downloads a day, while another one might be building more often but use cached resources.
 
fucking hell
 
what is that from?
 
high 400 level course at my school
 
3:50 PM
||> const spookyItems = ['👻', '🎃', '🕸'];
({ item: spookyItems[3] } = { item: '💀' });

console.log(spookyItems);
 
@VLAZ undefined Logged: [ '["","","",""]' ] Took: 0ms
 
Too spooky for James, it seems.
Just wanted to show off this weird thing. They use destructuring to place an item onto the third index in the array
||> const items = ['a', 'b', 'c'];
({ item: items[3] } = { item: 'd' });

console.log(items);
 
@VLAZ undefined Logged: [ '["a","b","c","d"]' ] Took: 0ms
 
I don't find it useful, honestly but still - interesting enough to show off.
 
 
2 hours later…
5:55 PM
that's dumb
 
6:15 PM
I'd agree. If I find such code in any codebase I work in, it's getting removed fast.
 
it's items[3] = 'd'
lol
i don't use very much destructuring at all
at most i'll use it to pick vars from an object
 
Anything more than one level of destructuring starts getting quite hard to maintain very fast. const {a, b} = obj is fine but when you get to const {a: {x: y}, b: [z]} = obj it's terrible.
 
yup
 
I guess, the "fanciest" use for destructuring I do is getting elements off an iterator:
||> const iterator = ["a", "b", "c"].values();
let [x] = iterator;
console.log(x);
[x] = iterator;
console.log(x);
[x] = iterator;
console.log(x);
 
@VLAZ undefined Logged: [ '"a"', '"b"', '"c"' ] Took: 1ms
 
6:23 PM
It's more useful if there is a loop or something and you want to get the first item off an iterator every time.
 
oh i see it, that's weird
 
Yeah, took me a while, as well.
 
6:35 PM
Is it ok to check if a variable is not (dynamically) set to display none like so:?
if (var) {Do This}
It works but Im wondering if this is good practice
 
It might be set to null or maybe even zero or empty string. In that case, the if will not execute.
if (var !== undefined) is the correct way to check if it's set.
 
Hi Vlaz
 
if you don't want null, then if (var != null) (single = in the !=) - will only be false if var is null or undefined.
 
Brilliant
and Brilliant again
<--- Still processing...
 
So you can't apply coloring to an alert, what about bolded text? or does it accept 0 styling whatsoever
 
6:41 PM
Thanks again My friend. Hopefully you've seen my "Live Timing" feature and I thank you again for your contributions
 
it accepts only text
 
@BeerusDev No styling. Alerts are basically to be used never. Unless you want something very in your face and very basic. Which most of the time, you don't.
 
the only alert-like built-in feature i'd consider using is confirm
 
confirm?
 
confirm
 
6:43 PM
Oh, like a alert type box pops up and asks if you want to do that action or not?
 
yes
 
Gotcha
 
Thanks VLAZ
 
7:16 PM
just wanted to share i earned my first silver badge :')
 
7:42 PM
@Moistbobo 🥈
 
now you just need a gold
 
8:28 PM
\o/
|| welcome
 
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.
 
@JBis That link was last shown in April this year, it seems: chat.stackoverflow.com/transcript/17?m=52019403#52019403
Oh...that's when the bug report is from.
So, there you go - it was correct at the time it was posted.
 
ah
 
8:43 PM
Hi does anyone know of some examples on the web of the 'copied' interaction, where you copy and paste the code from a code block? Know I've seen it a hundred times, but can't find any specific sites that show this, besides these two:

https://www.cssscript.com/demo/copy-to-clipboard-interaction/
https://pub.dev/packages/audioplayers/changelog

Anyone have any other examples?
 
9:16 PM
Found one: https://www.postgresql.org/download/linux/ubuntu/
https://www.postgresql.org/media/js/main.js?653a457c
 
10:07 PM
const foo = [{a:1},{a:2},{a:3}];
const a2 = foo[1];
return foo.find(a2);
 

« first day (3989 days earlier)      last day (942 days later) »