Posts by Jota • 509 points
33 posts
-
1
votes0
answers56
viewsQ: JWT and Passport returns 401 React
good afternoon. I am learning JWT and Passport and I am facing problems with the same, the problem is the following, I can log in and save in Localstorage, and redirect to another page however, even…
-
0
votes4
answers1986
viewsA: Where does JWT keep the tokens?
You can store in Localstorage when you make the AJAX request in the client.
-
2
votes1
answer144
viewsQ: How to display an element from a true or false within the Object? Javascript Reactjs
i have an array of objects, and I want to display the value from their status which is an attribute within the object. this.state = { objetcs: [{ value: 1, status: false }, { value: 2, status: true…
-
-1
votes2
answers80
viewsQ: How to know which elements are before and after a given element in the array?
i have an array: Const array = [1,”a”,3]; I want to know how I can verify which elements are before and after the "a".
javascriptasked Jota 509 -
1
votes1
answer219
viewsQ: Dynamic background with CSS? How to do it?
I have a question, it is possible to exchange background as a condition? Example: function A() { if (meuArray.length === 7) { eu quero background verde } else { background azul } } At first I’m…
-
0
votes1
answer4411
viewsQ: What is the difference between Function and Class in React?
I’m studying React now and I’m having a little doubt. What’s the difference between the two? From what I’ve seen, they both do the same thing.
-
0
votes2
answers486
viewsQ: How to delete an element from an Array with Onclick? Javascript?
i am with a code that, render the elements of the Array on the screen, and each element of the Array, has a button delete next door. I wanted to know how to delete it from Array and consequently…
-
1
votes3
answers1407
viewsQ: How to transform an Object Array into a Simple Array? Javascript
I wanted to know how I can transform an Object Array to a Simple Array with only a certain vaor.. I have this: const names = [ {id:0, name:"Jean"}, {id:2, name:"Ricardo"}, {id:4, name:"Letiiicia"},…
-
0
votes3
answers1186
viewsQ: How to check each character of an array? Javascript
Person, I’m with this code: const arrayOne = ['jean','geleia','gean','ea games', 'e1']; function buscar(){ arrayOne.forEach(function(valor){ const teste1 =…
-
0
votes1
answer66
viewsQ: How to return to initial value after an event change
I’m with this code: let inicial = 0 let vPag = 3 const numeros = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]; render() function resultadoPag(pagina){ vPag =…
-
-1
votes4
answers1878
viewsQ: Updating an element with Javascript
I have this code: let inicial = -0; const numeros = [1,2,3,4,5,6,7,8,9,10]; function proximo (){ inicial++ document.getElementById("lugar").innerHTML='' alert(inicial) for(let i = inicial-1; i <…
-
0
votes1
answer80
viewsQ: Update value using For each event
I have this code here: var current = 0; var array1 = [1,2,3,4,5,6,8,9,10]; function aparecer(){ //verifica se o current é maior do que o array if ( (array1.length - 1) < current ) { alert("oi");…
-
0
votes1
answer91
viewsQ: How to pause and continue after an event a For?
I have that code here: function aparecer(){ const array1 = [1,2,3,4,5,6,8,9,10]; for (let i=0; i < array1.length;i++){ const lugar = document.getElementById('local'); const ul =…
-
2
votes3
answers197
viewsQ: Why does parseint return Nan?
I’m with this code: function aparecer() { const elemento1 = document.getElementById('numero').value; const elemento2 = parseInt(elemento1); alert(elemento2) } <html> <body> <button…
-
2
votes1
answer244
viewsQ: How to increment a div using For Javascript
I’m with this code but it’s not picking up. I want to increment every click on "Increment". Code: function incrementar(){ for (let i =0; i<10; i++){…
-
-2
votes3
answers1379
viewsQ: How to traverse an element by one in a JS array
Come on, guys, good afternoon. I’m doing a function that has the same utility as ANY. What is the idea, is to know if it has any number smaller than the given in the function inside the array,…
-
1
votes3
answers582
viewsQ: How to remove spaces before and after a string without the Javascript "Trim()" method
I have this code to remove the first and last spaces but it’s removing all the spaces present. Follows: const separador = ' '; function filtro(separador, str) { let resultado = ''; let stringNova =…
-
1
votes2
answers592
viewsQ: How does Length work outside and inside For in Javascript?
I have a constant doubt about the Length and the noose for to measure an array or a string. Doubt 1: When we use that code: const numero ="teste"; const medir = numero.length; console.log(medir) It…
-
0
votes1
answer230
viewsQ: How to use return values using . map() in Javascript
I’m trying to make a way .map(), but I’m not getting it. My last code was this: var double = x => x * 2; function filtro(funcao, numeros) { let arr = []; for (let i = 0; i < numeros.length;…
-
1
votes1
answer502
viewsQ: How to return the last element of the array using the for method?
I wanted to know how I got the last element of array using the structure for in the case of decreasing? This is my code: const a = n => n % 2 === 0; function callbackfn (valorInserido, funcao) {…
-
7
votes2
answers2928
viewsQ: What’s the difference between For, Foreach and Find in Javascript?
What is the difference between the 3? For, ForEach and the Find
-
1
votes2
answers73
viewsQ: How to Filter an array using the For structure?
how I can filter an array using the structure for ? The code is this: const numeros = [1,2,3,4,5,55,190,355,747,1000,125]; I need to filter the numbers under 10. I used it this way, but I was asked…
-
0
votes1
answer916
viewsQ: How to go through an object and filter this object?
I’m trying to go through an object and after that, filter the same. I’m using this code, but it’s not working. Someone could help me and if possible explain the code ? const objeto = { idade: 20,…
-
0
votes2
answers601
viewsQ: What is the difference between map() and lenght()?
I was studying and this code appeared: var materials = [ 'Hydrogen', 'Helium', 'Lithium', 'Beryllium' ]; console.log(materials.map(material => material.length)); As I understand it, it scans the…
-
2
votes0
answers1259
viewsQ: What is Arrow Function and when to use?
I’m having a question, I’m studying ES6 but I don’t really understand what the Arrow Function replaces, I researched and I saw that it’s the function this. I would like to know better with an…
-
-3
votes1
answer286
viewsQ: How to increment and decrease using FOR?
I’m not getting to increment the variable with each click on one button. Example: a Button and a Paragraph, every click on button, increase the value in Paragraph, example, from 0 to 1, and each…
-
0
votes1
answer1178
viewsQ: How to go through an array and tell how many objects of each exist in it?
The program is: you type a letter/word in the Input and click on button(add) it appears in div, i was wondering how do I "scan" these words/letters and tell how many of each there are. Example: I…
-
-1
votes1
answer504
viewsQ: How do I browse an Array in Javascript?
I’d like to know how I get around a Array and return its value. In this case, it would be to compare whether a word/letter typed in a input has already been inserted before by another input and if…
javascriptasked Jota 509 -
0
votes0
answers111
viewsQ: What is the difference between Get, Push, Post methods?
I wanted to know the difference between the 3 in Javascript, I had been told that both do the same thing but have different semantics. But they didn’t explain what.
-
2
votes1
answer74
viewsQ: Why "new Array" after variable?
Why put new Array after the variable name? Example: var weatherPattern = new Array('Clouds', "raining", "clowdy");
-
0
votes1
answer92
viewsQ: Change background according to Javascript temperature
I did a Freecodecamp project where it’s to make a Weather Local (Local Weather). I used their own project API, already ready, but it does not change the background. I want to change the background…
-
6
votes2
answers8273
viewsQ: What is Encryption ($) for before a Function in Javascript?
Options of variables and functions, for example: $(function() {})
javascriptasked Jota 509 -
1
votes2
answers138
viewsQ: How to put several elementByID within one variable?
I wanted to know if there is a way and how to put several elementDocumentID within a single variable. Example: The code is for validation, the code is like this: var email =…
javascriptasked Jota 509