guys can someone explain what ([head, …[headTail, …tailTail]]) in the input of this link solution is doing? I can’t comment and ask the writer due to low reputation! he is writing a function that takes an array of arrays in input (based on where he calls it) but although I know few things about rest and spread in Java Script
Tag: node.js
How can I make a simple chat/store messages in localhost?
I’m working on exercise, a simple chat/store messages, working on localhost, but it’s not working properly. The objective is to send user and message, and store the user and messages sent with a date. Like:(11:32 @USER: Hello world). This message data (with user,message and date) should be displayed on page, one after another. I’m doing this with no dependencies, but
multer npm: TypeError: Cannot read property ‘path’ of undefined
I have a problem uploading an image file to my server, I watched a tutorial on YouTube about multer and I do exactly the same thing that is done in the tutorial and for whatever reason I get an error: (“TypeError: Cannot read property ‘path’ of undefined”). I googled for the error and found some people having the same issue
How to use async/await to get input from user but wait till entire condition statement is read before resolving?
I created a function that prompts the user for a URL, then validates that the entered input is actually a URL. The issue is, when I call this function from my other function, I have been able to get it to wait for user input before but it doesn’t go through the entire condition statement before returning the url. How
Setting Socket.io room variables
I would like to store some information in the socket room variables, but am getting the following error: UnhandledPromiseRejectionWarning: TypeError: Cannot set property ‘host’ of undefined This is my code: If I try to log socket.roomId it would return something like rBAhx0. And when I log io.sockets.adapter.rooms, I get the following: However, when I try to log io.sockets.adapter.rooms[socket.roomId], it returns
How to exclude fields on return in mongoose
I have the following code: It works perfectly but say I want to exclude a field returned, like the __v field. I know I can do this by just creating an object like and etc. for teh other fields, however if I have 20 fields I don’t want to list every single one, so is there a way for mongoose
Express Js EJS Layouts Error: No default engine was specified and no extension was provided
Hi I am trying to use Express EJS Layouts in my app. As soon as I try to app.use(expressEjsLayouts) it throws an error. Without it the application works perfectly fine but I’d like to make use of ExpressEjs-Layouts for my templates. Please be kind I am fairly new to coding 🙂 I’ve looked through many posts already but couldnt find
Appended data to formData in node.js…the data which i am posting to my api is always showing null?
Recently I was trying to append a lot of HTML form values to MongoDB database through an async process this const createproperty are my MongoDB fields which i have taken in an array .. these ids are some id’s from the HTML form which i have put in an array this newproperty will give me the values from the Html
Wait for Google translate api before writing to excel sheet
I can’t figure out how to make my code wait for google translate before trying to write to the excel sheet. In the console i can see the translated data but in the excel doc it is still in the original language. i know I’m doing this all wrong but I can’t figure it out. It’s not shown in the
In Javascript, make the content wrap, and some of them wrap an extra line
This is the instruction I did not use to add newlines.The picture shows what it looks like now. This is the instruction I use to add newlines.The picture shows what it looks like now. I actually made the text look the same as Figure 2, but Figure 2 somehow skipped one more line. All, my question is why this problem