Skip to content

Tag: javascript

moment.js error, sometimes ignores the day

I have a problem with moment.js and it’s that I have two dates (initial and final) when I initialize the dates, the initial is fine but the final date is not, moment.js ignores the day part of the date ,I set “2020-10-05T09:00” but in the console I get “2020-10T17:15Z”, as you ca…

javascript arrays of object comparing

I have a project when I get some data from a route in node and I need to compare with the last data I received to see if something changed, basically 2 arrays of objects. For the comparasion I used JSON.stringify(array1) = JSON.stringify(array2), but after I compare the arrays I want to put the value of array…

Calculating the mode value of an array

The function for returning the mode value of an array works on every test except one. When I pass the following array through the function, I get a TypeError. I figured out that it has something to do with the number 0 in the passed array, but I don’t know why and I don’t know how to solve the pro…

Not Found when serving express static file

I would like to access to a page of my web application. I created the server with expressJs and I serve the route by using app.use(express.static()). Here is my tree : In the app.js file, I have this : The line app.use(‘/MPS’, express.static(__dirname + ‘/client’)); work fine : when I …

How to simplify function which returns an object?

I have a function which returns an object but I don’t like that I gotta declare it first and then do forEach method I think there should be something like this But for some reason, it doesn’t work. PS: In this part — — I’m trying to create a key with a name separated by a dot (I …