Posts by emanoellucas • 886 points
20 posts
-
-1
votes1
answer49
viewsQ: How to access, within a function, the member of a dynamically allocated structure?
I have the following code in C: #include <stdio.h> #include <stdlib.h> struct pessoa{ char nome[11]; int idade; } void cadastra_pessoa(char novo_nome[11], int nova_idade, struct pessoa…
-
0
votes2
answers63
viewsA: How to align table in HTML?
You are writing "aling" instead of "align". Just change it and center. <body> <table align="center" border="1"> <div> <tr> <td>Nome</td> </tr> </div>…
-
3
votes2
answers421
viewsQ: What is the default sorting (order) of the result of an SQL query?
Suppose I have a table called "student" in the database, and its columns are nome, matricula and curso, your primary key being the column matricula. The column matricula does not have auto_increment…
-
2
votes3
answers109
viewsA: Calculator does not print the correct value
You are performing operations with values that should come from the keyboard, but have not yet been read. When you declare a variable and use it without initializing it, the value in it is unknown…
-
1
votes1
answer80
viewsA: How do I do a function with if/Else?
You should use quotes to make this comparison. I also suggest you change the name of the function parameter to day: function hojeSeJoga (dia){ if (dia=="domingo"){ console.log("Hoje é dia de…
javascriptanswered emanoellucas 886 -
1
votes2
answers767
viewsA: Compare String Elements in C
William, the problem is you’re using the function strcmp to compare one character to another, when its use, in fact, must be the comparison between strings. In this case, therefore, you compare…
-
1
votes3
answers204
viewsA: Is it possible to save a used browser object localstorage?
As Jean has already said, yes, it is possible to save the data in the Torage locale, and they will remain there indefinitely. The data saved in localStorage remains there until it is cleared, i.e.,…
-
0
votes5
answers835
viewsA: How to put the operation (sum, multiplication) within a variable
A simple way to do what you want is by using the function val Javascript, but it is a dangerous function, should be used with caution in the creation of systems. Since you are studying only…
-
2
votes2
answers47
viewsA: Why doesn’t the contents disappear or appear when I mark the radio buttons?
In what part of the code are you implementing this logic? To do this, GENERALLY get a programming language. In this case, the most used is JS. We could implement what you want, for example, as…
-
4
votes1
answer141
viewsA: Problem when Exchanging Image with Javascript
Bruno, the problem is that in Javascript code you use the method document.getElementById(), passing to it HTML element id, but in HTML code you don’t even use the selector id. Not to mention that…
javascriptanswered emanoellucas 886 -
12
votes2
answers286
viewsQ: Why does the exchange of values via de-structuring not work if we do not use semicolons?
We know that the semicolon is optional in Javascript, even always prefer not to use it. If I want to exchange values between two variables, via unstructuring, I can do: let a = 11; let b = 22; [a,…
-
0
votes2
answers2311
viewsA: CSS - H1 Does not align in the center
Bruno, as elements h1 have, by default, display block you can just do in CSS: h1{ margin: auto; } With this configuration, all elements h1 are centered horizontally, since, with this configuration,…
-
3
votes1
answer85
viewsQ: How to access, within a function, a global variable that has the same identifier as the variable within the function?
Let’s assume I have the following Javascript code: let variavel = 22 function funcao(){ let variavel = 333 console.log(variavel) } funcao() //333 We realized that, since the variable declared within…
-
0
votes1
answer410
viewsA: Function does not recognize global variable in Javascript
Well, there are some reasons for this, as we will see below. A code is rendered/interpreted from top to bottom by the browser, so if you make, for example, a code like this: <html>…
-
9
votes1
answer188
viewsA: What is the maximum millisecond interval that can be used in the Javascript setInterval?
As we can see in documentation of that method, there is, yes, a limit to the argument passed to him: Maximum delay value (Maximum delay value) The argument is converted to a 32-bit Signed integer…
javascriptanswered emanoellucas 886 -
1
votes2
answers57
viewsA: Java script: get the element by ID says it is NULL
There are some errors in your code, let’s go by parts. 1º) To take an HTML element with the method document.getElementById(), you must pass to it a string, which does not happen. You are passing a…
-
10
votes1
answer1426
viewsQ: On Github, what’s the difference between a project and a repository?
On Github, I saw that I can create a repository, but I can also create a project. What’s the difference between one and the other? When should I create a project instead of a repository and vice…
githubasked emanoellucas 886 -
-3
votes1
answer283
viewsQ: How to determine the order of executing callbacks functions without resorting to anonymous functions and how does the stack of executing functions in JS work?
Analyzing the code below: function rand(min = 1000, max = 3000){ return Math.floor(Math.random() * (max - min) + min) } function f1(callback){ setTimeout(function(){ console.log('f1') if(callback)…
-
0
votes1
answer269
viewsQ: How do functions that receive callbacks be executed in a specific order?
Let’s analyze the code snippet below, in Javascript: function rand(min = 1000, max = 4000){ return Math.floor(Math.random() * (max - min) + min) } function f1(callback){ setTimeout(function(){…
-
16
votes2
answers303
viewsQ: What are computed names ("dynamic" structuring) in Javascript?
Reading the documentation of dismantling in Javascript, I found the section below: Computed object property and destructuring names Computed property names, as in literal objects, can be used with…