« first day (3945 days earlier)      last day (986 days later) » 

3:53 AM
I am trying to cuatomize JSON.stringify() because I want to stop the value Infinite from getting converted into null, in an object. In replacer function of JSON.stringify() who takes key and value as two parameters, if I write the if(value === Infinity) return "Infinity", it works fine. But if I write if(!Number.isFinite(value)) return "Infinity", it doesn't work well. Anyone please clarify me.
 
@DamodaraSahu 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:50 AM
||> Infinity === Infinity
 
@JBis true Logged: [ ] Took: 0ms
 
||> const x = Infinity; Number.isFinite(x)
 
@JBis false Logged: [ ] Took: 0ms
 
@DamodaraSahu send full code
 
5:04 AM
||> const obj = { a: 1, b: Infinity, c: 3};

const json = JSON.stringify(obj, (key, value) => {
    if (!key)
        return value;

    if (!Number.isFinite(value))
        return "Infinity";

    return value;
});

console.log(json);
 
@VLAZ 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.
@VLAZ undefined Logged: [ '"{\"a\":1,\"b\":\"Infinity\",\"c\":3}"' ] Took: 0ms
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
@VLAZ undefined Logged: [ '"{\"a\":1,\"b\":\"Infinity\",\"c\":3}"' ] Took: 0ms
 
@DamodaraSahu check the above code. Is that what you need?
 
 
3 hours later…
8:19 AM
Wao. The code is working fine. Thank you. But I don't understand, why if I didn't need the code if(!key) return value, when I was using the condition if(value===Infinity) return "Infinity", but here I have to use this condition.
 
8:43 AM
isFinite is the opposite of Infinity. Finite = has end. Infinite = has no end.
 
btw isFinite is really useful to validate a request parameter (query, etc) - to verify that the inserted number is actually a valid number.
const convertedNumber = Number.parseFloat(req.query.someParam);
if (!isFinite(convertedNumber)) {
    //throw bad params or something?
}
!!> isFinite(Number.parseInt('hello world'))
 
@paul23 false Logged: [ ] Took: 0ms
 
 
1 hour later…
10:09 AM
I honestly don't think so. It's useful in very rare occasions in my experience.
It catches both NaN and Infinity as invalid values, so there is that.
But usually I just have some validation that checks if the value is between X and Y anyway, so it's quite hard to be in a situation where NaN and Infinity will be something to worry about.
 
10:26 AM
I still don't understand, why if (!key) return value; was used there. Normally while other valuable checking, I don't need this condition.
 
When serialising an object, the replacer function is first called with key = "" and value the object itself. if(!key) is a shortcut to avoid having to check whether the value is an object. if (value === Infinity) takes advantage of a similar shortcut, since when value is the object, it's definitely not Infinity.
The replacer function is then called with each property of the object.
|| mdn JSON.stringify
 
10:44 AM
I have an MVC project and I have a form
When i press on submit button , it execute a code from controller
How can i detect when the page is finish loading ?
 $("#form1").submit();
 alert('hi')

How the hi alert can be displayed only after form finish submitting ?
the problem now is it alert hi but the code is still processing
 
 
2 hours later…
12:28 PM
o/
 
Hello fellas! Just a quick question, if anywould would help. I'm doing my first project on vue using vue-cli and vue ui. Everything is running fine, but I have made some thanges to my app and there's Errors compiling. What's the easiest way to see what these errors are? What I'm doing right now is stopping the serve task, run it again, and read output. Ain't there a better way? Thanks!
 
 
1 hour later…
2:01 PM
Quiz: what's wrong here, given opts is of type T
this.options.map<KeyValue<T,string>>(opt => {key: opt, value: String(opt)});
 
opt => {key: opt, value: String(opt)} should be opt => ({key: opt, value: String(opt)})
Did I win?
 
You win! Your price is a followup question :-P
Why does typescript need those parens?!
Shouldn't it be obvious without them?
 
It's JS. Otherwise it interprets {} as the body block of a function.
 
Oh, I see. Thanks!
 
||> const fn = x => {
  const a = 1;
  const b = 2;
  return a + b;
}

fn();
 
2:04 PM
@VLAZ 3 Logged: [ ] Took: 1ms
@VLAZ 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.
@VLAZ 3 Logged: [ ] Took: 0ms
 
Consider the above. It uses {} but it is not an object.
 
Makes sense
 
@JBis i've only watched the... "goals" video they released a few years ago. looked like just another framework/library to replace the rest
claiming to be "the future of web development"
 
I don't understand below, what it means by iterator[Symbol.iterator](). And how this results true.

const arr =[ ];
const iterator=arr[Symbol.iterator]();
iterator[Symbol.iterator]()===iterator;//true
 
2:24 PM
Morn
 
||mdn Symbol.iterator
 
|| mdn iterator protocols
 
@DamodaraSahu ^ see above two for an introduction.
I also wrote an answer today about iterables. That is related to iterators. It will give you some more examples. (you can ignore the Enumerable stuff in the answer, it's not relevant for iteration)
 
2:29 PM
Day 3 of trying to figure out why this isn't maintaining count like it is here in SP jsfiddle.net/BeerusDev/1dshjpm3/166 o.0
 
There are things called IterableIterators in JavaScript. They implement both the Iterable protocol (they have an @@iterator symbol property which gives an iterator) and also the Iterator protocol (they have a next() method). The iterator of an array is an IterableIterator. It returns itself if you ask for an iterator.
Hence why iterator[Symbol.iterator]()===iterator;//true
 
3:05 PM
@VLAZ mind if i kick you for testing?
 
go ahead
 
behave better @VLAZ
;)
 
