« first day (3377 days earlier)      last day (1587 days later) » 
04:00 - 21:0021:00 - 00:00

@MadaraUchiha haha no need to hit i just want to understand the code. I have many other to come hope people here will help
 
 
3 hours later…
7:57 AM
Hi
can anyone explain this?
.map((_, i) => i)
also in
let arr = Array.from({ length: num + 1 }, (v, k) => k).slice(2);
what is (v,k)=>k is doing?
 
8:53 AM
@Ayaz It's mapping the index of the array to the value
.map((value, index) => index)
!!> Array.from({ length: 5 })
 
@BenFortune [null,null,null,null,null] Logged: ``
 
!!> Array.from({ length: 5 }).map((_, i) => i)
 
@BenFortune [0,1,2,3,4] Logged: ``
 
ABC
can anyone help me?
https://stackoverflow.com/questions/59676456/how-to-display-an-object-in-ag-grid-angular
thanks
 
9:29 AM
Can any regex gurus here tell me why this regex will fail (go in infinite loop) against an input (see comment): repl.it/@deostroll1/ScentedMajorEngineer
 
Hii
 
@David 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 message moved to Trash can
@David Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
 
Can anyone guide me how to take JavaScript skills to the advanced level?
 
9:44 AM
Suppose I have a JSON which has multiple nested JSONs inside. How can I access the value of a key inside it by searching super JSON?
 
10:31 AM
@BenFortune thanks ben any answers on second query ?
 
hi there
what does this sentence mean?

"Keep in mind this will include additional types to your client-side code that are not really available."
In the Angular CLI part:
https://stackoverflow.com/a/35961176/3037960
 
@David its really tuff just need to practice practice and practice. I am using freecodecamp which seems helpful
 
10:42 AM
Your IDE might suggest types you typically don't access @Suisse
 
I am trying to do this in my typescript (angular) project:
const assert: any = require('assert').strict;
but I get this error:
error TS2591: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
 
That's react
 
I added "node" to the tsconfig.. i did npm install
nothing works
@M.Doe why should it be react? because of require instead of import?
 
Uhm you don't really use 'require' in angular
You would import it and then declare your variable as that type
also you can't strictly type something then say that your variable can be any
Well, you could
But really shouldn't
 
hmm but how do I use this "assert"?
with import I can't get it
its a node module
 
10:47 AM
I know it is
If you really want to , your could include it in your compiler options
What exactly do you need the node module for?
Regardless: Save it as dev dependency
then add the type in your compiler options
{
    "compilerOptions": {
        "types": ["node"]
    }
}
 
yes I did that already
in the tsconfig.ts
hm aha
 
But I don't see any reason in angular why you would need to include a node assert
 
ok then I am using it totally wrongly if you say I should save it as a dev dependency
 
you using it for strict checking?
 
because I saw this piece of code in my project:
export function joinUrl(parts: string[]): string {
  assert(parts.length > 0);
  parts.forEach((part, index) => {
    assert.equal(part.includes('#'), false);
    assert.equal(part.includes('?'), false);
    assert.equal(part.length > 0, true);
    assert.equal(part.endsWith('/'), false);
    if (index > 0) {
      assert.equal(part.startsWith('/'), false);
    }
  });
  return parts.join('/');
}
 
10:50 AM
oh god
 
its a function to check if an url is valide
haha
 
I would rewrite that in actual typescript
 
just with if() ?
 
No
Using the angular router
you could easily get that out of your url
 
hmm
 
10:51 AM
That is just node code
 
its for the API calls... I define my API url endpoints
 
Uhm
 
and those need to be checked first, before I make an API call..
 
I'll put it bluntly
That's a bad way to do it
Overcomplicated, hard to maintain
 
because?
 
10:52 AM
and you're only checking if an url includes
Well because defining your api call endpoints could be as easy as this
 
to be honest, I would never do that at all... a friend who did his phd, but has not so much knowhow about typescript/angular, said to me: whaaat?? you are not checking your urls before doing an API call? what if someone writes "/users/" instead of "users/" ...
 
