« first day (3462 days earlier)      last day (1479 days later) » 

2:25 PM
Can Someone help me with this REGEX
https://stackoverflow.com/questions/61102152/how-to-capture-reoccurring-digit-by-using-regex-in-below-example
 
@VikasKalapur 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.
 
2:39 PM
a stupid question but how do we compare two super big string numbers e.e like something similar to JAVAs compareTo
 
hii guys
 
@Gopherine you can look into the source code of the String class
in java
but js has an API for that
Intl.Collator or something
||> mdn Intl.Collator
 
@KarelG "SyntaxError: Unexpected identifier" Logged: ``
 
whelp it's locale specific. But still useful
 
@KarelG seems more like string compare though and i want to compare big integers in string format

console.log('1000000000000000000000000000000000000000000000000000000000000000000000000001'
>'1000000000000000000000000000000000000000000000000000000000000000000000000000');
 
2:46 PM
> two super big string numbers
:P
you have to do that yourself then :|
write a function
 
e.e :( thats such a super long process however this does seem to work with numbers but now i am not sure if Intl.Collator is actually functioning like for numbers i ll run some test if not i will just write one :(
 
I'm not certain if that utility would work correctly
||> new Intl.Collator().compare(
'1000000000000000000000000000000000000000000000000000000000000000000000000001','0000000000000000000001111000000000000111000111111000000000000000000000111101')
 
@KarelG 1 Logged: ``
 
that's correct
:P
||> new Intl.Collator().compare('1000', '0100')
 
@KarelG 1 Logged: ``
 
2:51 PM
||> new Intl.Collator().compare('0100', '1000')
 
@KarelG -1 Logged: ``
 
well, here ya go
 
||> new Intl.Collator().compare('11', '10')
 
@Gopherine 1 Logged: ``
 
||> new Intl.Collator().compare('10', '11')
 
2:53 PM
@Gopherine -1 Logged: ``
 
||> new Intl.Collator().compare('5', '10')
 
@Gopherine 1 Logged: ``
 
@KarelG XD i guess it does not work
@KarelG works when new Intl.Collator(['en-u-kn-true']); :) this works i think so
but i have no idea what en-u-kn-true stands for however i took reference from here developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
 
you have to dig in the ecma standard for those then
en = english locale and kn = number priority
idk what that u and true does
 
what doesnt work?
new Intl.Collator().compare('5', '10') == 1 seems perfectly fine
 
3:09 PM
hi ..how to remove the values based on close icon instead on on select ..pls chk the fiddle jsfiddle.net/hearthacker/scgb5wx3/6
 
3:31 PM
Bernie Sanders has dropped out
 
3:51 PM
good
 
When regex fails, don't use it
 
4:22 PM
posted on April 08, 2020 by Bethany Nicolle Griggs

macOS package notarization and a change in builder configuration The macOS binaries for this release, and future 10.x releases, are now being compiled on macOS 10.15 (Catalina) with Xcode 11 to support package notarization, a requirement for installing .pkg files on macOS 10.15 and later. Previous builds of Node.js 10.x were compiled on macOS 10.10 (Yosemite) with a minimum deployment target of

 
4:42 PM
May I have help with linked lists in JavaScript?
ListNode { val: 1, next: ListNode { val: 2, next: ListNode { val: 3, next: [ListNode] } } }
I am not sure how to traverse this, wanting to count the entries, dividing it in half, and then selecting the middle item.
 
5:06 PM
@Matthew I've never seen linked lists used in JS.
 
Convert it to a normal array
 
5:18 PM
Is it an object?
Array.from(...);
 
|| mdn array frm
 
My first problem is not really knowing what this is, besides a series of values you can't get to directly by indexing.
I just want to traverse from the beginning to end so I can count the units, then find the middle one.
 
its an object with a reference to another object
you need recursion or a while loop
const node = {...};
how do you get the next node in that object?
 
.next
or ['next']?
not sure, because it looks like an object, but not sure it works like one
 
5:22 PM
Both are correct
Show me an example of the last node?
 
ListNode { val: 1, next: ListNode { val: 2, next: ListNode { val: 3, next: [ListNode] } } }
I'm not sure how to store it as a variable
let obj =
?
 
store what as a variable?
 
the linked list
codepen says it's a syntax error to put it into a variable as it is
 
send the codepen
 
5:30 PM
its empty
 
yeah thats not valid js, thats just the structure
stay in leet code
@Matthew do you have experience with recursion?
 
yes, a little. calling a function within itself till a condition is met
 
ok so what condition are we waiting to meet here
 
the traversal of an entire linked list
i want to hit that point while counting each traversed Node
not returning the count, but the index of the middle Node based on the count / 2
 
5:40 PM
(aka the final node)
so whats different between the final node and the node before it?
 
the final node has no .next
 
👏
 
haha.
 
now read this and make a recursive function
Jan 28 at 14:13, by JBis
heres the basic format for recursion
Jan 28 at 14:14, by JBis
function recursiveFunction(args){
	if(finalCase){
		return finalValue;
	}
	return firstVal + recursiveFunction(argsWithoutFirstVal);
}
thats the template for most recursive functions, use it make one for this
 
6:15 PM
I'm not there yet, but I have this:
var middleNode = function(head) {
    let count = 0;
    while(head.next != null) {
        this.next;
        count++
    }

    let even = count % 2 = 0;
    let odd = count % 2 != 0;

  if(even){
   return  count  / 2 ;
  } else if(odd){
  return  count  / 2 + 1 ;
  }

};
I need to return the indexes
indices
but I'm not sure how to access the middle node, returning it and all that follows
 
step 1: generate a collection of all nodes (or at the very least, a count of how many total nodes there are)
 
oh you chose the while loop approach, i like it bettter
 
you should strive to do so without actually requesting the nodes if possible
 
@KevinB i don't think it is possible here
 
If i return the head, the entire list is returned.
somehow I need to get to the middle and return it
 
6:19 PM
@Matthew "generate a collection of all nodes"
 
like a Map or Set?
 
map, set, array, whatever is most appropriate
This is the... return firstVal + recursiveFunction(argsWithoutFirstVal); part of JBi's recursive function
you'd just push it to the collection rather than doing string concatenation
this step can also be done with a while loop
in your code, i don't quite understand what you're doing with this
this.next inside the while loop doesn't do anything, and every iteration of the while loop is looking at the same head
so... that should be an infinite loop
or one that ends without iterating
 
||> "test " + true ? "trueVal" : "falseVal"
 
@JBis "trueVal" Logged: ``
 
Why is that "trueVal" instead of "test trueVal"? Why do i need () around the ternary expression?
||> "test " + (true ? "trueVal" : "falseVal")
 
6:25 PM
@JBis "test trueVal" Logged: ``
 
How do I escape the head? Or leave it? I am trying to add .next to head, and then .next to .next
until the chain of .next.next.next.next == null
 
you are very close
You need to store the previous node in a variable and then update it in the while loop
 
var middleNode = function(head) {
    let A = [head];
    while (A[A.length - 1].next != null)
        A.push(A[A.length - 1].next);
    return A[Math.trunc(A.length / 2)];
};
this is the solution, not mine
I didn't think of putting the head in brackets
I had: let current = head;
 
thats a terrible solution
i don't care whether it works, its shit
 
6:41 PM
how do you evaluate a solution's quality?
 
function middleNode(headNode) {
    const nodeArray = [headNode];
    let currentNode = head;
    while (currentNode.next !== null) {
        nodeArray.push(currentNode.next);
        currentNode = currentNode.next;
    }
    return nodeArray[Math.trunc(nodeArray.length / 2)];
};
 
Tay
Hey, I wanted to know if anyone has a good concept for an "automatic wrapping table"?
Like, a table of items, but when the page gets to a specific size, it wraps
 
1. Does it work?
2. Do I know what its doing just by looking at it?
3. Are variables named properly? (Could also contribute to #2)
4. Does it take advantage of language specific features?
5. Does it follow normal industry standard approaches?
6. Is it efficient? (1-5 are priority most of the time)
@Matthew ^
 
@JB
@Jbis thanks
 
!!magic
 
6:45 PM
(∩ ͡° ͜ʖ ͡°)⊃━☆゚. * ・ 。 ᵀᴴᴱ ᴳᴬᴹᴱ
 
what do you think of this:
 
Tay
So I have this webpage here https://functflow.web.app/portfolio, I want to be able to resize the page, and once the table starts to overflow about 80vw, itll wrap the table cells to the next line.

What should i try
 
that solution ticks of 1 and maybe 2 if i'm in a good mood
 
var middleNode = function(head) {
    let current = head;
    let middle = head;
    let length = 0;
    while (current) {
        length +=1;
        if (length % 2 === 0) {
            middle = middle.next;
        }
        current = current.next;
    }
    return middle;
};
 
Tay
Oh wait, I tried inline blocks with margins inside of a container... by accident... it actually looks pretty damn cool
I guess thats sorta the effect I was going for
Can anyone else test this and make sure it looks alright? https://functflow.web.app/portfolio

Im going to test it in IOS in a sec
Yeah, it looks perfect on iphone (almost)
 
6:54 PM
@Tay flex
 
Tay
I dont know how to use flexbox
 
Its floating out the window
 
@Tay watch out for spelling/grammar issues (I'm not one to talk, but still)
@Tay learn how to use flexbox :)
@Tay also stop using <br> everywhere
use margins
 
7:08 PM
Flexbox is worth learning, you end up using it everywhere.
 
Tay
7:27 PM
Alright
 
posted on April 08, 2020 by Shelley Vohr

Notable Changes doc: add ronag to collaborators (Robert Nagy) #31498 add GeoffreyBooth to collaborators (Geoffrey Booth) #31306 deps: upgrade npm to 6.13.6 (Ruy Adorno) #31304 update openssl to 1.1.1e (Hassaan Pasha) #32328 Commits [f756c809e0] - assert: align character indicators properly (Ruben Bridgewater) #31429 [597431b1f2] - async_hooks: remove internal only error checking (Anatoli

 
7:55 PM
 
Sadly, I know some
 
Wow...interesting
 

« first day (3462 days earlier)      last day (1479 days later) »