Posts by Andre • 5,836 points
229 posts
-
1
votes1
answer82
viewsA: Using the FOR command
As the statement itself says, you need to ignore both the spaces, and the differences between uppercase and minuscule, so before comparing the strings you could normalize them: char nome[255],…
-
3
votes2
answers637
viewsA: Regular word start expression until next number
Regular expressions require well-defined rules, as you yourself could not define a rule for when the expression should continue looking for numbers, and only provided an example, what I can imagine…
-
3
votes1
answer94
viewsA: Why does the vowel function not return the right value?
You are returning the value of cont before you finish reading your file. As you may already know, Javascript input and output operations are asynchronous, which means that the callback in which you…
-
0
votes1
answer41
viewsA: Doubt in the recovery of the value of callback in Nodejs
Javascript does not work like that, all io operations (input and output) in Javascript are done asynchronously, that is, your thread does not wait for the resolution of these operations to continue…
-
1
votes1
answer228
viewsA: Parking activity in JAVASCRIPT
I found your logic confusing, my suggestion would be to add the hours to the minutes, and work only with the minutes. Then you could calculate the total that way: var aPagar = 0; // Se ficou mais…
-
0
votes2
answers1378
viewsA: How to calculate potentiation only using the sum operation?
You can follow the same logic. If to multiply you go through a loop n number of times, where n is the multiplier, and sum it by multiplying to the result. To exponent you need to traverse a loop n -…
-
0
votes1
answer54
viewsA: Concatenate and show on screen
strncat concatenates one string at the end of the other, not in the middle. You can use strcpy to copy the string2 entire to the desired memory position, so just manipulate that position within the…
-
2
votes2
answers69
viewsA: How to interact multiple dropdown menu?
You could do a query to select all the other submenus and then remove the class visivel // busca todos os elementos com a classe submenu, exceto o com ID dropdown2 for (var outroSubmenu of…
-
1
votes1
answer21
viewsA: What is happening in this code the Event parameter would be a this?
In that case event is an object of the type MouseEvent. He is not undefined because you are not declaring it, you are receiving it. The value of event is defined by the code that will invoke its…
javascriptanswered Andre 5,836 -
1
votes2
answers638
viewsA: jQuery Mask does not work on elements created dynamically
Cloning an HTML won’t clone the eventListener pointing to the elements of this HTML. How the mask of jQuery is a eventListener, you need to assign it to the cloned elements as well:…
-
0
votes2
answers348
viewsA: Using radio input and doing real-time operations with javascript
You can capture the element iniciante with getElementById just like you did with the other elements, and check if it is activated via property checked. In addition, you will also need to create…
-
2
votes1
answer768
viewsA: Conditional formatting of Regex phone number
The problem is in the approach. The regex you have even validates the sequence (XX)XXXXX-XXXX, but as you format the input when typing a sequence of 10 digits, when the user enters with the 11th…
-
1
votes1
answer54
viewsA: How to set only a default parameter for a function?
Javascript does not have parameter passing by name. Usually when a function needs to receive multiple arguments, it is normal to send an object, with the properties representing the parameters. With…
-
3
votes1
answer110
viewsA: I can’t change properties using css
The problem is that you have declared a row of a table outside of a table. This is not valid in HTML, but your browser’s HTML interpreter tries to fix errors automatically to keep the page running…
-
2
votes1
answer26
viewsA: Activating various input with js
That’s because getElementsByName will return you an array, more specifically an NodeList. In assigning false to the property disabled of that return, you will only be creating a property called…
javascriptanswered Andre 5,836 -
0
votes1
answer80
viewsA: How to set variables with JSON received from an AJAX request
JSON.stringify serves to transform an object into a string with JSON format, is exactly the opposite of what you want. If in the answer of your server is sent the Content-Type of response, data…
-
0
votes1
answer221
viewsA: Questions about the use of C functions
I don’t know if I understood this exercise right, but most of the errors in your code refer to the manipulation of arrays. Variables used to store strings a and b, are arrays of char. The value…
-
1
votes1
answer64
viewsA: Water temperature
query is being used as both the value of your input, water status message, and you are also trying to access a property called water in that query, that makes no sense. You shouldn’t be initiating…
-
1
votes1
answer56
viewsA: Call function only when the previous one closes
Usually an asynchronous function will have to make use of either callback, or of promise. Since the question was not specified what the case is, I will have to use a generic example. If your…
javascriptanswered Andre 5,836 -
0
votes1
answer62
viewsA: Reduce with Sort
If you’re going to turn the array into an object to be able to access the ids from the index, I recommend storing the entire internal object in those indexes, not just its value, since the end…
-
2
votes2
answers735
viewsA: Accessing a property of an object array within another object array
You have an array within an array, so to isolate these properties, you will need a map inside a map. const objetos = [{ a: 'a', b: 'b', c: [ { cc: 1, dd: 2, ee: 3 }, { cc: 4, dd: 5, ee: 6 } ] }]…
-
1
votes2
answers110
viewsA: Show result inside a div without load on the page
You are not "jumping" to another screen, you are overwriting the existing one with document.write. If you don’t want to lose your page’s HTML, create an element like a div, and then attach your text…
-
2
votes2
answers146
viewsA: Scroll through an array of dates to pick up the amount of monthly records from the last 12 months
Why not create a map or an object to associate dates with occurrences? var arr = ['2018-02-19', '2018-02-19', '2018-02-19', '2018-02-19', '2018-02-19', '2018-02-19', '2018-02-19', '2018-02-19',…
-
3
votes2
answers171
viewsA: I can’t get content (number) of some tags read
getElementsByClassName is the correct way to recover the DOM elements, there is no more modern form, there are alternative forms, usually offered by an external library. Like li is not an element…
-
1
votes1
answer29
viewsA: Help with search
Add a input hidden in his form. Just add the attribute hidden, this way the input will not appear to the user, but still its value will be sent in the submit form. <form action='/search'…
-
2
votes1
answer48
viewsA: Why can’t I recover the background color with the gift
The background color of this element is set in CSS; it is not a property of the element, so obviously when you access the property backgroundColor it is empty. To recover the computed style of the…
-
1
votes1
answer35
viewsA: Pass parameters outside jQuery.Ajax
Yes, it’s possible, but the way you’re doing it, all the properties will stay inside the object sintax, that is, your code will be interpreted this way: jQuery.ajax({ sintax: { type: "POST", url:…
-
1
votes2
answers295
viewsA: writeln in Javascript is in disuse or not?
document.writeln writes to a new line. Writes to a new line in HTML. If you check the DOM of your page after executing the commands, it will look like this: <body> Mesma Linha1Mesma…
javascriptanswered Andre 5,836 -
2
votes1
answer499
viewsA: Problem with chained list in C
The problem is not that the pointer of your structure is pointing to the structure itself, the problem is that the attributes nome, banda and duracao are pointers, and the pointer of all structures…
-
0
votes1
answer56
viewsA: JAVASCRIPT - Accessing property that contains api link
Can use async? Whereas you are using let I believe compatibility with IE is not a priority, so let’s go. Inside the route response /planets, you own the property films which is an array with the…
-
1
votes1
answer17
viewsA: Error in listing interface
The method .html(meuHTML) jQuery overwrite all the HTML of the found object, to concatenate more HTML with the existing one, you can use .append(meuHTML) to add this HTML at the end of the existing…
-
0
votes1
answer1144
viewsA: Uncaught Typeerror: Cannot set Property 'src' of null
In your HTML, you have the following excerpt: <div id = "res"> <img id = 'foto'> <p>Preencha os dados acima para ver o resultado!</p> </div> Notice that your image is…
-
0
votes1
answer195
viewsA: a. getTime is not a Function - Google Charts
I believe that as you stated the type of data date in your JSON, the code behind Google Charts is trying to call an existing method in the class Date on its date, but its date is a string, not a…
-
9
votes1
answer131
viewsA: Why can the class be picked up by Javascript while loading the page and the ID not?
The reason for this is simple. Other than a getElementById, that returns a HTMLElement or null, getElementsByClassName returns a HTMLCollection, which is an iterable object, similar to the standard…
-
3
votes2
answers78
viewsA: Animate script that changes the "src=" of an image
Well, I see in your code you’re including jQuery, even though you’re not using it. If the solution can be con jQuery, you can use the methods fadeOut and fadeIn as in the example below. Edit I’m…
-
1
votes1
answer80
viewsA: Which method to use to make the code not large
I didn’t understand the purpose, but I can play with some checks. In this case, as an empty string converted to integer results in NaN, I checked if the return was not Nan to control the loop.…
-
0
votes1
answer21
viewsA: Image proportional to the system used. Can I continue doing so?
I find it unnecessary when CSS already offers properties for this. Besides width, CSS also offers max-width and min-width, that is, maximum width and minimum width. Combining these properties as…
-
5
votes2
answers165
views -
0
votes1
answer51
viewsA: 2 problems, add elements in array conditionally and then create another array with values per date
--Edit-- I made a revision of the code, because although it is working previously, I fear that in some extreme case, known as "edge case", the code may produce an unexpected result, since objects do…
javascriptanswered Andre 5,836 -
3
votes1
answer176
viewsA: Node.js execution error
The mistake is saying that you can’t change the headers of the reply after having already sent the same. Note that you are using the command res.end('ok') and right after in your switch you do…
-
2
votes2
answers925
viewsA: Validation of data in Javascript
By the test I did everything is working. The only detail is that your form submission button is not of the type submit. This button also calls a function called enviar, if this function is doing the…
-
2
votes2
answers121
viewsA: Typescript
'Cause you need to wear this? It is because the method getElementById returns a HTMLElement or null. HTMLElement is a class that does not own the property value, so if you want to access such a…
-
2
votes1
answer32
views -
1
votes2
answers109
viewsA: C Programming - Two-Dimensional Matrices
You are declaring an nxm size matrix without first having n or m, which size you expect this matrix to have? Without using pointers pointing to pointers and dynamic allocation, the easiest way I can…
-
0
votes2
answers430
viewsA: Alert message Response Headers
Why the alert is showing a different header from the answer I can’t tell you, but the way you’re doing it won’t work anyway, because JS doesn’t expect the response of your request to continue…
-
0
votes1
answer193
viewsA: Recover cookie with Typescript
If what you need is a cookie parse without jQuery, you can use the function suggested by w3schools function getCookie(cname: string): string { const name = cname + '='; const decodedCookie =…
-
1
votes2
answers87
viewsA: Conditional does not work as expected (related to ASCII table)
I don’t know if this covers the entire code, but I can tell you have two problems with your if Before the comparison a <= b <= c does not work in C, as the compiler will first compare a with…
-
3
votes3
answers534
viewsA: Escada Javascript
Try using this loop: for (const linha of array) { console.log(linha.padStart(entrada-1, ' ')) } The method padStart adds the character passed as the second parameter at the beginning of the string,…
javascriptanswered Andre 5,836 -
2
votes2
answers206
viewsA: Iterate an object within another. Is it possible?
Check if the property is an object with prop instanceof Object or typeof prop === 'object', if it is, use recursiveness to iterate over the properties of that object as well. let myObject = { nome:…
-
1
votes1
answer29
viewsA: table returning null
getElementById does not need selectors like # or ., the method searches for elements by id, you do not need to specify that you are looking for an id with #. Just use…