return this.http.post<Any>(${this.serverUrl}/your/api/endpoint, {
you could easily just pass in your parameters as a variable
No need to manually join to make an url to then send your request to
 
but... this part in your code "/your/api/endpoint" ... what if some other developer would write "your/api/endpoint" ... and he won't get an feedback from the compiler
we would see the error first when its already compiled and test it in the browser
 
Well no, you still need to error handle your http calls
 
yeah but thats on runtime
not on compile time
 
10:55 AM
True but angular compiles AOT
Should still work
like I said, if you want to go ahead you can save it as a dev dependency
 
it means you would see it in the browser console, that the http call throwed an error?
 
But if you have the opporunity to refactor it to actual angular code it'll save you a lot of trouble
yes, you can also just display it to a user
 
but then you need to test it manually
 
Do you write unit tests?
 
ok unit tests would be the answer to this right?
 
10:57 AM
Well 'no answer' to this, but to manually testing it yes
 
I must say, that the other dev is a backend developer.. for example in java you would really check the urls I think..
 
I can foresee if you do go with your original approach that your code will bee needlessly complicated
I have a meeting now, I would advise either savingi t as a dev dependcy then injecting it as a compiler option
 
ok thank you very much @M.Doe :)
 
 
2 hours later…
12:30 PM
can someone help me resolve an error? keep getting "Uncaught SyntaxError: Unexpeted end of JSON input" and can't figure out how o sort it
 
@drleechy please provide more information.
code?
 
// GET REQUEST - Retrieve data from the database file execute specified DOM manipulation
function showUsers() {
xhttp.open("GET", users_url, true);
xhttp.addEventListener('load', function(){

// Identiyfing the location to display all users
var user_list = document.querySelector('#revealUsers');

// Parsing JSON data
var users = JSON.parse(this.response);
console.log(users);
building a front end for a library system, so trying to add users to an API, delete users, update users etc.
 
can you just do console.log(this.response) ?
before parsing json data line
I thing this.response is undefined
you need to pass response as argument for the callback of the load event
function showUsers() {
  xhttp.open("GET", users_url, true);
  xhttp.addEventListener('load', function(response){ //added response as arg

  // Identiyfing the location to display all users
  var user_list = document.querySelector('#revealUsers');

  // Parsing JSON data
  var users = JSON.parse(response);  //without this
  console.log(users);

}
 
1 message moved to Trash can
@sabbir Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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'm trying to spy on my code. My code is given below:
 
12:39 PM
@Suisse comes up as a "Unexpected token o in JSON at position 1"
 
yeah because its not valid json
can you just do what I said? comment out the var users = ... and just console.log response
 
1 message moved to Trash can
@sabbir Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
 
@JamesBot you must press Ctrl+K on the keyboard if you want to send code
//this is a text without ctrl+k
//this is a text with ctrl+k
 
I'm trying to spy on my js code, but not working. Plz take a look hastebin.com/vusoqegona.js
 
1:08 PM
	// Generator.js
	// not working
    const { randomNumber } = require("../helpers/util")

		// working
		const helper = require("../helpers/util")


		const integerGenerator = () => {
		  // working
			// return helper.randomNumber();

			// not working
			return randomNumber();
		};

		// Generator.test.js
		const sandbox = sinon.createSandbox();

		beforeEach(() => {
			sandbox.spy(helper, "randomNumberGenerator");
		});

		afterEach(() => {
			sandbox.restore();
		});

		it("should return integer number", async () => {
 
1:35 PM
you have to much comments in it
@sabbir I don't know what you are trying
when you see the sandbox example.. it looks simple
try to understand that example and map it to your case
 
1 message moved to Trash can
@Suisse Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
 
var jQuery = require('jquery')(window);
global.document = document;

describe('Wrap all object method', function() {
    var sandbox = sinon.createSandbox();

    beforeEach(function() {
        sandbox.spy(jQuery);
    });

    afterEach(function() {
        sandbox.restore();
    });

    it("should inspect jQuery.getJSON's usage of jQuery.ajax", function () {
        var url = "https://jsonplaceholder.typicode.com/todos/1";
        jQuery.getJSON(url);

        assert(jQuery.ajax.calledOnce);
simple spy on every jQueries methods.. here shown for the getJSON()
 
@Suisse thank u
 
I've never worked with sinon.. but it looks makeable
:)
Angular question... I am trying to use material components, it works fine, but when I run $ng test I get a lot errors for each component:
Failed: Template parse errors:
'mat-card-title' is not a known element:
1. If 'mat-card-title' is an Angular component, then verify that it is part of this module.
2. If 'mat-card-title' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" <mat-card-header>
            <div mat-card-avatar class="example-header-image"></div>
            [ERROR ->]<mat-card-title>{{m[1]}}</mat-card-title>
 
1:56 PM
0
Q: Getting mat-card-title is not a known element with ng test

SuisseI set up a new Angular 8 project and wanted to use Angular Material components. Everything works fine, with $ ng serve but not when I do $ ng test. With $ ng test I get this error: Failed: Template parse errors: 'mat-card-title' is not a known element: 1. If 'mat-card-title' is an Angular comp...

 
Hmm can anyone explain why (after updating to mobx-react v6 today suddenly import {inject, observer} from "mobx-react/index"; stopped working (when injecting errors pop up that the store is not provided).
Yet import {inject, observer} from "mobx-react"; does work?
Shouldn't the /index basically be a non operator?
 
 
3 hours later…
5:18 PM
@KevinB had a feeling this wouldn't get much support. Oh well, worth a discussion.
 
I don't like the idea, feel like we'd be infringing on the other room. This room has been JS specific for a loooooong time, and personally i'd like it to stay that way.
I don't think increasing the scope would have much impact on traffic anyway
 
Fair enough. I just figured we do it anyway why not add it to the name and description. But I understand.
 
I have a math problem I want to solve using JavaScript. If I want to divide the polynomial x^3 - 2x^2 - 4 by the polynomial x -3 how do I represent this in JavaScript. It's trivial to calculate this polynomial long division by hand but how can I implement this polynomial long division in JavaScript when x is unknown, i.e. how can you compute a division in JavaScript when the numerator and denominator have unknowns?
 
Do you have the value of x?
 
5:34 PM
well... in javascript, x-4 for example isn't a value, it's an expression... and expressions aren't something javascript can create.
i'm sure there's a lib out there that can help you tho
If you had a value for x, you might be able to do something with it
but without a value for x... not so much
 
@KevinB I understand exactly what you mean. Yes x - 3 is a mathematical expression for a polynomial. @JBis so because I'm solving for the root of this polynomial which is the value of x I do not have the value of x. Actually I think that x is 3 but I need to use x - 3 as it is without using the value of x
I need to do something like this: purplemath.com/modules/polys/…
 
5:50 PM
@MyWrathAcademia your going to need to find an algebra library
look at the source of this algebra calculator mathpapa.com/algebra-calculator.html
 
@JBis thanks. By source, I'm sure you mean source code but I don't see a github repository linked on their website
Where is this source?
 
@MyWrathAcademia dev tools
 
6:27 PM
@ndugger ?
 
@JBis I'm getting a page not found error
 
@ndugger :(
@Madara'sGhost We will really miss you!
 
@JBis Thanks, same!
 
You did a great job with what you had
I mean, you had me to deal with. That's enough.
 
6:36 PM
Are you moving to a specific platform (e.g Discord) or just disappearing into the void?
 
@JBis I'll probably be lurking on a few platforms, I'm in a few groups on WhatsApp, Telegram and Discord
A bit disjointed, but the convo's interesting
 
I think your resignation means more than most mod resignations, at least to me. As you said:
> Back in September, when this whole thing started, I advocated patience. That we don't know the story. That considering only what we've observed, and ignoring interpretations, there was still a good chance of salvaging the situation.
You weren't quick to resign. You really had faith in SO. But SO has gone so far downhill you don't have faith anymore.
 
@AnantDoshi 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.
 
can any one help me to solve my posted question on below url
0
Q: How use both column filter and date range filter in Jquery Datatable

Anant DoshiHi all I am new in Using jquery datatable plugin below is url http://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js I want to use column filter and date range filter both so i used below code snippet $('#Tab1 thead tr').clone(true).appendTo('#Tab1 thead'); $('#Tab1 thead tr:eq(1) th')...

 
6:55 PM
This room is on strike
 
Who's left? Kevin, I guess. Shrek, Ben, and Forrest are here every so often.
 
Enough people to kill this chat room in protest, but I imagine SE would prefer all chat rooms to die anyways, so we'd be doing them a favor
Maybe just fill it with porn or something
(that was a joke)
 
the ikari strategy
 
7:14 PM
wtf
I am being framed here
 
tomato tomato
 
holy fuck can't reply from the history
@KarelG now
 
7:41 PM
and yes jupyter is still good
I personally use google colab
@Madara'sGhost :c
 
I keep getting suspended in the meta tavern by a bunch of crab people.
Injustice, I say
 
i mean, just gotta know what to say and what not to say, 😋
 
@KevinB Aren't there symbolic math libraries? Like sympy for python? - Those should have such operators and functionality "by default". Implementing it by hand is worth a master thesis in applied computer science though.
 
"for python"
 
?
 
7:56 PM
i did mention that there may be libs that could help.
i can't be bothered to look for'em
 
Is that wording wrong? Forgive me for literal translation of dutch sentence structure :P.
 
Hello did anyone configured connect-flash with handlebars?
I'm facing some problems
 
well, no, i mean, sure there's gonna be tools in other languages that can do it
javascript has no native support for it
 
8:23 PM
@ndugger Just remember to post the discord link so that we can all still hang out
It's crappy that the others didn't invite you along
 
I don't have a discord link to share. I'm not in any server with any other people from here
I don't mind; if they didn't want me, that's fine. I caused issues, I get it lol
 
I'll create one real quick
 
I'm good without, thanks
 
At some point in the last year or so I had my access revoked from the JS discord.
I was almost never in there though
 
which js discord?
 
8:26 PM
I'm not sure how you want me to describe it. The one with a bunch of former regulars.
 
@ndugger There are quite a few old members from here that made it to reactiflux.com
 
@KevinB @Madara'sGhost ^
idk if we will use it but i figured i would create
@MikeTheLiar This one has been talked about before but no one has a link. Maybe that was intended but we have no way to access it.
 
it's not a js discord
 
what is it?
 
a discord
:shrug:
think of it this way... what made this room active in the past was non-js discussion. That discussion has all moved
 
8:32 PM
kevin, are you planning on leaving anytime soon?
 
no
not any moreso than i already have
 
make me room owner
or CEO
your choice
 
yay
 
i will likely go back to being anonymous, but for the time being it's more beneficial to not be
 
i'd agree but we don't seem to have much activity that RO's are needed
 
8:40 PM
Oh look, people are talking
 
We're only talking about how little people talk here now, so it doesn't count
 
And about SE going down the drain
That counts
 
way to kill it
 
It's all Cerbrus' fault that SE is bad
2
 
8:56 PM
No, another user whom shall not be named is to blame :P
 
satan?
 
Pretty close
 
04:00 - 21:0021:00 - 00:00

« first day (3377 days earlier)      last day (1587 days later) »