Posts by anon • 159 points
18 posts
-
0
votes4
answers208
viewsA: How to get an index() of an array with the same element multiple times?
save the index of the first occurrence and use the index as offset for the next query "recursively": var indexOcorrencias = []; var text = 'tootf'; var toSearch = 't'; var index =…
javascriptanswered anon 159 -
0
votes2
answers78
views -
4
votes2
answers261
viewsA: bold the first word of the HTML paragraph
by CSS the options closer than you want are the selectors :first-Letter (first letter) and :first-line (first line), for your case I believe only surrounding the first word manually/programmatically…
-
1
votes2
answers36
viewsA: How to run the same Javascript function for more than one div
Use querySelectorAll, return a list of all the elements that answer the query slides = []; //retornara um nodeList... var nodes = querySelectorAll('.slide-wrapper'); for (var i = 0, e =…
-
0
votes3
answers79
viewsA: Decrease the code
use for loops to iterate the years as well, pass the data by parameters, rather than declaring duplicates, or by global (less advised), refactoring the code by applying such ideas: #include…
-
0
votes3
answers220
viewsA: Why can’t I use module export to export variable
Apparently, what you want is to keep some variables for a specific user between requests, if this is the case, you should use sessions. take a look at the express-Session npm package, it might…
-
0
votes1
answer66
viewsA: Doubt about the body of the requisition
the body of the request is normally used for a list of variables encoded in URI or JSON URI: var1=valor&var2=valor2 lembrando os nomes e valores de variaveis devem ser passados por…
-
-1
votes3
answers220
viewsA: Why can’t I use module export to export variable
if your Node JS does not support ES6 (version earlier than 10), the error is this: module.exports = { token:token } //que pode ser module.exports = { token } //ou module.exports = { 'token':token }…
-
0
votes1
answer126
viewsA: Cannot POST nodejs
the error is in the "action" form "./news/save" is relative it will be converted to "{current url}/news/save" the solution is simple: delete the point, and it will become an absolute URL:…
-
0
votes1
answer168
views -
0
votes1
answer161
viewsA: How to accurately measure the run time of a function in C++
If you are compiling for windows you can try Queryperformancecounter, but I don’t believe you can achieve such a significant improvement. Then the best option is to run the function N times and take…
-
1
votes1
answer88
viewsA: Remove() function does not delete the file in C
as an axiom of programming, I recommend closing the file in the same scope as it was opened, unless you run a "do {} white (...)" there is no certainty that fclose will be called... and if you are…
-
0
votes1
answer35
viewsA: Why should one use extern in a variable declared in a header file?
yes, you need "extern", just like when you declare a function without code: bool is_windows_10(); use extern on a variable will not define it, will only tell q it exists somewhere... because cpp…
-
0
votes1
answer55
viewsA: How to make fwrite only write the character instead of the entire record?
you can also use fputc(int character, FILE* file) for only one character fputc('*',insereCopia); *Obs: there is also the possibility that the last changes are not being saved due to a missing…
-
1
votes3
answers127
viewsA: How to call React routes with Nodejs?
could show your file tree? app.get("/", (req, res) => { res.sendFile(path.join(__dirname, 'build', 'index.html')); }); Stó will only send will send the index.html file, for statical files I…
-
1
votes1
answer41
viewsA: Place X, Y values on an image when loading the page | Javascript
this is the key code... var marker = new Marker(); marker.XPos = mouseXPos - (marker.Width / 2); marker.YPos = mouseYPos - marker.Height; Markers.push(marker); which can give rise to a simple-to-use…
-
0
votes2
answers92
viewsA: What is the difference between creating a method inside the constructor or inside the prototype property?
With the prototype, your objects shared the same "table" of functions, (inheriting the prototype functions), while declaring the functions within the constructor will create pointer for each table…
javascriptanswered anon 159 -
1
votes1
answer878
viewsA: Discord bot help command with Command Handler
confused and unspecific, but I think I understand... That doesn’t sound very safe, but... you can list the files and load them into an object... const fs = require('fs'), path = require('path') var…
javascriptanswered anon 159