that is now on your permanent record
 
Did something happen?
I didn't have to rejoin the room or anything.
 
Didn't even say you left
$("div.toolbar").html('<input type="text" id="dpicker" autocomplete="off">');
    $("#dpicker").datepicker().on('change', function() {
        var v = $(this).val();
        table.search(v).draw();

        $('#container2').hide();
        $('#container4').show();

    });
 
3:15 PM
why is the second line indented
 
container4 is by default display: none; and in my fiddle. On search, this works it hides 2 and shows 4, and when the input is cleared, it returns to the original container 2. But in sharepoint. It shows both on search? Is there a better way to go about this
Its not in my code, just when I pasted it here and Ctrl+K that is how it got formatted IG
I have noticed the format Ctrl+k will sometimes indent stuff super far over
 
Can somebody verify something for me quickly? On the TS playground it seems that Ctrl+Left/Right arrow don't work in Firefox for me. It should jump to the next word. It works in Chrome. Can somebody verify FF? Is it just my machines? Happens on two of them.
 
you need to fix your link
 
me?
 
yea, it's just going to the default
 
3:27 PM
I meant to link to the default one. Doesn't matter what code is inside.
 
well, wdym then?
firefox does recognize ctrlKey on keyboard events
 
Try this one if you want some text. Place the cursor at the beginning and try Ctrl+Right arrow. Should go to bbbb first, then to cccc
Yes, Ctrl+Left/Right works everywhere else. Just not on the TS playground. Dunno why.
I wonder if it's some plugin perhaps. Just wanted to verify if it's just me.
 
most likely an event handler they have on the box
 
 
2 hours later…
5:01 PM
posted on August 04, 2021 by Harry Souders

Hi, everyone! We've released Chrome Beta 93 (93.0.4577.25) for iOS: it'll become available on App Store in next few days. You can see a partial list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Harry Souders Google Chrome

 
5:15 PM
Whats the verdict on nested event handlers?
 
Uh, don't use them? What's a nested event handler, by the way?
 
@BeerusDev wdym?
 
5:27 PM
$('#dpicker').datepicker().on('input', function() {
$('#container2').hide();
    $('#container4').show();
		$('#dpicker').datepicker().on('change', function() {
			$('#container4').hide();
			$('#container2').show();
  });
});
Something along those lines
 
no
 
it's fine if thats what you want but you need to make sure you don't add it every input event
it's probably better to always have the event and just conditionally not do anything
 
What do you mean by "conditionally not do anything"
 
within a callback that can be called multiple time, event binding should only occur on elements created in that callback.
no exceptions
 
Ahhh
 
5:31 PM
let clicked = false;
$('.a').onclick(() => { clicked = true; })
$('.b').onclick(() => {
    if(!clicked){
       return;
    }
    // some code
})
 
that is what I was trying to do instead of the nest something like
$('#dpicker').datepicker().on('change', function() {
    isSearched = true;
});

$('#dpicker').datepicker().on('load', function() {
    if (isSearched) {
		$('#container2)
	}
});
 
5:44 PM
is that the jqui datepicker?
it has no special events, and text inputs have no load event
so...
 
It's okay, he want's to be prepared incase the load event is ever added. it's called future proofing.
 
!!wednesday
 
but but but its Wednesday
 
5:56 PM
@JBis Oh...you know what. Remember when I wasn't sure if kicking me worked? Apparently you kicked me but from my other machine. Not the one I was currently chatting from. I just went to my other desktop and it was sitting at the "you've been kicked" screen.
 
you would have probably been given the warning if you tried to send a message within the 30 seconds
not getting the banner on all sessions sounds like a bug
 
^
 
i got the banner for that kick while i was in another room
thought "tf did you do"
 
6:23 PM
What I saw at the time was JBis asked me if he could kick me, I said yes, tabbed away, got a ping in chat from his mention, tabbed back and didn't see anything different. I was still in chat. It probably took 30 seconds before I wrote a message.
 
6:45 PM
Are companies incompetent or cheap? It seems no one is able to handle predictable surges of traffic.
releases something extremely anticipated --> gets lots of traffic on website --> server crashes
like how do you not predict and handle that?
 
I mean...both, probably.
Also, you have no idea what's working for a company. There are managers at all levels discussing stuff then making requirements that are partitioned off to different teams, so nobody really gets the full picture.
Until it's too late and it turns out there is a fundamental flaw with the whole design but nobody really examined the whole thing.
Just par for the course in the business world...
Not that I'm annoyed by stuff that has been happening at work lately or anything...
 
lol
wheres the error codes for developers are idiots
Error 903 - Bob forgot how to scale things
Error 925 - John decided use MS Server
Error 953 - Cheepo management didn't give us enough money to run this properly
Error 953 might get abused tbh
 
Error 418 I'm a teapot
 
7:08 PM
The only true error.
 
7:44 PM
hahaha
@KevinB Then is what I am trying to do unachievable? I could do an on change and instead of having the divs hide()/show() just display the searched week count in an alert?
 
8:19 PM
Nvm that doesn't work, just get [object Object]
 
8:30 PM
@VLAZ My favorite error, hehe :)
 
eRROR 403 - PEBKAC
 
8:55 PM
posted on August 04, 2021 by Prudhvikumar Bommana

The Beta channel has been updated to 93.0.4577.25 for Windows, linux and Mac. 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. Prudhvikumar Bommana G

 
9:20 PM
@KevinB I get that one a lot. I think I'm pressing the any key too much.
 

« first day (3945 days earlier)      last day (986 days later) »