Questions tagged as 'javascript'

2
answers

Set property based on others during object creation

I am making a popular 'fullname' attempt with the result of the first two variables, but without success. var pessoa = { nome: "Joao", sobrenome: "Silva", nomecompleto : nome + sobrenome }; alert(pessoa.nomecompleto);    Uncaught Reference...
asked by 24.09.2014 / 19:31
1
answer

Virtual Tour 360 - Google Maps

I've done some map integrations with the Google Maps API for JavaScript on some clients, so I've noticed that map types conforming to documentation of basic maps are as follows: roadmap - Displays the default path map. This is th...
asked by 26.10.2017 / 14:47
2
answers

What's the difference between using toString () and JSON.stringify ()?

var arr = [1,2,3]; arr.toString(); // "1,2,3" JSON.stringify(arr); // "[1,2,3]"     
asked by 02.10.2018 / 01:25
2
answers

How to format date with Moment.js?

I need to format a date with Moment.js like this: 10 de Dezembro/2018. I tried this way: "DD [de] MMMM/YYYY" But the month is 1 lowercase letter. What's wrong?     
asked by 10.12.2018 / 19:53
2
answers

jQuery execution bug

I have a very strange problem, I had never encountered it. ... function resizeResponsivo() { var width = window.innerWidth, height = window.innerHeight; if ( width < 651 && keys[0]) { keys[0] = false;...
asked by 11.11.2016 / 14:10
1
answer

server-side timer?

I'm doing a question game in PHP, the user will have 15 seconds to answer each question, how to prevent the user from changing the timer via inspect element and add seconds? Just adding details, it is impractical to let the user change the ti...
asked by 03.03.2016 / 20:26
3
answers

How to compare variables using JavaScript?

I use a lot of variables. Example: if (item[l].item[0] == 'tipoRescisao') { log.info('Tipo Rescisão: ' + item[l].item[1]) if ( (item[l].item[1] == (1)) || (item[l].it...
asked by 14.10.2016 / 15:36
4
answers

Compare if variable is number inside an if

Having var chute = Math.round(parseInt(prompt("Adivinhe em qual número estou pensando"))); var numeroPensado = Math.round(Math.random() * 100); if(chute != numeroPensado){ document.write("Que pena, você errou, o número em que eu pensei er...
asked by 24.11.2016 / 14:14
4
answers

How to select a value comparison option?

I need to make "selected='selected'" in option whose value is what is written to the state variable retrieved in Ajax. How can I do this? $('#cep').on("change", function(){ $.ajax({ url: 'http://cep.republicavirtual...
asked by 20.10.2016 / 13:37
2
answers

Pivot Tables with JQuery, JavaScript and Mysql

Good afternoon, friends, I'm having a problem, I can not register all the users in the database, just register the last one, how can I solve this problem? Index<formmethod="post" action="salvar.php">             Name       CPF     ...
asked by 14.12.2016 / 20:29